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
20local Npc = FDrpg.get_npc()
21local Tux = FDrpg.get_tux()
22
23return {
24	EveryTime = function()
25		play_sound("effects/Menu_Item_Deselected_Sound_0.ogg")
26		DSB_PowerControlGate1_year = os.date("%Y") + 45 -- current year + 45
27		DSB_PowerControlGate1_date_1 = os.date("%a %b %d %H:%M:%S") -- emulate os.date() but without the year
28		DSB_PowerControlGate1_prompt = "guest@gate1.pc.dsb.ms: ~ #"
29
30		cli_says(_"Login : ", "NO_WAIT")
31		Tux:says(_"admin", "NO_WAIT")
32		cli_says(_"Password : ", "NO_WAIT")
33		Tux:says(_"*******", "NO_WAIT")
34		cli_says(_"Login failed. Entering as Guest")
35		Npc:says(_" ", "NO_WAIT")
36		if (DSB_PowerControlGate1_date == nil) then
37		--; TRANSLATORS: %s = a date ,  %d = a year number
38			Npc:says(_"First login from /dev/ttySO on %s %d", DSB_PowerControlGate1_date_1, DSB_PowerControlGate1_year, "NO_WAIT")
39		else
40			--; TRANSLATORS: %s = a date ,  %d = a year number
41			Npc:says(_"Last login from /dev/ttyS0 on %s %d", DSB_PowerControlGate1_date, DSB_PowerControlGate1_year, "NO_WAIT")
42		end
43		DSB_PowerControlGate1_date = DSB_PowerControlGate1_date_1
44
45		cli_says(DSB_PowerControlGate1_prompt, "NO_WAIT")
46		if (cmp_obstacle_state("DSB-PCGate1", "closed")) then
47			show("node0")
48		elseif (cmp_obstacle_state("DSB-PCGate1", "opened")) then
49			show("node10")
50		else
51			Npc:says(_"GAME BUG. PLEASE REPORT.")
52		end
53		show("node99")
54	end,
55
56	{
57		id = "node0",
58		text = _"open gate",
59		code = function()
60			--if (not dsb_pc_access) then
61			Npc:says(_"Gate status: CLOSED", "NO_WAIT")
62			Npc:says(_"Security Access to this area denied.")
63			Npc:says(_"Contact personnel in the Machine Deck Control Room if you believe this to be an error.")
64			--else
65			-- Npc:says(_"Gate status: CLOSED", "NO_WAIT")
66			-- Npc:says(_"Access granted. Opening gate ...")
67			--- Npc:says(_"Gate status: OPEN")
68			-- change_obstacle_state("DSB-PCGate1", "opened")
69			-- hide("node0") show("node10")
70			--end
71			cli_says(DSB_PowerControlGate1_prompt, "NO_WAIT")
72		end,
73	},
74	{
75		id = "node10",
76		text = _"close gate",
77		code = function()
78			Npc:says(_"Gate status: OPEN", "NO_WAIT")
79			Npc:says(_"Access granted. Closing gate ...")
80			Npc:says(_"Gate status: CLOSED")
81			change_obstacle_state("DSB-PCGate1", "closed")
82			cli_says(DSB_PowerControlGate1_prompt, "NO_WAIT")
83			hide("node10") show("node0")
84		end,
85	},
86	{
87		id = "node99",
88		text = _"logout",
89		code = function()
90			Npc:says(_"Exiting", "NO_WAIT")
91			Npc:says_random(_"Have a nice day.",
92							_"Have a wonderful day.",
93							_"We hope your day will be most productive.")
94			play_sound("effects/Menu_Item_Selected_Sound_1.ogg")
95			end_dialog()
96		end,
97	},
98}
99