public virtual bool Init(IMyRemoteControl rc = null) { Rc = rc ?? Term.GetBlocksOfType <IMyRemoteControl>(collect: x => x.IsFunctional).FirstOrDefault(); if (rc == null) { return(false); } DroneName = DroneNameProvider; Antennae = Term.GetBlocksOfType <IMyRadioAntenna>(collect: x => x.IsFunctional); bool hasSetup = ParseSetup(); if (!hasSetup) { return(false); } AiSessionCore.AddDamageHandler(Grid, (block, damage) => { OnDamaged?.Invoke(block, damage); }); Grid.OnBlockAdded += block => { OnBlockPlaced?.Invoke(block); }; _ownerFaction = Grid.GetOwnerFaction(true); BotOperable = true; return(true); }
public virtual void Shutdown() { Closed = true; if (HasModdedThrusters) { DemultiplyThrusters(); } AiSessionCore.RemoveDamageHandler(Grid); }