Working on night mode and how player goes in
This commit is contained in:
1 parent
1d3bea452c
commit
9221ab68ac
8 files changed
+550
-274
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user