Browse Source

Add `FindInstance()` method for `MutatorAPI`

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
e7372c8b6d
  1. 20
      sources/KFRealm/Server/Unreal/MutatorAPI/KF1_MutatorAPI.uc
  2. 12
      sources/ServerRealm/API/Unreal/MutatorsAPI/MutatorAPI.uc

20
sources/KFRealm/Server/Unreal/MutatorAPI/KF1_MutatorAPI.uc

@ -55,6 +55,26 @@ public function Mutator_OnModifyLogin_Slot OnModifyLogin(
return Mutator_OnModifyLogin_Slot(signal.NewSlot(receiver));
}
public function Mutator FindInstance(class<Mutator> mutatorClass)
{
local GameInfo gameInfo;
local Mutator result;
gameInfo = _server.unreal.GetGameType();
if (gameInfo == none) {
return none;
}
result = gameInfo.baseMutator;
while (result != none)
{
if (result.class == mutatorClass) {
return result;
}
result = result.nextMutator;
}
return none;
}
defaultproperties
{
}

12
sources/ServerRealm/API/Unreal/MutatorsAPI/MutatorAPI.uc

@ -91,6 +91,18 @@ public function Mutator_OnMutate_Slot OnMutate(AcediaObject receiver);
/* SIGNAL */
public function Mutator_OnModifyLogin_Slot OnModifyLogin(AcediaObject receiver);
/**
* Method for finding a `Mutator` instance of a given class.
* Note only once instance of `Mutator` class is supposed to be created.
*
* @param mutatorClass Class of the `Mutator`, which instance method should
* find.
* @return Instance of `Mutator` of the given class. Guaranteed to be of class
* `mutatorClass`. `none` iff there is no such instance added into
* the game.
*/
public function Mutator FindInstance(class<Mutator> mutatorClass);
defaultproperties
{
}
Loading…
Cancel
Save