Improve client script load a bit
This commit is contained in:
@@ -16,9 +16,6 @@ function initEventScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("OnResourceStart", onResourceStart);
|
||||
addEventHandler("OnResourceReady", onResourceReady);
|
||||
addEventHandler("OnResourceStop", onResourceStop);
|
||||
addEventHandler("OnProcess", onProcess);
|
||||
addEventHandler("OnKeyUp", onKeyUp);
|
||||
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
||||
@@ -94,8 +91,11 @@ function onResourceStop(event, resource) {
|
||||
function onResourceReady(event, resource) {
|
||||
if (resource == thisResource) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
|
||||
loadLocaleConfig();
|
||||
sendResourceReadySignalToServer();
|
||||
|
||||
setTimeout(function () {
|
||||
initClientScripts();
|
||||
sendResourceReadySignalToServer();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ function initClientScripts() {
|
||||
initPayPhoneScript();
|
||||
initTimersScript();
|
||||
initJobScript();
|
||||
initItemScript();
|
||||
initBusinessScript();
|
||||
initHouseScript();
|
||||
|
||||
loadLocaleConfig();
|
||||
|
||||
addAllNetworkHandlers();
|
||||
|
||||
@@ -203,6 +208,8 @@ function setUpInitialGame() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
initClientScripts();
|
||||
addEventHandler("OnResourceStart", onResourceStart);
|
||||
addEventHandler("OnResourceReady", onResourceReady);
|
||||
addEventHandler("OnResourceStop", onResourceStop);
|
||||
|
||||
// ===========================================================================
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user