Automatic Junks removal
Posted: Sat Oct 12, 2019 4:15 pm
Epic were so funny at random, while I could see not a single time servers crashed because or borked actors used in maps we might want to get rid of these getting over all mapper "solutions" when this wasn't really nice. By example we can have a ServerActor having an INI file using a static array where can be defined 8 known names that are causing problems. We nominate UT_Stealth as example and server will get rid of it shortly. Why we discuss in term "shortly" ?
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 cannot be compiled in normal UT state, there is needed a "fine tuned" one, it won't need remote role because... it is aiming server - that one was crashing. Of course, without item in server, client won't have access to said glitched thing so everyone can feel happy.
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.
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.