Skip to content
Snippets Groups Projects
Commit 77a42412 authored by svornost's avatar svornost
Browse files

Add JS Random Event event name to storyCaption to assist in debugging.

parent 61f39734
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,14 @@ App.Events.BaseEvent = class BaseEvent {
return JSON.reviveWrapper(`new App.Events.${this.constructor.name}(${JSON.stringify(this.actors)},${JSON.stringify(this.params)})`);
}
/** get the event's (human-readable) name. must not include ":".
* default implementation should generally suffice (though we might want to de-camelcase here or something).
* @returns {string}
*/
get eventName() {
return this.constructor.name;
}
/** build the actual list of actors that will be involved in this event.
* default implementation should suffice for child classes with a fixed number of actors; may be overridden for events with variable actor count.
* @param {App.Entity.SlaveState} firstActor - if non-null, the first actor should be this slave (fail if she is not qualified)
......
......@@ -39,13 +39,13 @@ App.Events.getNonindividualEvents = function() {
/** get a stringified list of possible individual events as fake passage names - TODO: kill me */
App.Events.getIndividualEventsPassageList = function(slave) {
const events = App.Events.getIndividualEvents(slave);
return events.map(e => `JSRE ${e.constructor.name}:${JSON.stringify(e.toJSON())}`);
return events.map(e => `JSRE ${e.eventName}:${JSON.stringify(e.toJSON())}`);
};
/** get a stringified list of possible individual events as fake passage names - TODO: kill me */
App.Events.getNonindividualEventsPassageList = function() {
const events = App.Events.getNonindividualEvents();
return events.map(e => `JSRE ${e.constructor.name}:${JSON.stringify(e.toJSON())}`);
return events.map(e => `JSRE ${e.eventName}:${JSON.stringify(e.toJSON())}`);
};
/** execute a fake event passage from the embedded JSON - TODO: kill me */
......
......@@ -62,6 +62,9 @@
<<if $ui != "start" && _Pass != "Encyclopedia">>
<<if $cheatMode || $debugMode>>
<div>_Pass</div>
<<if _Pass == "JS Random Event">>
<div><<= $event.eventName>></div>
<</if>>
<</if>>
<div>
<span id="week">''Week $week''</span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment