-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2893 from CombatExtended-Continued/HeightFuse
height fuse
- Loading branch information
Showing
8 changed files
with
916 additions
and
727 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,97 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Defs> | ||
<!-- Suppression Mote --> | ||
<!-- Suppression Mote --> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_SuppressIcon</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_SuppressIcon</texPath> | ||
</graphicData> | ||
<thingClass>MoteThrownAttached</thingClass> | ||
<altitudeLayer>MetaOverlays</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.25</fadeInTime> | ||
<solidTime>1</solidTime> | ||
<fadeOutTime>1.4</fadeOutTime> | ||
<attachedDrawOffset>(0.45, 0, 0.45)</attachedDrawOffset> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_SuppressIcon</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_SuppressIcon</texPath> | ||
</graphicData> | ||
<thingClass>MoteThrownAttached</thingClass> | ||
<altitudeLayer>MetaOverlays</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.25</fadeInTime> | ||
<solidTime>1</solidTime> | ||
<fadeOutTime>1.4</fadeOutTime> | ||
<attachedDrawOffset>(0.45, 0, 0.45)</attachedDrawOffset> | ||
</mote> | ||
</ThingDef> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_HunkerIcon</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_HunkerDownIcon</texPath> | ||
</graphicData> | ||
<thingClass>MoteThrownAttached</thingClass> | ||
<altitudeLayer>MetaOverlays</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.25</fadeInTime> | ||
<solidTime>1</solidTime> | ||
<fadeOutTime>1.4</fadeOutTime> | ||
<attachedDrawOffset>(0.45, 0, 0.45)</attachedDrawOffset> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_HunkerIcon</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_HunkerDownIcon</texPath> | ||
</graphicData> | ||
<thingClass>MoteThrownAttached</thingClass> | ||
<altitudeLayer>MetaOverlays</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.25</fadeInTime> | ||
<solidTime>1</solidTime> | ||
<fadeOutTime>1.4</fadeOutTime> | ||
<attachedDrawOffset>(0.45, 0, 0.45)</attachedDrawOffset> | ||
</mote> | ||
</ThingDef> | ||
|
||
<!-- Legacy Motes --> | ||
<!-- Legacy Motes --> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_BigExplode</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/BigExplode</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.05</fadeInTime> | ||
<solidTime>0.4</solidTime> | ||
<fadeOutTime>0.45</fadeOutTime> | ||
<growthRate>15</growthRate> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_BigExplode</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/BigExplode</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0</fadeInTime> | ||
<solidTime>0.4</solidTime> | ||
<fadeOutTime>0.45</fadeOutTime> | ||
<growthRate>0</growthRate> | ||
</mote> | ||
</ThingDef> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_Firetrail</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_FireSmoked</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.083</fadeInTime> | ||
<solidTime>0.083</solidTime> | ||
<fadeOutTime>1</fadeOutTime> | ||
<growthRate>0.035</growthRate> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_Firetrail</defName> | ||
<graphicData> | ||
<texPath>Things/Mote/Mote_FireSmoked</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.083</fadeInTime> | ||
<solidTime>0.083</solidTime> | ||
<fadeOutTime>1</fadeOutTime> | ||
<growthRate>0.035</growthRate> | ||
</mote> | ||
</ThingDef> | ||
|
||
<!-- Flare Motes --> | ||
<!-- Flare Motes --> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_FlareGlow</defName> | ||
<thingClass>CombatExtended.MoteThrownCE</thingClass> | ||
<graphicData> | ||
<texPath>Things/Mote/FireGlow</texPath> | ||
<shaderType>MoteGlow</shaderType> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.75</fadeInTime> | ||
<solidTime>1.08</solidTime> | ||
<fadeOutTime>0.8</fadeOutTime> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_FlareGlow</defName> | ||
<thingClass>CombatExtended.MoteThrownCE</thingClass> | ||
<graphicData> | ||
<texPath>Things/Mote/FireGlow</texPath> | ||
<shaderType>MoteGlow</shaderType> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.75</fadeInTime> | ||
<solidTime>1.08</solidTime> | ||
<fadeOutTime>0.8</fadeOutTime> | ||
</mote> | ||
</ThingDef> | ||
|
||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_FlareSmoke</defName> | ||
<thingClass>CombatExtended.MoteThrownCE</thingClass> | ||
<graphicData> | ||
<texPath>Things/Mote/Smoke</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.50</fadeInTime> | ||
<solidTime>6</solidTime> | ||
<fadeOutTime>3.2</fadeOutTime> | ||
<growthRate>0.005</growthRate> | ||
</mote> | ||
</ThingDef> | ||
<ThingDef ParentName="MoteBase"> | ||
<defName>Mote_FlareSmoke</defName> | ||
<thingClass>CombatExtended.MoteThrownCE</thingClass> | ||
<graphicData> | ||
<texPath>Things/Mote/Smoke</texPath> | ||
</graphicData> | ||
<altitudeLayer>MoteOverhead</altitudeLayer> | ||
<mote> | ||
<fadeInTime>0.50</fadeInTime> | ||
<solidTime>6</solidTime> | ||
<fadeOutTime>3.2</fadeOutTime> | ||
<growthRate>0.005</growthRate> | ||
</mote> | ||
</ThingDef> | ||
|
||
</Defs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE_HeightFuse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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() | ||
{ | ||
float f = (LastPos.y - detonationHeight) / (LastPos.y - Height); | ||
ExactPosition = f * (LastPos - ExactPosition); | ||
if (!ExactPosition.ToIntVec3().IsValid) | ||
{ | ||
Destroy(); | ||
return; | ||
} | ||
base.Impact(null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters