FIX THE COLLISION DETECTION BUG
This commit is contained in:
parent
d4e4684694
commit
85569595a9
2 changed files with 10 additions and 9 deletions
|
@ -149,14 +149,14 @@ class BumpAction(MoveAction):
|
|||
position_is_walkable = engine.map.tile_is_walkable(new_position)
|
||||
|
||||
for ent in engine.entities:
|
||||
if new_position != ent.position:
|
||||
if new_position != ent.position or not ent.blocks_movement:
|
||||
continue
|
||||
entity_occupying_position = ent
|
||||
break
|
||||
else:
|
||||
entity_occupying_position = None
|
||||
|
||||
log.ACTIONS.debug('Bumping %s into %s (in_bounds:%s walkable:%s overlaps:%s)',
|
||||
log.ACTIONS.info('Bumping %s into %s (in_bounds:%s walkable:%s overlaps:%s)',
|
||||
self.actor,
|
||||
new_position,
|
||||
position_is_in_bounds,
|
||||
|
@ -166,7 +166,8 @@ class BumpAction(MoveAction):
|
|||
if not position_is_in_bounds or not position_is_walkable:
|
||||
return self.failure()
|
||||
|
||||
if entity_occupying_position and entity_occupying_position.blocks_movement:
|
||||
if entity_occupying_position:
|
||||
assert entity_occupying_position.blocks_movement
|
||||
return ActionResult(self, alternate=MeleeAction(self.actor, self.direction, entity_occupying_position))
|
||||
|
||||
return ActionResult(self, alternate=WalkAction(self.actor, self.direction))
|
||||
|
|
|
@ -182,12 +182,12 @@ class Engine:
|
|||
alternate_string = f'{result.alternate.__class__.__name__}[{result.alternate.actor.symbol}]'
|
||||
else:
|
||||
alternate_string = str(result.alternate)
|
||||
log.ACTIONS_TREE.info('| %s-> %s => success=%s done=%s alternate=%s',
|
||||
'|' if not result.success or not result.done else '`',
|
||||
action,
|
||||
result.success,
|
||||
result.done,
|
||||
alternate_string)
|
||||
log.ACTIONS_TREE.info('| %s-> %s => success=%s done=%s alternate=%s',
|
||||
'|' if not result.success or not result.done else '`',
|
||||
action,
|
||||
result.success,
|
||||
result.done,
|
||||
alternate_string)
|
||||
|
||||
while not result.done:
|
||||
action = result.alternate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue