Browse Source

Add proper method to disable a `Feature`

new
Anton Tarasenko 4 years ago
parent
commit
826e6272a4
  1. 14
      sources/Core/Feature.uc

14
sources/Core/Feature.uc

@ -53,7 +53,6 @@ public static final function bool IsEnabled()
}
// Enables feature of given class.
// To disable a feature simply use 'Destroy'.
public static final function Feature EnableMe()
{
local Feature newInstance;
@ -67,6 +66,18 @@ public static final function Feature EnableMe()
return newInstance;
}
public static final function bool DisableMe()
{
local Feature myself;
myself = Feature(GetInstance());
if (myself != none)
{
myself.Destroy();
return true;
}
return false;
}
// Event functions that are called when
protected function OnEnabled(){}
protected function OnDisabled(){}
@ -98,6 +109,7 @@ protected function OnDestroyed()
defaultproperties
{
autoEnable = false
DrawType = DT_None
// Prevent spawning this feature by any other means than 'EnableMe()'.
blockSpawning = true
// Features are server-only actors