(Most of which won't happen without a custom class.... Will look at that later.)
While we were bouncing ideas around, I took a look at the source code for the original DecalStay Mod by Mongo.
From Nov. 1999. Probably the 1st 3rd party mod I ever installed.
The original DecalStay runs off a tick via Mod Menu item, and runs client-side only. Works while playing online or offline with everything.
It only acts on 14 of the default UT99 scorch marks. It copies them. Respawns custom replacements. Destroys the original scorch.
While looking at it, I noticed I could make that happen with just a few lines of code. Without spawning or destroying anything.
And have it work with ALL scorch marks.
(2 or 3 lines not including basic overhead to make it a mutator or Mod Menu item...)
Now I have that working as either a Mod Menu item like the original, and a 2nd version, that runs as a mutator, and will run
on a server.
My question is regarding something I noticed while testing the mutator/server version of it.
Had a log file line in the code, to make sure my replication was working, and that things were working as I wanted on client and server.
And this shows up in the logs. Botpack.WallCrack is spawning on both the dedicated server and the client.
Botpack.WallCrack is a tiny Scorch/Decal that gets spawned by Ripper Primary fire when they hit the wall, and probably a few other classes.
In testing on a dedicated FoodFight server, I get the same thing for the BeanSplat decal. (Canopener primary)
But none of the other cool FF decals.
No other scorchmarks are showing up on the dedicated server. I can't think of any reason that they should. (If anybody knows of one, please tell me....)
These scorch classes items should only be spawning on the client.
This has to be an error in those classes or the projectile classes that are spawning them.
My question: Should I have my mutator destroy those items on the server? (It only takes 1 additional line in the code...)
Testing that on 2 of my servers currently, and nothing bad seems to happen. WallCracks and BeanSplats still spawn fine
on the client.
The current full source for my mutator version of this thing is so small, here it is in its entirety so you can see exactly what I mean:
Class 1. DsMut Mutator:
Code: Select all
//----------------------------------------------------------------------------------------------------//
// DecalStayPlus. Mutator Version An Update to Mongo's DecalStay Mod by MrLoathsome. 5/12/2018 //
//----------------------------------------------------------------------------------------------------//
class DsMut extends Mutator config(DSP_Mut);
var() config float TimeMultiplier;
var() config int MaxDecals;
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
Spawn(class'MyWatcher');
}
defaultproperties
{
TimeMultiplier=60.0
MaxDecals=2000
}
Code: Select all
class MyWatcher expands SpawnNotify;
var float TM;
var int MaxDecals, DecalCount, K;
replication
{
// Variables the server should send to the client.
reliable if( Role==ROLE_Authority )
TM, MaxDecals;
}
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
TM = class'DsMut'.default.TimeMultiplier;
MaxDecals = class'DsMut'.default.MaxDecals;
}
simulated function CountDecals()
{
local Scorch S;
DecalCount = 0;
foreach Level.allactors(class'Scorch', S) DecalCount++;
}
simulated event actor SpawnNotification(actor A)
{
if (Scorch(A) == None)
return A;
//Log(Self@A);
if (Level.NetMode == NM_DedicatedServer) A.Destroy();
K++;
if (K > 60) // Only update the DecalCount once every 60 scorchmarks spawned
{
k = 0;
CountDecals();
}
if (TM == 0)
{
A.Disable('Timer');
A.Lifespan = 0.0;
}
else if (DecalCount < MaxDecals)
{
A.SetTimer(TM, false);
A.Lifespan = 0.0;
}
return A;
}
defaultproperties
{
}
Above version does destroy the Scorches if they are spawning on the dedicated server.
Other option I was testing just ignores the server-side scorch actors, but excludes them from any adjustments.
Let me know if you have any opinions on that. Or if you notice anything I am doing wrong with the replication or other code.
(Anything left out that should be there, anything I am doing that doesn't need to be done etc...)
Hope to be posting both versions of this new DecalStayPlus thing here soon.
*Edit. Adjustment to CountDecals function....
**Edit 2. Just noticed while re-reading the post. I used Extends in one class, and Expands for the other. Damn I am old. LOL