001package com.fs.starfarer.api.impl.campaign.ghosts;
002
003import com.fs.starfarer.api.Script;
004
005public class GBIRunScript extends BaseGhostBehaviorInterrupt {
006
007        protected Script script;
008        protected boolean endBehaviorWhenRun;
009
010        public GBIRunScript(float delay, Script script, boolean endBehaviorWhenRun) {
011                super(delay);
012                this.script = script;
013                this.endBehaviorWhenRun = endBehaviorWhenRun;
014        }
015
016        @Override
017        public boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior) {
018                if (hasDelayRemaining()) return false;
019
020                if (script != null) {
021                        script.run();
022                        script = null;
023                }
024                
025                return endBehaviorWhenRun;
026        }
027
028        
029}