def add_entity(world, entity): pt = entities.get_position(entity) if within_bounds(world, pt): old_entity = occ_grid.get_cell(world.occupancy, pt) if old_entity != None: entities.clear_pending_actions(old_entity) occ_grid.set_cell(world.occupancy, pt, entity) world.entities.append(entity)
def add_entity(self, entity): pt = entity.get_position() if self.within_bounds(pt): old_entity = occ_grid.Grid.get_cell(self.occupancy, pt) if old_entity != None: entities.clear_pending_actions(old_entity) occ_grid.Grid.set_cell(self.occupancy, pt, entity) self.entities.append(entity)
def add_entity(self, entity): pt = entity.get_position() if self.within_bounds(pt): old_entity = self.occupancy.get_cell(pt) if old_entity != None: entities.clear_pending_actions(old_entity) self.occupancy.set_cell(pt, entity) self.entities.append(entity)
def remove_entity(world, entity): for action in entities.get_pending_actions(entity): unschedule_action(world, action) entities.clear_pending_actions(entity) remove_entity(world, entity)
def clear_pending_actions(world, entity): for action in entities.get_pending_actions(entity): worldmodel.unschedule_action(world, action) entities.clear_pending_actions(entity)