Major refactoring - internal server state machine implemented
This commit is contained in:
1 parent
71c654e5b6
commit
66e93d46f4
48 files changed
+3948
-3696
No files matched your search
+26
-27
@@ -2,18 +2,8 @@
|
||||
-- NPC PATROL WAYPOINTS
|
||||
-- ============================================
|
||||
|
||||
bathroom_door_opened = false
|
||||
player_door_opened = false
|
||||
alik_door_opened = false
|
||||
|
||||
|
||||
game_api.start_dialogue("dialog_start001")
|
||||
|
||||
phone_picked_up = false
|
||||
journal_picked_up = false
|
||||
|
||||
function on_npc_interact(npc_index)
|
||||
if npc_index == 0 then
|
||||
function on_npc_interact(npc_id)
|
||||
if npc_id == "npc_alik" then
|
||||
--[[
|
||||
local player_alik_aware = game_api.getIntValue("alik_aware")
|
||||
local player_container_aware = game_api.getIntValue("player_container_aware")
|
||||
@@ -25,7 +15,7 @@ function on_npc_interact(npc_index)
|
||||
else
|
||||
game_api.start_dialogue("dialog_alik001")
|
||||
end]]
|
||||
game_api.player_stop_and_rotate_to_npc(0)
|
||||
game_api.player_stop_and_rotate_to_npc("npc_alik")
|
||||
game_api.start_dialogue("dialog_alik002")
|
||||
end
|
||||
end
|
||||
@@ -119,8 +109,8 @@ end
|
||||
|
||||
function callback_deactivate_cover_alik_room()
|
||||
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_S_2_001")
|
||||
game_api.set_npc_enabled(0, true)
|
||||
game_api.npc_rotate_to(0, 90)
|
||||
game_api.set_npc_enabled("npc_alik", true)
|
||||
game_api.npc_rotate_to("npc_alik", 90)
|
||||
end
|
||||
|
||||
function callback_deactivate_cover_bathroom()
|
||||
@@ -161,7 +151,7 @@ function closeAlikDoor()
|
||||
game_api.activate_interactive_object("Room_Cover_LivingRoom_W_S_2_001")
|
||||
game_api.set_object_alpha("Room_Cover_LivingRoom_W_S_2_001", 1)
|
||||
game_api.set_object_rotation("Door_Room_-1_-1_1_Leaf_001", 0)
|
||||
game_api.set_npc_enabled(0, false)
|
||||
game_api.set_npc_enabled("npc_alik", false)
|
||||
if (bathroom_door_opened) then
|
||||
game_api.switch_navigation(3) -- closed only alik (a)
|
||||
else
|
||||
@@ -330,11 +320,27 @@ function on_toilet_click()
|
||||
game_api.player_stop()
|
||||
end
|
||||
|
||||
function callback_init_location()
|
||||
bathroom_door_opened = false
|
||||
player_door_opened = false
|
||||
alik_door_opened = false
|
||||
phone_picked_up = false
|
||||
journal_picked_up = false
|
||||
|
||||
game_api.start_dialogue("dialog_start001")
|
||||
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_N_2_001")
|
||||
game_api.rotate_object("Door_Utility_-1_1_2_Leaf_001", 90, 0.01, nil)
|
||||
game_api.rotate_object("Door_Utility_-1_-1_2_Leaf_001", -90, 0.01, nil)
|
||||
game_api.set_npc_enabled("npc_alik", false)
|
||||
game_api.switch_navigation(0)
|
||||
print("----callback_init_location----")
|
||||
end
|
||||
|
||||
function callback_enter_location()
|
||||
print("Enter location dorm")
|
||||
local hp = game_api.getFloatValue("player_hp")
|
||||
game_api.set_player_hp(hp)
|
||||
game_api.set_teleport_active(0, false)
|
||||
game_api.set_teleport_active("tp_dorm_to_loc2", false)
|
||||
if (game_api.is_night()) then
|
||||
closeAlikDoor()
|
||||
end
|
||||
@@ -347,25 +353,18 @@ function callback_exit_location()
|
||||
end
|
||||
|
||||
game_api.set_location_callbacks(
|
||||
callback_init_location,
|
||||
callback_enter_location,
|
||||
callback_exit_location
|
||||
)
|
||||
|
||||
function callback_call_taxi()
|
||||
game_api.set_teleport_active(0, true)
|
||||
game_api.set_trigger_zone_enabled(0, false)
|
||||
game_api.set_teleport_active("tp_dorm_to_loc2", true)
|
||||
game_api.set_trigger_zone_enabled("taxi_zone001", false)
|
||||
end
|
||||
|
||||
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_N_2_001")
|
||||
|
||||
game_api.rotate_object("Door_Utility_-1_1_2_Leaf_001", 90, 0.01, nil)
|
||||
game_api.rotate_object("Door_Utility_-1_-1_2_Leaf_001", -90, 0.01, nil)
|
||||
|
||||
game_api.set_call_taxi_callback(
|
||||
callback_call_taxi
|
||||
)
|
||||
|
||||
|
||||
game_api.set_npc_enabled(0, false)
|
||||
game_api.switch_navigation(0)
|
||||
print("Lua script loaded successfully--!")
|
||||
Reference in new issue
Block a user