HkCb_GeneralDmg not called on shield damage?
-
I’ll have to say I’m somewhat surprised by this but apparently Hook’s HkCb_GeneralDmg is only called when hull damage happens; shield damage is completely ignored. HkCb_AddDmgEntry however is called on every damage taken, which means iDmgTo is invalid for shield damage.
Now, that part of Hook has always looked like a giant hack, what with having to hook three separate locations (0x6D653F4, 0x6D672CC and 0x6D6761C) with the code to determine the object handled by HkCb_AddDmgEntry… Is there a fourth location missing, or is there a more direct way of obtaining the object being damaged directly in HkCb_AddDmgEntry?
-
DamageList does not contain the object ID of what is being damaged.
-
HM could you get the CShip anywhere from this entry? It contains
struct IObjRW * get_target(void)const ;
I am just thinking if this could be away, although i dont know how to get the CShip Object. And there is
IObjInspectImpl* HkGetInspect (uint x_uiClientID)
or
typedef bool (__cdecl _GetShipInspect)(uint &x_ruiShip, IObjInspectImpl &inspect, uint &x_ruiDunno)
But i suspect thats not what your are looking for. At least in the last case the x_ruiShipId can be retrieved from the DamageList as far as i understand it.
-
I want to know the ship or solar being damaged. None of those can give me this. You don’t know the client ID of the player being damaged, so HkGetInspect/_GetShipInspect is pointless. Assuming that the attacker’s target is always what is being damaged is wrong in so many cases it’s not worth considering.
EDIT: In an ideal world we’d be able to have a mapping of DamageList to object and vice-versa, but it doesn’t look like the DamageList is stored in a CEqObj or IObjInspectImpl* and I’m not even sure if a singular DamageList is used, or rather a sequence of small ones.
-
After a bit of integration work, it seems to be working exactly as expected! All shield hits now trigger HkCb_GeneralDmg and I’ve committed the changes to the SVN for anyone who’d like to have that functionality as well. As usual, adoxa, you save me
Now all I need to figure out is the damage’s source so I can trace back the munition archetype.
EDIT: From what I can tell, it would appear that the damage has already been applied by the time 6CEA740 or its equivalent hull function are called, so in order to find the projectile that did the damage I’d probably need to trace back the munitions earlier. Player beam hits (I only really care about beams) can be traced using MunitionCollision events, but NPC beam hits are harder (I’m guessing they’d be found somewhere in PhySys::GenerateCollisions(CBeam*)) and matching the beams with the GeneralDmg call would be quite tricky.