IsValid check insufficient for AttackTarget and Gadget
Issue #8
resolved
I'm seeing an issue where AttackTargets are destroyed in-game, but IsValid is still returning true for them.
bool AttackTarget::IsValid() const
{
return !!m_ptr;
}
If you look at the Agent and Character IsValid checks, they also verify that the pointer actually refers to a real object in memory.
bool Agent::IsValid() const
{
return m_ptr && GetMain()->GetGameData()->objData.agentDataList[m_ptr->agentId];
}
I'm guessing a vector for Gadgets and AttackTargets need to be stored in order to correct IsValid (similar to what's done for Agents/Players/Characters).
Comments (3)
-
-
- marked as enhancement
- edited description
-
reporter - changed status to resolved
- Log in to comment
Technically, attack targets never despawn, at least, not any I've seen :)
There might be arrays kept internally by the game for gadgets and attack targets, but I don't think we need them. All the pointers involved for attack targets (agent => atk tgt => health struct) are still valid and point to valid data. The server just isn't updating the hp when an attack target dies, so you end up with something like 3/1000000 hp remaining. I'll keep an eye out for something along the lines of "IsAlive()" or an "IsActive" flag for gadgets/atk targets.
I added a "IsSelectable()" for agents, that might help you for now, although it might not help you if sabetha cannons ever have a "non-selectable" phase (like SB). I've never done sabetha, so idk.