# Path: settings.py
# CLIENT_UPDATE_FREQ = MSPERSEC/CLIENT_NETWORK_FPS
# 
# DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S:%f'
# 
# Path: basetickserver.py
# class BaseTickServer(object):
#     '''This is a class that should be subclassed and tick() defined to do something
#     every "tick".'''
# 
#     def __init__(self):
#         self.tick_freq_multiplier = 1
# 
#     def tick(self):
#         '''Do things every tick. Should be overridden.'''
#         pass
# 
#     def start(self):
#         self.current_tick = 0
#         skip_ticks = CLIENT_UPDATE_FREQ
#         max_frameskip = 5
# 
#         next_tick = 0
#         self.running = True
# 
#         while self.running:
#             loops = 0
#             self.current_tick += 1
#             while (self.current_tick > next_tick) and (loops < max_frameskip):
#                 # dt = ((current_tick + skip_ticks) - next_tick) / skip_ticks
#                 self.tick()
#                 next_tick += skip_ticks
#                 loops += 1


from uuid import uuid4
from pymunk import Vec2d
from settings import CLIENT_UPDATE_FREQ, DATETIME_FORMAT
from basetickserver import BaseTickServer
import datetime
import pymunk as pm
    import sys
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# ##### END AGPL LICENSE BLOCK #####

'''PhysicsServer
A server that runs a physics simulation for all the objects in a zone.
It doesn't really care why or how objects ended up where they claim to be now.
It pretends to be a client with omniscient control over all the little
puppets, er, I mean movable Objects in the zone.
It determines if an object can occupy the space it claims to be in now,
and if not, it fixes it.
Think of it as a physics-based position sanity check.

This should be started by the ZoneServer.
'''


# TODO: This still needs ported from Mongo to Peewee, but it's unused so I'm leaving it for now.

### Physics collision types
COLLTYPE_BALL = 2




# Path: settings.py
# CLIENT_UPDATE_FREQ = MSPERSEC/CLIENT_NETWORK_FPS
# 
# DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S:%f'
# 
# Path: basetickserver.py
# class BaseTickServer(object):
#     '''This is a class that should be subclassed and tick() defined to do something
#     every "tick".'''
# 
#     def __init__(self):
#         self.tick_freq_multiplier = 1
# 
#     def tick(self):
#         '''Do things every tick. Should be overridden.'''
#         pass
# 
#     def start(self):
#         self.current_tick = 0
#         skip_ticks = CLIENT_UPDATE_FREQ
#         max_frameskip = 5
# 
#         next_tick = 0
#         self.running = True
# 
#         while self.running:
#             loops = 0
#             self.current_tick += 1
#             while (self.current_tick > next_tick) and (loops < max_frameskip):
#                 # dt = ((current_tick + skip_ticks) - next_tick) / skip_ticks
#                 self.tick()
#                 next_tick += skip_ticks
#                 loops += 1


# Path: physicsserver.py
from uuid import uuid4
from pymunk import Vec2d
from settings import CLIENT_UPDATE_FREQ, DATETIME_FORMAT
from basetickserver import BaseTickServer
import datetime
import pymunk as pm
    import sys

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# ##### END AGPL LICENSE BLOCK #####

'''PhysicsServer
A server that runs a physics simulation for all the objects in a zone.
It doesn't really care why or how objects ended up where they claim to be now.
It pretends to be a client with omniscient control over all the little
puppets, er, I mean movable Objects in the zone.
It determines if an object can occupy the space it claims to be in now,
and if not, it fixes it.
Think of it as a physics-based position sanity check.

This should be started by the ZoneServer.
'''


# TODO: This still needs ported from Mongo to Peewee, but it's unused so I'm leaving it for now.

### Physics collision types
COLLTYPE_BALL = 2




class PhysicsServer(BaseTickServer):