Revert weapon conversion

This patch reverts first step of global weapon conversion
that would have halted the release of the next version for too long.
This commit is contained in:
Anton Tarasenko 2020-04-17 23:06:41 +07:00
commit 12d95e387e
757 changed files with 10788 additions and 4046 deletions

View file

@ -0,0 +1,57 @@
class NiceMedicDartFire extends NiceFire;
function DoFireEffect(){
local float oldLoad;
oldLoad = Load;
Load = 1;
super.DoFireEffect();
Load = oldLoad;
}
simulated function bool AllowFire(){
local KFPawn kfPwn;
if(currentContext.sourceWeapon == none || Instigator == none)
return false;
if(currentContext.sourceWeapon.secondaryCharge < default.AmmoPerFire)
return false;
// Check reloading
if(currentContext.sourceWeapon.bIsReloading)
return false;
// Check pawn actions
kfPwn = KFPawn(Instigator);
if(kfPwn == none || kfPwn.SecondaryItem != none || kfPwn.bThrowingNade)
return false;
return true;
}
simulated function ReduceAmmoClient(){
local NiceMedicGun sourceMedGun;
currentContext.sourceWeapon.secondaryCharge -= AmmoPerFire;
sourceMedGun = NiceMedicGun(currentContext.sourceWeapon);
if(sourceMedGun != none){
sourceMedGun.ServerSetMedicCharge(currentContext.sourceWeapon.secondaryCharge);
sourceMedGun.ClientSetMedicCharge(currentContext.sourceWeapon.secondaryCharge);
}
}
defaultproperties
{
ProjectileSpeed=12500.000000
bulletClass=Class'NicePack.NiceMedicProjectile'
FireAimedAnim="Fire_Iron"
FireSoundRef="KF_MP7Snd.Medicgun_Fire"
StereoFireSoundRef="KF_MP7Snd.Medicgun_FireST"
NoAmmoSoundRef="KF_PumpSGSnd.SG_DryFire"
DamageMax=30
bWaitForRelease=True
bAttachSmokeEmitter=True
TransientSoundVolume=2.000000
TransientSoundRadius=500.000000
AmmoPerFire=50
ShakeRotMag=(X=50.000000,Y=50.000000,Z=400.000000)
ShakeRotRate=(X=12500.000000,Y=12500.000000,Z=12500.000000)
ShakeRotTime=5.000000
ShakeOffsetMag=(X=6.000000,Y=2.000000,Z=10.000000)
ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
ShakeOffsetTime=3.000000
BotRefireRate=0.250000
FlashEmitterClass=Class'ROEffects.MuzzleFlash1stKar'
aimerror=1.000000
}

View file

@ -0,0 +1,91 @@
class NiceMedicGun extends NiceWeapon
abstract;
var const float maxMedicCharge;
var float medicChargeRegenRate;
// This variable is dictated by client.
var float medicCharge;
// Medic charge is replicated on server via these periods
var float medicChargeUpdatePeriod;
// This variable is only relevant on a server, to predict current medic charge in-between new updates
var float lastMedicChargeServerUpdate;
// This variable is only relevant on a client, to predict current medic charge in-between weapon ticks
var float lastMedicChargeClientUpdate;
replication{
reliable if(Role < ROLE_Authority)
ServerSetMedicCharge;
reliable if(Role == ROLE_Authority)
ClientSetMedicCharge, ClientSuccessfulHeal;
}
function NicePlainData.Data GetNiceData(){
local NicePlainData.Data transferData;
transferData = super.GetNiceData();
class'NicePlainData'.static.SetFloat(transferData, "MedicCharge", GetCurrentMedicCharge());
class'NicePlainData'.static.SetFloat(transferData, "MedicChargeUpd", Level.TimeSeconds);
return transferData;
}
function SetNiceData(NicePlainData.Data transferData, optional NiceHumanPawn newOwner){
super.SetNiceData(transferData, newOwner);
medicCharge = class'NicePlainData'.static.GetFloat(transferData, "MedicCharge", 0.0);
lastMedicChargeServerUpdate = class'NicePlainData'.static.GetFloat(transferData, "MedicChargeUpd", -1.0);
if(lastMedicChargeServerUpdate >= 0.0)
medicCharge += (Level.TimeSeconds - lastMedicChargeServerUpdate) * medicChargeRegenRate;
lastMedicChargeServerUpdate = Level.TimeSeconds;
ClientSetMedicCharge(medicCharge);
}
function ServerSetMedicCharge(float newCharge){
medicCharge = newCharge;
lastMedicChargeServerUpdate = Level.TimeSeconds;
}
simulated function ClientSetMedicCharge(float newCharge){
medicCharge = newCharge;
}
// Returns current medic charge
// Uses prediction a server
simulated function float GetCurrentMedicCharge(){
if(Role < ROLE_Authority)
return medicCharge;
else
return medicCharge + (Level.TimeSeconds - lastMedicChargeServerUpdate) * medicChargeRegenRate;
}
simulated function WeaponTick(float dt){
local int prevPeriodsAmount;
local bool bWasBelowMax;
if(Role < ROLE_Authority){
// Remember the old state
bWasBelowMax = (medicCharge < maxMedicCharge);
prevPeriodsAmount = Ceil(medicCharge / medicChargeUpdatePeriod);
// Update medic charge
medicCharge += (Level.TimeSeconds - lastMedicChargeClientUpdate) * medicChargeRegenRate;
lastMedicChargeClientUpdate = Level.TimeSeconds;
medicCharge = FMin(medicCharge, maxMedicCharge);
secondaryCharge = Ceil(medicCharge);
// Replicate to server when necessary
if( (bWasBelowMax && medicCharge >= maxMedicCharge)
|| prevPeriodsAmount < Ceil(medicCharge / medicChargeUpdatePeriod) )
ServerSetMedicCharge(medicCharge);
}
super.WeaponTick(dt);
}
simulated function ClientSuccessfulHeal(NiceHumanPawn healer, NiceHumanPawn healed){
if(healed == none)
return;
if(instigator != none && PlayerController(instigator.controller) != none)
PlayerController(instigator.controller).
ClientMessage("You've healed"@healed.GetPlayerName(), 'CriticalEvent');
if(NiceHumanPawn(instigator) != none && PlayerController(healed.controller) != none)
PlayerController(healed.controller).
ClientMessage("You've been healed by"@healer.GetPlayerName(), 'CriticalEvent');
}
defaultproperties
{
maxMedicCharge=100.000000
medicChargeRegenRate=10.000000
medicChargeUpdatePeriod=10.000000
bShowSecondaryCharge=True
SecondaryCharge=0
bChangeSecondaryIcon=True
hudSecondaryTexture=Texture'KillingFloorHUD.HUD.Hud_Syringe'
activeSlowdown=0.750000
activeSpeedup=2.000000
}

View file

@ -0,0 +1,20 @@
class NiceMedicProjectile extends NiceBullet;
function GenerateImpactEffects(ImpactEffect effect, Vector hitLocation, Vector hitNormal,
optional bool bWallImpact, optional bool bGenerateDecal){
if(bWallImpact){
effect.EmitterClass = none;
effect.bPlayROEffect = true;
effect.bImportanEffect = false;
effect.noise = none;
}
super.GenerateImpactEffects(effect, hitLocation, hitNormal, bWallImpact, bGenerateDecal);
}
defaultproperties
{
trailXClass=None
regularImpact=(bImportanEffect=True,bPlayROEffect=False,decalClass=Class'KFMod.ShotgunDecal',EmitterClass=Class'KFMod.healingFX',emitterShiftWall=20.000000,emitterShiftPawn=20.000000,noiseRef="KF_MP7Snd.MP7_DartImpact",noiseVolume=2.000000)
bGenRegEffectOnPawn=True
StaticMeshRef="KF_pickups2_Trip.MP7_Dart"
AmbientSoundRef="KF_MP7Snd.MP7_DartFlyLoop"
}