Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }