Browse Source

modding[#1602]: Events can now define onStart and onStop events in their configs

tags/v0.8.1^2
Shaun 3 years ago
parent
commit
ba3974a643
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/server/events/events.js

+ 9
- 1
src/server/events/events.js View File

@@ -185,7 +185,7 @@ module.exports = {
if (config.oldDescription)
config.description = config.oldDescription;

let event = {
const event = {
id: this.nextId++,
config: extend({}, config),
eventManager: this,
@@ -199,6 +199,10 @@ module.exports = {
};
event.config.event = event;

const onStart = _.getDeepProperty(event, ['config', 'events', 'onStart']);
if (onStart)
onStart(this, event);

return event;
},

@@ -305,6 +309,10 @@ module.exports = {
}
});

const onStop = _.getDeepProperty(event, ['config', 'events', 'onStop']);
if (onStop)
onStop(this, event);

delete config.event;
},



Loading…
Cancel
Save