t.uncarry()
self.things.remove(t)
self.record_change(t.position, 'other')
- if t.blocking:
+ if t.blocks_light:
self.record_change(t.position, 'fov')
def add_thing(self, type_, position, id_=0):
else:
self.things += [t]
self.record_change(t.position, 'other')
- if t.blocking:
+ if t.blocks_light:
self.record_change(t.position, 'fov')
return t
write(f, 'GOD_THING_NAME %s %s' % (t.id_, quote(t.name)))
if hasattr(t, 'installable') and (not t.portable):
write(f, 'THING_INSTALLED %s' % t.id_)
- if t.type_ == 'Door' and t.blocking:
+ if t.type_ == 'Door' and t.blocks_movement:
write(f, 'THING_DOOR_CLOSED %s' % t.id_)
elif t.type_ == 'Hat':
write(f, 'THING_HAT_DESIGN %s %s' % (t.id_,
test_yxyx = self._get_move_target()
move_blockers = self.thing.game.get_movement_blockers()
if test_yxyx in [t.position for t in self.thing.game.things
- if t.blocking]:
+ if t.blocks_movement]:
raise PlayError('blocked by other thing')
elif self.thing.game.maps[test_yxyx[0]][test_yxyx[1]] in move_blockers:
raise PlayError('blocked by impassable tile')
def do(self):
self.thing.game.record_change(self.thing.position, 'other')
- if self.thing.blocking:
+ if self.thing.blocks_light:
self.thing.game.record_change(self.thing.position, 'fov')
self.thing.position = self._get_move_target()
self.thing.game.record_change(self.thing.position, 'other')
- if self.thing.blocking:
+ if self.thing.blocks_light:
self.thing.game.record_change(self.thing.position, 'fov')
if self.thing.carrying:
self.thing.carrying.position = self.thing.position
get_neighbors_yxyx(self.thing.position).values())
for t in [t for t in self.thing.game.things if
t.type_ == 'Door' and t.position in action_radius]:
- if t.blocking:
+ if t.blocks_movement:
t.open()
else:
t.close()
class Thing(ThingBase):
- blocking = False
+ blocks_movement = False
+ blocks_sound = False
+ blocks_light = False
portable = False
protection = '.'
commandable = False
return lowered_msg
largest_audible_distance = 20
- # player's don't block sound
- obstacles = [t.position for t in self.game.things
- if t.blocking and t.type_ != 'Player']
+ obstacles = [t.position for t in self.game.things if t.blocks_sound]
sound_blockers = self.game.get_sound_blockers()
dijkstra_map = DijkstraMap(sound_blockers, obstacles, self.game.maps,
self.position, largest_audible_distance,
class Thing_Door(Thing):
symbol_hint = 'D'
- blocking = False
+ blocks_movement = False
portable = True
installable = True
def open(self):
- self.blocking = False
+ self.blocks_movement = False
+ self.blocks_light = False
+ self.blocks_sound = False
del self.thing_char
def close(self):
- self.blocking = True
+ self.blocks_movement = True
+ self.blocks_light = True
+ self.blocks_sound = True
self.thing_char = '#'
def install(self):
fov_map_class = self.game.map_geometry.fov_map_class
fov_radius = 12
light_blockers = self.game.get_light_blockers()
- obstacles = [t.position for t in self.game.things if t.blocking]
+ obstacles = [t.position for t in self.game.things if t.blocks_light]
fov = fov_map_class(light_blockers, obstacles, self.game.maps,
self.position, fov_radius, self.game.get_map)
fov.init_terrain()
class ThingAnimate(Thing):
- blocking = True
+ blocks_movement = True
+ blocks_light = True
drunk = 0
def __init__(self, *args, **kwargs):
fov_map_class = self.game.map_geometry.fov_map_class
fov_radius = 3 if self.drunk > 0 else 12
light_blockers = self.game.get_light_blockers()
- obstacles = [t.position for t in self.game.things if t.blocking]
+ obstacles = [t.position for t in self.game.things if t.blocks_light]
self._fov = fov_map_class(light_blockers, obstacles, self.game.maps,
self.position, fov_radius, self.game.get_map)