changeset 412:8ac5b3d619fe

Signal fire.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 09 Apr 2011 17:36:04 +0200
parents a5f54ae9217e
children f14b4da859c4
files skaapsteker/sprites/base.py skaapsteker/sprites/items.py
diffstat 2 files changed, 42 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/skaapsteker/sprites/base.py	Sat Apr 09 17:35:11 2011 +0200
+++ b/skaapsteker/sprites/base.py	Sat Apr 09 17:36:04 2011 +0200
@@ -346,7 +346,6 @@
 
 
     def player_action(self, player):
-        print "Player touched %s" % self
         player.take_item(self)
 
 
--- a/skaapsteker/sprites/items.py	Sat Apr 09 17:35:11 2011 +0200
+++ b/skaapsteker/sprites/items.py	Sat Apr 09 17:36:04 2011 +0200
@@ -112,10 +112,52 @@
 class Kindling(Item):
     image_file = 'props/kindling.png'
 
+    def player_action(self, player):
+        if player.has_item('oil'):
+            set_fire(player, self)
+        else:
+            player.take_item(self)
+
 
 class Oil(Item):
     image_file = 'props/oil.png'
 
+    def player_action(self, player):
+        if player.has_item('kindling'):
+            set_fire(player, self)
+        else:
+            player.take_item(self)
+
+
+
+# TODO: Finish this thing's behaviour
+class SignalFire(Item):
+    image_file = 'dummy.png'
+
+    def setup(self, litness, **opts):
+        super(SignalFire, self).setup(**opts)
+
+
+    def player_action(self, player):
+        if self._me.litness == 'set':
+            if player.has_item('kindling'):
+                notify('You put the kindling in the fire.')
+            elif player.has_item('oil'):
+                notify('You pour the oil on the fire.')
+            else:
+                return
+            player.discard_item()
+            self._me.litness = 'kindled'
+        elif self._me.litness == 'kindled':
+            if player.has_item('kindling'):
+                notify('You put the kindling in the fire and light it.')
+            elif player.has_item('oil'):
+                notify('You pour the oil on the fire and light it.')
+            else:
+                return
+            player.discard_item()
+            self._me.litness = 'burning'
+            self.world.missions.fire_started_on_road = True
 
 
 ##################################################