KF2-Server-Extension/ServerExt/Classes/Ext_T_MonsterPRI.uc

62 lines
1.4 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class Ext_T_MonsterPRI extends PlayerReplicationInfo;
var repnotify class<Pawn> MonsterType;
var repnotify PlayerReplicationInfo OwnerPRI;
var Controller OwnerController;
var string MonsterName;
var int HealthStatus,HealthMax;
var Pawn PawnOwner;
var KFExtendedHUD OwnerHUD;
replication
{
// Things the server should send to the client.
if (bNetDirty)
OwnerPRI,MonsterType,HealthStatus,HealthMax;
}
// Make no efforts with this one.
simulated event PostBeginPlay()
{
2020-11-28 20:04:55 +00:00
if(WorldInfo.NetMode!=NM_Client)
2017-10-20 02:00:49 +00:00
SetTimer(1,true);
}
simulated event Destroyed()
{
2020-11-28 20:04:55 +00:00
if(OwnerHUD!=None)
2017-10-20 02:00:49 +00:00
{
OwnerHUD.MyCurrentPet.RemoveItem(Self);
OwnerHUD = None;
}
2020-11-28 20:04:55 +00:00
if (WorldInfo.GRI != None)
2017-10-20 02:00:49 +00:00
WorldInfo.GRI.RemovePRI(self);
}
simulated event ReplicatedEvent(name VarName)
{
2020-11-28 20:04:55 +00:00
if(VarName=='OwnerPRI' && OwnerPRI!=None)
2017-10-20 02:00:49 +00:00
NotifyOwner();
2020-11-28 20:04:55 +00:00
else if(VarName=='MonsterType' && MonsterType!=None)
2017-10-20 02:00:49 +00:00
MonsterName = Class'KFExtendedHUD'.Static.GetNameOf(MonsterType);
}
simulated function Timer()
{
2020-11-28 20:04:55 +00:00
if(PawnOwner==None || PawnOwner.Health<=0)
2017-10-20 02:00:49 +00:00
Destroy();
2020-11-28 20:04:55 +00:00
else if(HealthStatus!=PawnOwner.Health)
2017-10-20 02:00:49 +00:00
HealthStatus = PawnOwner.Health;
}
simulated final function NotifyOwner()
{
local PlayerController PC;
PC = GetALocalPlayerController();
2020-11-28 20:04:55 +00:00
if(PC==None || PC.PlayerReplicationInfo!=OwnerPRI || KFExtendedHUD(PC.MyHUD)==None)
2017-10-20 02:00:49 +00:00
return;
OwnerHUD = KFExtendedHUD(PC.MyHUD);
OwnerHUD.MyCurrentPet.AddItem(Self);
}
defaultproperties
{
bBot=true
}