From c8cc7b2a9bdb852633165dd4a7e1f62ce6026851 Mon Sep 17 00:00:00 2001 From: Safairette <71556532+Safairette@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:03:43 +0200 Subject: [PATCH] Redo 81mm as generic shell --- Defs/Ammo/Generic/Shell_Artillery.xml | 363 +++++++ Defs/Ammo/Generic/Shell_Mortar.xml | 958 ------------------ Defs/Ammo/Shell/50mmType89Mortar.xml | 2 +- Defs/Ammo/Shell/60mmMortar.xml | 2 +- Defs/Ammo/Shell/81mmMortar.xml | 153 ++- .../CombatExtended/AmmoGeneralizer.cs | 49 +- .../Defs/GenericLabelExtension.cs | 11 + 7 files changed, 576 insertions(+), 962 deletions(-) create mode 100644 Defs/Ammo/Generic/Shell_Artillery.xml delete mode 100644 Defs/Ammo/Generic/Shell_Mortar.xml create mode 100644 Source/CombatExtended/CombatExtended/Defs/GenericLabelExtension.cs diff --git a/Defs/Ammo/Generic/Shell_Artillery.xml b/Defs/Ammo/Generic/Shell_Artillery.xml new file mode 100644 index 0000000000..4b1a04fdc8 --- /dev/null +++ b/Defs/Ammo/Generic/Shell_Artillery.xml @@ -0,0 +1,363 @@ + + + + + + + AmmoMortarShellHeavy + + AmmoShells + UI/Icons/ThingCategories/CaliberCannon + + + + + + AmmoSet_ArtilleryShell + + + Bullet_155mmHowitzerShell_HE + Bullet_155mmHowitzerShell_HE_HFuzed + Bullet_155mmHowitzerShell_Incendiary + Bullet_155mmHowitzerShell_EMP + Bullet_155mmHowitzerShell_Smoke + + true + + + + + + Large cannon shell used by howitzers. + +
  • AmmoMortarShellHeavy
  • +
    + 25 + +
  • CE_AutoEnableTrade
  • +
  • CE_AutoEnableCrafting_TableMachining
  • +
    + + 300 + 46.7 + 47.67 + + 40 + MortarBomb_Explode + true +
    + + + Ammo_ArtilleryShell_HE + + + Things/Ammo/Cannon/Howitzer/HE + Graphic_StackCount + + + 384.6 + + GrenadeHE + Bullet_155mmHowitzerShell_HE + + + + Ammo_ArtilleryShell_HE_HFuzed + + + Things/Ammo/Cannon/Howitzer/AB + Graphic_StackCount + + + 449.6 + + GrenadeHETF + Bullet_155mmHowitzerShell_HE + + + + Ammo_ArtilleryShell_Incendiary + + + Things/Ammo/Cannon/Howitzer/INC + Graphic_StackCount + + + 283.1 + + GrenadeIncendiary + Bullet_155mmHowitzerShell_Incendiary + + + + Ammo_ArtilleryShell_EMP + + + Things/Ammo/Cannon/Howitzer/EMP + Graphic_StackCount + + + 673.94 + + GrenadeEMP + Bullet_155mmHowitzerShell_EMP + + + + Ammo_ArtilleryShell_Smoke + + + Things/Ammo/Cannon/Howitzer/SMK + Graphic_StackCount + + + 262.5 + + Smoke + false + Bullet_155mmHowitzerShell_Smoke + + + + + + MakeAmmo_ArtilleryShell_HE + + Craft 2 artillery shells (HE). + Making artillery shells (HE). + + +
  • Mortars
  • +
  • CE_TurretHeavyWeapons
  • +
    + 17400 + +
  • + + +
  • Steel
  • + + + 94 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • FSX
  • + + + 17 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
  • FSX
  • +
    +
    + + 2 + +
    + + + MakeAmmo_ArtilleryShell_HE_HFuzed + + Craft 2 155mm (Airburst) artillery shells. + Making 155mm (Airburst) artillery shells. + + +
  • Mortars
  • +
  • CE_TurretHeavyWeapons
  • +
    + 18600 + +
  • + + +
  • Steel
  • + + + 94 + +
  • + + +
  • ComponentIndustrial
  • + + + 4 + +
  • + + +
  • FSX
  • + + + 17 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
  • FSX
  • +
    +
    + + 2 + + + 5 + +
    + + + MakeAmmo_ArtilleryShell_Incendiary + + Craft 2 artillery shells (Incendiary). + Making artillery shell (Incendiary). + + +
  • Mortars
  • +
  • CE_TurretHeavyWeapons
  • +
    + 12600 + +
  • + + +
  • Steel
  • + + + 94 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • Prometheum
  • + + + 5 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
  • Prometheum
  • +
    +
    + + 2 + +
    + + + MakeAmmo_ArtilleryShell_EMP + + Craft 2 artillery shells (EMP). + Making artillery shells (EMP). + + +
  • Mortars
  • +
  • CE_TurretHeavyWeapons
  • +
  • MicroelectronicsBasics
  • +
    + 18400 + +
  • + + +
  • Steel
  • + + + 94 + +
  • + + +
  • ComponentIndustrial
  • + + + 15 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
    +
    + + 2 + +
    + + + MakeAmmo_ArtilleryShell_Smoke + + Craft 2 artillery shells (Smoke). + Making artillery shells (Smoke). + + +
  • Mortars
  • +
  • CE_TurretHeavyWeapons
  • +
    + 11400 + +
  • + + +
  • Steel
  • + + + 90 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • Prometheum
  • + + + 3 + +
    + + +
  • Steel
  • +
  • Prometheum
  • +
  • ComponentIndustrial
  • +
    +
    + + 2 + +
    + +
    \ No newline at end of file diff --git a/Defs/Ammo/Generic/Shell_Mortar.xml b/Defs/Ammo/Generic/Shell_Mortar.xml deleted file mode 100644 index bc6a495a04..0000000000 --- a/Defs/Ammo/Generic/Shell_Mortar.xml +++ /dev/null @@ -1,958 +0,0 @@ - - - - - - - AmmoMortarShell - - AmmoShells - UI/Icons/ThingCategories/CaliberMortar - - - - AmmoMortarShellHeavy - - AmmoShells - UI/Icons/ThingCategories/CaliberCannon - - - - - - AmmoSet_MortarShell - - - Bullet_81mmMortarShell_HE - Bullet_81mmMortarShell_HE_HFuzed - Bullet_81mmMortarShell_Incendiary - Bullet_81mmMortarShell_EMP - Bullet_81mmMortarShell_Firefoam - Bullet_81mmMortarShell_Smoke - Bullet_81mmMortarShell_Antigrain - Bullet_81mmMortarShell_Tox - Bullet_81mmMortarShell_Deadlife - - true - - - - AmmoSet_ArtilleryShell - - - Bullet_155mmHowitzerShell_HE - Bullet_155mmHowitzerShell_HE_HFuzed - Bullet_155mmHowitzerShell_Incendiary - Bullet_155mmHowitzerShell_EMP - Bullet_155mmHowitzerShell_Smoke - - true - - - - - - - - Low-velocity shell designed to be fired from a mortar. - - 200 - - -
  • AmmoMortarShell
  • -
    - 25 - 30 - MortarBomb_Explode - true -
    - - - -
  • CE_AutoEnableTrade
  • -
  • CE_AutoEnableCrafting_TableMachining
  • -
    -
    - - - Ammo_MortarShell_HighExplosive - - - Things/Ammo/Mortar/HE - Graphic_StackCount - - - 50.09 - 5.27 - 8.17 - - GrenadeHE - Bullet_81mmMortarShell_HE - - - - Ammo_MortarShell_HighExplosive_HFuzed - - - Things/Ammo/Mortar/Airburst - Graphic_StackCount - - - 63.09 - 5.27 - 8.17 - - GrenadeHETF - Bullet_81mmMortarShell_HE - - - - Ammo_MortarShell_Incendiary - - - Things/Ammo/Mortar/Incendiary - Graphic_StackCount - - - 42.34 - 5.65 - 9.0 - - GrenadeIncendiary - Bullet_81mmMortarShell_Incendiary - - - - Ammo_MortarShell_EMP - - - Things/Ammo/Mortar/EMP - Graphic_StackCount - - - 112.42 - 5.27 - 8.17 - - GrenadeEMP - Bullet_81mmMortarShell_EMP - - - - Ammo_MortarShell_Firefoam - - - Things/Ammo/Mortar/Firefoam - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - FoamFuel - Bullet_81mmMortarShell_Firefoam - false - - - - Ammo_MortarShell_Smoke - - - Things/Ammo/Mortar/Smoke - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - Smoke - Bullet_81mmMortarShell_Smoke - false - - - - Ammo_MortarShell_AntigrainWarhead - - - Things/Ammo/Mortar/Antigrain - Graphic_StackCount - - - 1500 - 6.5 - 6 - - -
  • RewardStandardCore
  • -
    - -
  • CE_AutoEnableTrade_Sellable
  • -
    - Antigrain - false - - -
  • - 14.9 - 300 - BombSuper - 0.7 - 0.22 - true - GiantExplosion - Explosion_GiantBomb - 60~120 - True - true -
  • -
    -
    - - - Ammo_MortarShell_Toxic - - - Things/Ammo/Mortar/Toxic - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - Toxic - Bullet_81mmMortarShell_Tox - - - - Ammo_MortarShell_Deadlife - - - Things/Ammo/Mortar/Deadlife - Graphic_StackCount - - - 41.03 - 4.4 - 10.01 - - Deadlife - Bullet_81mmMortarShell_Deadlife - - - - - - Large cannon shell used by howitzers. - -
  • AmmoMortarShellHeavy
  • -
    - 25 - -
  • CE_AutoEnableTrade
  • -
  • CE_AutoEnableCrafting_TableMachining
  • -
    - - 300 - 46.7 - 47.67 - - 40 - MortarBomb_Explode - true -
    - - - Ammo_ArtilleryShell_HE - - - Things/Ammo/Cannon/Howitzer/HE - Graphic_StackCount - - - 384.6 - - GrenadeHE - Bullet_155mmHowitzerShell_HE - - - - Ammo_ArtilleryShell_HE_HFuzed - - - Things/Ammo/Cannon/Howitzer/AB - Graphic_StackCount - - - 449.6 - - GrenadeHETF - Bullet_155mmHowitzerShell_HE - - - - Ammo_ArtilleryShell_Incendiary - - - Things/Ammo/Cannon/Howitzer/INC - Graphic_StackCount - - - 283.1 - - GrenadeIncendiary - Bullet_155mmHowitzerShell_Incendiary - - - - Ammo_ArtilleryShell_EMP - - - Things/Ammo/Cannon/Howitzer/EMP - Graphic_StackCount - - - 673.94 - - GrenadeEMP - Bullet_155mmHowitzerShell_EMP - - - - Ammo_ArtilleryShell_Smoke - - - Things/Ammo/Cannon/Howitzer/SMK - Graphic_StackCount - - - 262.5 - - Smoke - false - Bullet_155mmHowitzerShell_Smoke - - - - - - - - MakeAmmo_MortarShell_HighExplosive - - Craft 5 mortar shells (HE). - Making mortar shells (HE). - 10600 - -
  • - - -
  • Steel
  • - - - 54 - -
  • - - -
  • FSX
  • - - - 10 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
    - - -
  • Steel
  • -
  • FSX
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_HighExplosive_HFuzed - - Craft 5 mortar shells (Airburst). - Making mortar shells (Airburst). - 11800 - -
  • - - -
  • Steel
  • - - - 54 - -
  • - - -
  • FSX
  • - - - 10 - -
  • - - -
  • ComponentIndustrial
  • - - - 4 - -
    - - -
  • Steel
  • -
  • FSX
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 5 - -
    - - - MakeAmmo_MortarShell_Incendiary - - Craft 5 mortar shells (Incendiary). - Making mortar shells (Incendiary). - 9000 - -
  • - - -
  • Steel
  • - - - 58 - -
  • - - -
  • Prometheum
  • - - - 5 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_EMP - - Craft 5 mortar shells (EMP). - Making mortar shells (EMP). - - -
  • Mortars
  • -
  • MicroelectronicsBasics
  • -
    - 13800 - -
  • - - -
  • Steel
  • - - - 54 - -
  • - - -
  • ComponentIndustrial
  • - - - 14 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_Firefoam - - Craft 5 mortar shells (Firefoam). - Making mortar shells (Firefoam). - - -
  • Mortars
  • -
  • Firefoam
  • -
    - 8800 - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • MeatRaw
  • - - - 17 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
    - -
  • MeatRaw
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_Smoke - - Craft 5 mortar shells (Smoke). - Making mortar shells (Smoke). - 6600 - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_Toxic - - Craft 5 mortar shells (Tox). - Making mortar shells (Tox). - - -
  • Mortars
  • -
  • ToxGas
  • -
    - 6600 - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - -
    - - - MakeAmmo_MortarShell_Deadlife - - Craft 5 deadlife mortar shells. - Making deadlife mortar shells. - -
  • DeadlifeDust
  • -
  • Mortars
  • -
    - -
  • BioferriteShaper
  • -
    - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Bioferrite
  • - - - 25 - -
    - - -
  • Steel
  • -
  • Bioferrite
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 6600 -
    - - - - - MakeAmmo_ArtilleryShell_HE - - Craft 2 artillery shells (HE). - Making artillery shells (HE). - - -
  • Mortars
  • -
  • CE_TurretHeavyWeapons
  • -
    - 17400 - -
  • - - -
  • Steel
  • - - - 94 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • FSX
  • - - - 17 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
  • FSX
  • -
    -
    - - 2 - -
    - - - MakeAmmo_ArtilleryShell_HE_HFuzed - - Craft 2 155mm (Airburst) artillery shells. - Making 155mm (Airburst) artillery shells. - - -
  • Mortars
  • -
  • CE_TurretHeavyWeapons
  • -
    - 18600 - -
  • - - -
  • Steel
  • - - - 94 - -
  • - - -
  • ComponentIndustrial
  • - - - 4 - -
  • - - -
  • FSX
  • - - - 17 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
  • FSX
  • -
    -
    - - 2 - - - 5 - -
    - - - MakeAmmo_ArtilleryShell_Incendiary - - Craft 2 artillery shells (Incendiary). - Making artillery shell (Incendiary). - - -
  • Mortars
  • -
  • CE_TurretHeavyWeapons
  • -
    - 12600 - -
  • - - -
  • Steel
  • - - - 94 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 5 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
  • Prometheum
  • -
    -
    - - 2 - -
    - - - MakeAmmo_ArtilleryShell_EMP - - Craft 2 artillery shells (EMP). - Making artillery shells (EMP). - - -
  • Mortars
  • -
  • CE_TurretHeavyWeapons
  • -
  • MicroelectronicsBasics
  • -
    - 18400 - -
  • - - -
  • Steel
  • - - - 94 - -
  • - - -
  • ComponentIndustrial
  • - - - 15 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
    -
    - - 2 - -
    - - - MakeAmmo_ArtilleryShell_Smoke - - Craft 2 artillery shells (Smoke). - Making artillery shells (Smoke). - - -
  • Mortars
  • -
  • CE_TurretHeavyWeapons
  • -
    - 11400 - -
  • - - -
  • Steel
  • - - - 90 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 3 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 2 - -
    - -
    \ No newline at end of file diff --git a/Defs/Ammo/Shell/50mmType89Mortar.xml b/Defs/Ammo/Shell/50mmType89Mortar.xml index 7c2ddd8ba7..373f3169f5 100644 --- a/Defs/Ammo/Shell/50mmType89Mortar.xml +++ b/Defs/Ammo/Shell/50mmType89Mortar.xml @@ -20,7 +20,7 @@ Bullet_50mmType89MortarShell_Smoke true - AmmoSet_MortarShell + AmmoSet_81mmMortarShell diff --git a/Defs/Ammo/Shell/60mmMortar.xml b/Defs/Ammo/Shell/60mmMortar.xml index acbaae418e..58f8a22d01 100644 --- a/Defs/Ammo/Shell/60mmMortar.xml +++ b/Defs/Ammo/Shell/60mmMortar.xml @@ -21,7 +21,7 @@ Bullet_60mmMortarShell_Smoke true - AmmoSet_MortarShell + AmmoSet_81mmMortarShell diff --git a/Defs/Ammo/Shell/81mmMortar.xml b/Defs/Ammo/Shell/81mmMortar.xml index c0324015b4..108084b853 100644 --- a/Defs/Ammo/Shell/81mmMortar.xml +++ b/Defs/Ammo/Shell/81mmMortar.xml @@ -25,8 +25,13 @@ Bullet_81mmMortarShell_Tox Bullet_81mmMortarShell_Deadlife - AmmoSet_MortarShell true + + +
  • + mortar shells +
  • +
    @@ -67,6 +72,11 @@ GrenadeHE Bullet_81mmMortarShell_HE + +
  • + mortar shell (HE) +
  • +
    @@ -83,6 +93,11 @@ GrenadeHETF Bullet_81mmMortarShell_HE + +
  • + mortar shell (Airburst) +
  • +
    @@ -99,6 +114,11 @@ GrenadeIncendiary Bullet_81mmMortarShell_Incendiary + +
  • + mortar shell (Incendiary) +
  • +
    @@ -115,6 +135,11 @@ GrenadeEMP Bullet_81mmMortarShell_EMP + +
  • + mortar shell (EMP) +
  • +
    @@ -132,6 +157,11 @@ FoamFuel Bullet_81mmMortarShell_Firefoam false + +
  • + mortar shell (Foam) +
  • +
    @@ -149,6 +179,11 @@ Smoke Bullet_81mmMortarShell_Smoke false + +
  • + mortar shell (Smoke) +
  • +
    @@ -186,6 +221,11 @@ true + +
  • + mortar shell (Anti) +
  • +
    @@ -202,6 +242,11 @@ Toxic Bullet_81mmMortarShell_Tox + +
  • + mortar shell (Toxic) +
  • +
    @@ -219,6 +264,11 @@ Deadlife Bullet_81mmMortarShell_Deadlife false + +
  • + mortar shell (Deadlife) +
  • +
    @@ -268,6 +318,11 @@ + +
  • + mortar shell (HE) +
  • +
    @@ -300,6 +355,11 @@ -90~-48 + +
  • + mortar shell (Airburst) +
  • +
    @@ -318,6 +378,11 @@ 0.15 MortarIncendiary_Explode + +
  • + mortar shell (Incendiary) +
  • +
    @@ -333,6 +398,11 @@ true 5.5 + +
  • + mortar shell (EMP) +
  • +
    @@ -358,6 +428,11 @@ true ExtinguisherExplosion + +
  • + mortar shell (Foam) +
  • +
    @@ -385,6 +460,11 @@ 0 + +
  • + mortar shell (Smoke) +
  • +
    @@ -410,6 +490,11 @@ 0.85 + +
  • + mortar shell (Anti) +
  • +
    @@ -435,6 +520,11 @@ 0.12 + +
  • + mortar shell (Toxic) +
  • +
    @@ -459,6 +549,11 @@ 0 + +
  • + mortar shell (Deadlife) +
  • +
    @@ -505,6 +600,13 @@ 5 + +
  • + make mortar shells (HE) x5 + Craft 5 mortar shells (HE). + Making mortar shells (HE). +
  • +
    @@ -552,6 +654,13 @@ 5 + +
  • + make mortar shells (Airburst) x5 + Craft 5 mortar shells (Airburst). + Making mortar shells (Airburst). +
  • +
    @@ -596,6 +705,13 @@ 5 + +
  • + make mortar shells (Incendiary) x5 + Craft 5 mortar shells (Incendiary). + Making mortar shells (Incendiary). +
  • +
    @@ -636,6 +752,13 @@ 5 + +
  • + make mortar shells (EMP) x5 + Craft 5 mortar shells (EMP). + Making mortar shells (EMP). +
  • +
    @@ -687,6 +810,13 @@ 5 + +
  • + make mortar shells (Firefoam) x5 + Craft 5 mortar shells (Firefoam). + Making mortar shells (Firefoam). +
  • +
    @@ -731,6 +861,13 @@ 5 + +
  • + make mortar shells (Smoke) x5 + Craft 5 mortar shells (Smoke). + Making mortar shells (Smoke). +
  • +
    @@ -780,6 +917,13 @@ 5 + +
  • + make mortar shells (Tox) x5 + Craft 5 mortar shells (Tox). + Making mortar shells (Tox). +
  • +
    @@ -834,6 +978,13 @@ 4 6600 + +
  • + make mortar shells (Deadlife) x5 + Craft 5 mortar shells (Deadlife). + Making mortar shells (Deadlife). +
  • +
    \ No newline at end of file diff --git a/Source/CombatExtended/CombatExtended/AmmoGeneralizer.cs b/Source/CombatExtended/CombatExtended/AmmoGeneralizer.cs index 7f1f1f674b..19bcf871d5 100644 --- a/Source/CombatExtended/CombatExtended/AmmoGeneralizer.cs +++ b/Source/CombatExtended/CombatExtended/AmmoGeneralizer.cs @@ -19,6 +19,18 @@ static AmmoGeneralizer() if (Controller.settings.GenericAmmo) { + // Goes before the main generalizer to propagate the name to child ammosets + var toGenericAmmoSetLabels = DefDatabase.AllDefs.Where(def => def.GetModExtension() != null); + + foreach (var def in toGenericAmmoSetLabels) + { + var ext = def.GetModExtension(); + if (ext.genericLabel != null) + { + def.label = ext.genericLabel; + } + } + var toGenericAmmos = DefDatabase.AllDefs.Where(x => x.similarTo != null); foreach (AmmoSetDef amset in toGenericAmmos) @@ -122,9 +134,44 @@ static AmmoGeneralizer() } } } - } + + var toChangeLabelsDefs = DefDatabase.AllDefs.Where(x => x.GetModExtension() != null); + + foreach (ThingDef def in toChangeLabelsDefs) + { + var ext = def.GetModExtension(); + if (ext.genericLabel != null) + { + def.label = ext.genericLabel; + } + + if (ext.genericDescription != null) + { + def.description = ext.genericDescription; + } + } + + var toChangeLabelsRecipes = DefDatabase.AllDefs.Where(x => x.GetModExtension() != null); + + foreach (var def in toChangeLabelsRecipes) + { + var ext = def.GetModExtension(); + if (ext.genericLabel != null) + { + def.label = ext.genericLabel; + } + if (ext.genericDescription != null) + { + def.description = ext.genericDescription; + } + if (ext.genericJobString != null) + { + def.jobString = ext.genericJobString; + } + } + } } } } diff --git a/Source/CombatExtended/CombatExtended/Defs/GenericLabelExtension.cs b/Source/CombatExtended/CombatExtended/Defs/GenericLabelExtension.cs new file mode 100644 index 0000000000..e3c15448ae --- /dev/null +++ b/Source/CombatExtended/CombatExtended/Defs/GenericLabelExtension.cs @@ -0,0 +1,11 @@ +using Verse; + +namespace CombatExtended +{ + public class GenericLabelExtension : DefModExtension + { + public string genericLabel; + public string genericDescription; + public string genericJobString; + } +}