public override void SpawnSetup(Map map, bool respawningAfterLoad) //Add mannableComp, ticksUntilAutoReload, register to GenClosestAmmo { base.SpawnSetup(map, respawningAfterLoad); dormantComp = GetComp <CompCanBeDormant>(); powerComp = GetComp <CompPowerTrader>(); mannableComp = GetComp <CompMannable>(); if (!respawningAfterLoad) { CELogger.Message($"top is {top?.ToString() ?? "null"}"); top.SetRotationFromOrientation(); burstCooldownTicksLeft = def.building.turretInitialCooldownTime.SecondsToTicks(); //Delay auto-reload for a few seconds after spawn, so player can operate the turret right after placing it, before other colonists start reserving it for reload jobs if (mannableComp != null) { ticksUntilAutoReload = minTicksBeforeAutoReload; } } // if (CompAmmo == null || CompAmmo.Props == null || CompAmmo.Props.ammoSet == null || CompAmmo.Props.ammoSet.ammoTypes.NullOrEmpty()) // return; // //"Subscribe" turret to GenClosestAmmo // foreach (var ammo in CompAmmo.Props.ammoSet.ammoTypes.Select(x => x.ammo)) // { // if (!GenClosestAmmo.listeners.ContainsKey(ammo)) // GenClosestAmmo.listeners.Add(ammo, new List<Building_TurretGunCE>() { this }); // else // GenClosestAmmo.listeners[ammo].Add(this); // if (!GenClosestAmmo.latestAmmoUpdate.ContainsKey(ammo)) // GenClosestAmmo.latestAmmoUpdate.Add(ammo, 0); // } }