Stopped triggers from firing if they are inactive
This commit is contained in:
@@ -51,6 +51,11 @@ function triggerMatchTags(trigger, prop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyTrigger(trigger, { creature, targets, scope, log }) {
|
export function applyTrigger(trigger, { creature, targets, scope, log }) {
|
||||||
|
// Prevent trigger from firing if it's inactive
|
||||||
|
if (trigger.inactive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent triggers from firing if their condition is false
|
// Prevent triggers from firing if their condition is false
|
||||||
if (trigger.condition?.parseNode) {
|
if (trigger.condition?.parseNode) {
|
||||||
recalculateCalculation(trigger.condition, scope, log);
|
recalculateCalculation(trigger.condition, scope, log);
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ export function doActionWork({
|
|||||||
|
|
||||||
// Get the triggers
|
// Get the triggers
|
||||||
const triggers = getPropertiesOfType(creature._id, 'trigger');
|
const triggers = getPropertiesOfType(creature._id, 'trigger');
|
||||||
remove(triggers, trigger => trigger.event !== 'doActionProperty');
|
// Skip triggers that aren't triggered by action props or are inactive
|
||||||
|
remove(triggers, trigger => trigger.event !== 'doActionProperty' || trigger.inactive);
|
||||||
|
// Group the triggers into creature.triggers.<propertyType>.<timing>
|
||||||
creature.triggers = groupBy(triggers, 'actionPropertyType');
|
creature.triggers = groupBy(triggers, 'actionPropertyType');
|
||||||
for (let type in creature.triggers) {
|
for (let type in creature.triggers) {
|
||||||
creature.triggers[type] = groupBy(creature.triggers[type], 'timing')
|
creature.triggers[type] = groupBy(creature.triggers[type], 'timing')
|
||||||
|
|||||||
Reference in New Issue
Block a user