Added a property to prevent scripts from running after certain other scripts have run.

This commit is contained in:
Scott Erickson 2014-02-25 10:50:40 -08:00
parent a1a5d5eea0
commit 45e6fadfe2
2 changed files with 12 additions and 1 deletions

View file

@ -132,6 +132,15 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
continue unless script.channel is channel
continue if alreadyTriggered and not script.repeats
continue if script.lastTriggered? and new Date().getTime() - script.lastTriggered < 1
continue if script.neverRun
if script.notAfter
for scriptID in script.notAfter
if scriptID in @triggered
script.neverRun = true
break
continue if script.neverRun
continue unless @scriptPrereqsSatisfied(script)
continue unless scriptMatchesEventPrereqs(script, event)
# everything passed!

View file

@ -147,7 +147,9 @@ ScriptSchema = c.object {
eventPrereqs: c.array {title: "Event Checks", description: "Logical checks on the event for this script to trigger.", format:'event-prereqs'}, EventPrereqSchema
repeats: {title: "Repeats", description: "Whether this script can trigger more than once during a level.", type: 'boolean', "default": false}
scriptPrereqs: c.array {title: "Happens After", description: "Scripts that need to fire first."},
c.shortString(title: "ID", description: "A unique ID of a script that must have triggered before the parent script can trigger.")
c.shortString(title: "ID", description: "A unique ID of a script.")
notAfter: c.array {title: "Not After", description: "Do not run this script if any of these scripts have run."},
c.shortString(title: "ID", description: "A unique ID of a script.")
noteChain: c.array {title: "Actions", description: "A list of things that happen when this script triggers."}, NoteGroupSchema
LevelThangSchema = c.object {