Because this actor will be very polite and very kind - like a pig trough. It will allow replacements and iterators to do what they want first, and... kicking them in balls a bit later for preventing recursive reactions and crashes. Here is the sample (that can be adjusted):
Code: Select all
class NoBadItems expands Actor config (NoBadItems);
var() config Name Bad[8];
var int j;
const version=1;
/*
ServerActor used for removal of items crashing game...
Array has 8 elements, 0 to 7... we could use a dynamic array but...
Here we defined Bad classes by Epic (or others) like UT_Stealth
Actor allows replacements done and then will react if something
is being found later spawned by whatever entity...
Map has to be checked for trash - evil spawners - for preventing a recursive load
and developing a lot of garbage objects. Item spawned later not being bStatic is
removed and stupid thing might keep spawning new ones. For such case we have to
do some update. This version is simple, it won't include special checks.
In configuration file we have to add these names of bad items,
it's based on searching for names.
*/
event PreBeginPlay()
{
}
event PostBeginPlay()
{
InitialState = 'Removing';
}
function DoRemoveClass( Name Bad, optional bool bStartUpChecked )
{
local bool bInvalid;
local Inventory Inv;
local bool bLogged;
bInvalid = ( Bad == '' || Bad == 'None' );
if (!bInvalid )
{
foreach AllActors(class'Inventory',Inv)
{
if ( Inv.IsA(Bad) && !Inv.bDeleteMe )
{
if ( ( Inv.bStatic || Inv.bNoDelete ) && !bStartUpChecked )
{
if ( !bLogged )
{
bLogged = True;
log ("Found dumb set"@Inv.Name$", perform deactivation...",'NoBadItems');
}
else
log ("Still deactivating"@Inv.Name$".",'NoBadItems');
Inv.bStatic = False;
Inv.SetCollision(False,False,False);
Inv.SetCollisionSize(0,0);
Inv.GotoState('');
Inv.Disable('Touch');
Inv.Disable('UnTouch');
Inv.bHidden = True;
Inv.SetPhysics(PHYS_None);
Inv.DrawType = DT_None;
}
else
{
log ("Deleting"@Inv.Name$".",'NoBadItems');
if ( !Inv.bDeleteMe && !Inv.bHidden && Inv.DrawType != DT_None )
Inv.Destroy();
}
}
}
}
}
state() Removing
{
Begin:
Sleep (0.1);
log ( "Actor version "$version$" is active...",'NoBadItems');
log ( "Checking list...",'NoBadItems');
j = 0;
LittleLoop:
if ( Bad[j] != '' || Bad[j] != 'None' )
DoRemoveClass(Bad[j]);
j++;
Sleep(0.15);
if ( j < 8 )
GoTo('LittleLoop');
log ("Initial check has been finished... Will stay resident in background.",'NoBadItems');
BigLoop:
j = 0;
Sleep(2.5);
if ( Level.Game != None && !Level.Game.bGameEnded )
{
for (j=0; j < 8; j++)
{
if ( Bad[j] != '' || Bad[j] != 'None' )
DoRemoveClass(Bad[j],True);
Sleep(0.1);
}
GoTo('BigLoop');
}
else
Stop;
}
defaultproperties
{
RemoteRole=ROLE_None
NetPriority=3.000000
bGameRelevant=True
}
To do:
Testing stage when mapper was... "creative" with default properties for borked items...
XC Trivia:
In XCGE environments such list can be a dynamic array like those ServerPackages and ServerActors things - this one doesn't include such thing for now.