Changeset 476:1c05b6c2b971


Ignore:
Timestamp:
04/09/11 19:55:45 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Rebase:
35326261633337343461333538316532386563646437306633653162636430386436643233393637
Message:

Start of drop item support.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/npc-test

    r458 r476  
    6060
    6161    def test_switch_to(npc_name):
    62         assert npc_name in game.world.npcs
     62        assert npc_name in game.world.npcs, "Unknown NPC %r" % (npc_name,)
     63
     64    def test_drop_item(item_name):
     65        assert item_name in game.world.items, "Unknown item %r" % (item_name,)
    6366
    6467    my_locals = {
     
    6770        "npcs": dsm.world.npcs,
    6871        "switch_to": test_switch_to,
     72        "drop_item": test_drop_item,
    6973    }
    7074    my_locals.update(DsmEvent().items)
  • skaapsteker/dialogue.py

    r331 r476  
    4040        OpenDialog.post(npc_name)
    4141
     42    def _drop_item(self, item):
     43        """Create a tail of the given type."""
     44        print "Dropping", item
     45        self.world.get_item(item, to_level=self._me.level)
     46
    4247    def event(self, ev):
    4348        my_locals = {
     
    4651            "npcs": self.world.npcs,
    4752            "switch_to": self._switch_dialogue_to,
     53            "drop_item": self._drop_item,
    4854        }
    4955        my_locals.update(ev.items)
Note: See TracChangeset for help on using the changeset viewer.