/usr/share/freedroidrpg/dialogs/Guy.lua is in freedroidrpg-data 0.16.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | ---------------------------------------------------------------------
-- This file is part of Freedroid
--
-- Freedroid is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- Freedroid is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Freedroid; see the file COPYING. If not, write to the
-- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-- MA 02111-1307 USA
----------------------------------------------------------------------
--[[WIKI
PURPOSE = "$$NAME$$ is a character used for Debug purposes",
WIKI]]--
local Npc = FDrpg.get_npc()
local Tux = FDrpg.get_tux()
local function guy_fail(test, ...)
print(FDutils.text.highlight("ERROR! The following test failed:", "red"))
print(FDutils.text.highlight(test, "red"))
npc_says("%s failed!" ,test , "NO_WAIT")
end_dialog()
exit_game(1)
end
return {
FirstTime = function()
---------------------------------------------------------- HAS_MET
if (not Tux:has_met("Guy")) then
Npc:says("HAS MET test 1 succeeded", "NO_WAIT")
else
guy_fail("HAS MET")
end
if (not Tux:has_quest("24_guy_death_quest")) then
Tux:add_quest("24_guy_death_quest", "Quest to check if droid markers work.")
end
Npc:says("This text is only shown as you speak to this character the first time.")
end,
EveryTime = function()
Guy_dialog_executing = true
-- Tux:says_random..
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says_random("1", "2", "3", "4", "5", "NO_WAIT")
Tux:says("Tux:says()", "NO_WAIT")
Npc:says("Npc:says()", "NO_WAIT")
cli_says("cli_says()", "NO_WAIT")
Npc:says("", "NO_WAIT") -- extra linebreak for cli_says()
GuyArray = {"one", "two", "three"}
for var in ipairs(GuyArray) do
Npc:says(GuyArray[var], "NO_WAIT")
end
next("node0")
end,
{
id = "node0",
text = "RUNNING TEST NODE",
code = function()
show("node0")
hide("node0")
---------------------------------------------------------- ITEM
Tux:add_item("Laser Scalpel")
Tux:add_item(".22 Automatic", 2)
if (Tux:has_item(".22 Automatic")) then
Npc:says("ADD ITEM test 1 succeeded", "NO_WAIT")
else
guy_fail("ADD ITEM 1")
end
if (Tux:has_item_backpack(".22 Automatic")) then
Npc:says("ADD ITEM test 2 succeeded", "NO_WAIT")
else
guy_fail("ADD ITEM 2")
end
if (Tux:has_item_equipped("Laser Scalpel")) then
Npc:says("ADD ITEM test 3 succeeded", "NO_WAIT")
else
guy_fail("ADD ITEM 3")
end
-- ru654
--[[ NOTE we need del_item_equipped() or unequipp_item()
Tux:del_item("Laser Scalpel")
if (not Tux:has_item("Laser Scalpel")) then
Npc:says("DEL ITEM 1 test succeeded", "NO_WAIT")
else
guy_fail("DEL ITEM 1")
end
]]--
Tux:del_item_backpack(".22 Automatic", 2)
if (not Tux:has_item_backpack(".22 Automatic")) then
Npc:says("DEL ITEM test 2 succeeded", "NO_WAIT")
else
guy_fail("DEL ITEM 2")
end
---------------------------------------------------------- FACTION
npc_faction("self", "Guy - self")
npc_faction("ms", "Guy - ms")
npc_faction("redguard", "Guy - redguard" )
npc_faction("resistance", "Guy - resistance")
npc_faction("civilian", "Guy - civilian")
npc_faction("crazy", "Guy - crazy")
npc_faction("singularity", "Guy - singularity")
npc_faction("neutral", "Guy - neutral")
---------------------------------------------------------- HEALTH
Tux:heal()
Tux:hurt(1)
Tux:hurt(-1)
if (Tux:get_hp() == 60) then
Npc:says("HEALTH test 1 succeeded", "NO_WAIT")
else
guy_fail("HEALTH 1")
end
if (Tux:get_max_hp() == 60) then
Npc:says("HEALTH test 2 succeeded", "NO_WAIT")
else
guy_fail("HEALTH 2")
end
---------------------------------------------------------- COOL
Tux:heat(1)
Tux:heat(-1)
if (Tux:get_cool() == 100) then
Npc:says("COOL test 1 succeeded", "NO_WAIT")
else
guy_fail("COOL 1")
end
---------------------------------------------------------- TELEPORT
Tux:teleport("24-tux1")
Tux:teleport("24-tux2")
Npc:teleport("24-guy1")
Npc:teleport("24-guy2")
Dude:teleport("24-dude1")
Dude:teleport("24-dude2")
---------------------------------------------------------- SKILLS
--Npc:says(Tux:get_skill("programming"))
if (not Tux:has_met("Guy")) then
Tux:improve_skill("programming")
if (Tux:get_skill("programming") == 1) then
Npc:says("SKILL test 1 succeeded", "NO_WAIT")
else
guy_fail("SKILL 1")
end
else
Tux:says("Skipping SKILL test 1 due to missing possibility to downgrade skills!")
end
---------------------------------------------------------- PROGRAMMS
Tux:improve_program("Ricer CFLAGS")
Tux:downgrade_program("Ricer CFLAGS")
if (Tux:get_program_revision("Ricer CFLAGS") == 0) then
Npc:says("PROGRAMM test 1 succeeded", "NO_WAIT")
else
guy_fail("PROGRAMM 1")
end
---------------------------------------------------------- QUESTS
if (not Tux:has_met("Guy")) then
if (not Tux:has_quest("24_dude_test_quest")) then
Npc:says("QUEST test 1 succeeded", "NO_WAIT")
else
guy_fail("QUEST 1")
end
Tux:add_quest("24_dude_test_quest", "Add 24 dude quest.")
else
Tux:says("Skipping QUEST test 1 due to missing possibility to remove quests!")
end
if (Tux:has_quest("24_dude_test_quest")) then
Npc:says("QUEST test 2 succeeded", "NO_WAIT")
else
guy_fail("QUEST 2")
end
Tux:update_quest("24_dude_test_quest", "Update 24 dude quest.")
if (not Tux:has_met("Guy")) then
if (not Tux:done_quest("24_dude_test_quest")) then
Npc:says("QUEST test 3 succeeded", "NO_WAIT")
else
guy_fail("QUEST 3")
end
Tux:end_quest("24_dude_test_quest", "Complete 24 dude quest.")
if (Tux:done_quest("24_dude_test_quest")) then
Npc:says("QUEST test 4 succeeded", "NO_WAIT")
else
guy_fail("QUEST 4")
end
else
Tux:says("Skipping QUEST test 3 due to missing possibility to remove quests!")
Tux:says("Skipping QUEST test 4 due to missing possibility to remove quests!")
end
if (Tux:has_met("Guy")) then -- need to have met guy to let the DeadGuy die...
if (Tux:done_quest("24_guy_death_quest")) then -- check droid markers
Npc:says("QUEST test 5 succeeded","NO_WAIT")
else
guy_fail("QUEST 5")
end
else
Tux:says("Skipping QUEST test 5, we need to have met Guy...")
end
---------------------------------------------------------- OBSTACLES
change_obstacle_message("24_guy_sign", _"Guy signmessage B")
display_big_message("Sign message changed from")
display_big_message("Guy signmessage A' to 'Guy signmessage B'")
if (cmp_obstacle_state("24_guy_door", "opened")) then
Npc:says("OBSTACLE test 1 succeeded", "NO_WAIT")
else
guy_fail("OBSTACLE 1")
end
change_obstacle_state("24_guy_door", "closed")
if (cmp_obstacle_state("24_guy_door", "closed")) then
Npc:says("OBSTACLE test 2 succeeded", "NO_WAIT")
else
guy_fail("OBSTACLE 2")
end
change_obstacle_state("24_guy_door", "opened") -- 6 = door
change_obstacle_type("24_guy_door", "1")
if (get_obstacle_type("24_guy_door") == 1) then
Npc:says("OBSTACLE test 3 succeeded", "NO_WAIT")
else
guy_fail("OBSTACLE 3")
end
change_obstacle_type("24_guy_door", "6") -- set it back to door
---------------------------------------------------------- NPC DEATH TEST
if (not Tux:has_met("Guy")) then
if (not DeadGuy:is_dead()) then
Npc:says("NPC DEATH test 1 succeeded", "NO_WAIT")
else
guy_fail("NPC DEATH 1")
end
DeadGuy:drop_dead() -- kill Dude
end
if not (running_benchmark()) then -- remember: our dialog validator is quite dump :(
if (DeadGuy:is_dead()) then
Npc:says("NPC DEATH test 2 succeeded", "NO_WAIT")
else
guy_fail("NPC DEATH 2")
end
end
-- one day we might be able to revive DeadGuy
--[[ if (not Dude:is_dead()) then
Npc:says("NPC DEATH test 3 succeeded", "NO_WAIT")
else
guy_fail("NPC DEATH 3")
end ]]--
---------------------------------------------------------- FACTION DEATH TEST
if (not Tux:has_met("Guy")) then
if (not FactionDeadBot:is_dead()) then -- it's alive
Npc:says("FACTION DEATH test 1 succeeded", "NO_WAIT")
else
guy_fail("FACTION DEATH 1")
end
kill_faction("test") -- kill test faction
if not (running_benchmark()) then -- remember: our dialog validator is quite dump :(
if (FactionDeadBot:is_dead()) then -- we killed it, it's dead
Npc:says("FACTION DEATH test 2 succeeded", "NO_WAIT")
else
guy_fail("FACTION DEATH 2")
end
end
-- @TODO: implement revive and additional checks
respawn_level(24) --respawn level, now check if bot is alive again
if not (running_benchmark()) then -- remember: our dialog validator is quite dump :(
if (not FactionDeadBot:is_dead()) then --it's alive again
Npc:says("FACTION DEATH test 3 succeeded", "NO_WAIT")
else
guy_fail("FACTION DEATH 3")
end
end
-- now check if kill_faction with no_respawn works
kill_faction("test", "no_respawn")
if not (running_benchmark()) then -- remember: our dialog validator is quite dump :(
if (FactionDeadBot:is_dead()) then -- we killed it, it's dead
Npc:says("FACTION DEATH test 4 succeeded", "NO_WAIT")
else
guy_fail("FACTION DEATH 4")
end
end
-- now respawn and check if its still dead.
respawn_level(24)
if not (running_benchmark()) then -- remember: our dialog validator is quite dump :(
if (FactionDeadBot:is_dead()) then -- we killed it, no_respawn was given, it should still be dead
Npc:says("FACTION DEATH test 5 succeeded", "NO_WAIT")
else
guy_fail("FACTION DEATH 5")
end
end
end
---------------------------------------------------------- EVENTS
if not (running_benchmark()) then
if (l24_event_test == "works" ) then
Npc:says("EVENT test 1 (map label) succeeded", "NO_WAIT")
else
guy_fail("EVENT test 1 (map label)")
end
end
if not (running_benchmark()) then
if (DeadGuy_death_trigger == "works" ) then
Npc:says("EVENT test 2 (death event) succeeded", "NO_WAIT")
else
guy_fail("EVENT test 2 (death event)")
end
end
Guy_24_to_70_passed = false --reset these here.
Guy_70_to_24_passed = false -- needed because we might have walked around manually
if not (running_benchmark()) then
-- tux is on lvl 24 currently
teleport("24-exit-level-70") -- teleport from level 24 to level 70, to a label
if (Guy_24_to_70_passed) then -- the from24to70 event worked! the event also teleport tux back to level 24 (from70to24!)...
Npc:says("EVENT test 3 (Entering 70, exiting 24) succeeded", "NO_WAIT")
else
guy_fail("EVENT test 3 (Entering 70, exiting 24)")
end
if (Guy_70_to_24_passed) then -- ... which sets this as true. tux is also teleported to label 24-tux2
Npc:says("EVENT test 4 (Entering 24, exiting 70) succeeded", "NO_WAIT")
else
guy_fail("EVENT test 4 (Entering 24, exiting 70)")
end
end
---------------------------------------------------------- Gold
if (Tux:get_gold() == 0) then
Npc:says("GOLD test 1 succeed", "NO_WAIT")
else
guy_fail("GOLD 1")
end
Tux:add_gold(100)
if (Tux:get_gold() == 100) then
Npc:says("GOLD test 2 succeed", "NO_WAIT")
else
guy_fail("GOLD 2")
end
if (not Tux:del_gold(1000)) then
Npc:says("GOLD test 3 succeed", "NO_WAIT")
else
guy_fail("GOLD 3")
end
if (Tux:get_gold() == 100) then -- check if gold changed, just to be sure...
Npc:says("GOLD test 4 succeed", "NO_WAIT")
else
guy_fail("GOLD 4")
end
if (Tux:del_gold(100)) then
Npc:says("GOLD test 5 succeed", "NO_WAIT")
else
guy_fail("GOLD 5")
end
Tux:add_gold(100)
Tux:add_gold(-100)
if (Tux:get_gold() == 0) then
Npc:says("GOLD test 6 succeed")
else
guy_fail("GOLD 6")
end
---------------------------------------------------------- RUSH TUX
if (not Tux:has_met("Guy")) then
if not (Npc:get_rush_tux()) then
Npc:says("RUSH TUX test 1 succeed", "NO_WAIT")
else
guy_fail("RUSH TUX 1")
end
else
Tux:says("Skipping RUSH TUX test 1 because it would fail since we directly rush tux on second time we call the dialog.")
end
Npc:set_rush_tux(true)
if (Npc:get_rush_tux()) then
Npc:says("RUSH TUX test 2 succeed", "NO_WAIT")
else
guy_fail("RUSH TUX 2")
end
---------------------------------------------------------- OTHER
-- print some useless colorful foo
Guy_colors={"black", "red", "green", "yellow", "blue", "purple", "cyan", "white"}
if (running_benchmark()) then -- for nodes we use printf which has no linebreak at the end.
print("") -- "black" would get appended directly to a node but this avoids it.
end
for k, color in ipairs(Guy_colors) do
print(FDutils.text.highlight(color, color))
end
Npc:set_death_item("Pandora's Cube")
Npc:says("")
display_big_message("Big Message")
display_console_message("Console message, [b]blue[/b], not blue.")
end_dialog()
Guy_dialog_executing = false
end,
},
{
id = "node99",
text = "logout",
code = function()
end_dialog()
end,
},
}
|