Fixing inconsistency between day and nights on uni_int location
This commit is contained in:
1 parent
f52b6872b0
commit
a9f4025333
10 files changed
+154
-54
No files matched your search
@@ -8,11 +8,21 @@ player_hold_key = false
|
||||
teacher_arrived = false
|
||||
teacher_told_about_book = false
|
||||
|
||||
night_time = false
|
||||
|
||||
--player_left_darklands = false
|
||||
|
||||
was_darklands = false
|
||||
--was_darklands = false
|
||||
|
||||
|
||||
--[[
|
||||
0 - day0
|
||||
1 - darklands
|
||||
2 - morning
|
||||
3 - night
|
||||
4 - day
|
||||
|
||||
]]
|
||||
was_state_when_player_left = 0
|
||||
was_day_when_player_left = 0
|
||||
|
||||
morning_can_open_door_index = 0
|
||||
morning_did_open_door_index = 0
|
||||
@@ -58,7 +68,7 @@ function knife_dialog_zone001_enter_callback()
|
||||
game_api.switch_navigation(4)
|
||||
end
|
||||
else
|
||||
if (night_time == false) then
|
||||
if (game_api.is_night() == false) then
|
||||
game_api.start_dialogue("knife_dialog_second001")
|
||||
game_api.set_trigger_zone_enabled(1, false)
|
||||
end
|
||||
@@ -103,7 +113,7 @@ function on_book_pickup()
|
||||
if (teacher_told_about_book) then
|
||||
print("on_book_pickup step1")
|
||||
if not player_hold_book then
|
||||
if (night_time) or (day >= 1) then
|
||||
if (game_api.is_night()) or (day >= 1) then
|
||||
game_api.start_dialogue("book_dialog006")
|
||||
else
|
||||
game_api.pickup_item("book")
|
||||
@@ -224,7 +234,7 @@ function on_library_door_click()
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 0) then
|
||||
if (night_time) then
|
||||
if (game_api.is_night()) then
|
||||
game_api.start_dialogue("door_night_dialog001")
|
||||
else
|
||||
if (not lection_is_over) then
|
||||
@@ -247,13 +257,6 @@ function on_library_door_click()
|
||||
print("Library door step 4")
|
||||
end
|
||||
print("Library door step5")
|
||||
--[[
|
||||
if (game_api.is_night() and not game.is_dawn()) then
|
||||
game_api.start_dialogue("door_dialog001")
|
||||
end
|
||||
if (game_api.is_night() and game.is_dawn() and not (morning_did_open_door_index == 4) then
|
||||
game_api.start_dialogue("door_dialog001")
|
||||
end]]
|
||||
end
|
||||
print("Library door step 5")
|
||||
end
|
||||
@@ -266,7 +269,7 @@ function on_teachers_door_click()
|
||||
print("day is")
|
||||
print(day)
|
||||
|
||||
if (day == 0) then
|
||||
if (day == 0) and not game_api.is_dawn() then
|
||||
if (player_hold_key) then
|
||||
if (not teacher_door_opened) then
|
||||
teacher_door_opened = true
|
||||
@@ -373,7 +376,7 @@ function on_hall_door_click()
|
||||
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 0) then
|
||||
if (day == 0) and not game_api.is_dawn() then
|
||||
if (not hall_door_opened) then
|
||||
hall_door_opened = true
|
||||
game_api.switch_navigation(1)
|
||||
@@ -499,7 +502,7 @@ function book_dialog_zone001_enter_callback()
|
||||
game_api.advance_darklands_hud()
|
||||
else
|
||||
print("book_dialog_zone001_enter_callback step 3")
|
||||
if (player_hold_book) and (night_time == false) then
|
||||
if (player_hold_book) and (game_api.is_night() == false) then
|
||||
print("book_dialog_zone001_enter_callback step 4")
|
||||
game_api.start_dialogue("book_dialog001")
|
||||
game_api.switch_navigation(0)
|
||||
@@ -510,7 +513,7 @@ end
|
||||
|
||||
function book_dialog_zone001_exit_callback()
|
||||
print("book_dialog_zone001_exit_callback step 1")
|
||||
if (player_hold_book) and (night_time == false) then
|
||||
if (player_hold_book) and (game_api.is_night() == false) then
|
||||
game_api.switch_navigation(3)
|
||||
end
|
||||
end
|
||||
@@ -518,18 +521,16 @@ end
|
||||
function on_computer_clicked()
|
||||
print("on_computer_clicked--")
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
if (day == 1) then
|
||||
-- TODO: some dialog like I don't need it
|
||||
|
||||
if game_api.is_darklands() then
|
||||
game_api.start_dialogue("computer_dialog004")
|
||||
elseif (day >= 1) or game_api.is_dawn() then
|
||||
print("on_computer_clicked--1")
|
||||
game_api.start_dialogue("computer_dialog003")
|
||||
else
|
||||
if game_api.is_darklands() then
|
||||
game_api.start_dialogue("computer_dialog004")
|
||||
else
|
||||
if teacher_told_about_book then
|
||||
print("on_computer_clicked--2")
|
||||
if (night_time == false) then
|
||||
if (game_api.is_night() == false) then
|
||||
print("on_computer_clicked--3")
|
||||
if (player_hold_book) then
|
||||
print("on_computer_clicked--4")
|
||||
@@ -547,13 +548,12 @@ function on_computer_clicked()
|
||||
print("on_computer_clicked--7")
|
||||
game_api.start_dialogue("computer_dialog001")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_sleep_cutscene()
|
||||
print("Cutscene 2 done!")
|
||||
night_time = true
|
||||
|
||||
game_api.set_night()
|
||||
--game_api.set_trigger_zone_enabled(1, false)
|
||||
game_api.set_npc_enabled(0, false)
|
||||
@@ -662,8 +662,6 @@ game_api.set_darklands_callbacks(
|
||||
game_api.npc_set_position(5, 5.0, 0, 12)
|
||||
end
|
||||
|
||||
night_time = false
|
||||
|
||||
game_api.switch_navigation(5)
|
||||
end,
|
||||
function()
|
||||
@@ -674,8 +672,7 @@ game_api.set_darklands_callbacks(
|
||||
game_api.set_npc_enabled(3, false)
|
||||
game_api.set_npc_enabled(4, false)
|
||||
game_api.set_npc_enabled(5, false)
|
||||
game_api.setIntValue("day", 1)
|
||||
print("Setting to day 1----x")
|
||||
|
||||
--game_api.setIntValue("need_sleep", 1)
|
||||
--player_left_darklands = true
|
||||
morning_did_open_door_index = 0
|
||||
@@ -902,7 +899,7 @@ function setDay1MorningSetup()
|
||||
end
|
||||
|
||||
function setDay1NightSetup()
|
||||
night_time = true
|
||||
|
||||
teacher_door_opened = false
|
||||
|
||||
print("setDay1NightSetup")
|
||||
@@ -1167,6 +1164,67 @@ game_api.set_location_callbacks(
|
||||
|
||||
print("day is:")
|
||||
print(day)
|
||||
|
||||
local resetState = false
|
||||
if not (day == was_day_when_player_left) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 1) and game_api.is_darklands() == false then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 2) and (game_api.is_darklands() or game_api.is_dawn() == false) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 3) and (game_api.is_darklands() or game_api.is_night() == false) then
|
||||
resetState = true
|
||||
elseif (was_state_when_player_left == 4) and (game_api.is_night() or game_api.is_darklands()) then
|
||||
resetState = true
|
||||
end
|
||||
|
||||
if (day > 0) and resetState then
|
||||
|
||||
if (game_api.is_darklands()) then
|
||||
--Currently not possible
|
||||
print("Entered darklands setup")
|
||||
elseif (game_api.is_dawn()) then
|
||||
print("setDay1MorningSetup entered-")
|
||||
setDay1MorningSetup()
|
||||
elseif (game_api.is_night()) then
|
||||
print("entered night setup")
|
||||
setDay1NightSetup()
|
||||
game_api.switch_navigation(17)
|
||||
else
|
||||
print("entered day setup")
|
||||
setDay1setup()
|
||||
game_api.switch_navigation(3)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
local day = game_api.getIntValue("day")
|
||||
if (day == 0)then
|
||||
was_state_when_player_left = 0
|
||||
elseif game_api.is_darklands() then
|
||||
was_state_when_player_left = 1
|
||||
elseif game_api.is_dawn() then
|
||||
was_state_when_player_left = 2
|
||||
elseif game_api.is_night() then
|
||||
was_state_when_player_left = 3
|
||||
else
|
||||
was_state_when_player_left = 4
|
||||
end
|
||||
possible situation combinations:
|
||||
left from darklands
|
||||
left from morning
|
||||
left from day
|
||||
left from night
|
||||
|
||||
arrive in darklands
|
||||
arrive in morning
|
||||
arrive in day
|
||||
arrive in night
|
||||
|
||||
]]
|
||||
|
||||
|
||||
|
||||
if (day > 0) and (game_api.is_night() == false) then
|
||||
print("entered day setup")
|
||||
@@ -1182,26 +1240,37 @@ game_api.set_location_callbacks(
|
||||
setDay1MorningSetup()
|
||||
end
|
||||
|
||||
--[[
|
||||
|
||||
local need_sleep = game_api.getIntValue("need_sleep")
|
||||
local day = game_api.getIntValue("day")
|
||||
if (day > 0) and (need_sleep == 1) then
|
||||
setDay1MorningSetup()
|
||||
elseif (day > 0) then
|
||||
setDay1setup()
|
||||
game_api.switch_navigation(3)
|
||||
else
|
||||
--Do nothing, it should have been already set up
|
||||
end]]
|
||||
end,
|
||||
function()
|
||||
print("Exit location uni interior")
|
||||
--player_left_darklands = false
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
|
||||
|
||||
--[[
|
||||
0 - day0
|
||||
1 - darklands
|
||||
2 - morning
|
||||
3 - night
|
||||
4 - day
|
||||
|
||||
was_darklands = game_api.is_darklands()
|
||||
]]
|
||||
|
||||
local day = game_api.getIntValue("day")
|
||||
|
||||
was_day_when_player_left = day
|
||||
if (day == 0)then
|
||||
was_state_when_player_left = 0
|
||||
elseif game_api.is_darklands() then
|
||||
was_state_when_player_left = 1
|
||||
elseif game_api.is_dawn() then
|
||||
was_state_when_player_left = 2
|
||||
elseif game_api.is_night() then
|
||||
was_state_when_player_left = 3
|
||||
else
|
||||
was_state_when_player_left = 4
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user