# HG changeset patch # User Neil Muller # Date 1359488727 -7200 # Node ID bdebe693453f42e230364af5f562c19f28db1b39 # Parent daecbd66d19c707c872398e9714685ee78afdf25 Track total sentence diff -r daecbd66d19c -r bdebe693453f TODO --- a/TODO Tue Jan 29 17:45:41 2013 +0200 +++ b/TODO Tue Jan 29 21:45:27 2013 +0200 @@ -23,7 +23,6 @@ * JIM Speaks after fixing engines & repairing environment? Game: - * Keep track of total sentence. * Add descriptions for items. * Add sound to more rooms. diff -r daecbd66d19c -r bdebe693453f gamelib/scenes/crew_quarters.py --- a/gamelib/scenes/crew_quarters.py Tue Jan 29 17:45:41 2013 +0200 +++ b/gamelib/scenes/crew_quarters.py Tue Jan 29 21:45:27 2013 +0200 @@ -8,7 +8,8 @@ TakeableThing) from gamelib.scenes.game_constants import PLAYER_ID -from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog +from gamelib.scenes.game_widgets import (Door, BaseCamera, make_jim_dialog, + make_sentence_dialog) class CrewQuarters(Scene): @@ -89,10 +90,10 @@ if self.get_data('is_cracked'): return Result(_("It's already unlocked. " "There's no more challenge.")) - # TODO: Add years to the sentence for safecracking. # 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" @@ -100,8 +101,9 @@ make_jim_dialog(_("Prisoner %s, you have been observed" " committing a felony violation. This will" " go onto your permanent record, and your" - " sentence may be extended by up to twenty" - " years.") % PLAYER_ID, self.game)) + " 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" diff -r daecbd66d19c -r bdebe693453f gamelib/scenes/cryo.py --- a/gamelib/scenes/cryo.py Tue Jan 29 17:45:41 2013 +0200 +++ b/gamelib/scenes/cryo.py Tue Jan 29 21:45:27 2013 +0200 @@ -22,6 +22,7 @@ INITIAL_DATA = { 'greet': True, 'vandalism_warn': True, + 'sentence': 30, } # sounds that will be played randomly as background noise diff -r daecbd66d19c -r bdebe693453f gamelib/scenes/game_widgets.py --- a/gamelib/scenes/game_widgets.py Tue Jan 29 17:45:41 2013 +0200 +++ b/gamelib/scenes/game_widgets.py Tue Jan 29 21:45:27 2013 +0200 @@ -39,6 +39,12 @@ return None +def make_sentence_dialog(prisoner, game): + return make_jim_dialog( + _("Prisoner %(id)s, your total sentence is now %(sen)d years.") % { + "id": prisoner, 'sen': game.data.get_total_sentence()}, game) + + class BaseCamera(Thing): "Base class for the camera puzzles" diff -r daecbd66d19c -r bdebe693453f gamelib/scenes/map.py --- a/gamelib/scenes/map.py Tue Jan 29 17:45:41 2013 +0200 +++ b/gamelib/scenes/map.py Tue Jan 29 21:45:27 2013 +0200 @@ -13,7 +13,7 @@ InteractText, InteractNoImage) from gamelib.scenes.game_constants import PLAYER_ID -from gamelib.scenes.game_widgets import make_jim_dialog +from gamelib.scenes.game_widgets import make_jim_dialog, make_sentence_dialog class Map(Scene): @@ -44,11 +44,12 @@ "neural implant to help you navigate around the ship."), self.game) if ai1: + self.state.increase_sentence(3) return ai1, make_jim_dialog(_("Prisoner %s, you are a " "class 1 felon. Obtaining access to the ship's schematics " "constitutes a level 2 offence and carries a minimal penalty " "of an additional 3 years on your sentence.") % PLAYER_ID, - self.game) + self.game), make_sentence_dialog(PLAYER_ID, self.game) class DoorThing(Thing): diff -r daecbd66d19c -r bdebe693453f gamelib/ss_state.py --- a/gamelib/ss_state.py Tue Jan 29 17:45:41 2013 +0200 +++ b/gamelib/ss_state.py Tue Jan 29 21:45:27 2013 +0200 @@ -15,3 +15,10 @@ def break_ai(self): self['bridge']['ai status'] = 'dead' + + def get_total_sentence(self): + return self['cryo']['sentence'] + + def increase_sentence(self, years): + if self['bridge']['ai status'] == 'online': + self['cryo']['sentence'] += years