Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmunro committed Jan 4, 2014
1 parent 3ae7d8e commit e1b59b9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions mudpy/sys/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet import reactor
import random, time, __main__
from . import wireframe, debug
from . import wireframe, debug, observer

__config__ = wireframe.create("config.server")
__init_time__ = time.time()

if '__mudpy__' in __main__:
__publisher__ = getattr(__main__, '__mudpy__')
else:
__publisher__ = observer.Observer()

def heartbeat():
"""Callback provided to twisted for communicating between game threads."""

Expand All @@ -20,16 +25,16 @@ def heartbeat():
__config__['intervals']['tick']['lowbound'], \
__config__['intervals']['tick']['highbound'])
while(1):
__main__.__mudpy__.fire('cycle')
__publisher__.fire('cycle')
if time.time() >= next_pulse:
next_pulse += __config__['intervals']['pulse']
__main__.__mudpy__.fire('pulse')
__main__.__mudpy__.fire('stat')
__publisher__.fire('pulse')
__publisher__.fire('stat')
if time.time() >= next_tick:
next_tick = int(time.time()+random.randint(
__config__['intervals']['tick']['lowbound'], \
__config__['intervals']['tick']['highbound']))
__main__.__mudpy__.fire('tick')
__publisher__.fire('tick')
rel_next_tick = int(next_tick-time.time())
debug.log("tick; next in "+str(rel_next_tick)+" seconds")

Expand Down

0 comments on commit e1b59b9

Please sign in to comment.