Debian Codegraph @

data/storyline/act1/dialogs/Kevin-Lawnmower.lua

raw
1 ---------------------------------------------------------------------
2 -- This file is part of Freedroid
3 --
4 -- Freedroid is free software; you can redistribute it and/or modify
5 -- it under the terms of the GNU General Public License as published by
6 -- the Free Software Foundation; either version 2 of the License, or
7 -- (at your option) any later version.
8 --
9 -- Freedroid is distributed in the hope that it will be useful,
10 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- GNU General Public License for more details.
13 --
14 -- You should have received a copy of the GNU General Public License
15 -- along with Freedroid; see the file COPYING. If not, write to the
16 -- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17 -- MA 02111-1307 USA
18 ----------------------------------------------------------------------
19 --[[WIKI
20 PERSONALITY = { "Robotic" },
21 MARKERS = { NPCID1 = "Kevin" },
22 PURPOSE = "$$NAME$$ defends $$NPCID1$$\'s compound and mows the lawn.",
23 RELATIONSHIP = {
24 { actor = "$$NPCID1$$", text = "$$NAME$$ is owned by $$NPCID1$$." },
25 }
26 WIKI]]--
27
28 local Npc = FDrpg.get_npc()
29 local Tux = FDrpg.get_tux()
30
31 return {
32 FirstTime = function()
33 fuel = 97
34 end,
35
36 EveryTime = function()
37
38 if (Kevin_entering_from_back) then
39 Npc:says(_"Intruder detected.")
40 Npc:says(_"[b]Security mode:[/b] ACTIVATED")
41 end_dialog()
42 return
43 end
44
45 Npc:says(_"Welcome to Kevin's personal lawnmower.")
46 Npc:says(_"Your connection with this bot has been logged and reported to Kevin.")
47 Npc:says(_"Please state your name for identification.")
48 Npc:says(_"WARNING: ANY ABUSE WILL BE PUNISHED!")
49
50 if (fuel < 5) then
51 Npc:set_state("fixed")
52 Npc:says(_"WARNING:", "NO_WAIT")
53 Npc:says(_"Less than [b]5%%[/b] fuel remaining!", "NO_WAIT")
54 Npc:says(_"All movement suppressed...")
55 Npc:says(_"Scanning area for possible compatible energy sources...")
56 hide("node5", "node6")
57 if (Tux:has_item_backpack("Barf's Energy Drink")) then
58 Npc:says(_"Compatible energy source found!")
59 Npc:says(_"[b]Barf's Energy Drink[/b]")
60 show("node50", "node51")
61 else
62 Npc:says(_"Could not detect compatible energy source.")
63 Npc:says(_"Recommended energy source: [b]Barf's Energy Drink[/b]")
64 Npc:says(_"Resuming hibernation...")
65 end_dialog()
66 end
67 end
68
69 if (fuel > 4) and
70 (fuel <= 97) then
71 fuel = math.floor(fuel*0.7-2)
72 if (fuel < 0) then
73 fuel = 0
74 end
75 end
76
77 show("node5", "node6", "node99")
78 end,
79
80 {
81 id = "node5",
82 text = _"I'll state my name.",
83 echo_text = false,
84 code = function()
85 Tux:says(Tux:get_player_name())
86 Npc:says(_"Identifying as %s", Tux:get_player_name(), "NO_WAIT")
87 if (Kevins_Lawnmower_tux_login_granted) then
88 Npc:says(_"Welcome to Kevin's lawnmower.")
89 show("node20")
90 hide("node5", "node6", "node30", "node30", "node31")
91 else
92 Npc:says(_"Verification failed!")
93 Npc:says(_"WARNING: LOGIN ATTEMPT REPORTED. THERE WILL BE CONSEQUENCES!")
94 Kevins_Lawnmower_tux_login = true
95 Tux:heat(15)
96 end_dialog()
97 end
98 end,
99 },
100 {
101 id = "node6",
102 text = _"I'll try 'Kevin'.",
103 echo_text = false,
104 code = function()
105 Tux:says(_"Kevin")
106 Npc:says(_"Identifying as Kevin...", "NO_WAIT")
107 Npc:says(_"Identification failed!", "NO_WAIT")
108 Npc:says(_"Liar!", "NO_WAIT")
109 Npc:says(_"WARNING: ABUSE REPORTED!")
110 Npc:says(_"PUNISHMENT IN 3 SECONDS!")
111 Npc:says(_"IN 2 SECONDS!")
112 Npc:says(_"IN 1 SECOND!")
113 Npc:says(_"DIE!")
114 Kevins_Lawnmower_tux_login_kevin_attempt = true
115 Tux:heat(25)
116 end_dialog()
117 end,
118 },
119 {
120 id = "node20",
121 text = _"help",
122 code = function()
123 Tux:says(_"Available commands:", "NO_WAIT")
124 Npc:says(_"help", "NO_WAIT")
125 Npc:says(_"version", "NO_WAIT")
126 Npc:says(_"fuel_level", "NO_WAIT")
127 Npc:says(_"exit", "NO_WAIT")
128 show("node30", "node31", "node20")
129 end,
130 },
131 {
132 id = "node30",
133 text = _"version",
134 echo_text = false,
135 code = function()
136 Tux:says(_"version", "NO_WAIT")
137 Npc:says(_"printing version...", "NO_WAIT")
138 Npc:says(_"MowOS 0.4.2", "NO_WAIT")
139 hide("node30")
140 end,
141 },
142 {
143 id = "node31",
144 text = _"fuel_level",
145 echo_text = false,
146 code = function()
147 Tux:says(_"fuel_level", "NO_WAIT")
148 Npc:says(_"Printing fuel level...")
149 if (fuel < 5) then
150 --; TRANSLATORS: '%%' is not a typo
151 Npc:says(_"WARNING, less than [b]5%%[/b] fuel remaining!")
152 elseif (fuel <= 97) then
153 --; TRANSLATORS: '%%' is not a typo, %s = number
154 Npc:says(_"[b]%s[/b]%% remaining", fuel)
155 else
156 Npc:says(_"Tank completely refilled.")
157 end
158 hide("node31")
159 end,
160 },
161 {
162 id = "node50",
163 text = _"It can have one drink...",
164 echo_text = false,
165 code = function()
166 Tux:says(_"So, where do I have to put in the drink...?", "NO_WAIT")
167 Tux:says(_"Ah, here!", "NO_WAIT")
168 Npc:says(_"[b]glug glug glug[/b]")
169 Npc:says(_"Tank refilled.")
170 Npc:says(_"Fuel status:")
171 --; TRANSLATORS: '%%' is not a typo
172 Npc:says(_"[b]100[/b]%%!")
173 Npc:says(_"This will approximately suffice for:")
174 Npc:says(_"1 month and 14 days.")
175 Npc:says(_"Dropping waste product of last fuel filling...")
176 Npc:says(_"Done.")
177 Tux:del_item("Barf's Energy Drink", 1)
178 Tux:add_item("Tungsten spikes", 2)
179 fuel = 100
180 Npc:set_state("home")
181 hide("node50", "node51")
182 end,
183 },
184 {
185 id = "node51",
186 text = _"No, I cannot spare any drinks!",
187 echo_text = false,
188 code = function()
189 Tux:says(_"Sorry, tin can.")
190 Npc:says(_"Import error: [b]null[/b] fuel received.", "NO_WAIT")
191 --; TRANSLATORS: '%%' is not a typo
192 Npc:says(_"WARNING, less than [b]5[/b]%% fuel remaining!")
193 Npc:says(_"Resuming hibernation...")
194 hide("node50", "node51")
195 end_dialog()
196 end,
197 },
198 {
199 id = "node99",
200 text = _"exit",
201 echo_text = false,
202 code = function()
203 Tux:says(_"exit", "NO_WAIT")
204 Npc:says(_"exiting...")
205 hide("node31", "node30", "node20", "node50", "node51")
206 end_dialog()
207 end,
208 },
209 }