public override void PostSpawnSetup(bool respawningAfterLoad) { base.PostSpawnSetup(respawningAfterLoad); compPowerTrader = parent.TryGetComp <CompPowerTrader>(); if (compPowerTrader == null) { Log.Error("[RT Solar Flare Shield]: Could not get CompPowerTrader of " + parent); } coordinator = parent.Map.GetShieldCoordinator(); coordinator.shields.Add(this); }
public static MapComponent_ShieldCoordinator GetShieldCoordinator(this Map map) { MapComponent_ShieldCoordinator coordinator = map.GetComponent <MapComponent_ShieldCoordinator>(); if (coordinator == null) { coordinator = new MapComponent_ShieldCoordinator(map); map.components.Add(coordinator); } return(coordinator); }