When a PlayerPawn reference is passed as instigator, it there shouldn't be any problem.
Two possible cases that come to mind when player disconnects:
- All projectiles fired by the player have their instigator set to none (in native code), damageAttituteTo returns immediately.
- Actor isn't cleaned from memory, so Instigator var is still valid (from a c++ point of view), monsters will attack at where the player disappeared at until another routine tells them not to.
First, find out what's happening from the above two.
In the meantime...
Code: Select all
class XC_ENGINE_API FCollisionCacus : public FCollisionHashBase
{
public:
#define MAX_LOOKUP_DIST 300.0
FCollisionHashBase* Hooked;
FVector OldDelta;
struct ActorRemove
{
AActor* Actor;
INT Idx; //Index in XOrdered
};
TArray<ActorRemove> PendingRemove;
TArray<AActor*> XOrdered;
...
My goal is to make the engine use both hashes (lol).
Movers, huge or static actors will remain in the old hash.
All else will go into the new FCollisionCacus which will use an X-axis ordered Actor list.
Ideally the old hash should process first then my hook should complement, the X-ordering of the array is done and list maintaining should be way faster:
- RemoveActor called, finds actor in list, adds to PendingRemove.
- AddActor called (for same actor, because movement removes and adds), attempts to find in PendingRemove -> removes PendingRemove entry instead.
If AddActor isn't called on the remainder of the frame, then PendingRemove will indeed clear the actor from XOrdered and then self-remove.
- TODO:
Make a fast actor-finding function for XOrdered, cutting the array in half by checking the middle and then recutting until found should work wonders... but I might attempt to store the XOrdered IDX on the actor itself if I can find some unused memory lol.
Prevent old hash from adding actors I want to keep in XOrdered (small, moving non-brush stuff).
Try and find out what
void CheckActorNotReferenced( AActor* Actor ) does, so far it appears to be called on every actor upon destruction. (Maybe it's a safeguard for removing colliding actors?)
Try and get the same behaviour for the ActorLineCheck, ActorPointCheck, ActorRadiusCheck, ActorEncroachmentCheck for the hook.
Then make these functions work together with the old hash ones'