local TYPE_ANIMATE = 0
local TYPE_DISPLAY = 1
-- list of all of the commands (makes it easy to add/remove/move to script)
local SRKFA = 1
local NO_SRKFA = 2
local NOCLIP = 3
local NO_NOCLIP = 4
local DROP_TANK = 5
local DROP_TANK_CONFIRM = 6
local DROP_TANK_3_D = 7
local DROP_TANK_3_D_ERR = 8
local DROP_3_TANK_CONFIRM = 9
local CYCLE_ARRAY = 10
local CYCLE_ARRAY_CONFIRM = 11
local DROP_TANK_3D = 12
local DROP_TANK_3D_CONFIRM = 13
local PASSWORD1 = 14
local PASSWORD2 = 15
local PASSWORD3 = 16
local PASSWORD4 = 17
local PASSWORD5 = 18
local GAMES1 = 19
local GAMES2 = 20
local GAMES3 = 21
local GAMES4 = 22
local HACKING1 = 23
local HACKING2 = 24
local HACKING3 = 25
local HACKING4 = 26
local HACKING5 = 27
local HACKING6 = 28
local BACKDOOR1 = 29
local BACKDOOR2 = 30
local BACKDOOR3 = 31
local BACKDOOR4 = 32
local KILL_ALL = 33
local KILL_ALL_CONFIRM = 34
local DROP_CYCLE = 35
local DROP_CYCLE_CONFIRM = 36
local REBOOT = 37
local SHUTDOWN = 38
local SYSTEM_LOCKED = 39
local NUM_COMMANDS = SYSTEM_LOCKED
local Console_cursor_anim_h = -1
local Console_cursor_twn_h = -1
local Console_cursor_h = -1
local Screen_grp_h = -1
local Console_txt_h = -1
local Text_thread = -1
local String_idx = 0
local Global_string = ""
local Text_handles = {}
-- do not change the name of this variable
-- it is accessed by C
Msn_donnie_is_line_playing = false
-- speed = the base delay between each char
-- speed_rand = random time that is added to the base delay
-- start_delay = time to wait before text starts displaying
-- end_delay = time to wait after text is displayed
--
local Lines = {
[ SRKFA ] = {
type = TYPE_ANIMATE,
speed = 0.1,
text = "] srkfa",
},
[ NO_SRKFA ] = {
type = TYPE_DISPLAY,
end_delay = 1.0,
text = "UNKNOWN COMMAND 'srkfa'",
},
[ NOCLIP ] = {
type = TYPE_ANIMATE,
speed = 0.1,
text = "] noclip",
},
[ NO_NOCLIP ] = {
type = TYPE_DISPLAY,
end_delay = 1.0,
text = "UNKNOWN COMMAND 'noclip'",
},
[ DROP_TANK ] = {
type = TYPE_ANIMATE,
speed = 0.1,
text = "] drop_tank",
},
[ DROP_TANK_CONFIRM ] = {
type = TYPE_DISPLAY,
text = "DEPLOYING TANK",
},
[ DROP_TANK_3_D ] = {
type = TYPE_ANIMATE,
text = "] drop_tank 3 D",
},
[ DROP_TANK_3_D_ERR ] = {
type = TYPE_DISPLAY,
text = "IGNORING UNUSED COMMAND LINE TAIL 'D'",
},
[ DROP_3_TANK_CONFIRM ] = {
type = TYPE_DISPLAY,
text = "DEPLOYING 3 TANKS",
},
[ CYCLE_ARRAY ] = {
type = TYPE_ANIMATE,
text = "] cycle_array",
},
[ CYCLE_ARRAY_CONFIRM ] = {
type = TYPE_DISPLAY,
text = "DEPLOYING ARRAY OF CYCLES",
},
[ DROP_TANK_3D ] = {
type = TYPE_ANIMATE,
speed = 0.2,
text = "] drop_tank 3D",
},
[ DROP_TANK_3D_CONFIRM ] = {
type = TYPE_DISPLAY,
text = "DEPLOYING 3D TANK",
},
-- system trap
[ PASSWORD1 ] = {
type = TYPE_DISPLAY,
text = "PASSWORD:",
},
[ PASSWORD2 ] = {
type = TYPE_ANIMATE,
text = "] ********",
},
[ PASSWORD3 ] = {
type = TYPE_DISPLAY,
text = "AH AH AH, YOU DIDN'T SAY THE MAGIC WORD",
},
[ PASSWORD4 ] = {
type = TYPE_ANIMATE,
text = "] please",
},
[ PASSWORD5 ] = {
type = TYPE_DISPLAY,
text = "ACCESS GRANTED",
},
[ GAMES1 ] = {
type = TYPE_ANIMATE,
text = "] disarm security systems",
},
[ GAMES2 ] = {
type = TYPE_DISPLAY,
text = "WOULD YOU LIKE TO PLAY A GAME?",
},
[ GAMES3 ] = {
type = TYPE_ANIMATE,
text = "] play global thermonuclear war",
},
[ GAMES4 ] = {
type = TYPE_DISPLAY,
text = "THE ONLY WINNING MOVE IS NOT TO PLAY",
},
[ HACKING1 ] = {
type = TYPE_ANIMATE,
text = "] release FS3",
},
[ HACKING2 ] = {
type = TYPE_DISPLAY,
text = "NOT GOING TO HAPPEN",
},
[ HACKING3 ] = {
type = TYPE_ANIMATE,
text = "] download garbage",
},
[ HACKING4 ] = {
type = TYPE_DISPLAY,
text = "SYSTEM CRASH DUE TO MODULE ACID BURN",
},
[ HACKING5 ] = {
type = TYPE_ANIMATE,
text = "] crash override",
},
[ HACKING6 ] = {
type = TYPE_DISPLAY,
text = ":(",
},
[ BACKDOOR1 ] = {
type = TYPE_ANIMATE,
text = "] grant full SCSI interface",
},
[ BACKDOOR2 ] = {
type = TYPE_DISPLAY,
text = "I REALLY SHOULD NOT",
},
[ BACKDOOR3 ] = {
type = TYPE_ANIMATE,
text = "] access backdoor",
},
[ BACKDOOR4 ] = {
type = TYPE_DISPLAY,
text = "YOU ARE NAUGHTY",
},
[ KILL_ALL ] = {
type = TYPE_ANIMATE,
text = "] initiate order 66",
},
[ KILL_ALL_CONFIRM ] = {
type = TYPE_DISPLAY,
text = "DELETING SYSTEM CONSTRUCTS",
},
[ DROP_CYCLE ] = {
type = TYPE_ANIMATE,
text = "] drop_cycle 3D",
},
[ DROP_CYCLE_CONFIRM ] = {
type = TYPE_DISPLAY,
end_delay = 3.0,
text = "DEPLOYING 3D CYCLE",
},
[ REBOOT ] = {
type = TYPE_DISPLAY,
text = "REBOOTING",
},
[ SHUTDOWN ] = {
type = TYPE_DISPLAY,
end_delay = 1.0,
text = "SHUTTING DOWN NETWORK IN 4 MINUTES",
},
[ SYSTEM_LOCKED ] = {
type = TYPE_DISPLAY,
end_delay = 5.0,
text = "SYSTEM LOCKED",
},
}
local Line_queue = { }
local Line_queue_count = 0
function msn_donnie_init()
Screen_grp_h = vint_object_find( "screen_grp" )
Console_txt_h = vint_object_find( "console_txt" )
Console_cursor_h = vint_object_find( "console_cursor" )
vint_set_property( Console_txt_h, "text_tag", "" )
msn_donnie_open()
Console_cursor_anim_h = vint_object_find( "console_cursor_anim" )
Console_cursor_twn_h = vint_object_find( "console_cursor_twn" )
vint_set_property( Console_cursor_twn_h, "end_event", "msn_donnie_cursor_loop" )
lua_play_anim( Console_cursor_anim_h )
-- for testing
--msn_donnie_play_all_lines_test()
end
function msn_donnie_cursor_loop()
lua_play_anim( Console_cursor_anim_h )
end
function msn_donnie_play_all_lines_test()
for i = 1, NUM_COMMANDS do
msn_donnie_play_line( i )
end
end
-- do not change the name or params of this function
-- it is accessed by C
function msn_donnie_play_line( idx )
if Lines[ idx ] == nil then
return
end
Line_queue_count = Line_queue_count + 1
Line_queue[ Line_queue_count ] = Lines[ idx ]
if Text_thread == -1 then
Text_thread = thread_new( "msn_donnie_process_queue" )
end
end
-- do not change the name or params of this function
-- it is accessed by C
function msn_donnie_close()
-- Jason: this should animate the console out
msn_donnie_end()
end
function msn_donnie_open()
local console_in_anim_h = vint_object_find( "console_in_anim" )
lua_play_anim( console_in_anim_h )
end
function msn_donnie_process_queue()
Msn_donnie_is_line_playing = true
while Line_queue_count > 0 do
msn_donnie_do_line( Line_queue[ 1 ] )
for i = 1, Line_queue_count - 1 do
Line_queue[ i ] = Line_queue[ i + 1 ]
end
Line_queue[ Line_queue_count ] = nil
Line_queue_count = Line_queue_count - 1
end
Msn_donnie_is_line_playing = false
Text_thread = -1
end
function msn_donnie_do_line( new_text )
local new_speed = new_text.speed or 0.1
local is_loop = new_text.is_loop or false
local time_delay = new_text.time_delay or 0
local start_delay = new_text.start_delay or 0
local end_delay = new_text.end_delay or 0
local speed_rand = new_text.speed_rand or 0.2
local count = 0
local new_string = ""
local char = ""
Text_handles[ String_idx ] = vint_object_clone( Console_txt_h )
local text_x,text_y
local text_width,text_height
local cursor_x,cursor_y = vint_get_property( Console_cursor_h, "anchor" )
text_x,text_y = vint_get_property( Text_handles[ String_idx ], "anchor")
vint_set_property( Console_cursor_h, "anchor", text_x, text_y )
-- use a start_delay if one exists
delay( start_delay )
--repeat
-- Run through the text
if new_text.type == TYPE_ANIMATE then
-- assume the first two characters are the prompt "] "
for i = 1, 2 do
char = get_char_in_string( new_text.text, count )
if char == nil then
break
end
new_string = set_char_in_string( new_string, count, char )
count = count + 1
end
while true do
char = get_char_in_string( new_text.text, count )
if char == nil then
break
end
new_string = set_char_in_string( new_string, count, char )
vint_set_property( Text_handles[ String_idx ], "text_tag", new_string )
text_width,text_height = vint_get_property( Text_handles[ String_idx ], "screen_size")
vint_set_property( Console_cursor_h, "anchor", text_x + text_width, text_y )
count = count + 1
delay( new_speed + rand_float( 0, speed_rand ) )
end
else
new_string = new_text.text
vint_set_property( Text_handles[ String_idx ], "text_tag", new_string )
text_width,text_height = vint_get_property( Text_handles[ String_idx ], "screen_size")
vint_set_property( Console_cursor_h, "anchor", text_x + text_width, text_y )
delay( new_speed )
end
String_idx = String_idx + 1
vint_set_property( Console_cursor_h, "anchor", text_x, text_y )
for i = 0, String_idx - 1 do
text_x,text_y = vint_get_property( Text_handles[ i ], "anchor")
vint_set_property( Text_handles[ i ], "anchor", text_x, text_y - 17 )
end
delay( end_delay )
end
function msn_donnie_end()
local anim_h = vint_object_find( "console_out_anim" )
lua_play_anim( anim_h )
end
function msn_donnie_cleanup()
if Text_thread ~= nil then
thread_kill( Text_thread )
end
end