From de705e4a5e368c1ea7ea92f8a99ba77860c01909 Mon Sep 17 00:00:00 2001 From: Andrea Rendine Date: Mon, 11 May 2015 19:17:58 +0200 Subject: [PATCH] Load event before anything else An event could produce different notifications or rewards according to different outcomes of the event itself (e.g. a negative event impacting on buildings and/or villagers, or a wanderer leaving items of some specific kind), but the notification is generated before the onLoad() call. I'd say that this is the best action order: 1. event action 2. event notification 3. event reward (and possible additional notifications due to that) --- script/events.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/events.js b/script/events.js index 355c70f..480bea7 100644 --- a/script/events.js +++ b/script/events.js @@ -42,6 +42,11 @@ var Events = { Events.activeScene = name; var scene = Events.activeEvent().scenes[name]; + // onLoad + if(scene.onLoad) { + scene.onLoad(); + } + // Notify the scene change if(scene.notification) { Notifications.notify(null, scene.notification); @@ -52,11 +57,6 @@ var Events = { $SM.addM('stores', scene.reward); } - // onLoad - if(scene.onLoad) { - scene.onLoad(); - } - $('#description', Events.eventPanel()).empty(); $('#buttons', Events.eventPanel()).empty(); if(scene.combat) {