Add more Singletons existence verifications

This commit is contained in:
GreenComfyTea
2023-08-16 12:34:17 +03:00
parent aac30e7a08
commit 2d77b78a1c
3 changed files with 18 additions and 1 deletions

View File

@@ -141,6 +141,7 @@ function this.update()
if quest_status.flow_state <= quest_status.flow_states.IN_LOBBY
or quest_status.flow_state == quest_status.flow_states.CUTSCENE
or quest_status.flow_state == quest_status.flow_states.LOADING_QUEST
or quest_status.flow_state >= quest_status.flow_states.QUEST_END_ANIMATION then
return;
end

View File

@@ -190,6 +190,11 @@ function this.update_servant_list()
end
function this.update_otomo_list(is_on_quest, is_online)
if singletons.otomo_manager == nil then
error_handler.report("non_players.update_otomo_list", "Failed to access Data: otomo_manager");
return;
end
if is_online then
if is_on_quest then
--non_players.update_my_otomos();
@@ -241,9 +246,10 @@ function this.update_my_otomos()
local name = otomo_create_data_name_field:get_data(second_otomo);
if name == nil then
error_handler.report("non_players.update_my_otomos", "Failed to access Data: second_otomo -> name");
return;
end
if name ~= nil and name ~= "" then
if name ~= "" then
local level = otomo_create_data_level_field:get_data(second_otomo) or 0;
-- the secondary otomo is actually the 4th one!

View File

@@ -153,6 +153,11 @@ function this.set_flow_state(new_flow_state)
end
function this.get_cart_count()
if singletons.quest_manager == nil then
error_handler.report("quest_status.get_cart_count", "Failed to access Data: quest_manager");
return;
end
local death_num = get_death_num_method:call(singletons.quest_manager);
if death_num == nil then
error_handler.report("quest_status.get_cart_count", "Failed to access Data: death_num");
@@ -162,6 +167,11 @@ function this.get_cart_count()
end
function this.get_max_cart_count()
if singletons.quest_manager == nil then
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_manager");
return;
end
local quest_life = get_quest_life_method:call(singletons.quest_manager);
if quest_life == nil then
error_handler.report("quest_status.get_max_cart_count", "Failed to access Data: quest_life");