Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Defs/Ammo/Grenade/25x59mmGrenade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.4</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>24</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Grenade/30x29mmGrenade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.4</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>28</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
8 changes: 5 additions & 3 deletions Defs/Ammo/Grenade/40x46mmGrenade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,17 @@
<damageAmountBase>22</damageAmountBase>
<explosionRadius>1.0</explosionRadius>
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.4</aimHeightOffset>
<armingDelay>2</armingDelay>
<aimHeightOffset>1.4</aimHeightOffset> <!-- How much higher above the target to do we aim? -->
<armingDelay>2</armingDelay> <!-- Minimum ticks after launch before it can explode, so it doesn't go off in the shooter's face.-->
<airburstDistanceOffset>-3</airburstDistanceOffset> <!-- How many tiles in front of (negative) or behind (positive) the target does it explode? -->
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>20</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange> <!-- Vertical frag spread in degrees, relative to the projectile's trajectory. 0 is coplanar. -->
<fragXZAngleRange>-45~45</fragXZAngleRange> <!-- Horizontal frag spread in degrees, relative to the projectile's trajectory. 0 is directly ahead. -->
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Grenade/40x53mmGrenade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.4</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>36</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Grenade/40x53mmVOG25Grenade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.4</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>24</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Rocket/84x246mmR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,16 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>2</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Large>10</Fragment_Large>
<Fragment_Small>24</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Shell/40x365mmBofors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>2</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Large>3</Fragment_Large>
<Fragment_Small>6</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Shell/57x348mmSR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>2</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Large>7</Fragment_Large>
<Fragment_Small>14</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
4 changes: 3 additions & 1 deletion Defs/Ammo/Shell/57x438mmBofors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>2</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Large>7</Fragment_Large>
<Fragment_Small>14</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@
<fragments>
<Fragment_Small>6</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
3 changes: 2 additions & 1 deletion ModPatches/Maru Race/Defs/Maru Race/Ammo_Arrow_AT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
<fragments>
<Projectile_CPB_ATTc>12</Projectile_CPB_ATTc>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ r = resource cost. -->
<fragments>
<Fragment_Small>24</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down Expand Up @@ -871,7 +872,8 @@ r = resource cost. -->
<fragments>
<Fragment_Small>36</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,15 @@
<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
<aimHeightOffset>1.05</aimHeightOffset>
<armingDelay>2</armingDelay>
<airburstDistanceOffset>-3</airburstDistanceOffset>
</projectile>
<comps>
<li Class="CombatExtended.CompProperties_Fragments">
<fragments>
<Fragment_Small>6</Fragment_Small>
</fragments>
<fragAngleRange>-89~-5</fragAngleRange>
<fragAngleRange>-60~-2</fragAngleRange>
<fragXZAngleRange>-45~45</fragXZAngleRange>
</li>
</comps>
</ThingDef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,25 @@ public override void ExposeData()
public override void Launch(Thing launcher, Vector2 origin, float shotAngle, float shotRotation, float shotHeight = 0f, float shotSpeed = -1f, Thing equipment = null, float distance = -1)
{
int armingDelay = 0;
float airburstDistanceOffset = 0f;
if (def.projectile is ProjectilePropertiesCE props)
{
armingDelay = props.armingDelay;
this.castShadow = props.castShadow;
this.GravityPerWidth = props.GravityPerWidth;
airburstDistanceOffset = props.airburstDistanceOffset;
}
if (distance > 0)
{
float cosine = (float)Math.Cos((double)shotAngle);

float fuzeTiming = distance / ((shotSpeed / 60) * cosine);
float fuzeTiming = (distance + airburstDistanceOffset) / ((shotSpeed / 60) * cosine);
#if DEBUG
Log.Message("Distance = " + distance);
Log.Message("ShotSpeed = " + shotSpeed / 60);
Log.Message("Cosine = " + cosine);
Log.Message("Fuse timing = " + fuzeTiming);
Log.Message("Distance offset = " + airburstDistanceOffset);
Log.Message("Launched ProjectileCEBursting with ticks to burst = " + fuzeTiming);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class ProjectilePropertiesCE : ProjectileProperties

public int armingDelay = 0;
public float aimHeightOffset = 0;
public float airburstDistanceOffset = 0f;

public float empShieldBreakChance = 1f;
public float collideDistance = 1f;
Expand Down