class ToEngine(DoorThing): "Way to engine room." NAME = "map.toengine" DEST = "engine" INTERACTS = { 'door': InteractUnion(( InteractNoImage(691, 279, 76, 54), InteractText(662, 496, 128, 33, _("Engine room"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door' def interact(self, item): if not self.game.is_in_inventory('helmet:'): return Result( _('The airlock refuses to open. The automated' ' voice says: "Hull breach beyond this door. Personnel' ' must be equipped for vacuum before entry."')) else: return super(ToEngine, self).interact(item)
class DetergentThing(Thing): NAME = "mess.detergent" INTERACTS = { 'present': InteractImageRect(581, 424, 'detergent_lid.png', 565, 399, 62, 95), 'taken': InteractNoImage(565, 399, 62, 95), } INITIAL = 'present' INITIAL_DATA = { 'taken': False, } def select_interact(self): if self.get_data('taken'): return 'taken' return self.INITIAL def interact_without(self): if self.get_data('taken'): return Result(_("The remaining bottles leak.")) self.set_data('taken', True) self.set_interact() self.game.add_inventory_item('detergent_bottle') return Result( _("You pick up an empty dishwashing liquid bottle. You" " can't find any sponges.")) def get_description(self): return _("Empty plastic containers. " "They used to hold dishwasher soap.")
class CryoPipeLeft(CryoPipeBase): "Left cryo pipe." NAME = "cryo.pipe.left" INTERACTS = { "fixed": InteractImage(117, 226, "intact_cryo_pipe_left.png"), "chopped": InteractNoImage(125, 192, 27, 258), }
class CryoPipeRightTop(CryoPipeBase): "Right cryo pipe, top." NAME = "cryo.pipe.right.top" INTERACTS = { "fixed": InteractImage(645, 212, "intact_cryo_pipe_right_top.png"), "chopped": InteractNoImage(643, 199, 31, 111), }
class CryoPipeRightBottom(CryoPipeBase): "Right cryo pipe, bottom." NAME = "cryo.pipe.right.bottom" INTERACTS = { "fixed": InteractImage(644, 333, "intact_cryo_pipe_right_bottom.png"), "chopped": InteractNoImage(644, 333, 31, 107), }
class JimPanel(Thing): "The panel to JIM's internals'" NAME = "jim_panel" INTERACTS = { 'closed': InteractNoImage(506, 430, 137, 47), 'open': InteractImage(500, 427, 'jim_panel_open.png'), 'broken': InteractImage(488, 412, 'jim_panel_destroyed.png'), } INITIAL = 'closed' def get_description(self): if self.scene.get_data('ai panel') == 'closed': return _("The sign reads 'Warning: Authorized Techinicians Only'.") def select_interact(self): status = self.scene.get_data('ai panel') return status or self.INITIAL def interact_without(self): ai_status = self.state.get_jim_state() if ai_status == 'online': return self.interact_default(None) elif self.scene.get_data('ai panel') == 'closed': return Result( _("You are unable to open the panel with your" " bare hands.")) elif self.scene.get_data('ai panel') == 'open': self.scene.set_data('ai panel', 'broken') self.state.break_ai() self.set_interact() return Result(_("You unplug various important-looking wires.")) def interact_with_machete(self, item): ai_status = self.state.get_jim_state() if ai_status == 'online': return self.interact_default(item) elif self.scene.get_data('ai panel') == 'closed': self.scene.set_data('ai panel', 'open') self.set_interact() return Result(_("Using the machete, you lever the panel off.")) elif self.scene.get_data('ai panel') == 'open': self.scene.set_data('ai panel', 'broken') self.state.break_ai() self.set_interact() return Result( _("You smash various delicate components with" " the machete.")) def interact_default(self, item): if self.state.get_jim_state() == 'online': return (Result(_('You feel a shock from the panel.')), make_jim_dialog( _("Prisoner %s. Please step away from the" " panel. You are not an authorized" " technician.") % PLAYER_ID, self.game))
class ToMap(Door): SCENE = "crew_quarters" INTERACTS = { "door": InteractNoImage(233, 252, 125, 181), } INITIAL = "door"
class ToMap(Door): SCENE = "machine" INTERACTS = { "door": InteractNoImage(695, 350, 97, 212), } INITIAL = "door"
class ToMap(Door): SCENE = "bridge" INTERACTS = { "door": InteractNoImage(707, 344, 84, 245), } INITIAL = "door"
class ToMap(Door): SCENE = "mess" INTERACTS = { "door": InteractNoImage(20, 390, 85, 150), } INITIAL = "door"
class ToMap(Door): SCENE = "engine" INTERACTS = { "door": InteractNoImage(663, 360, 108, 193), } INITIAL = "door" def get_description(self): return _("The airlock leads back to the rest of the ship.")
class ToBridge(DoorThing): "Way to bridge room." NAME = "map.tobridge" DEST = "bridge" INTERACTS = { 'door': InteractUnion(( InteractNoImage(36, 260, 60, 83), InteractText(26, 170, 71, 33, _("Bridge"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door'
class ToCryo(DoorThing): "Way to cryo room." NAME = "map.tocryo" DEST = "cryo" INTERACTS = { 'door': InteractUnion(( InteractNoImage(515, 158, 56, 68), InteractText(361, 512, 245, 33, _("Prisoner cryo chambers"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door'
class ToCrew(DoorThing): "Way to crew quarters." NAME = "map.tocrew_quarters" DEST = "crew_quarters" INTERACTS = { 'door': InteractUnion(( InteractNoImage(210, 321, 37, 64), InteractText(69, 460, 160, 33, _("Crew quarters"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door'
class ToMachine(DoorThing): "Way to machine room." NAME = "map.tomachine" DEST = "machine" INTERACTS = { 'door': InteractUnion(( InteractNoImage(608, 156, 57, 72), InteractText(578, 83, 140, 33, _("Machine room"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door'
class ToMess(DoorThing): "Way to cryo room." NAME = "map.tomess" DEST = "mess" INTERACTS = { 'door': InteractUnion(( InteractNoImage(395, 262, 64, 80), InteractText(341, 430, 110, 33, _("Mess hall"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'door'
class LaserWelderButton(Thing): NAME = "machine.welder.button" INTERACTS = { "button": InteractNoImage(406, 389, 28, 31), } INITIAL = "button" def interact_without(self): welder_slot = self.scene.things["machine.welder.slot"] contents = welder_slot.get_data("contents") if not contents: return Result(_("The laser welder doesn't currently contain" " anything weldable.")) elif len(contents) == 1: if "can" in contents: return Result(_("The laser welder needs something to weld the" " can to.")) elif "tube" in contents: return Result(_("The laser welder needs something to weld the" " tube fragments to.")) else: welder_slot.set_data("contents", []) welder_slot.set_interact() if self.game.is_in_inventory("cryo_pipes_one:"): self.game.replace_inventory_item( "cryo_pipes_one:", "cryo_pipes_two") return Result(_("With high-precision spitzensparken, you weld" " together a second pipe. You bundle the two" " pipes together."), soundfile='laser.ogg') elif self.game.is_in_inventory("cryo_pipes_two:"): self.game.replace_inventory_item( "cryo_pipes_two:", "cryo_pipes_three") return Result(_("With high-precision spitzensparken, you" " create yet another pipe. You store it with" " the other two."), soundfile='laser.ogg') elif self.game.is_in_inventory("cryo_pipes_three:"): # just for safety return None else: self.game.add_inventory_item("cryo_pipes_one") return Result(_("With high-precision spitzensparken, the can" " and tube are welded into a whole greater" " than the sum of the parts."), soundfile='laser.ogg')
class CansOnShelf(Thing): NAME = "mess.cans" INTERACTS = { '3cans': InteractImage(165, 209, 'shelf_3_cans.png'), '2cans': InteractImage(165, 209, 'shelf_2_cans.png'), '1cans': InteractImage(165, 209, 'shelf_1_can.png'), '0cans': InteractNoImage(165, 209, 50, 50), } INITIAL = '3cans' INITIAL_DATA = { 'cans_available': 3, } def should_add(self): return self.get_data('cans_available') > 0 def select_interact(self): return '%icans' % (self.get_data('cans_available'), ) def interact_without(self): starting_cans = self.get_data('cans_available') if starting_cans > 0: self.game.add_inventory_item('full_can') self.set_data('cans_available', starting_cans - 1) self.set_interact() if starting_cans == 1: self.scene.remove_thing(self) return Result({ 3: _("Best before a long time in the past." " Better not eat these."), 2: _("Mmmm. Nutritious bacteria stew."), 1: _("Candied silkworms. Who stocked this place?!"), }[starting_cans]) else: return Result( _("The rest of the cans are rusted beyond " "usefulness.")) def get_description(self): return _("The contents of these cans look synthetic.")
class PageNext(PageBase): """Next page in the manual""" NAME = 'manual.page_next' INTERACTS = { 'on': InteractImage(185, 351, 'arrow_right.png'), 'off': InteractNoImage(185, 351, 34, 23), } INITIAL = 'on' INITIAL_DATA = { 'display': 'on', } def interact_without(self): self.set_page(self.get_page() + 1)
class PagePrior(PageBase): """Prior page in the manual""" NAME = 'manual.page_prior' INTERACTS = { 'on': InteractImage(36, 351, 'arrow_left.png'), 'off': InteractNoImage(31, 351, 34, 23), } INITIAL = 'off' INITIAL_DATA = { 'display': 'off', } def interact_without(self): self.set_page(self.get_page() - 1)
class PlaqueThing(Thing): "Plaque on the detailed cryo chamber" NAME = "cryo.plaque" INTERACTS = { "plaque": InteractNoImage(60, 40, 35, 24), } INITIAL = "plaque" def interact_without(self): return Result( _("The plaque is welded to the unit. You can't shift it.")) def get_description(self): return _("'Prisoner 98CC-764E646391EE. War crimes. 45 years.")
class HydroponicsArea(Thing): NAME = 'map.hydroponics' INTERACTS = { 'areas': InteractUnion(( InteractNoImage(314, 263, 73, 81), InteractText(313, 132, 140, 33, _("Hydroponics"), 'white', 20, 'Monospace.ttf'), )) } INITIAL = 'areas' def interact(self, _item): return Result( _("Peering in through the window, you see that the " "entire chamber is overgrown with giant broccoli. " "It would take you years to cut a path through that."))
class Boomslang(Thing): NAME = 'mess.boomslang' INTERACTS = { 'snake': InteractAnimated(455, 241, ( 'boomslang_no_tongue.png', 'boomslang_with_tongue.png', 'boomslang_no_tongue.png', 'boomslang_with_tongue.png', 'boomslang_no_tongue.png', ), 5), 'no_snake': InteractNoImage(0, 0, 0, 0), } INITIAL = 'no_snake' INITIAL_DATA = { 'anim_pos': -1, } HISS = 'boomslang.ogg' def is_interactive(self, tool=None): return False def animate(self): hiss = self.game.gd.sound.get_sound(self.HISS) if self.get_data('anim_pos') > -1: self.current_interact.animate() if self.get_data('anim_pos') > self.current_interact._anim_pos: self._set_interact('no_snake') self.set_data('anim_pos', -1) else: self.set_data('anim_pos', self.current_interact._anim_pos) return True if randint(0, 30 * self.game.gd.constants.frame_rate) == 0: self._set_interact('snake') self.set_data('anim_pos', 0) hiss.play() return False
class CompUpButton(Thing): """Up button on log screen""" NAME = 'bridge_comp.up_button' INTERACTS = { 'up': InteractNoImage(594, 82, 30, 58), } INITIAL = 'up' COMPUTER = 'bridge_comp_detail' def is_interactive(self, tool=None): tab = self.game.detail_views[self.COMPUTER].get_data('tab') page = self.game.detail_views[self.COMPUTER].get_data('log page') return tab == 'log' and page > 0 def interact_without(self): page = self.game.detail_views[self.COMPUTER].get_data('log page') self.game.detail_views[self.COMPUTER].set_data('log page', page - 1) self.game.detail_views[self.COMPUTER].set_background() return Result(soundfile='beep550.ogg')
class CompDownButton(Thing): """Down button on log screen""" NAME = 'bridge_comp.down_button' INTERACTS = { 'down': InteractNoImage(594, 293, 30, 58), } INITIAL = 'down' COMPUTER = 'bridge_comp_detail' def is_interactive(self, tool=None): tab = self.game.detail_views[self.COMPUTER].get_data('tab') page = self.game.detail_views[self.COMPUTER].get_data('log page') max_page = self.game.detail_views[self.COMPUTER].get_data('max page') return tab == 'log' and (page + 1) < max_page def interact_without(self): page = self.game.detail_views[self.COMPUTER].get_data('log page') self.game.detail_views[self.COMPUTER].set_data('log page', page + 1) self.game.detail_views[self.COMPUTER].set_background() return Result(soundfile='beep550.ogg')
class BridgeComputer(Thing): """The bridge computer. Gives status updates""" NAME = "bridge.comp" INTERACTS = { 'screen': InteractNoImage(338, 296, 123, 74), } INITIAL = 'screen' def interact_without(self): return Result(detail_view='bridge_comp_detail') def interact_with_titanium_leg(self, item): return Result(_("You can't break the duraplastic screen.")) def interact_with_machete(self, item): return Result(_("Scratching the screen won't help you.")) def get_description(self): return _("The main bridge computer screen.")
class MassageChairBase(Thing): "The captain's massage chair, contains superconductor" NAME = 'bridge.massagechair_base' INTERACTS = { 'chair': InteractNoImage(127, 518, 69, 64), } INITIAL = 'chair' INITIAL_DATA = { 'contains_superconductor': True, } def interact_without(self): return Result(detail_view='chair_detail') def get_description(self): if self.get_data('contains_superconductor'): return _("A top of the line Massage-o-Matic Captain's Executive" " Command Chair. It's massaging a skeleton.") return _("The chair won't work any more, it has no power.")
class Grinder(Thing): NAME = "machine.grinder" INTERACTS = { "grind": InteractNoImage(86, 402, 94, 63), } INITIAL = "grind" def interact_without(self): return Result(_("It looks like it eats fingers. Perhaps a different" " approach is in order?")) def interact_with_titanium_leg(self, item): self.game.replace_inventory_item(item.name, 'machete') return Result(_("After much delicate grinding and a few close calls" " with various body parts, the titanium femur now" " resembles a machete more than a bone. Nice and" " sharp, too."), soundfile="grinder.ogg") def get_description(self): return _("A pretty ordinary, albeit rather industrial, grinding" " machine.")
class Safe(Thing): "A safe, for keeping things safe." NAME = 'crew.safe' INTERACTS = { 'safe': InteractNoImage(447, 238, 72, 73), 'full_safe': InteractImage(445, 227, 'open_safe_full.png'), 'empty_safe': InteractImage(445, 227, 'open_safe_empty.png'), } INITIAL = 'safe' INITIAL_DATA = { 'is_cracked': False, 'has_tape': True, } def select_interact(self): if self.get_data('is_cracked'): if self.get_data('has_tape'): return 'full_safe' return 'empty_safe' return self.INITIAL def interact_without(self): if self.get_data('is_cracked'): if self.get_data('has_tape'): self.set_data('has_tape', False) self.game.add_inventory_item('duct_tape') self.set_interact() return Result( _("Duct tape. It'll stick to everything except " "ducts, apparently.")) return Result( _("The perfectly balanced door swings " "frictionlessly to and fro. What craftsmanship!")) return Result( _("The safe is locked. This might be an interesting " "challenge, if suitable equipment can be found.")) def interact_with_stethoscope(self, item): if self.get_data('is_cracked'): return Result( _("It's already unlocked. " "There's no more challenge.")) # TODO: Wax lyrical some more about safecracking. self.set_data('is_cracked', True) self.set_interact() self.state.increase_sentence(20) return (Result( _("Even after centuries of neglect, the tumblers slide" " almost silently into place. Turns out the" " combination was '1 2 3 4 5'. An idiot must keep his" " luggage in here.")), make_jim_dialog( _("Prisoner %s, you have been observed" " committing a felony violation. This will" " go onto your permanent record, and your" " sentence will be extended by twenty" " years.") % PLAYER_ID, self.game), make_sentence_dialog(PLAYER_ID, self.game)) def get_description(self): return _("Ah, a vintage Knoxx & Co. model QR3. Quaint, but" " reasonably secure.")
class CryoRoomDoor(Door): "Door to the cryo room." SCENE = "cryo" INTERACTS = { "shut": InteractNoImage(290, 260, 99, 152), "ajar": InteractImage(290, 260, "door_ajar.png"), "open": InteractImage(290, 260, "door_open.png"), } INITIAL = "shut" INITIAL_DATA = { 'door': "shut", } def interact_with_titanium_leg(self, item): if self.get_data('door') == "ajar": self.open_door() return Result(_("You wedge the titanium femur into the chain and" " twist. With a satisfying *snap*, the chain" " breaks and the door opens."), soundfile='break.ogg') elif self.get_data('door') == "shut": text = _("You bang on the door with the titanium femur. It makes a" " clanging sound.") return Result(text, soundfile='clang.ogg') else: return Result( _("You wave the femur in the doorway. Nothing" " happens.")) def interact_without(self): if self.get_data('door') == "shut": self.half_open_door() if self.get_data('door') != "open": return Result(_("It moves slightly and then stops. A chain on the" " other side is preventing it from opening" " completely."), soundfile='chain.ogg') else: self.game.change_scene('map') return None def interact_default(self, item): return self.interact_without() def select_interact(self): return self.get_data('door') or self.INITIAL def half_open_door(self): self.set_data('door', "ajar") self.set_interact() def open_door(self): self.set_data('door', "open") self.set_interact() def get_description(self): if self.get_data('door') == "open": return _('An open doorway leads to the rest of the ship.') elif self.get_data('door') == "ajar": return _("A rusty door. It can't open all the way because of a " "chain on the other side.") return _('A rusty door. It is currently closed.')