rott/kf_sources/ScrnStoryGame/Classes/PickupModifier.uc
2026-07-14 20:27:09 +07:00

87 lines
2.0 KiB
Ucode

class PickupModifier extends Actor
placeable;
var() class<Pickup> PickupClass; // base pickup class to apply properties on
var() name PickupTag; // pickup tag to apply properties on
var() bool bRemoveGlow; // removes UV2Texture and AmbientGlow
var() bool bRemoveUnlit; // sets bUnlit=false (can't see pickups in dark places)
var() int SellValue; // if > 0 sets weapon's sell value (only for KFWeaponPickup)
replication {
reliable if ( (bNetInitial || bNetDirty) && Role == ROLE_Authority )
bRemoveGlow, bRemoveUnlit, SellValue;
}
simulated function PostBeginPlay()
{
SetTimer(5, false); // give enough time for pickups to spawn
}
simulated function PostNetReceive()
{
ApplyMod();
}
simulated function Timer()
{
ApplyMod();
}
simulated function ApplyMod()
{
local Actor Other;
local int count;
foreach DynamicActors(PickupClass, Other, PickupTag) {
count++;
if ( bRemoveGlow ) {
Other.ScaleGlow = 0;
Other.AmbientGlow = 0;
Pickup(Other).bAmbientGlow = false;
Other.UV2Texture = none;
}
if ( bRemoveUnlit ) {
SetDisplayProperties(Style, Texture, false); // sets bUnlit
Other.bStaticLighting = false;
Other.bUseDynamicLights = true;
}
if ( SellValue > 0 && KFWeaponPickup(Other) != none ) {
KFWeaponPickup(Other).SellValue = SellValue;
}
}
Log("PickupModifier: " $ count $ " pickups were modified");
}
event Trigger( Actor Other, Pawn EventInstigator )
{
ApplyMod();
bClientTrigger = !bClientTrigger;
NetUpdateTime = Level.TimeSeconds - 1;
}
simulated function ClientTrigger()
{
Log("PickupModifier: ClientTrigger()");
ApplyMod();
}
defaultproperties
{
PickupClass=Class'KFMod.KFWeaponPickup'
bHidden=True
bAlwaysRelevant=True
bOnlyDirtyReplication=True
RemoteRole=ROLE_SimulatedProxy
NetUpdateFrequency=2.000000
Texture=Texture'Engine.S_Inventory'
bNetNotify=True
}