public override void Destroy(DestroyMode mode = DestroyMode.Vanish) { try { MapComponent_PowerBroker.DeregisterBroker(this); } catch (Exception err) { Verse.Log.Error($"Error deregistering broker: {err}"); } base.Destroy(mode); }
public static void RegisterBroker([NotNull] Building_BackupPowerAttachment broker, bool update = false) { MapComponent_PowerBroker comp = For(broker.Map); if (update) { _ = comp.brokers.Remove(broker); } comp.brokers.AddSafe(broker); }
private bool TryAttach(Map map, bool reAttach = false) { Parent = Position.GetEdifice(map); var success = PowerPlant != null && Flickable != null; if (success) { MapComponent_PowerBroker.RegisterBroker(this, reAttach); } return(success); }