Improve client script load a bit

This commit is contained in:
Vortrex
2023-03-08 22:21:41 -06:00
parent fd02988d5d
commit 85388f0cb8
2 changed files with 14 additions and 7 deletions

View File

@@ -16,9 +16,6 @@ function initEventScript() {
// =========================================================================== // ===========================================================================
function addAllEventHandlers() { function addAllEventHandlers() {
addEventHandler("OnResourceStart", onResourceStart);
addEventHandler("OnResourceReady", onResourceReady);
addEventHandler("OnResourceStop", onResourceStop);
addEventHandler("OnProcess", onProcess); addEventHandler("OnProcess", onProcess);
addEventHandler("OnKeyUp", onKeyUp); addEventHandler("OnKeyUp", onKeyUp);
addEventHandler("OnDrawnHUD", onDrawnHUD); addEventHandler("OnDrawnHUD", onDrawnHUD);
@@ -94,8 +91,11 @@ function onResourceStop(event, resource) {
function onResourceReady(event, resource) { function onResourceReady(event, resource) {
if (resource == thisResource) { if (resource == thisResource) {
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`); logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
loadLocaleConfig();
sendResourceReadySignalToServer(); setTimeout(function () {
initClientScripts();
sendResourceReadySignalToServer();
}, 500);
} }
} }

View File

@@ -25,6 +25,11 @@ function initClientScripts() {
initPayPhoneScript(); initPayPhoneScript();
initTimersScript(); initTimersScript();
initJobScript(); initJobScript();
initItemScript();
initBusinessScript();
initHouseScript();
loadLocaleConfig();
addAllNetworkHandlers(); addAllNetworkHandlers();
@@ -203,6 +208,8 @@ function setUpInitialGame() {
// =========================================================================== // ===========================================================================
initClientScripts(); addEventHandler("OnResourceStart", onResourceStart);
addEventHandler("OnResourceReady", onResourceReady);
addEventHandler("OnResourceStop", onResourceStop);
// =========================================================================== // ===========================================================================