Anton Tarasenko
4 years ago
20 changed files with 514 additions and 443 deletions
@ -0,0 +1,72 @@
|
||||
/** |
||||
* Service for storing `FixAmmoSelling`'s `Actor`s. |
||||
* Copyright 2021 Anton Tarasenko |
||||
*------------------------------------------------------------------------------ |
||||
* This file is part of Acedia. |
||||
* |
||||
* Acedia is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Acedia is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
||||
*/ |
||||
class FixAmmoSellingService extends FeatureService |
||||
dependson(FixAmmoSelling); |
||||
|
||||
var private FixAmmoSelling ammoSellingFix; |
||||
|
||||
// All weapons we've detected so far. |
||||
// Made `public` to avoid needless calls, since this is not part of |
||||
// a library's interface anyway. |
||||
var public array<FixAmmoSelling.WeaponRecord> registeredWeapons; |
||||
|
||||
protected function Finalizer() |
||||
{ |
||||
ammoSellingFix = none; |
||||
} |
||||
|
||||
public function SetOwnerFeature(Feature newOwnerFeature) |
||||
{ |
||||
super.SetOwnerFeature(newOwnerFeature); |
||||
ammoSellingFix = FixAmmoSelling(newOwnerFeature); |
||||
} |
||||
|
||||
event Tick(float delta) |
||||
{ |
||||
local int i; |
||||
if (ammoSellingFix == none) { |
||||
return; |
||||
} |
||||
// For all the weapon records... |
||||
i = 0; |
||||
while (i < registeredWeapons.length) |
||||
{ |
||||
// ...remove dead records |
||||
if (registeredWeapons[i].weapon == none) |
||||
{ |
||||
registeredWeapons.Remove(i, 1); |
||||
continue; |
||||
} |
||||
// ...find ammo if it's missing |
||||
if (registeredWeapons[i].ammo == none) |
||||
{ |
||||
registeredWeapons[i] = |
||||
ammoSellingFix.FindAmmoInstance(registeredWeapons[i]); |
||||
} |
||||
// ...tax for ammo, if we can |
||||
registeredWeapons[i] = |
||||
ammoSellingFix.TaxAmmoChange(registeredWeapons[i]); |
||||
i += 1; |
||||
} |
||||
} |
||||
|
||||
defaultproperties |
||||
{ |
||||
} |
@ -1,44 +0,0 @@
|
||||
/** |
||||
* This rule detects any pickup events to allow us to |
||||
* properly record and/or fix pistols' prices. |
||||
* Copyright 2019 Anton Tarasenko |
||||
*------------------------------------------------------------------------------ |
||||
* This file is part of Acedia. |
||||
* |
||||
* Acedia is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Acedia is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
||||
*/ |
||||
class DualiesCostRule extends GameRules; |
||||
|
||||
function bool OverridePickupQuery( |
||||
Pawn other, |
||||
Pickup item, |
||||
out byte allowPickup |
||||
) |
||||
{ |
||||
local KFWeaponPickup weaponPickup; |
||||
local FixDualiesCost dualiesCostFix; |
||||
weaponPickup = KFWeaponPickup(item); |
||||
dualiesCostFix = FixDualiesCost(class'FixDualiesCost'.static.GetInstance()); |
||||
if (weaponPickup != none && dualiesCostFix != none) |
||||
{ |
||||
dualiesCostFix.ApplyPendingValues(); |
||||
dualiesCostFix.StoreSinglePistolValues(); |
||||
dualiesCostFix.SetNextSellValue(weaponPickup.sellValue); |
||||
} |
||||
return super.OverridePickupQuery(other, item, allowPickup); |
||||
} |
||||
|
||||
defaultproperties |
||||
{ |
||||
} |
@ -1,75 +0,0 @@
|
||||
/** |
||||
* This rule detects suspicious attempts to deal damage and |
||||
* applies friendly fire scaling according to `FixFFHack`'s rules. |
||||
* Copyright 2019 Anton Tarasenko |
||||
*------------------------------------------------------------------------------ |
||||
* This file is part of Acedia. |
||||
* |
||||
* Acedia is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Acedia is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
||||
*/ |
||||
class FFHackRule extends GameRules; |
||||
|
||||
function int NetDamage( |
||||
int originalDamage, |
||||
int damage, |
||||
Pawn injured, |
||||
Pawn instigator, |
||||
Vector hitLocation, |
||||
out Vector momentum, |
||||
class<DamageType> damageType |
||||
) |
||||
{ |
||||
local KFGameType gameType; |
||||
local FixFFHack ffHackFix; |
||||
gameType = KFGameType(level.game); |
||||
// Something is very wrong and we can just bail on this damage |
||||
if (damageType == none || gameType == none) { |
||||
return 0; |
||||
} |
||||
|
||||
// We only check when suspicious instigators that aren't a world |
||||
if (!damageType.default.bCausedByWorld && IsSuspicious(instigator)) |
||||
{ |
||||
ffHackFix = FixFFHack(class'FixFFHack'.static.GetInstance()); |
||||
if (ffHackFix != none && ffHackFix.ShouldScaleDamage(damageType)) |
||||
{ |
||||
// Remove pushback to avoid environmental kills |
||||
momentum = Vect(0.0, 0.0, 0.0); |
||||
damage *= gameType.friendlyFireScale; |
||||
} |
||||
} |
||||
return super.NetDamage( originalDamage, damage, injured, instigator, |
||||
hitLocation, momentum, damageType); |
||||
} |
||||
|
||||
private function bool IsSuspicious(Pawn instigator) |
||||
{ |
||||
// Instigator vanished |
||||
if (instigator == none) return true; |
||||
|
||||
// Instigator already became spectator |
||||
if (KFPawn(instigator) != none) |
||||
{ |
||||
if (instigator.playerReplicationInfo != none) |
||||
{ |
||||
return instigator.playerReplicationInfo.bOnlySpectator; |
||||
} |
||||
return true; // Replication info is gone => suspicious |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
defaultproperties |
||||
{ |
||||
} |
@ -1,38 +0,0 @@
|
||||
/** |
||||
* This rule detects when someone is trying to... pick up a pickup and |
||||
* forces additional fixing update on all the ones, dropped by players. |
||||
* Copyright 2021 Anton Tarasenko |
||||
*------------------------------------------------------------------------------ |
||||
* This file is part of Acedia. |
||||
* |
||||
* Acedia is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* Acedia is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
||||
*/ |
||||
class PickupSpamRule extends GameRules; |
||||
|
||||
function bool OverridePickupQuery( |
||||
Pawn toucher, |
||||
Pickup touchedPickup, |
||||
out byte allowPickup) |
||||
{ |
||||
local HelperPickup helper; |
||||
helper = class'HelperPickup'.static.GetInstance(); |
||||
if (helper != none) { |
||||
helper.UpdatePickups(); |
||||
} |
||||
return super.OverridePickupQuery(toucher, touchedPickup, allowPickup); |
||||
} |
||||
|
||||
defaultproperties |
||||
{ |
||||
} |
Loading…
Reference in new issue