raise PlayError('already carrying something')
nothing_to_pick_up = True
for t in [t for t in self.thing.game.things
- if t != self.thing and t.position == self.thing.position and
+ if t.portable
+ and t != self.thing and t.position == self.thing.position and
t.type_ != 'Player']:
nothing_to_pick_up = False
break
def do(self):
to_pick_up = [t for t in self.thing.game.things
- if t != self.thing and t.position == self.thing.position][0]
+ if t.portable
+ and t != self.thing and t.position == self.thing.position][0]
self.thing.carrying = to_pick_up
class Thing(ThingBase):
blocking = False
+ portable = False
protection = '.'
def __init__(self, *args, **kwargs):
class Thing_Item(Thing):
symbol_hint = 'i'
+ portable = True
+
+
+
+class Thing_Spawner(Thing):
+ symbol_hint = 'S'
+
+ def proceed(self):
+ for t in [t for t in self.game.things
+ if t != self and t.position == self.position]:
+ return
+ t = self.game.thing_types['Item'](self.game, position=self.position)
+ self.game.things += [t]
+ self.game.changed = True
cmd_SET_MAP_CONTROL_PASSWORD, cmd_SPAWN_POINT)
from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP,
Task_DROP, Task_FLATTEN_SURROUNDINGS)
-from plomrogue.things import Thing_Player, Thing_Item
+from plomrogue.things import Thing_Player, Thing_Item, Thing_Spawner
from plomrogue.config import config
game = Game(config['savefile'])
game.register_task(Task_DROP)
game.register_thing_type(Thing_Player)
game.register_thing_type(Thing_Item)
+game.register_thing_type(Thing_Spawner)
game.read_savefile()
game.io.start_loop()
for port in config['servers']: