-
Notifications
You must be signed in to change notification settings - Fork 0
/
General.py
111 lines (106 loc) · 4.62 KB
/
General.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#General
#for events that can trigger from more than one module/place in the story.
#TODO: consider moving base runners from Game to this module.
# That would also moving general functions from Game.
# Doing so would spread out the code a bit, hopefully making things more readable.
import Game
def elevator(game:Game.Game):
def content():
T = Game.Gettexter(game)
frags = {}
place = game.place
#region elevator
if place == "outer":
frags["_BUTTONSET"] = "{ELEVATOR_BUTTONSET_BOTTOM}"
frags["_DESC"] = "{ELEVATOR_DESC_CORRIDOR}"
choices = (("UP", T("ELEVATOR_OPTION_UP")), ("CARGO",T("ELEVATOR_OPTION_CARGO")), ("EXIT",T("ELEVATOR_OPTION_EXIT")))
elif place == "core":
frags["_BUTTONSET"] = "{ELEVATOR_BUTTONSET_CORE}"
frags["_DESC"] = "{ELEVATOR_DESC_CORRIDOR}"
choices = (("DOWN", T("ELEVATOR_OPTION_DOWN")), ("CARGO",T("ELEVATOR_OPTION_CARGO")), ("EXIT",T("ELEVATOR_OPTION_EXIT")))
else:
frags["_BUTTONSET"] = "{ELEVATOR_BUTTONSET_MID}"
frags["_DESC"] = "{ELEVATOR_DESC_CORRIDOR}"
choices = (("UP", T("ELEVATOR_OPTION_UP")), ("DOWN", T("ELEVATOR_OPTION_DOWN")), ("CARGO",T("ELEVATOR_OPTION_CARGO")), ("EXIT",T("ELEVATOR_OPTION_EXIT")))
game.rolltext("{ELEVATOR_DESC}", frags=frags)
while True:
game.choose(choices, "{ELEVATOR_QUEST}")
data = game.wait()
if not data or data.Type != "action":
continue
if data.tag == "EXIT":
game.showtext("{ELEVATOR_EXIT}")
break
elif game.getdata("WheelC_elevator") == "dead":
game.rolltext("{ELEVATOR_PRESS_DEAD}")
elif data.tag == "UP" or data.tag == "DOWN":
game.rolltext("{ELEVATOR_PRESS_NORM}")
game.setdata("WheelC_elevator", "dead")
elif data.tag == "CARGO":
game.rolltext("{ELEVATOR_PRESS_CARGO}")
game.setdata("WheelC_elevator", "dead")
return content
#endregion elevator
def LadderAccess(game:Game.Game, goto:callable):
frags = {}
frags["_PLACENAME"] = {
"middle" : "{MIDDLE_NAME_LADDER}",
"inner" : "{INNER_NAME_LADDER}",
"outer" : "{OUTER_NAME_LADDER}",
"core" : "{CORE_NAME_LADDER}"
}[game.place]
varname = {
"middle" : "WheelCMiddleLadder",
"inner" : "WheelCInnerLadder",
"outer" : "WheelCOuterLadder",
"core" : "WheelCCoreLadder"
}[game.place]
def content():
knowledge = game.getdata("wheelC:knowledge", 0)
if knowledge < 1:
knowledge = 1
game.setdata("wheelC:knowledge", knowledge)
counter = game.getCounter("reactorC")
if not game.getdata("reactorC:fixed", False) and not counter.enabled: #if counter reactorC is not enabled
game.setCounter("reactorC", "onReactorCTime", 10) #sets up a new timer, running onReactorCTime every time it is updated.
text = "{LADDER_ACCESS_INTRO_1}"
knowledge = game.getdata("wheelC:knowledge", 0)
if knowledge < 1:
knowledge = 1
game.setdata("wheelC:knowledge", knowledge)
if game.getdata(varname) == "open":
frags["_INTROPART"] = "{LADDER_ACCESS_INTRO_2}"
enterText = "{LADDER_ACCESS_ENTERQUEST_1}"
openText = "{LADDER_ACCESS_ENTER_1}"
else:
frags["_INTROPART"] = "{LADDER_ACCESS_INTRO_3}"
enterText = "{LADDER_ACCESS_ENTERQUEST_1}"
openText = "{LADDER_ACCESS_ENTER_2}"
game.rolltext(text, frags=frags)
if(game.yesno(openText)):
if game.getdata(varname) == None:
game.setdata(varname, "open")
game.rolltext(enterText)
goto("ladder")
return content
class Runner_WheelC_Rings(Game.PlaceRunner1D):
def __init__(self, game:Game.Game, passActs:list=[]):
super().__init__(game, 'x', 'left', 'right')
self.passActs = passActs
def onTravel(self, previndex:int):
if previndex == self.index:
print("Null travel error ? ignoring")
pNodeID = self.nodes[previndex].id
nNodeID = self.nodes[self.index].id
for p in self.passActs:
if (p[0], p[1]) == (pNodeID, nNodeID):
try:
p[2]()
except:
pass
def runaction(self, action):
status = self.game.updateCounter("reactorC", -1)
if status == "death":
self.running = False
return
super().runaction(action)