OldUnreal / Unreal-testing

OU 227 testing
Other
57 stars 0 forks source link

UnrealShare.ArbitItem may destroy unrelated actors on level startup #294

Open Masterkent opened 1 year ago

Masterkent commented 1 year ago
auto state CheckReplacement
{
    function BeginState()
    {
        local int i;
        local Actor what;

        // destroy any other actors inside a 2-mark radius (safeguard)
        foreach RadiusActors(Class'Actor', what,2,location)
        {
            if (what != self)
            {
                if (bDebug) log("safeguard destroys "$what,'ARBITITEM');
                what.destroy();
            }
        }

I don't see any reasons why ArbitItem should destroy anything, not just Inventory. It may remove unrelated actors (f.e., Triggers, SpecialEvents, and even Info actors) that could be placed nearby for some reason. Note that RadiusActors takes collision metrics into account, hence it may find actors whose Location is 2000uu or more away from the ArbitItem as long as their CollisionRadius and CollisionHeight are big enough for occupying the space within the given radius. I faced with this situation when I tried to spawn some actors on DmRetrospective, and figuring out why they were suddenly destroyed took a lot of time.

My suggestion is to replace Actor class by Inventory class in the aforementioned piece of code.

Marco888 commented 1 year ago

Actually RadiusActors doesn't take collision metrics into account, it only checks distance between Location and test location. But I changed it to only check with inventory based colliding actors.