public void EquipPawn(Mercenary merc, MilUnitFC loadout) { foreach (Apparel clothes in loadout.defaultPawn.apparel.WornApparel) { if (clothes.def.MadeFromStuff) { Thing thing = ThingMaker.MakeThing(clothes.def, clothes.Stuff); thing.SetColor(Color.white); merc.pawn.apparel.Wear(thing as Apparel); } else { Thing thing = ThingMaker.MakeThing(clothes.def, clothes.Stuff); thing.SetColor(Color.white); merc.pawn.apparel.Wear(thing as Apparel); } } foreach (ThingWithComps weapon in loadout.defaultPawn.equipment.AllEquipmentListForReading) { if (weapon.def.MadeFromStuff) { merc.pawn.equipment.AddEquipment(ThingMaker.MakeThing(weapon.def, weapon.Stuff) as ThingWithComps); } else { merc.pawn.equipment.AddEquipment(ThingMaker.MakeThing(weapon.def) as ThingWithComps); } if (FactionColonies.IsModLoaded("CETeam.CombatExtended")) { //Log.Message("mod detected"); //CE is loaded foreach (ThingComp comp in merc.pawn.AllComps) { if (comp.GetType().ToString() == "CombatExtended.CompInventory") { Type typ = FactionColonies.returnUnknownTypeFromName( "CombatExtended.LoadoutPropertiesExtension"); //Method not static, so create instance of object and define the parameters to the method. var obj = Activator.CreateInstance(typ); object[] paramArgu = { merc.pawn.equipment.Primary, comp, 1 }; Traverse.Create(obj).Method("TryGenerateAmmoFor", paramArgu).GetValue(); Traverse.Create(obj).Method("LoadWeaponWithRandAmmo", merc.pawn.equipment.Primary) .GetValue(); } } } } }
public void Process() { if (fireSupportType == "fireSupport") { if (ShouldFire) { IntVec3 spawnCenter = SemiRandomSpawnCenter; LocalTargetInfo info = new LocalTargetInfo(spawnCenter); ThingDef def = new ThingDef(); if (FactionColonies.IsModLoaded("CETeam.CombatExtended")) { DoCombatExtendedLaunch(spawnCenter, def); } else { def = expendProjectile().projectileWhenLoaded; Projectile projectile = (Projectile)GenSpawn.Spawn(def, sourceLocation, map); projectile.Launch(null, info, info, ProjectileHitFlags.All); } } } timeRunning++; }