/// <summary> /// This is called seperately when the Mod-Thread is done. /// It is needed to be seperately from SpawnSetup, so that the graphics can be found /// </summary> private void SpawnSetup_Part2() { powerComp = base.GetComp <CompPowerTrader>(); mannableComp = base.GetComp <CompMannable>(); ReadXmlData(); if (forceCreateGunAndTop) { CreateGunAndTop(gun); } else { gun = null; top = null; } // When not of colony, equip a Mortar Bomb as main weapon. if (Faction != Faction.OfPlayer) { def.building.turretGunDef = ThingDef.Named("Artillery_MortarBomb"); this.gun = (Thing)ThingMaker.MakeThing(def.building.turretGunDef, null); List <Verb> allVerbs = this.GunCompEq.AllVerbs; for (int i = 0; i < allVerbs.Count; i++) { Verb item = allVerbs[i]; item.caster = this; item.castCompleteCallback = new Action(this.BurstComplete); } top = new TurretTop_TurretWeaponBase(this); } }
// Create the gun and turret top private void CreateGunAndTop(Thing thing) { gun = thing; List <Verb> allVerbs = this.GunCompEq.AllVerbs; for (int i = 0; i < allVerbs.Count; i++) { Verb item = allVerbs[i]; item.caster = this; item.castCompleteCallback = new Action(this.BurstComplete); } top = new TurretTop_TurretWeaponBase(this); }
private void DeconstructGunAndReset() { if (gun != null && PositionHeld != null && MapHeld != null) { Thing resultingThing; GenDrop.TryDropSpawn(gun, PositionHeld, MapHeld, ThingPlaceMode.Near, out resultingThing); } forceCreateGunAndTop = false; collectingGunAllowed = false; gun = null; top = null; ResetCurrentTarget(); burstCooldownTicksLeft = 0; loaded = false; holdFire = false; }