Set up session-repeating scripts.
This commit is contained in:
parent
ef9c0a610f
commit
2894d4f39c
2 changed files with 3 additions and 1 deletions
|
@ -102,6 +102,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
unless script
|
||||
console.warn "Couldn't find script for", scriptID, "from scripts", @scripts, "when restoring session scripts."
|
||||
continue
|
||||
continue if script.repeats # repeating scripts are not 'rerun'
|
||||
@triggered.push(scriptID)
|
||||
@ended.push(scriptID)
|
||||
noteChain = @processScript(script)
|
||||
|
@ -131,6 +132,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
alreadyTriggered = script.id in @triggered
|
||||
continue unless script.channel is channel
|
||||
continue if alreadyTriggered and not script.repeats
|
||||
continue if script.lastTriggered? and script.repeats is 'session'
|
||||
continue if script.lastTriggered? and new Date().getTime() - script.lastTriggered < 1
|
||||
continue if script.neverRun
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ ScriptSchema = c.object {
|
|||
id: c.shortString(title: "ID", description: "A unique ID that other scripts can rely on in their Happens After prereqs, for sequencing.") # uniqueness?
|
||||
channel: c.shortString(title: "Event", format: 'event-channel', description: 'Event channel this script might trigger for, like "world:won".')
|
||||
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}
|
||||
repeats: {title: "Repeats", description: "Whether this script can trigger more than once during a level.", enum: [true, false, 'session'], "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.")
|
||||
notAfter: c.array {title: "Not After", description: "Do not run this script if any of these scripts have run."},
|
||||
|
|
Reference in a new issue