From afd2b15ae327e8fafc7e90e202cc2915af0a17df Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Fri, 17 Nov 2023 07:35:36 +0000 Subject: [PATCH 1/3] height fuse --- Defs/Ammo/Shell/81mmMortar.xml | 1366 +++++++++-------- Defs/Effects/Motes.xml | 170 +- .../CombatExtended/DefOfs/CE_ThingDefOf.cs | 2 + .../Projectiles/ProjectileCE_HeightFuse.cs | 62 + 4 files changed, 878 insertions(+), 722 deletions(-) create mode 100644 Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs diff --git a/Defs/Ammo/Shell/81mmMortar.xml b/Defs/Ammo/Shell/81mmMortar.xml index de75b586f9..983a6e7225 100644 --- a/Defs/Ammo/Shell/81mmMortar.xml +++ b/Defs/Ammo/Shell/81mmMortar.xml @@ -1,642 +1,734 @@  - - Ammo81mmMortarShells - - AmmoShells - UI/Icons/ThingCategories/CaliberMortar - - - - - - AmmoSet_81mmMortarShell - - - - Bullet_81mmMortarShell_HE - Bullet_81mmMortarShell_Incendiary - Bullet_81mmMortarShell_EMP - Bullet_81mmMortarShell_Firefoam - Bullet_81mmMortarShell_Smoke - Bullet_81mmMortarShell_Antigrain - Bullet_81mmMortarShell_Tox - - true - - - - - - Low-velocity shell designed to be fired from a mortar. - - 200 - - -
  • Ammo81mmMortarShells
  • -
    - 25 - 30 - MortarBomb_Explode - true -
    - - - -
  • CE_AutoEnableTrade
  • -
  • CE_AutoEnableCrafting_TableMachining
  • -
    -
    - - - - Shell_HighExplosive - - - Things/Ammo/Mortar/HE - Graphic_StackCount - - - 50.09 - 5.27 - 8.17 - - GrenadeHE - Bullet_81mmMortarShell_HE - - - - Shell_Incendiary - - - Things/Ammo/Mortar/Incendiary - Graphic_StackCount - - - 42.34 - 5.65 - 9.0 - - GrenadeIncendiary - Bullet_81mmMortarShell_Incendiary - - - - Shell_EMP - - - Things/Ammo/Mortar/EMP - Graphic_StackCount - - - 112.42 - 5.27 - 8.17 - - GrenadeEMP - Bullet_81mmMortarShell_EMP - - - - Shell_Firefoam - - - Things/Ammo/Mortar/Firefoam - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - FoamFuel - Bullet_81mmMortarShell_Firefoam - - - - Shell_Smoke - - - Things/Ammo/Mortar/Smoke - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - Smoke - Bullet_81mmMortarShell_Smoke - - - - Shell_AntigrainWarhead - - - Things/Ammo/Mortar/Antigrain - Graphic_StackCount - - - 1500 - 6.5 - 6 - - -
  • RewardStandardCore
  • -
    - -
  • CE_AutoEnableTrade_Sellable
  • -
    - Antigrain - - -
  • - 14.9 - BombSuper - 0.7 - 0.22 - true - GiantExplosion - Explosion_GiantBomb - 60~120 - True - true -
  • -
    -
    - - - Shell_Toxic - - - Things/Ammo/Mortar/Toxic - Graphic_StackCount - - - 37.03 - 4.1 - 10.01 - - Toxic - Bullet_81mmMortarShell_Tox - - - - - - CombatExtended.ProjectileCE_Explosive - - TransparentPostLight - - - 0 - Artillery_HitThickRoof - MortarRound_PreImpact - MortarRound_Ambient - true - false - 5 - - Things/WorldObjects/Munitions/Mortar - 0.06 - 10 - - - - - - Bullet_81mmMortarShell_HE - - - Things/Projectile/Mortar/HE - Graphic_Single - - - Bomb - 156 - 2.5 - true - MortarBomb_Explode - true - true - - -
  • - - 16 - 25 - -
  • -
    -
    - - - Bullet_81mmMortarShell_Incendiary - - - Things/Projectile/Mortar/Incendiary - Graphic_Single - - - PrometheumFlame - 11 - 6.5 - true - FilthPrometheum - 0.15 - MortarIncendiary_Explode - - - - - Bullet_81mmMortarShell_EMP - - - Things/Projectile/Mortar/EMP - Graphic_Single - - - EMP - 156 - true - 5.5 - - - - - Bullet_81mmMortarShell_Firefoam - - - Things/Projectile/Mortar/Firefoam - Graphic_Single - - - Extinguish - 0.0 - 0.0 - 5 - true - Artillery_HitThickRoof - Explosion_EMP - MortarRound_PreImpact - MortarRound_Ambient - Filth_FireFoam - 1 - 3 - true - ExtinguisherExplosion - - - - - Bullet_81mmMortarShell_Smoke - - - Things/Projectile/Mortar/Smoke - Graphic_Single - - - Smoke - 0.0 - 0.0 - 6 - true - Artillery_HitThickRoof - Explosion_EMP - MortarRound_PreImpact - MortarRound_Ambient - BlindSmoke - 1 - true - ExtinguisherExplosion - - - - - Bullet_81mmMortarShell_Antigrain - - - Things/Projectile/Mortar/Antigrain - Graphic_Single - - - BombSuper - 50 - 0.22 - true - true - GiantExplosion - Artillery_HitThickRoof - Explosion_GiantBomb - MortarRound_PreImpact - MortarRound_Ambient - - 0.85 - - - - - - Bullet_81mmMortarShell_Tox - - - Things/Projectile/Mortar/Toxic - Graphic_Single - - - ToxGas - 0 - 0 - 0.1 - true - Artillery_HitThickRoof - ToxicShellLanded - MortarRound_PreImpact - MortarRound_Ambient - Shell_Toxic_Releasing - Shell_Toxic_Releasing_Water - - - - - - - MakeShell_HighExplosive - - Craft 5 81mm HE mortar shells. - Making 81mm HE mortar shells. - -
  • - - -
  • Steel
  • - - - 54 - -
  • - - -
  • FSX
  • - - - 10 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
    - - -
  • Steel
  • -
  • FSX
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 10600 -
    - - - MakeShell_Incendiary - - Craft 5 81mm incendiary mortar shells. - Making 81mm incendiary mortar shells. - -
  • - - -
  • Steel
  • - - - 58 - -
  • - - -
  • Prometheum
  • - - - 5 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 9000 -
    - - - MakeShell_EMP - - Craft 5 81mm EMP mortar shells. - Making 81mm EMP mortar shells. - MicroelectronicsBasics - -
  • - - -
  • Steel
  • - - - 54 - -
  • - - -
  • ComponentIndustrial
  • - - - 14 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 13800 -
    - - - MakeShell_Firefoam - - Craft 5 81mm firefoam mortar shells. - Making 81mm firefoam mortar shells. - Firefoam - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • MeatRaw
  • - - - 17 - -
    - - -
  • Steel
  • -
  • ComponentIndustrial
  • -
    - -
  • MeatRaw
  • -
    -
    - - 5 - - - 4 - - 8800 -
    - - - MakeShell_Smoke - - Craft 5 81mm smoke mortar shells. - Making 81mm smoke mortar shells. - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 6600 -
    - - - MakeShell_Toxic - - Craft 5 81mm tox mortar shells. - Making 81mm tox mortar shells. - ToxGas - -
  • - - -
  • Steel
  • - - - 42 - -
  • - - -
  • ComponentIndustrial
  • - - - 2 - -
  • - - -
  • Prometheum
  • - - - 2 - -
    - - -
  • Steel
  • -
  • Prometheum
  • -
  • ComponentIndustrial
  • -
    -
    - - 5 - - - 4 - - 6600 -
    + + Ammo81mmMortarShells + + AmmoShells + UI/Icons/ThingCategories/CaliberMortar + + + + + + AmmoSet_81mmMortarShell + + + + Bullet_81mmMortarShell_HE + Bullet_81mmMortarShell_HE_HF + Bullet_81mmMortarShell_HE_HiF + Bullet_81mmMortarShell_Incendiary + Bullet_81mmMortarShell_EMP + Bullet_81mmMortarShell_Firefoam + Bullet_81mmMortarShell_Smoke + Bullet_81mmMortarShell_Antigrain + Bullet_81mmMortarShell_Tox + + true + + + + + + Low-velocity shell designed to be fired from a mortar. + + 200 + + +
  • Ammo81mmMortarShells
  • +
    + 25 + 30 + MortarBomb_Explode + true +
    + + + +
  • CE_AutoEnableTrade
  • +
  • CE_AutoEnableCrafting_TableMachining
  • +
    +
    + + + + Shell_HighExplosive + + + Things/Ammo/Mortar/HE + Graphic_StackCount + + + 50.09 + 5.27 + 8.17 + + GrenadeHE + Bullet_81mmMortarShell_HE + + + + Shell_HighExplosive_HF + + + Things/Ammo/Mortar/HE + Graphic_StackCount + + + 50.09 + 5.27 + 8.17 + + GrenadeHETF + Bullet_81mmMortarShell_HE + + + + Shell_HighExplosive_HiF + + + Things/Ammo/Mortar/HE + Graphic_StackCount + + + 50.09 + 5.27 + 8.17 + + RocketFrag + Bullet_81mmMortarShell_HE + + + + Shell_Incendiary + + + Things/Ammo/Mortar/Incendiary + Graphic_StackCount + + + 42.34 + 5.65 + 9.0 + + GrenadeIncendiary + Bullet_81mmMortarShell_Incendiary + + + + Shell_EMP + + + Things/Ammo/Mortar/EMP + Graphic_StackCount + + + 112.42 + 5.27 + 8.17 + + GrenadeEMP + Bullet_81mmMortarShell_EMP + + + + Shell_Firefoam + + + Things/Ammo/Mortar/Firefoam + Graphic_StackCount + + + 37.03 + 4.1 + 10.01 + + FoamFuel + Bullet_81mmMortarShell_Firefoam + + + + Shell_Smoke + + + Things/Ammo/Mortar/Smoke + Graphic_StackCount + + + 37.03 + 4.1 + 10.01 + + Smoke + Bullet_81mmMortarShell_Smoke + + + + Shell_AntigrainWarhead + + + Things/Ammo/Mortar/Antigrain + Graphic_StackCount + + + 1500 + 6.5 + 6 + + +
  • RewardStandardCore
  • +
    + +
  • CE_AutoEnableTrade_Sellable
  • +
    + Antigrain + + +
  • + 14.9 + BombSuper + 0.7 + 0.22 + true + GiantExplosion + Explosion_GiantBomb + 60~120 + True + true +
  • +
    +
    + + + Shell_Toxic + + + Things/Ammo/Mortar/Toxic + Graphic_StackCount + + + 37.03 + 4.1 + 10.01 + + Toxic + Bullet_81mmMortarShell_Tox + + + + + + CombatExtended.ProjectileCE_Explosive + + TransparentPostLight + + + 0 + Artillery_HitThickRoof + MortarRound_PreImpact + MortarRound_Ambient + true + false + 5 + + Things/WorldObjects/Munitions/Mortar + 0.06 + 10 + + + + + + Bullet_81mmMortarShell_HE + + + Things/Projectile/Mortar/HE + Graphic_Single + + + Bomb + 156 + 2.5 + true + MortarBomb_Explode + true + true + + +
  • + + 16 + 25 + +
  • +
    +
    + + + Bullet_81mmMortarShell_HE_HF + + CombatExtended.ProjectileCE_HeightFuse + + Things/Projectile/Mortar/HE + Graphic_Single + + + Bomb + 156 + 2.5 + true + MortarBomb_Explode + true + true + 0.6 + + +
  • + + 16 + 25 + + -0.5~0.1 +
  • +
    +
    + + + Bullet_81mmMortarShell_HE_HiF + + CombatExtended.ProjectileCE_HeightFuse + + Things/Projectile/Mortar/HE + Graphic_Single + + + Bomb + 156 + 2.5 + true + MortarBomb_Explode + true + true + 6 + + +
  • + + 16 + 25 + + -80~-20 +
  • +
    +
    + + + Bullet_81mmMortarShell_Incendiary + + + Things/Projectile/Mortar/Incendiary + Graphic_Single + + + PrometheumFlame + 11 + 6.5 + true + FilthPrometheum + 0.15 + MortarIncendiary_Explode + + + + + Bullet_81mmMortarShell_EMP + + + Things/Projectile/Mortar/EMP + Graphic_Single + + + EMP + 156 + true + 5.5 + + + + + Bullet_81mmMortarShell_Firefoam + + + Things/Projectile/Mortar/Firefoam + Graphic_Single + + + Extinguish + 0.0 + 0.0 + 5 + true + Artillery_HitThickRoof + Explosion_EMP + MortarRound_PreImpact + MortarRound_Ambient + Filth_FireFoam + 1 + 3 + true + ExtinguisherExplosion + + + + + Bullet_81mmMortarShell_Smoke + + + Things/Projectile/Mortar/Smoke + Graphic_Single + + + Smoke + 0.0 + 0.0 + 6 + true + Artillery_HitThickRoof + Explosion_EMP + MortarRound_PreImpact + MortarRound_Ambient + BlindSmoke + 1 + true + ExtinguisherExplosion + + + + + Bullet_81mmMortarShell_Antigrain + + + Things/Projectile/Mortar/Antigrain + Graphic_Single + + + BombSuper + 50 + 0.22 + true + true + GiantExplosion + Artillery_HitThickRoof + Explosion_GiantBomb + MortarRound_PreImpact + MortarRound_Ambient + + 0.85 + + + + + + Bullet_81mmMortarShell_Tox + + + Things/Projectile/Mortar/Toxic + Graphic_Single + + + ToxGas + 0 + 0 + 0.1 + true + Artillery_HitThickRoof + ToxicShellLanded + MortarRound_PreImpact + MortarRound_Ambient + Shell_Toxic_Releasing + Shell_Toxic_Releasing_Water + + + + + + + MakeShell_HighExplosive + + Craft 5 81mm HE mortar shells. + Making 81mm HE mortar shells. + +
  • + + +
  • Steel
  • + + + 54 + +
  • + + +
  • FSX
  • + + + 10 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
    + + +
  • Steel
  • +
  • FSX
  • +
  • ComponentIndustrial
  • +
    +
    + + 5 + + + 4 + + 10600 +
    + + + MakeShell_Incendiary + + Craft 5 81mm incendiary mortar shells. + Making 81mm incendiary mortar shells. + +
  • + + +
  • Steel
  • + + + 58 + +
  • + + +
  • Prometheum
  • + + + 5 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
    + + +
  • Steel
  • +
  • Prometheum
  • +
  • ComponentIndustrial
  • +
    +
    + + 5 + + + 4 + + 9000 +
    + + + MakeShell_EMP + + Craft 5 81mm EMP mortar shells. + Making 81mm EMP mortar shells. + MicroelectronicsBasics + +
  • + + +
  • Steel
  • + + + 54 + +
  • + + +
  • ComponentIndustrial
  • + + + 14 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
    +
    + + 5 + + + 4 + + 13800 +
    + + + MakeShell_Firefoam + + Craft 5 81mm firefoam mortar shells. + Making 81mm firefoam mortar shells. + Firefoam + +
  • + + +
  • Steel
  • + + + 42 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • MeatRaw
  • + + + 17 + +
    + + +
  • Steel
  • +
  • ComponentIndustrial
  • +
    + +
  • MeatRaw
  • +
    +
    + + 5 + + + 4 + + 8800 +
    + + + MakeShell_Smoke + + Craft 5 81mm smoke mortar shells. + Making 81mm smoke mortar shells. + +
  • + + +
  • Steel
  • + + + 42 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • Prometheum
  • + + + 2 + +
    + + +
  • Steel
  • +
  • Prometheum
  • +
  • ComponentIndustrial
  • +
    +
    + + 5 + + + 4 + + 6600 +
    + + + MakeShell_Toxic + + Craft 5 81mm tox mortar shells. + Making 81mm tox mortar shells. + ToxGas + +
  • + + +
  • Steel
  • + + + 42 + +
  • + + +
  • ComponentIndustrial
  • + + + 2 + +
  • + + +
  • Prometheum
  • + + + 2 + +
    + + +
  • Steel
  • +
  • Prometheum
  • +
  • ComponentIndustrial
  • +
    +
    + + 5 + + + 4 + + 6600 +
    \ No newline at end of file diff --git a/Defs/Effects/Motes.xml b/Defs/Effects/Motes.xml index af76427197..5ffc0df201 100644 --- a/Defs/Effects/Motes.xml +++ b/Defs/Effects/Motes.xml @@ -1,97 +1,97 @@  - + - - Mote_SuppressIcon - - Things/Mote/Mote_SuppressIcon - - MoteThrownAttached - MetaOverlays - - 0.25 - 1 - 1.4 - (0.45, 0, 0.45) - - + + Mote_SuppressIcon + + Things/Mote/Mote_SuppressIcon + + MoteThrownAttached + MetaOverlays + + 0.25 + 1 + 1.4 + (0.45, 0, 0.45) + + - - Mote_HunkerIcon - - Things/Mote/Mote_HunkerDownIcon - - MoteThrownAttached - MetaOverlays - - 0.25 - 1 - 1.4 - (0.45, 0, 0.45) - - + + Mote_HunkerIcon + + Things/Mote/Mote_HunkerDownIcon + + MoteThrownAttached + MetaOverlays + + 0.25 + 1 + 1.4 + (0.45, 0, 0.45) + + - + - - Mote_BigExplode - - Things/Mote/BigExplode - - MoteOverhead - - 0.05 - 0.4 - 0.45 - 15 - - + + Mote_BigExplode + + Things/Mote/BigExplode + + MoteOverhead + + 0 + 0.4 + 0.45 + 0 + + - - Mote_Firetrail - - Things/Mote/Mote_FireSmoked - - MoteOverhead - - 0.083 - 0.083 - 1 - 0.035 - - + + Mote_Firetrail + + Things/Mote/Mote_FireSmoked + + MoteOverhead + + 0.083 + 0.083 + 1 + 0.035 + + - + - - Mote_FlareGlow - CombatExtended.MoteThrownCE - - Things/Mote/FireGlow - MoteGlow - - MoteOverhead - - 0.75 - 1.08 - 0.8 - - + + Mote_FlareGlow + CombatExtended.MoteThrownCE + + Things/Mote/FireGlow + MoteGlow + + MoteOverhead + + 0.75 + 1.08 + 0.8 + + - - Mote_FlareSmoke - CombatExtended.MoteThrownCE - - Things/Mote/Smoke - - MoteOverhead - - 0.50 - 6 - 3.2 - 0.005 - - + + Mote_FlareSmoke + CombatExtended.MoteThrownCE + + Things/Mote/Smoke + + MoteOverhead + + 0.50 + 6 + 3.2 + 0.005 + + \ No newline at end of file diff --git a/Source/CombatExtended/CombatExtended/DefOfs/CE_ThingDefOf.cs b/Source/CombatExtended/CombatExtended/DefOfs/CE_ThingDefOf.cs index b515687e3d..8008f8fa4a 100644 --- a/Source/CombatExtended/CombatExtended/DefOfs/CE_ThingDefOf.cs +++ b/Source/CombatExtended/CombatExtended/DefOfs/CE_ThingDefOf.cs @@ -10,6 +10,8 @@ namespace CombatExtended [DefOf] public static class CE_ThingDefOf { + public static ThingDef Mote_BigExplode; + public static ThingDef Mote_FlareSmoke; public static ThingDef Mote_FlareGlow; diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs new file mode 100644 index 0000000000..52417fa20b --- /dev/null +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using RimWorld; +using UnityEngine; +using Verse; +using Verse.Sound; +using CombatExtended.Compatibility; +using CombatExtended.Lasers; +using ProjectileImpactFX; +using CombatExtended.Utilities; + +namespace CombatExtended +{ + class ProjectileCE_HeightFuse : ProjectileCE + { + float detonationHeight => (def.projectile as ProjectilePropertiesCE).aimHeightOffset; + + bool armed; + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref armed, "armed", false); + } + + public override void Tick() + { + base.Tick(); + if (!armed && LastPos.y > detonationHeight) + { + armed = true; + } + if (armed && Height <= detonationHeight) + { + HeightFuseAirBurst(); + } + } + + public override void Impact(Thing hitThing) + { + //intercept impact if it hit something after where height fuse should have triggered + if (armed && Height <= detonationHeight) + { + HeightFuseAirBurst(); + } + else + { + base.Impact(hitThing); + } + } + + void HeightFuseAirBurst() + { + Mote mote = MoteMaker.MakeStaticMote(DrawPos, Map, CE_ThingDefOf.Mote_BigExplode, (def.projectile as ProjectilePropertiesCE).explosionRadius * 2); + float f = (LastPos.y - detonationHeight) / (LastPos.y - Height); + ExactPosition = f * (LastPos - ExactPosition); + base.Impact(null); + } + } +} From de8ea1bcb6732bee484aaab0cb0bb97ac928ea30 Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Fri, 17 Nov 2023 08:52:31 +0000 Subject: [PATCH 2/3] effect xml, accept multiple compfrag --- Defs/Ammo/Shell/81mmMortar.xml | 29 ++++++++++++------- .../CombatExtended/Comps/CompExplosiveCE.cs | 5 +++- .../Projectiles/ProjectileCE.cs | 17 +++++++++-- .../Projectiles/ProjectileCE_HeightFuse.cs | 6 +++- .../Projectiles/ProjectilePropertiesCE.cs | 4 +++ 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/Defs/Ammo/Shell/81mmMortar.xml b/Defs/Ammo/Shell/81mmMortar.xml index 983a6e7225..d37958e6b4 100644 --- a/Defs/Ammo/Shell/81mmMortar.xml +++ b/Defs/Ammo/Shell/81mmMortar.xml @@ -80,7 +80,7 @@ 5.27 8.17 - GrenadeHETF + RocketFrag Bullet_81mmMortarShell_HE @@ -96,7 +96,7 @@ 5.27 8.17 - RocketFrag + GrenadeHETF Bullet_81mmMortarShell_HE @@ -281,13 +281,14 @@ MortarBomb_Explode true true + Mote_BigExplode 0.6
  • - 16 - 25 + 6 + 45 -0.5~0.1
  • @@ -303,22 +304,30 @@ Graphic_Single - Bomb - 156 - 2.5 + Smoke + 0 + 0.5 true MortarBomb_Explode true true 6 + Mote_BigExplode + 5
  • - 16 - 25 + 11 + 35 + + -89~-60 +
  • +
  • + + 15 - -80~-20 + -60~-30
  • diff --git a/Source/CombatExtended/CombatExtended/Comps/CompExplosiveCE.cs b/Source/CombatExtended/CombatExtended/Comps/CompExplosiveCE.cs index 928c05d5ad..f823953f9e 100644 --- a/Source/CombatExtended/CombatExtended/Comps/CompExplosiveCE.cs +++ b/Source/CombatExtended/CombatExtended/Comps/CompExplosiveCE.cs @@ -32,7 +32,10 @@ public virtual void Explode(Thing instigator, Vector3 pos, Map map, float scaleF } //Try to throw fragments -- increase count by scaleFactor - parent.TryGetComp()?.Throw(pos, map, instigator);//scaleFactor); + foreach (var comp in parent.GetComps()) + { + comp.Throw(pos, map, instigator); + } if (Props.explosiveRadius > 0 //&& Props.damageAmountBase > 0 Disabled to allow flame explosions etc && parent.def != null) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs index 2294f65f81..49f7da859c 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs @@ -1341,14 +1341,27 @@ public virtual void Impact(Thing hitThing) effecter.Trigger(new TargetInfo(explodePos.ToIntVec3(), Map, false), new TargetInfo(explodePos.ToIntVec3(), Map, false)); effecter.Cleanup(); } - + ProjectilePropertiesCE projectileCE = def.projectile as ProjectilePropertiesCE; + float effectScale = projectileCE.detonateEffectsScaleOverride > 0 ? projectileCE.detonateEffectsScaleOverride : projectileCE.explosionRadius * 2; + if (projectileCE.detonateMoteDef != null) + { + MoteMaker.MakeStaticMote(DrawPos, Map, CE_ThingDefOf.Mote_BigExplode, effectScale); + } + if (projectileCE.detonateFleckDef != null) + { + FleckCreationData dataStatic = FleckMaker.GetDataStatic(DrawPos, MapHeld, projectileCE.detonateFleckDef, effectScale); + MapHeld.flecks.CreateFleck(dataStatic); + } var projectilePropsCE = (def.projectile as ProjectilePropertiesCE); var explodingComp = this.TryGetComp(); if (explodingComp == null) { - this.TryGetComp()?.Throw(explodePos, Map, launcher); + foreach (var comp in GetComps()) + { + comp.Throw(explodePos, Map, launcher); + } } //If the comp exists, it'll already call CompFragments diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs index 52417fa20b..b4139725dd 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs @@ -53,9 +53,13 @@ public override void Impact(Thing hitThing) void HeightFuseAirBurst() { - Mote mote = MoteMaker.MakeStaticMote(DrawPos, Map, CE_ThingDefOf.Mote_BigExplode, (def.projectile as ProjectilePropertiesCE).explosionRadius * 2); float f = (LastPos.y - detonationHeight) / (LastPos.y - Height); ExactPosition = f * (LastPos - ExactPosition); + if (!ExactPosition.ToIntVec3().IsValid) + { + Destroy(); + return; + } base.Impact(null); } } diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectilePropertiesCE.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectilePropertiesCE.cs index 2b6c9ea17c..3c42e78272 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectilePropertiesCE.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectilePropertiesCE.cs @@ -31,6 +31,10 @@ public class ProjectilePropertiesCE : ProjectileProperties public float airborneSuppressionFactor = 1; public float dangerFactor = 1; + public ThingDef detonateMoteDef; + public FleckDef detonateFleckDef; + public float detonateEffectsScaleOverride = -1; + #region Bunker Buster fields /// /// Amount of tiles ProjectileCE_BunkerBuster will detonate after after penetrating an obstacle From 4f6709d1b49c90c5d2384330eb31c0ae8ddc109f Mon Sep 17 00:00:00 2001 From: CMDR-Bill-Doors Date: Fri, 17 Nov 2023 08:59:47 +0000 Subject: [PATCH 3/3] Update ProjectileCE_BunkerBuster.cs --- .../CombatExtended/Projectiles/ProjectileCE_BunkerBuster.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_BunkerBuster.cs b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_BunkerBuster.cs index 4b2094d852..fa0db8642f 100644 --- a/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_BunkerBuster.cs +++ b/Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_BunkerBuster.cs @@ -43,9 +43,9 @@ public override void Impact(Thing hitThing) postExplosionGasType: props.postExplosionGasType ); - if (this.TryGetComp() != null) + foreach (var comp in GetComps()) { - this.TryGetComp().Throw(finalPos.ToVector3(), this.Map, this); + comp.Throw(finalPos.ToVector3(), this.Map, this); } this.Destroy();