Ludeon Forums

RimWorld => Mods => Help => Topic started by: pablo603 on August 05, 2019, 07:17:59 AM

Title: How can I replace enemy's mortars with cannons?
Post by: pablo603 on August 05, 2019, 07:17:59 AM
I have created a cannon with all the textures and stuff. I don't want to delete mortars entirely. I just want to change the build scheme during their sieges so they build those cannons instead of mortars. Is it even possible at all? Any help is appreciated!
Title: Re: How can I replace enemy's mortars with cannons?
Post by: LWM on August 06, 2019, 12:21:21 AM
From RimWorld/SiegeBlueprintPlacer.cs:

Code: [Select]
    private static IEnumerable<Blueprint_Build> PlaceArtilleryBlueprints(float points, Map map)
    {
      IEnumerable<ThingDef> artyDefs = from def in DefDatabase<ThingDef>.AllDefs
      where def.building != null && def.building.buildingTags.Contains("Artillery_BaseDestroyer")
      select def;
    ...
        ThingDef artyDef = artyDefs.RandomElement<ThingDef>();

So if you add that tag to your cannons, they will start to show up.  If you remove it from the vanilla mortars, they will no longer show up.

It should be safe to change?  I don't see Artillery_BaseDestroyer mentioned anywhere else in the code...

--LWM