diff --git a/js/002-config/fc-js-init.js b/js/002-config/fc-js-init.js index 407f9dd4adc13e131087ec84b1da83487340ef04..2197e4b88e3b6767ff96bfc1948553b6baf452ee 100644 --- a/js/002-config/fc-js-init.js +++ b/js/002-config/fc-js-init.js @@ -74,6 +74,15 @@ App.Medicine.Surgery.Reactions = {}; App.Mods = {}; App.Mods.DinnerParty = {}; App.Mods.Drugs = {}; +App.Mods.events = { + nonRandom: [], + random: { + individual: [], + nonindividual: [], + recruitment: [], + }, + recruit: [], +}; App.Mods.SecExp = {}; App.Mods.SF = {}; App.Neighbor = {}; diff --git a/mods/events.md b/mods/events.md new file mode 100644 index 0000000000000000000000000000000000000000..2a4d57c58551bedd4ce70a31251182f2e4ad503b --- /dev/null +++ b/mods/events.md @@ -0,0 +1,20 @@ +# Custom Events + +To add a custom event(s) through modding, add `new App.Events.EVENT_NAME()` (following the file structure laid out within `devNotes\jsEventCreationGuide.md` is heaving recommended) to the applicable array. + +## Example + +`EVENT_NAME` is bigTitsPlease. +To add this as a new `random` `individual` event place `App.Mods.events.random.individual.add(new App.Events.bigTitsPlease())` within the `index.js` outlined as apart of `mods\mods.md`. + +## Array list and notes + +- `App.Mods.events.nonRandom` - hooks into the end of `App.Events.getNonrandomEvents` (`src\events\nonRandomEvent.js`) which has the following warning `// ORDER MATTERS - if multiple events from this list trigger in a single week, they are executed in this order`. + +- `App.Mods.events.random.individual` - hooks into the end of `App.Events.getIndividualEvents` (`src\events\randomEvent.js`), `// instantiate all possible random individual events here`. + +- `App.Mods.events.random.nonIndividual` - hooks into the end of `App.Events.getNonindividualEvents` (`src\events\randomEvent.js`), `// instantiate all possible random nonindividual events here` and `Note: recruitment events should NOT be added to this list; they go in getNonindividualRecruitmentEvents instead.`. + +- `App.Mods.events.random.recruitment` - hooks into the end of `App.Events.getNonindividualRecruitmentEvents` (`src\events\randomEvent.js`). + +- `App.Mods.events.recruit` - hooks into the end of `this.eventList` (`App.Events.RERecruit` - `src\events\reRecruit.js`). diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js index 47b8cecae690e6498619c3c29d399f6cf9c555c9..1d14f35ddf29670979d8f690171dff041ffb3545 100644 --- a/src/events/nonRandomEvent.js +++ b/src/events/nonRandomEvent.js @@ -95,7 +95,7 @@ App.Events.getNonrandomEvents = function() { new App.Events.PRivalInitiation(), new App.Events.PRivalryDispatch(), new App.Events.pHostageAcquisition() - ]; + ].concat(App.Mods.events.nonRandom); }; /** get the next nonrandom event which should fire @@ -150,7 +150,7 @@ App.Events.playNonrandomEvent = function() { App.UI.DOM.appendNewElement("div", d, "These scheduled and nonrandom events still need to play this week, in this order."); App.UI.DOM.appendNewElement("div", d, "WARNING: playing certain scheduled events out of order, or skipping them, can break your game! Be careful!", ["note", "warning"]); const events = App.Events.getWeekNonrandomEvents(); - const linkList = App.UI.DOM.appendNewElement("div", d, '', "event-section"); + const linkList = App.UI.DOM.appendNewElement("div", d, '', ["event-section"]); for (const event of events) { App.UI.DOM.appendNewElement("div", linkList, App.UI.DOM.passageLink(event.eventName, passage(), () => { V.event = event; })); } diff --git a/src/events/randomEvent.js b/src/events/randomEvent.js index 448e75a74401df3ec809e00d3304fb1ceccd0f47..03735d8c7f869f1e86f4fe8eca159ab468ef1d83 100644 --- a/src/events/randomEvent.js +++ b/src/events/randomEvent.js @@ -207,7 +207,7 @@ App.Events.getIndividualEvents = function() { new App.Events.RERelationshipAdvice(), new App.Events.RESlaveMarriage(), new App.Events.RESiblingPlease(), - ]; + ].concat(App.Mods.events.random.individual); }; /** get a list of possible nonindividual events @@ -343,7 +343,7 @@ App.Events.getNonindividualEvents = function() { new App.Events.pessTiredMilkmaid(), new App.Events.pessWorriedHeadgirl(), new App.Events.pessWorshipfulImpregnatrix(), - ]; + ].concat(App.Mods.events.random.nonIndividual); }; /** get a list of possible nonindividual recruitment events @@ -428,7 +428,7 @@ App.Events.getNonindividualRecruitmentEvents = function() { new App.Events.recetsMatchedPair(), new App.Events.recetsMismatchedPair(), new App.Events.recetsPoshMotherDaughter(), - ]; + ].concat(App.Mods.events.random.recruitment); }; /** choose a valid, castable event from the given event list @@ -484,7 +484,7 @@ App.Events.playRandomIndividualEvent = function() { App.UI.DOM.appendNewElement("p", d, "One of the following individual events would have been chosen for this slave."); - const linkList = App.UI.DOM.appendNewElement("div", d, '', "event-section"); + const linkList = App.UI.DOM.appendNewElement("div", d, '', ["event-section"]); const writeEventList = (/** @type {App.Entity.SlaveState} */eventSlave) => { $(linkList).empty(); const events = App.Events.getValidEvents(App.Events.getIndividualEvents(), eventSlave); @@ -535,7 +535,7 @@ App.Events.playRandomNonindividualEvent = function() { // show all the possible nonindividual random events App.UI.DOM.appendNewElement("h2", d, "Random Nonindividual Events"); App.UI.DOM.appendNewElement("p", d, "One of the following nonindividual events would have been chosen."); - const linkList = App.UI.DOM.appendNewElement("div", d, '', "event-section"); + const linkList = App.UI.DOM.appendNewElement("div", d, '', ["event-section"]); for (const event of nonRecEvents.concat(recEvents)) { App.UI.DOM.appendNewElement("div", linkList, App.UI.DOM.passageLink(event.eventName, passage(), () => { V.event = event; })); } diff --git a/src/events/reRecruit.js b/src/events/reRecruit.js index 845702b0dc781ae5cc182aac09eed70b101419b9..cf6fd7f55b417d564bdf8fbb4074e861c88e69ff 100644 --- a/src/events/reRecruit.js +++ b/src/events/reRecruit.js @@ -62,7 +62,7 @@ App.Events.RERecruit = class RERecruit extends App.Events.BaseEvent { new App.Events.recWanderingHomeless, new App.Events.recWhoreRecruit, new App.Events.recWomanlyPC, - ]; + ].concat(App.Mods.events.recruit); } eventPrerequisites() {