comparison gamelib/scenes/cryo.py @ 764:a8510f4e2ea1 pyntnclick

Conditionally add things based on state.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 26 Jan 2013 15:24:56 +0200
parents 386475464202
children a35f5364437d
comparison
equal deleted inserted replaced
763:afe7b1cb16c0 764:a8510f4e2ea1
2 2
3 import random 3 import random
4 4
5 from pyntnclick.cursor import CursorSprite 5 from pyntnclick.cursor import CursorSprite
6 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result 6 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
7 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion, 7 from pyntnclick.scenewidgets import (
8 InteractImage, InteractAnimated, 8 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
9 GenericDescThing) 9 GenericDescThing, TakeableThing)
10 10
11 from gamelib.scenes.game_constants import PLAYER_ID 11 from gamelib.scenes.game_constants import PLAYER_ID
12 from gamelib.scenes.game_widgets import Door, make_jim_dialog 12 from gamelib.scenes.game_widgets import Door, make_jim_dialog
13 13
14 14
414 414
415 def get_description(self): 415 def get_description(self):
416 return "A computer terminal, with some text on it." 416 return "A computer terminal, with some text on it."
417 417
418 418
419 class TitaniumLegThing(Thing): 419 class TitaniumLegThing(TakeableThing):
420 "Triangle in the cryo room." 420 "Triangle in the cryo room."
421 421
422 NAME = "cryo.titanium_leg" 422 NAME = "cryo.titanium_leg"
423 423
424 INTERACTS = { 424 INTERACTS = {
425 "leg": InteractImage(180, 132, "leg.png"), 425 "leg": InteractImage(180, 132, "leg.png"),
426 } 426 }
427 427
428 INITIAL = "leg" 428 INITIAL = "leg"
429 429 ITEM = 'titanium_leg'
430 def interact_without(self): 430
431 self.game.add_inventory_item('titanium_leg') 431 def interact_without(self):
432 self.game.scenes['cryo'].things['cryo.unit.1'].set_data( 432 self.game.scenes['cryo'].things['cryo.unit.1'].set_data(
433 'contains_titanium_leg', False) 433 'contains_titanium_leg', False)
434 self.scene.remove_thing(self) 434 self.take()
435 return Result("The skeletal occupant of this cryo unit has an" 435 return Result("The skeletal occupant of this cryo unit has an"
436 " artificial femur made of titanium. You take it.") 436 " artificial femur made of titanium. You take it.")
437 437
438 def get_description(self): 438 def get_description(self):
439 return "This femur looks synthetic." 439 return "This femur looks synthetic."