Source Code Project Mantis - FSSCP
View Issue Details
0003139FSSCPgameplaypublic2015-02-03 12:252015-05-19 18:09
Assigned ToMageKing17 
PlatformOSOS Version
Product Version3.7.2 RC5 
Target Version3.7.4Fixed in Version3.7.3 
Summary0003139: Ship explosions ignore damage type settings
DescriptionThe shockwave caused by an exploding ship appears to ignore the damage type set by either the $Shockwave Damage Type table entry or the ship-set-shockwave-damage-type SEXP, and deals unmodified damage.
Additional InformationThis is a real problem for AI strikecraft that trade shields for heavy armor, as they don't flee from dying ships and even a Fenris' shockwave can ruin their day.
TagsNo tags attached.
Attached Fileszip (2,877) 2015-02-03 12:25
patch 3139.patch (530) 2015-02-05 15:16

2015-02-03 14:58   
Shockwaves caused by ship death most certainly are using damage types correctly. However, the blast caused by a ship exploding when it doesn't have a shockwave speed (this is an instantaneous AoE damage effect) will not use the shockwave damage type (because it's not a shockwave); it uses the ship's collision damage type instead.

Since ship_do_damage() and do_subobj_hit_stuff() only know that the damage is coming from an object of type OBJ_SHIP, they assume the two ships are colliding and use the collision damage type. If changing the ship's collsion damage type is undesirable (and, really, there are a lot of reasons to want an explosion to have a different damage type than a collision), and giving the ship a shockwave speed is similarly undesirable, then the code will need to be changed to allow the damage functions to tell when a ship is exploding instead of colliding (that, or temporarily change the ship's collision_damage_type_idx... but that would be quite hackish).
2015-02-04 09:41   
(Last edited: 2015-02-04 09:46)
MageKing, I'm able to replicate the behavior you mention in the test mission (a meson bomb sat next to a crate) by altering the bomb's shockwave speed and impact damage type - the crate survives. However, when I restore the shockwave speed to its retail value, the crate is pulverized even if it's armor is set to multiply the shockwave damage type by 0. Honestly, I'm hard pressed to think of a time when a non-shockwave ship explosion would be readily apparent in normal gameplay; as I mentioned this is most noticeable when small ships are crowded around attacking a capital ship.

Anecdotally, I can also confirm that if the "shockwaves damage small ship subsystems" flag is flipped on, a Demon's shockwave will maul an unshielded Bakha's subsystems, even if the subsystem armor is set to negate the shockwave's damage type. At first I thought this was my fault for goofing off and mixing FS1 behavior with advanced ones like armor, but bomb shockwaves behave as documented: with the same set-up the Bakha can eat a Helios shockwave at close range and suffer no subsystem damage.

Could somebody else have a pop at replicating this? I'm pretty sure at this point that it's not just me setting things up wrong but I'd like confirmation.

2015-02-04 17:24   
Well, restoring the retail value (100) would naturally cause it to generate a shockwave, thereby making it use the shockwave damage type instead of the impact damage type, so making it immune to the impact damage type instead of the shockwave damage type won't help it survive there.

There are a couple of caveats that could cause unintended behavior (I haven't yet had time to try out your test mod, so I don't know if you're even doing any of these, but I just thought I'd throw them out there):

1) "Kamikaze" ships skip normal blast/shockwave definitions (you can use a "special explosion" to override this).
2) "Special explosions" will, of course, override normal blasts/shockwaves.
3) If the ship/subsystem/shield receiving damage doesn't have an armor type set, the damage type is ignored (the only damage scaling will be difficulty scaling).

If none of those apply, hopefully I'll have some time later to verify that the problem is engine-side.
2015-02-05 15:06   
(Last edited: 2015-02-05 15:19)
Turns out that the ship's shockwave damage type wasn't ever actually being copied onto the shockwave that was created. I should have a patch to fix this up shortly.

EDIT: And done. Note that this will also make kamikaze and "special explosion" shockwaves use the ship's shockwave damage type. Given that there was no particular reason to expect them not to, this may not be a big deal... but at the same time, there was no particular reason to expect them to do so, either, and it might break something in a released mod.

2015-05-15 19:14   
Pull request:
2015-05-19 18:09   

Issue History
2015-02-03 12:25HC-EmpNew Issue
2015-02-03 12:25HC-EmpFile Added:
2015-02-03 14:58MageKing17Note Added: 0016469
2015-02-03 14:58MageKing17Statusnew => confirmed
2015-02-04 09:41HC-EmpNote Added: 0016470
2015-02-04 09:46HC-EmpNote Edited: 0016470bug_revision_view_page.php?bugnote_id=16470#r980
2015-02-04 17:24MageKing17Note Added: 0016471
2015-02-05 15:06MageKing17Note Added: 0016472
2015-02-05 15:06MageKing17Assigned To => MageKing17
2015-02-05 15:06MageKing17Statusconfirmed => assigned
2015-02-05 15:16MageKing17File Added: 3139.patch
2015-02-05 15:16MageKing17Statusassigned => code review
2015-02-05 15:19MageKing17Note Edited: 0016472bug_revision_view_page.php?bugnote_id=16472#r982
2015-05-15 19:14MageKing17Note Added: 0016707
2015-05-19 18:09MageKing17Note Added: 0016709
2015-05-19 18:09MageKing17Statuscode review => resolved
2015-05-19 18:09MageKing17Resolutionopen => fixed
2015-05-19 18:09MageKing17Fixed in Version => 3.7.3
2015-05-19 18:09MageKing17Target Version => 3.7.4