Commit 325c3f7d authored by Constantin's avatar Constantin
Browse files

functional horror code to fix stuff somehow

parent 6550d3d5
......@@ -52,9 +52,8 @@ class Player(Thing):
def __str__(self):
return "another player"
def isMovedBy(self,pusher):
dx = self.field.column - pusher.field.column
dy = self.field.row - pusher.field.row
def pushAway(self,pusher,direction):
dy,dx = directionOffsets[direction]
pushTarget = self.field.neighbor(dx=dx,dy=dy)
travelDistance = 1
while pushTarget is not None and not pushTarget.isWalkable():
......@@ -74,9 +73,9 @@ class Player(Thing):
playerToPush = None
for thing in pushTarget.things:
if thing != self and isinstance(thing, Player):
playerToPush = thing # yes, this may have higher speeds than one *grin*
playerToPush = thing
self.send("After coming out of the wall with incredible speed, you hit another player, who is in turn pushed away by your momentum. Poor bastard...")
self.game.labyrinth.moveThing(self,pushTarget,(lambda:playerToPush.isMovedBy(self) if playerToPush else None))
self.game.labyrinth.moveThing(self,pushTarget,(lambda:playerToPush.pushAway(self) if playerToPush else None))
# high(er)-level functions
def readCmd(self, cmd):
......@@ -103,9 +102,9 @@ class Player(Thing):
for thing in target.things:
if thing != self and isinstance(thing, Player):
playerToPush = thing
self.send("By moving to the "+direction[0]+" you pushed another player away."))
self.send("By moving to the "+direction[0]+" you pushed another player away.")
self.game.labyrinth.moveThing(self, target, (lambda:playerToPush.isMovedBy(self) if playerToPush else None))
self.game.labyrinth.moveThing(self, target, (lambda:playerToPush.pushAway(self,direction[0]) if playerToPush else None))
elif verb in sayVerbs:
msg = " ".join(words[1:])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment