Working on night mode and how player goes in

This commit is contained in:
Vladislav Khorev 2026-06-04 21:41:32 +03:00
parent 1d3bea452c
commit 9221ab68ac
8 changed files with 550 additions and 274 deletions

View File

@ -1,17 +1,88 @@
{
"lights": [
{
"id": "lamp_library",
"positionX": 3.76222,
"positionY": 5.0,
"positionZ": 4.16035,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": false
}
]
}
"lights": [
{
"id": "lamp_library",
"positionX": 3.76222,
"positionY": 5.0,
"positionZ": 4.16035,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
},
{
"id": "lamp_teacher_room",
"positionX": -4.15666,
"positionY": 5.0,
"positionZ": 4.27091,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
},
{
"id": "lamp_student_room",
"positionX": 3.60541,
"positionY": 5.0,
"positionZ": -4.36552,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
},
{
"id": "lamp_s1_room",
"positionX": -3.90337,
"positionY": 5.0,
"positionZ": -4.00563,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
},
{
"id": "lamp_s0_room",
"positionX": -3.90337,
"positionY": 5.0,
"positionZ": -12.485,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
},
{
"id": "lamp_hall_room",
"positionX": 0.0,
"positionY": 5.0,
"positionZ": 11.7949,
"directionX": 0.0,
"directionY": -1.0,
"directionZ": 0.0,
"colorR": 4.0,
"colorG": 3.2,
"colorB": 2.4,
"autoLight": true,
"autoLightDistance": 6.0
}
]
}

View File

@ -192,6 +192,12 @@ function on_player_door_click()
end
game_api.set_enter_night_callback(
function()
game_api.start_dialogue("dialog_video001")
end
)
game_api.set_location_callbacks(
function()
print("Enter location dorm")
@ -207,14 +213,6 @@ game_api.set_location_callbacks(
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_N_2_001")
--debug
--game_api.deactivate_interactive_object("Room_Cover_Bath_W_N_2_001")
--game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_S_2_001")
--game_api.deactivate_interactive_object("Room_Cover_Main_Hall_And_Corridors_002")
--game_api.deactivate_interactive_object("Room_Cover_Utility_W_N_3_001")
--game_api.deactivate_interactive_object("Room_Cover_Utility_W_S_3_001")
--debug end
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)

View File

@ -32,6 +32,12 @@ game_api.start_dialogue("dialog_contaier001")
end
end
game_api.set_enter_night_callback(
function()
game_api.start_dialogue("dialog_video001")
end
)
game_api.set_darklands_callbacks(
nil,
function()

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@
#endif
#ifdef EMSCRIPTEN
#include <emscripten.h>
#endif
@ -1191,7 +1190,11 @@ namespace ZL
if (darklandsFlashAlpha >= 1.0f) {
if (isNightTransition) {
menuManager.isNight = !menuManager.isNight;
if (currentLocation) currentLocation->dialogueSystem.startDialogue("dialog_video001");
if (currentLocation)
{
//currentLocation->dialogueSystem.startDialogue("dialog_video001");
currentLocation->scriptEngine.callTriggerNightEnterCallback();
}
} else {
isDarklands = !isDarklands;

View File

@ -362,6 +362,7 @@ namespace ZL {
money_ -= amount;
}
void MenuManager::openPhoneBank() {
uiManager.pushMenuFromSavedRoot(phoneBankRoot);
uiManager.setText("balanceText", formatMoney(money_));

View File

@ -25,6 +25,7 @@ namespace ZL {
sol::protected_function locationExitCallback;
sol::protected_function darklandsEnterCallback;
sol::protected_function darklandsExitCallback;
sol::protected_function triggerNightEnterCallback;
};
ScriptEngine::ScriptEngine() = default;
@ -318,6 +319,12 @@ namespace ZL {
this_impl->darklandsExitCallback = onExit.as<sol::protected_function>();
});
api.set_function("set_enter_night_callback",
[this_impl = impl.get()](sol::object onEnter) {
if (onEnter.is<sol::protected_function>())
this_impl->triggerNightEnterCallback = onEnter.as<sol::protected_function>();
});
api.set_function("set_trigger_zone_enabled",
[game](int index, bool value) {
auto& triggerZones = game->triggerZones;
@ -742,6 +749,15 @@ namespace ZL {
}
}
void ScriptEngine::callTriggerNightEnterCallback() {
if (!impl || !impl->triggerNightEnterCallback.valid()) return;
auto result = impl->triggerNightEnterCallback();
if (!result.valid()) {
sol::error err = result;
std::cerr << "[SCRIPT] trigger night enter callback error: " << err.what() << "\n";
}
}
void ScriptEngine::callDarklandsExitCallback() {
if (!impl || !impl->darklandsExitCallback.valid()) return;
auto result = impl->darklandsExitCallback();

View File

@ -44,6 +44,8 @@ public:
void callDarklandsEnterCallback();
void callDarklandsExitCallback();
void callTriggerNightEnterCallback();
void callCutsceneCompleteCallback(const std::string& cutsceneId);
private: