FeatureDamaged and FeaturePreDamaged#5752
Conversation
|
What are they for? The comment you haven't removed says that they are missing on purpose to avoid paying the performance cost. |
|
Sprung had asked for it to be split off from the Nanoplague PR Reasoning as per issue #5668 I had asked about how to do feature damaged detection the way the comment described but handnt gotten an answer/it was easier to implement the callin. |
| local allWeaponDefs = {} | ||
|
|
||
| do | ||
| for i=-7,#WeaponDefs do |
There was a problem hiding this comment.
This is an uncommeted offset taken from usage in UnitPreDamaged.
I'm unsure why it's there either, but assumed it was intentional.
The UnitPreDamaged Callin is used a decent amount, also using the weapondef value within.
Its also reused as a fallback on line 2215 for the Explosion gadgetHandler
I'll remove the duplicate declaration I suppose, and maybe make an issue for the -7? (Line 1748)
Since it's the fallback option in all usecases, it may just never be used and has as such never failed yet?
| "FeatureCreated", | ||
| "FeatureDestroyed", | ||
| "FeaturePreDamaged", | ||
| "FeatureDamaged", |
There was a problem hiding this comment.
the comment below was discovered to be untrue (no perf cost if callin not actually used) and no longer applies, remove it
| local weaponDefs = (g.FeaturePreDamaged_GetWantedWeaponDef and g:FeatureDamaged_GetWantedWeaponDef()) or allWeaponDefs | ||
| tracy.ZoneEnd() | ||
| for _,wdid in ipairs(weaponDefs) do | ||
| if FeatureDamaged_GadgetMap[wdid] then |
| function gadgetHandler:FeaturePreDamaged(featureID, featureDefID, featureTeam, | ||
| damage, paralyzer, weaponDefID, | ||
| projectileID, attackerID, attackerDefID, attackerTeam) |
There was a problem hiding this comment.
this doesnt seem to be the actual signature of the function as passed by the engine
There was a problem hiding this comment.
I missed the paralyze damage not being included in feature callins (Except add damage) when checking the recoil docs
| if gadgetHandler.GG._AddUnitDamage_teamID then | ||
| attackerTeam = gadgetHandler.GG._AddUnitDamage_teamID | ||
| end |
There was a problem hiding this comment.
probably remove this bit (unless an equivalent AddFeatureDamage hack for features is implemented)
There was a problem hiding this comment.
Should do the same for FeatureDamaged at line 2109?
Without the callin it's just not possible to identify non-lethal damage. The "use armordefs" comment is only about implementing basic "deals more/less/zero damage to features" kind of logic, which I think was the bulk of what people used to want to do. |
What it says on the tin!
FeatureDamage is tested in Refumble mod and seems to work as intended.
FeaturePreDamaged I am uncertain about, though it mimics the UnitPreDamaged Callin.