Debian Codegraph @

data/storyline/act1/dialogs/24-Controllable-Bot.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 PURPOSE = "$$NAME$$ is used for debugging Aftertakeover features.",
22 WIKI]]--
23
24 local Npc = FDrpg.get_npc()
25 local Tux = FDrpg.get_tux()
26
27 return {
28 FirstTime = function()
29 show("node0")
30 end,
31
32 EveryTime = function()
33 local ControllableBot_try_again = true
34 local ControllableBot_response_is = nil
35
36 while (ControllableBot_try_again) do
37 ControllableBot_response = user_input_string("enter target waypoint or bot state. states: follow-tux, fixed, free, home, patrol")
38 if (ControllableBot_response == "follow-tux" ) or
39 (running_benchmark()) then
40 -- missing characters are missing
41 ControllableBot_response = "follow_tux"
42 ControllableBot_response_is = "state"
43 elseif (ControllableBot_response == "fixed" ) or
44 (ControllableBot_response == "free" ) or
45 (ControllableBot_response == "home" ) or
46 (ControllableBot_response == "patrol" ) or
47 (running_benchmark()) then
48 ControllableBot_response_is = "state"
49 end
50
51 if (ControllableBot_response == "24-A1" ) or
52 (ControllableBot_response == "24-A2" ) or
53 (ControllableBot_response == "24-A3" ) or
54 (ControllableBot_response == "24-A4" ) or
55 (ControllableBot_response == "24-B1" ) or
56 (ControllableBot_response == "24-B2" ) or
57 (ControllableBot_response == "24-B3" ) or
58 (ControllableBot_response == "24-B4" ) or
59 (ControllableBot_response == "24-C1" ) or
60 (ControllableBot_response == "24-C2" ) or
61 (ControllableBot_response == "24-C3" ) or
62 (ControllableBot_response == "24-C4" ) or
63 (ControllableBot_response == "24-D1" ) or
64 (ControllableBot_response == "24-D2" ) or
65 (ControllableBot_response == "24-D3" ) or
66 (ControllableBot_response == "24-D4" ) or
67 (running_benchmark()) then
68 ControllableBot_response_is = "waypoint"
69 end
70
71 if (ControllableBot_response_is == "state") or
72 (running_benchmark()) then
73 if not (running_benchmark()) then -- sucks but can't be helped currently afaik
74 Npc:set_state(ControllableBot_response)
75 end
76 ControllableBot_try_again = false
77 end_dialog()
78 elseif (ControllableBot_response_is == "waypoint") or
79 (running_benchmark()) then
80 Npc:set_state("free")
81 Npc:set_destination(ControllableBot_response)
82 ControllableBot_try_again = false
83 end_dialog()
84 else
85 Npc:says("WARNING, '%s' not a valid map label.", ControllableBot_response)
86 Npc:says("Please retry.")
87 end
88 end
89 end,
90
91 {
92 id = "node0",
93 text = "Hiiiiiii!!!",
94 code = function()
95 hide("node0")
96 end,
97 },
98 {
99 id = "node99",
100 text = "logout",
101 code = function()
102 end_dialog()
103 end,
104 },
105 }