Browse Source

Fix code style

master
Anton Tarasenko 4 years ago
parent
commit
229ecca122
  1. 4
      config/AcediaFixes.ini
  2. 9
      sources/FixAmmoSelling/AmmoPickupStalker.uc
  3. 30
      sources/FixAmmoSelling/FixAmmoSelling.uc
  4. 6
      sources/FixAmmoSelling/MutatorListener_FixAmmoSelling.uc
  5. 24
      sources/FixDoshSpam/FixDoshSpam.uc
  6. 3
      sources/FixDoshSpam/MutatorListener_FixDoshSpam.uc
  7. 3
      sources/FixDualiesCost/DualiesCostRule.uc
  8. 24
      sources/FixDualiesCost/FixDualiesCost.uc
  9. 3
      sources/FixFFHack/FFHackRule.uc
  10. 9
      sources/FixFFHack/FixFFHack.uc
  11. 4
      sources/FixInfiniteNades/FixInfiniteNades.uc
  12. 15
      sources/FixInventoryAbuse/FixInventoryAbuse.uc
  13. 3
      sources/FixSpectatorCrash/BroadcastListener_FixSpectatorCrash.uc
  14. 15
      sources/FixSpectatorCrash/FixSpectatorCrash.uc
  15. 20
      sources/FixZedTimeLags/FixZedTimeLags.uc

4
config/AcediaFixes.ini

@ -102,8 +102,8 @@ autoEnable=true
; Setting this flag to 'true' will allow to throw grenades by calling
; 'ServerThrow' directly, as long as player has necessary ammo.
; This can allow some players to throw grenades much quicker than intended,
; therefore it's suggested to keep this flag set to 'false'.
ignoreTossFlags=false
; so if you wish to prevent it, keep this flag set to `false`.
ignoreTossFlags=true
[AcediaFixes.FixDoshSpam]

9
sources/FixAmmoSelling/AmmoPickupStalker.uc

@ -58,20 +58,17 @@ event Touch(Actor other)
if (!wasActive && !target.IsInState('Pickup')) return;
ammoSellingFix = FixAmmoSelling(class'FixAmmoSelling'.static.GetInstance());
if (ammoSellingFix != none)
{
if (ammoSellingFix != none) {
ammoSellingFix.RecordAmmoPickup(Pawn(other), target);
}
}
event Tick(float delta)
{
if (target != none)
{
if (target != none) {
wasActive = target.IsInState('Pickup');
}
else
{
else {
Destroy();
}
}

30
sources/FixAmmoSelling/FixAmmoSelling.uc

@ -139,13 +139,11 @@ protected function OnEnabled()
local KFWeapon nextWeapon;
local KFAmmoPickup nextPickup;
// Find all abusable weapons
foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon)
{
foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon) {
FixWeapon(nextWeapon);
}
// Start tracking all ammo boxes
foreach level.DynamicActors(class'KFMod.KFAmmoPickup', nextPickup)
{
foreach level.DynamicActors(class'KFMod.KFAmmoPickup', nextPickup) {
class'AmmoPickupStalker'.static.StalkAmmoPickup(nextPickup);
}
}
@ -167,14 +165,12 @@ protected function OnDisabled()
registeredWeapons.length = 0;
// Kill all the stalkers;
// to be safe, avoid destroying them directly in the iterator.
foreach level.DynamicActors(class'AmmoPickupStalker', nextStalker)
{
foreach level.DynamicActors(class'AmmoPickupStalker', nextStalker) {
stalkers[stalkers.length] = nextStalker;
}
for (i = 0; i < stalkers.length; i += 1)
{
if (stalkers[i] != none)
{
if (stalkers[i] != none) {
stalkers[i].Destroy();
}
}
@ -187,8 +183,7 @@ public static final function bool IsReplacer(class<Actor> pickupClass)
if (pickupClass == none) return false;
for (i = 0; i < default.rules.length; i += 1)
{
if (pickupClass == default.rules[i].pickupReplacement)
{
if (pickupClass == default.rules[i].pickupReplacement) {
return true;
}
}
@ -205,8 +200,7 @@ public final function FixWeapon(KFWeapon potentialAbuser)
for (i = 0; i < registeredWeapons.length; i += 1)
{
if (registeredWeapons[i].weapon == potentialAbuser)
{
if (registeredWeapons[i].weapon == potentialAbuser) {
return;
}
}
@ -234,8 +228,7 @@ private final function WeaponRecord FindAmmoInstance(WeaponRecord record)
invIter = record.weapon.instigator.inventory;
while (invIter != none)
{
if (record.weapon.ammoClass[0] == invIter.class)
{
if (record.weapon.ammoClass[0] == invIter.class) {
ammo = KFAmmunition(invIter);
}
invIter = invIter.inventory;
@ -251,8 +244,7 @@ private final function WeaponRecord FindAmmoInstance(WeaponRecord record)
// Calculates how much more player should have paid for 'ammoAmount'
// amount of ammo, compared to how much trader took after our fix.
private final function float GetPriceCorrection
(
private final function float GetPriceCorrection(
KFWeapon kfWeapon,
int ammoAmount
)
@ -319,8 +311,7 @@ private final function WeaponRecord TaxAmmoChange(WeaponRecord record)
// (actual price + our correction).
// But if user is extra concerned about it, -
// we can additionally for force the score above 0.
if (!allowNegativeDosh)
{
if (!allowNegativeDosh) {
replicationInfo.score = FMax(0, replicationInfo.score);
}
}
@ -368,8 +359,7 @@ event Tick(float delta)
continue;
}
// ...find ammo if it's missing
if (registeredWeapons[i].ammo == none)
{
if (registeredWeapons[i].ammo == none) {
registeredWeapons[i] = FindAmmoInstance(registeredWeapons[i]);
}
// ...tax for ammo, if we can

6
sources/FixAmmoSelling/MutatorListener_FixAmmoSelling.uc

@ -70,8 +70,7 @@ private static function ReplacePickupWith(Pickup oldPickup)
}
// TODO: this is code duplication, some sort of solution is needed
static final function KFWeapon GetWeaponOfClass
(
static final function KFWeapon GetWeaponOfClass(
Pawn playerPawn,
class<Inventory> weaponClass
)
@ -82,8 +81,7 @@ static final function KFWeapon GetWeaponOfClass
invIter = playerPawn.inventory;
while (invIter != none)
{
if (invIter.class == weaponClass)
{
if (invIter.class == weaponClass) {
return KFWeapon(invIter);
}
invIter = invIter.inventory;

24
sources/FixDoshSpam/FixDoshSpam.uc

@ -95,8 +95,7 @@ protected function OnEnabled()
local CashPickup nextCash;
// Find all wads of cash laying around on the map,
// so that we could accordingly limit the cash spam.
foreach level.DynamicActors(class'KFMod.CashPickup', nextCash)
{
foreach level.DynamicActors(class'KFMod.CashPickup', nextCash) {
wads[wads.length] = nextCash;
}
}
@ -119,8 +118,7 @@ public final function bool IsDoshStreamOverLimit()
local int i;
local float overallContribution;
overallContribution = 0.0;
for (i = 0; i < currentContributors.length; i += 1)
{
for (i = 0; i < currentContributors.length; i += 1) {
overallContribution += currentContributors[i].contribution;
}
return (overallContribution > lastTickDuration * GetCurrentDPSLimit());
@ -130,8 +128,7 @@ public final function bool IsDoshStreamOverLimit()
private final function float GetCurrentDPSLimit()
{
local float speedScale;
if (doshPerSecondLimitMax < doshPerSecondLimitMin)
{
if (doshPerSecondLimitMax < doshPerSecondLimitMin) {
return doshPerSecondLimitMax;
}
speedScale = Float(wads.length) / Float(criticalDoshAmount);
@ -151,8 +148,7 @@ private final function int GetContributorIndex(PlayerController player)
for (i = 0; i < currentContributors.length; i += 1)
{
if (currentContributors[i].player == player)
{
if (currentContributors[i].player == player) {
return i;
}
}
@ -170,8 +166,7 @@ public final function AddContribution(PlayerController player, CashPickup cash)
// Check if given dosh was already accounted for.
for (i = 0; i < wads.length; i += 1)
{
if (cash == wads[i])
{
if (cash == wads[i]) {
return;
}
}
@ -194,8 +189,7 @@ private final function ReducePlayerContributions(float trueTimePassed)
local float streamReduction;
streamReduction = trueTimePassed *
(GetCurrentDPSLimit() / currentContributors.length);
for (i = 0; i < currentContributors.length; i += 1)
{
for (i = 0; i < currentContributors.length; i += 1) {
currentContributors[i].contribution -= streamReduction;
}
}
@ -207,12 +201,10 @@ private final function CleanWadsArray()
i = 0;
while (i < wads.length)
{
if (wads[i] == none)
{
if (wads[i] == none) {
wads.Remove(i, 1);
}
else
{
else {
i += 1;
}
}

3
sources/FixDoshSpam/MutatorListener_FixDoshSpam.uc

@ -36,8 +36,7 @@ static function bool CheckReplacement(Actor other, out byte isSuperRelevant)
// the limit and the one trying to throw this cash contributed to it.
// We allow other players to throw at least one wad of cash.
player = PlayerController(other.instigator.controller);
if (doshFix.IsDoshStreamOverLimit() && doshFix.IsContributor(player))
{
if (doshFix.IsDoshStreamOverLimit() && doshFix.IsContributor(player)) {
return false;
}
// If we do spawn cash - record this contribution.

3
sources/FixDualiesCost/DualiesCostRule.uc

@ -20,8 +20,7 @@
*/
class DualiesCostRule extends GameRules;
function bool OverridePickupQuery
(
function bool OverridePickupQuery(
Pawn other,
Pickup item,
out byte allowPickup

24
sources/FixDualiesCost/FixDualiesCost.uc

@ -150,8 +150,7 @@ protected function OnEnabled()
{
local KFWeapon nextWeapon;
// Find all frags, that spawned when this fix wasn't running.
foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon)
{
foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon) {
RegisterSinglePistol(nextWeapon, false);
}
level.game.AddGameModifier(Spawn(class'DualiesCostRule'));
@ -192,8 +191,7 @@ public final function SetNextSellValue(int newValue)
// Finds a weapon of a given class in given 'Pawn' 's inventory.
// Returns 'none' if weapon isn't there.
private final function KFWeapon GetWeaponOfClass
(
private final function KFWeapon GetWeaponOfClass(
Pawn playerPawn,
class<KFWeapon> weaponClass
)
@ -204,8 +202,7 @@ private final function KFWeapon GetWeaponOfClass
invIter = playerPawn.inventory;
while (invIter != none)
{
if (invIter.class == weaponClass)
{
if (invIter.class == weaponClass) {
return KFWeapon(invIter);
}
invIter = invIter.inventory;
@ -227,12 +224,10 @@ private final function int GetIndexAs(KFWeapon weapon, bool asSingle)
for (i = 0; i < dualiesClasses.length; i += 1)
{
if (asSingle && dualiesClasses[i].single == weapon.class)
{
if (asSingle && dualiesClasses[i].single == weapon.class) {
return i;
}
if (!asSingle && dualiesClasses[i].dual == weapon.class)
{
if (!asSingle && dualiesClasses[i].dual == weapon.class) {
return i;
}
}
@ -266,8 +261,7 @@ private final function float GetFullCost(KFWeapon weapon)
// If passed weapon is a pistol - we start tracking it's value;
// Otherwise - do nothing.
public final function RegisterSinglePistol
(
public final function RegisterSinglePistol(
KFWeapon singlePistol,
bool justSpawned
)
@ -384,8 +378,7 @@ public final function FixCostAfterPickUp(KFWeapon dualPistols)
dualiesClasses[index].single);
if (singlePistol != none) return;
if (nextSellValue == -1)
{
if (nextSellValue == -1) {
nextSellValue = GetFullCost(dualPistols) * 0.75;
}
for (i = 0; i < storedValues.length; i += 1)
@ -409,8 +402,7 @@ public final function ApplyPendingValues()
// Our fixes can only increase the correct ('!= -1')
// sell value of weapons, so if we only need to change sell value
// if we're allowed to increase it or it's incorrect.
if (allowSellValueIncrease || pendingValues[i].weapon.sellValue == -1)
{
if (allowSellValueIncrease || pendingValues[i].weapon.sellValue == -1) {
pendingValues[i].weapon.sellValue = pendingValues[i].value;
}
}

3
sources/FixFFHack/FFHackRule.uc

@ -20,8 +20,7 @@
*/
class FFHackRule extends GameRules;
function int NetDamage
(
function int NetDamage(
int originalDamage,
int damage,
Pawn injured,

9
sources/FixFFHack/FixFFHack.uc

@ -97,14 +97,15 @@ public final function bool ShouldScaleDamage(class<DamageType> damageType)
local array< class<DamageType> > exceptions;
if (damageType == none) return false;
if (scaleByDefault)
if (scaleByDefault) {
exceptions = neverScale;
else
}
else {
exceptions = alwaysScale;
}
for (i = 0; i < exceptions.length; i += 1)
{
if (exceptions[i] == damageType)
{
if (exceptions[i] == damageType) {
return (!scaleByDefault);
}
}

4
sources/FixInfiniteNades/FixInfiniteNades.uc

@ -48,7 +48,7 @@ class FixInfiniteNades extends Feature
// Setting this flag to 'true' will allow to throw grenades by calling
// 'ServerThrow' directly, as long as player has necessary ammo.
// This can allow some players to throw grenades much quicker than intended,
// therefore it's suggested to keep this flag set to 'false'.
// so if you wish to prevent it, keep this flag set to `false`.
var private config const bool ignoreTossFlags;
// Records how much ammo given frag grenade ('Frag') has.
@ -228,7 +228,7 @@ event Tick(float delta)
defaultproperties
{
ignoreTossFlags = false
ignoreTossFlags = true
// Listeners
requiredListeners(0) = class'MutatorListener_FixInfiniteNades'
}

15
sources/FixInventoryAbuse/FixInventoryAbuse.uc

@ -49,8 +49,7 @@ protected function OnEnabled()
{
local float actualInterval;
actualInterval = checkInterval;
if (actualInterval <= 0)
{
if (actualInterval <= 0) {
actualInterval = 0.25;
}
SetTimer(actualInterval, true);
@ -124,8 +123,7 @@ private final function bool HasDuplicateGuns(KFHumanPawn playerPawn)
if (nextWeapon == none) continue;
if (nextWeapon.bKFNeverThrow) continue;
rootClass = GetRootPickupClass(nextWeapon);
if (rootClass != none)
{
if (rootClass != none) {
rootList[rootList.length] = rootClass;
}
}
@ -134,8 +132,7 @@ private final function bool HasDuplicateGuns(KFHumanPawn playerPawn)
{
for (j = i + 1; j < rootList.length; j += 1)
{
if (rootList[i] == rootList[j])
{
if (rootList[i] == rootList[j]) {
return true;
}
}
@ -203,12 +200,10 @@ event Timer()
for (i = 0; i < connections.length; i += 1)
{
nextPawn = none;
if (connections[i].controllerReference != none)
{
if (connections[i].controllerReference != none) {
nextPawn = KFHumanPawn(connections[i].controllerReference.pawn);
}
if (IsWeightLimitViolated(nextPawn) || HasDuplicateGuns(nextPawn))
{
if (IsWeightLimitViolated(nextPawn) || HasDuplicateGuns(nextPawn)) {
DropEverything(nextPawn);
}
}

3
sources/FixSpectatorCrash/BroadcastListener_FixSpectatorCrash.uc

@ -24,8 +24,7 @@ class BroadcastListener_FixSpectatorCrash extends BroadcastListenerBase
var private const int becomeAlivePlayerID;
var private const int becomeSpectatorID;
static function bool HandleLocalized
(
static function bool HandleLocalized(
Actor sender,
BroadcastEvents.LocalizedMessage message
)

15
sources/FixSpectatorCrash/FixSpectatorCrash.uc

@ -105,8 +105,7 @@ private final function int GetCooldownIndex(PlayerController player)
for (i = 0; i < currentCooldowns.length; i += 1)
{
if (currentCooldowns[i].player == player)
{
if (currentCooldowns[i].player == player) {
return i;
}
}
@ -122,8 +121,7 @@ public final function bool IsViolator(PlayerController player)
for (i = 0; i < violators.length; i += 1)
{
if (violators[i] == player)
{
if (violators[i] == player) {
return true;
}
}
@ -146,8 +144,7 @@ public final function NotifyStatusChange(PlayerController player)
player.Destroy();
currentCooldowns.Remove(index, 1);
violators[violators.length] = player;
if (allowServerBlock)
{
if (allowServerBlock) {
SetBlock(true);
}
}
@ -201,8 +198,7 @@ private final function TryUnblocking()
for (i = 0; i < violators.length; i += 1)
{
if (violators[i] != none)
{
if (violators[i] != none) {
return;
}
}
@ -232,8 +228,7 @@ private final function int GetRealPlayers()
player = connections[i].controllerReference;
if (player == none) continue;
if (player.playerReplicationInfo == none) continue;
if (!player.playerReplicationInfo.bOnlySpectator)
{
if (!player.playerReplicationInfo.bOnlySpectator) {
realPlayersAmount += 1;
}
}

20
sources/FixZedTimeLags/FixZedTimeLags.uc

@ -69,12 +69,10 @@ var private KFGameType gameType;
protected function OnEnabled()
{
gameType = KFGameType(level.game);
if (gameType == none)
{
if (gameType == none) {
Destroy();
}
else if (disableTick)
{
else if (disableTick) {
gameType.Disable('Tick');
}
}
@ -82,8 +80,7 @@ protected function OnEnabled()
protected function OnDisabled()
{
gameType = KFGameType(level.game);
if (gameType != none && disableTick)
{
if (gameType != none && disableTick) {
gameType.Enable('Tick');
}
}
@ -93,11 +90,10 @@ event Tick(float delta)
local float trueTimePassed;
if (gameType == none) return;
if (!gameType.bZEDTimeActive) return;
// Unfortunately we need to keep disabling 'Tick' probe function,
// Unfortunately we need to keep disabling `Tick()` probe function,
// because it constantly gets enabled back and I don't know where
// (maybe native code?); only really matters during zed time.
if (disableTick)
{
if (disableTick) {
gameType.Disable('Tick');
}
// How much real (not in-game) time has passed
@ -105,8 +101,7 @@ event Tick(float delta)
gameType.currentZEDTimeDuration -= trueTimePassed;
// Handle speeding up phase
if (gameType.bSpeedingBackUp)
{
if (gameType.bSpeedingBackUp) {
DoSpeedBackUp(trueTimePassed);
}
else if (gameType.currentZEDTimeDuration < GetSpeedupDuration())
@ -163,8 +158,7 @@ private final function DoSpeedBackUp(float trueTimePassed)
updateCooldown -= trueTimePassed;
return;
}
else
{
else {
updateCooldown = GetFullUpdateCooldown();
}
slowdownScale = gameType.currentZEDTimeDuration / GetSpeedupDuration();

Loading…
Cancel
Save