From 826e6272a4481e10e834dfab585905c33da4a704 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sat, 18 Jul 2020 02:35:25 +0700 Subject: [PATCH] Add proper method to disable a `Feature` --- sources/Core/Feature.uc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sources/Core/Feature.uc b/sources/Core/Feature.uc index 675f962..fc29a7b 100644 --- a/sources/Core/Feature.uc +++ b/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