KF2-YetAnotherScoreboard/YAS/Classes/YASMut.uc

60 lines
865 B
Ucode
Raw Normal View History

2022-09-03 17:26:40 +00:00
class YASMut extends KFMutator;
2022-09-03 17:26:40 +00:00
var private YAS YAS;
2021-05-31 01:46:53 +00:00
2022-09-03 17:26:40 +00:00
public simulated function bool SafeDestroy()
2021-05-31 01:46:53 +00:00
{
2022-09-03 17:26:40 +00:00
return (bPendingDelete || bDeleteMe || Destroy());
2021-06-12 20:11:37 +00:00
}
2022-09-03 17:26:40 +00:00
public event PreBeginPlay()
2021-05-31 01:46:53 +00:00
{
2022-09-03 17:26:40 +00:00
Super.PreBeginPlay();
2022-09-03 17:26:40 +00:00
if (WorldInfo.NetMode == NM_Client) return;
2022-09-03 17:26:40 +00:00
foreach WorldInfo.DynamicActors(class'YAS', YAS)
2021-05-31 01:46:53 +00:00
{
2022-09-03 17:26:40 +00:00
break;
2021-05-31 01:46:53 +00:00
}
2022-09-03 17:26:40 +00:00
if (YAS == None)
2021-05-31 01:46:53 +00:00
{
2022-09-03 17:26:40 +00:00
YAS = WorldInfo.Spawn(class'YAS');
2021-06-12 18:44:20 +00:00
}
2022-09-03 17:26:40 +00:00
if (YAS == None)
2021-06-12 18:44:20 +00:00
{
2022-09-03 17:26:40 +00:00
`Log_Base("FATAL: Can't Spawn 'YAS'");
SafeDestroy();
2021-05-31 01:46:53 +00:00
}
2020-01-10 13:14:11 +00:00
}
2022-09-03 17:26:40 +00:00
public function AddMutator(Mutator Mut)
{
2022-09-03 17:26:40 +00:00
if (Mut == Self) return;
2022-09-03 17:26:40 +00:00
if (Mut.Class == Class)
2023-05-14 00:57:20 +00:00
YASMut(Mut).SafeDestroy();
2022-09-03 17:26:40 +00:00
else
Super.AddMutator(Mut);
2021-05-31 01:46:53 +00:00
}
2022-09-03 17:26:40 +00:00
public function NotifyLogin(Controller C)
2021-06-12 18:44:20 +00:00
{
2022-09-03 17:26:40 +00:00
YAS.NotifyLogin(C);
2022-09-03 17:26:40 +00:00
Super.NotifyLogin(C);
2021-06-12 18:44:20 +00:00
}
2022-09-03 17:26:40 +00:00
public function NotifyLogout(Controller C)
2021-06-12 18:44:20 +00:00
{
2022-09-03 17:26:40 +00:00
YAS.NotifyLogout(C);
2022-09-03 17:26:40 +00:00
Super.NotifyLogout(C);
2021-06-12 18:44:20 +00:00
}
2022-09-03 17:26:40 +00:00
DefaultProperties
2021-05-31 01:46:53 +00:00
{
2023-05-14 00:57:20 +00:00
GroupNames.Add("Scoreboard")
}