Refactor Feature
Make events functions `OnEnabled()` and `OnEnabled()` protected rather than public. Move initialization and clean up logic into `OnCreated()` and `OnDestroyed()` event functions.
This commit is contained in:
parent
dd0bdc8904
commit
3969eb3824
@ -133,7 +133,7 @@ struct WeaponRecord
|
||||
// All weapons we've detected so far.
|
||||
var private array<WeaponRecord> registeredWeapons;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
local KFWeapon nextWeapon;
|
||||
local KFAmmoPickup nextPickup;
|
||||
@ -149,7 +149,7 @@ public function OnEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
local int i;
|
||||
local AmmoPickupStalker nextStalker;
|
||||
|
@ -89,7 +89,7 @@ var private array<DoshStreamPerPlayer> currentContributors;
|
||||
// Wads of cash that are lying around on the map.
|
||||
var private array<CashPickup> wads;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
local CashPickup nextCash;
|
||||
// Find all wads of cash laying around on the map,
|
||||
@ -100,7 +100,7 @@ public function OnEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
wads.length = 0;
|
||||
currentContributors.length = 0;
|
||||
|
@ -145,7 +145,7 @@ var private const array<WeaponDataRecord> storedValues;
|
||||
// Sell value of the last seen pickup in 'OverridePickupQuery'
|
||||
var private int nextSellValue;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
local KFWeapon nextWeapon;
|
||||
// Find all frags, that spawned when this fix wasn't running.
|
||||
@ -156,7 +156,7 @@ public function OnEnabled()
|
||||
level.game.AddGameModifier(Spawn(class'DualiesCostRule'));
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
local GameRules rulesIter;
|
||||
local DualiesCostRule ruleToDestroy;
|
||||
|
@ -56,12 +56,12 @@ var private config const array< class<DamageType> > alwaysScale;
|
||||
// Damage types, for which we should never reapply friendly fire scaling.
|
||||
var private config const array< class<DamageType> > neverScale;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
level.game.AddGameModifier(Spawn(class'FFHackRule'));
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
local GameRules rulesIter;
|
||||
local FFHackRule ruleToDestroy;
|
||||
|
@ -58,7 +58,7 @@ struct FragAmmoRecord
|
||||
};
|
||||
var private array<FragAmmoRecord> ammoRecords;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
local Frag nextFrag;
|
||||
// Find all frags, that spawned when this fix wasn't running.
|
||||
@ -69,7 +69,7 @@ public function OnEnabled()
|
||||
RecreateFrags();
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
RecreateFrags();
|
||||
ammoRecords.length = 0;
|
||||
|
@ -44,7 +44,7 @@ struct DualiesPair
|
||||
// It's made configurable in case of custom dual weapons.
|
||||
var private config const array<DualiesPair> dualiesClasses;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
local float actualInterval;
|
||||
actualInterval = checkInterval;
|
||||
@ -55,7 +55,7 @@ public function OnEnabled()
|
||||
SetTimer(actualInterval, true);
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
SetTimer(0.0f, false);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ var private float updateCooldown;
|
||||
// Recorded game type, to avoid constant conversions every tick
|
||||
var private KFGameType gameType;
|
||||
|
||||
public function OnEnabled()
|
||||
protected function OnEnabled()
|
||||
{
|
||||
gameType = KFGameType(level.game);
|
||||
if (gameType == none)
|
||||
@ -78,7 +78,7 @@ public function OnEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
public function OnDisabled()
|
||||
protected function OnDisabled()
|
||||
{
|
||||
gameType = KFGameType(level.game);
|
||||
if (gameType != none && disableTick)
|
||||
|
Reference in New Issue
Block a user