Reviewed-on: https://insultplayers.ru/git/dkanus/NicePack/pulls/27
This commit is contained in:
commit
f8cf67e117
File diff suppressed because it is too large
Load Diff
@ -9,57 +9,132 @@
|
||||
// E-mail: dkanus@gmail.com
|
||||
//======================================================================================================================
|
||||
class NiceBulletAdapter extends Object;
|
||||
var const int BigZedMinHealth; // If zed's base Health >= this value, zed counts as Big
|
||||
var const int MediumZedMinHealth; // If zed's base Health >= this value, zed counts as Medium-size
|
||||
static function Explode(NiceBullet bullet, NiceReplicationInfo niceRI, Vector hitLocation, optional Actor explosionTarget){
|
||||
if(!bullet.bGhost){
|
||||
niceRI.ServerExplode(bullet.charExplosionDamage, bullet.charExplosionRadius, bullet.charExplosionExponent,
|
||||
bullet.charExplosionDamageType, bullet.charExplosionMomentum, hitLocation, bullet.instigator, true,
|
||||
explosionTarget, Vector(bullet.Rotation));
|
||||
if(KFMonster(bullet.base) != none && bullet.bStuck && bullet.bStuckToHead)
|
||||
niceRI.ServerDealDamage(KFMonster(bullet.base), bullet.charExplosionDamage, bullet.instigator, hitLocation,
|
||||
bullet.charExplosionMomentum * vect(0,0,-1), bullet.charExplosionDamageType, 1.0);
|
||||
|
||||
var const int BigZedMinHealth; // If zed's base Health >= this value, zed counts as Big
|
||||
var const int MediumZedMinHealth; // If zed's base Health >= this value, zed counts as Medium-size
|
||||
|
||||
static function Explode(
|
||||
NiceBullet bullet,
|
||||
NiceReplicationInfo niceRI,
|
||||
Vector hitLocation,
|
||||
optional Actor explosionTarget
|
||||
) {
|
||||
if (!bullet.bGhost) {
|
||||
niceRI.ServerExplode(
|
||||
bullet.charExplosionDamage,
|
||||
bullet.charExplosionRadius,
|
||||
bullet.charExplosionExponent,
|
||||
bullet.charExplosionDamageType,
|
||||
bullet.charExplosionMomentum,
|
||||
hitLocation,
|
||||
bullet.instigator,
|
||||
true,
|
||||
explosionTarget,
|
||||
Vector(bullet.Rotation)
|
||||
);
|
||||
|
||||
if (KFMonster(bullet.base) != none && bullet.bStuck && bullet.bStuckToHead) {
|
||||
niceRI.ServerDealDamage(
|
||||
KFMonster(bullet.base),
|
||||
bullet.charExplosionDamage,
|
||||
bullet.instigator,
|
||||
hitLocation,
|
||||
bullet.charExplosionMomentum * vect(0, 0, -1),
|
||||
bullet.charExplosionDamageType,
|
||||
1.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
static function HandleCalibration
|
||||
(
|
||||
bool isHeadshot,
|
||||
NiceHumanPawn nicePawn,
|
||||
NiceMonster targetZed
|
||||
){
|
||||
if(nicePawn == none) return;
|
||||
if(nicePawn.currentCalibrationState != CALSTATE_ACTIVE) return;
|
||||
|
||||
static function HandleCalibration (
|
||||
bool isHeadshot,
|
||||
NiceHumanPawn nicePawn,
|
||||
NiceMonster targetZed
|
||||
) {
|
||||
if (nicePawn == none || nicePawn.currentCalibrationState != CALSTATE_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
nicePawn.ServerUpdateCalibration(isHeadshot, targetZed);
|
||||
}
|
||||
static function HitWall(NiceBullet bullet, NiceReplicationInfo niceRI, Actor targetWall,
|
||||
Vector hitLocation, Vector hitNormal){
|
||||
|
||||
static function HitWall(
|
||||
NiceBullet bullet,
|
||||
NiceReplicationInfo niceRI,
|
||||
Actor targetWall,
|
||||
Vector hitLocation,
|
||||
Vector hitNormal
|
||||
) {
|
||||
local NicePlayerController nicePlayer;
|
||||
|
||||
nicePlayer = NicePlayerController(bullet.Instigator.Controller);
|
||||
if(nicePlayer == none)
|
||||
return;
|
||||
if(!bullet.bAlreadyHitZed)
|
||||
HandleCalibration(false, NiceHumanPawn(bullet.Instigator), none);
|
||||
if(!targetWall.bStatic && !targetWall.bWorldGeometry && nicePlayer != none && (nicePlayer.wallHitsLeft > 0 || Projectile(targetWall) != none)){
|
||||
niceRI.ServerDealDamage(targetWall, bullet.charOrigDamage, bullet.Instigator, hitLocation,
|
||||
bullet.charMomentumTransfer * hitNormal, bullet.charDamageType);
|
||||
nicePlayer.wallHitsLeft --;
|
||||
if (nicePlayer == none) {
|
||||
return;
|
||||
}
|
||||
if (!bullet.bAlreadyHitZed) {
|
||||
HandleCalibration(false, NiceHumanPawn(bullet.Instigator), none);
|
||||
}
|
||||
if (
|
||||
!targetWall.bStatic &&
|
||||
!targetWall.bWorldGeometry &&
|
||||
nicePlayer != none &&
|
||||
(nicePlayer.wallHitsLeft > 0 || Projectile(targetWall) != none)
|
||||
) {
|
||||
niceRI.ServerDealDamage(
|
||||
targetWall,
|
||||
bullet.charOrigDamage,
|
||||
bullet.Instigator,
|
||||
hitLocation,
|
||||
bullet.charMomentumTransfer * hitNormal,
|
||||
bullet.charDamageType
|
||||
);
|
||||
nicePlayer.wallHitsLeft --;
|
||||
}
|
||||
}
|
||||
static function HandleScream(NiceBullet bullet, NiceReplicationInfo niceRI, Vector location, Vector entryDirection){
|
||||
|
||||
static function HandleScream(
|
||||
NiceBullet bullet,
|
||||
NiceReplicationInfo niceRI,
|
||||
Vector location,
|
||||
Vector entryDirection
|
||||
) {
|
||||
bullet.charIsDud = true;
|
||||
}
|
||||
static function HitPawn(NiceBullet bullet, NiceReplicationInfo niceRI, KFPawn targetPawn, Vector hitLocation,
|
||||
Vector hitNormal, array<int> hitPoints){
|
||||
|
||||
static function HitPawn(
|
||||
NiceBullet bullet,
|
||||
NiceReplicationInfo niceRI,
|
||||
KFPawn targetPawn,
|
||||
Vector hitLocation,
|
||||
Vector hitNormal,
|
||||
array<int> hitPoints
|
||||
) {
|
||||
local NiceMedicProjectile niceDart;
|
||||
|
||||
niceDart = NiceMedicProjectile(bullet);
|
||||
if(niceDart == none)
|
||||
niceRI.ServerDealDamage(targetPawn, bullet.charDamage, bullet.instigator, HitLocation,
|
||||
hitNormal * bullet.charMomentumTransfer, bullet.charDamageType);
|
||||
else
|
||||
niceRI.ServerHealTarget(NiceHumanPawn(targetPawn), bullet.charDamage, bullet.instigator);
|
||||
if (niceDart == none) {
|
||||
niceRI.ServerDealDamage(
|
||||
targetPawn,
|
||||
bullet.charDamage,
|
||||
bullet.instigator,
|
||||
HitLocation,
|
||||
hitNormal * bullet.charMomentumTransfer,
|
||||
bullet.charDamageType
|
||||
);
|
||||
} else {
|
||||
niceRI.ServerHealTarget(NiceHumanPawn(targetPawn), bullet.charDamage, bullet.instigator);
|
||||
}
|
||||
}
|
||||
static function HitZed(NiceBullet bullet, NiceReplicationInfo niceRI, KFMonster kfZed, Vector hitLocation,
|
||||
Vector hitNormal, float headshotLevel){
|
||||
|
||||
static function HitZed(
|
||||
NiceBullet bullet,
|
||||
NiceReplicationInfo niceRI,
|
||||
KFMonster kfZed,
|
||||
Vector hitLocation,
|
||||
Vector hitNormal,
|
||||
float headshotLevel
|
||||
) {
|
||||
local bool bIsHeadshot, bIsPreciseHeadshot;
|
||||
local float actualDamage;
|
||||
local int lockonTicks;
|
||||
@ -68,74 +143,113 @@ static function HitZed(NiceBullet bullet, NiceReplicationInfo niceRI, KFMonster
|
||||
local NiceHumanPawn nicePawn;
|
||||
local NicePlayerController nicePlayer;
|
||||
local class<NiceVeterancyTypes> niceVet;
|
||||
|
||||
nicePlayer = NicePlayerController(bullet.Instigator.Controller);
|
||||
if ( nicePlayer != none && nicePlayer.abilityManager != none
|
||||
&& nicePlayer.abilityManager.IsAbilityActive(class'NiceSkillEnforcerBruteA'.default.abilityID)) {
|
||||
if (
|
||||
nicePlayer != none &&
|
||||
nicePlayer.abilityManager != none &&
|
||||
nicePlayer.abilityManager.IsAbilityActive(class'NiceSkillEnforcerBruteA'.default.abilityID)
|
||||
) {
|
||||
headshotLevel = 0.0;
|
||||
}
|
||||
bIsHeadshot = (headshotLevel > 0.0);
|
||||
bIsPreciseHeadshot = (headshotLevel > bullet.charDamageType.default.prReqPrecise);
|
||||
if(!bullet.bAlreadyHitZed || bIsHeadshot)
|
||||
HandleCalibration(bIsHeadshot, NiceHumanPawn(bullet.Instigator), NiceMonster(kfZed));
|
||||
if(bIsHeadshot && bullet.sourceWeapon != none)
|
||||
bullet.sourceWeapon.lastHeadshotTime = bullet.Level.TimeSeconds;
|
||||
if(nicePlayer == none)
|
||||
return;
|
||||
nicePawn = NiceHumanPawn(bullet.instigator);
|
||||
if( !bIsHeadshot
|
||||
&& nicePawn != none
|
||||
&& nicePlayer.abilityManager != none
|
||||
&& nicePlayer.abilityManager.IsAbilityActive(class'NiceSkillSharpshooterReaperA'.default.abilityID))
|
||||
nicePawn.ServerCooldownAbility(class'NiceSkillSharpshooterReaperA'.default.abilityID);
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
if(bullet.charCausePain)
|
||||
actualDamage = bullet.charOrigDamage;
|
||||
else
|
||||
actualDamage = bullet.charDamage;
|
||||
if(headshotLevel > 0)
|
||||
actualDamage *= bullet.charContiniousBonus;
|
||||
if(bullet.bGrazing)
|
||||
actualDamage *= class'NiceSkillSupportGraze'.default.grazeDamageMult;
|
||||
bullet.bGrazing = false;
|
||||
if(kfZed == bullet.lockonZed && bullet.lockonTime > bullet.sourceWeapon.stdFireRate
|
||||
&& niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterKillConfirmed')){
|
||||
lockOnTickRate =class'NiceSkillSharpshooterKillConfirmed'.default.stackDelay;
|
||||
lockonTicks = Ceil(bullet.lockonTime / lockOnTickRate) - 1;
|
||||
lockonTicks = Min(class'NiceSkillSharpshooterKillConfirmed'.default.maxStacks, lockonTicks);
|
||||
//actualDamage *= 1.0 +
|
||||
// 0.5 * lockonTicks * (lockonTicks + 1) * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
//damageMod *= 1.0 + lockonTicks * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
actualDamage *= 1.0 + lockonTicks * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
if (!bullet.bAlreadyHitZed || bIsHeadshot) {
|
||||
HandleCalibration(bIsHeadshot, NiceHumanPawn(bullet.Instigator), NiceMonster(kfZed));
|
||||
}
|
||||
if (bIsHeadshot && bullet.sourceWeapon != none) {
|
||||
bullet.sourceWeapon.lastHeadshotTime = bullet.Level.TimeSeconds;
|
||||
}
|
||||
if (nicePlayer == none) {
|
||||
return;
|
||||
}
|
||||
nicePawn = NiceHumanPawn(bullet.instigator);
|
||||
if (
|
||||
!bIsHeadshot &&
|
||||
nicePawn != none &&
|
||||
nicePlayer.abilityManager != none &&
|
||||
nicePlayer.abilityManager.IsAbilityActive(class'NiceSkillSharpshooterReaperA'.default.abilityID)
|
||||
) {
|
||||
nicePawn.ServerCooldownAbility(class'NiceSkillSharpshooterReaperA'.default.abilityID);
|
||||
}
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
if (bullet.charCausePain) {
|
||||
actualDamage = bullet.charOrigDamage;
|
||||
} else {
|
||||
actualDamage = bullet.charDamage;
|
||||
}
|
||||
if (headshotLevel > 0) {
|
||||
actualDamage *= bullet.charContiniousBonus;
|
||||
}
|
||||
if (bullet.bGrazing) {
|
||||
actualDamage *= class'NiceSkillSupportGraze'.default.grazeDamageMult;
|
||||
}
|
||||
bullet.bGrazing = false;
|
||||
if (
|
||||
kfZed == bullet.lockonZed &&
|
||||
bullet.lockonTime > bullet.sourceWeapon.stdFireRate &&
|
||||
niceVet != none &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterKillConfirmed')
|
||||
) {
|
||||
lockOnTickRate =class'NiceSkillSharpshooterKillConfirmed'.default.stackDelay;
|
||||
lockonTicks = Ceil(bullet.lockonTime / lockOnTickRate) - 1;
|
||||
lockonTicks = Min(class'NiceSkillSharpshooterKillConfirmed'.default.maxStacks, lockonTicks);
|
||||
// actualDamage *= 1.0 +
|
||||
// 0.5 * lockonTicks * (lockonTicks + 1) * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
// damageMod *= 1.0 + lockonTicks * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
actualDamage *= 1.0 + lockonTicks * class'NiceSkillSharpshooterKillConfirmed'.default.damageBonus;
|
||||
}
|
||||
if (!bullet.bGhost) {
|
||||
niceRI.ServerDealDamage(
|
||||
kfZed,
|
||||
actualDamage,
|
||||
bullet.instigator,
|
||||
hitLocation,
|
||||
bullet.charMomentumTransfer * hitNormal,
|
||||
bullet.charDamageType,
|
||||
headshotLevel,
|
||||
bullet.lockonTime
|
||||
);
|
||||
}
|
||||
if(!bullet.bGhost)
|
||||
niceRI.ServerDealDamage(kfZed, actualDamage, bullet.instigator, hitLocation,
|
||||
bullet.charMomentumTransfer * hitNormal, bullet.charDamageType, headshotLevel, bullet.lockonTime);
|
||||
//// Handle angled shots
|
||||
angle = asin(hitNormal.Z);
|
||||
// Apply angled shots
|
||||
if((angle > 0.8 || angle < -0.45) && bullet.bCanAngleDamage && kfZed != none){
|
||||
bullet.bCanAngleDamage = false;
|
||||
bullet.bAlreadyHitZed = true;
|
||||
if(ZedPenetration(bullet.charDamage, bullet, kfZed, bIsHeadshot, bIsPreciseHeadshot))
|
||||
HitZed(bullet, niceRI, kfZed, hitLocation, hitNormal, headshotLevel);
|
||||
if ((angle > 0.8 || angle < -0.45) && bullet.bCanAngleDamage && kfZed != none) {
|
||||
bullet.bCanAngleDamage = false;
|
||||
bullet.bAlreadyHitZed = true;
|
||||
if (ZedPenetration(bullet.charDamage, bullet, kfZed, bIsHeadshot, bIsPreciseHeadshot)) {
|
||||
HitZed(bullet, niceRI, kfZed, hitLocation, hitNormal, headshotLevel);
|
||||
}
|
||||
}
|
||||
//// 'Bore' support skill
|
||||
if( niceVet != none && nicePlayer.IsZedTimeActive() && bullet.insideBouncesLeft > 0
|
||||
&& niceVet.static.hasSkill(nicePlayer, class'NiceSkillSupportZEDBore')){
|
||||
// Count one bounce
|
||||
bullet.insideBouncesLeft --;
|
||||
// Swap head-shot level
|
||||
if(headshotLevel <= 0.0)
|
||||
headshotLevel = class'NiceSkillSupportZEDBore'.default.minHeadshotPrecision;
|
||||
else
|
||||
headshotLevel = -headshotLevel;
|
||||
// Deal next batch of damage
|
||||
ZedPenetration(bullet.charDamage, bullet, kfZed, false, false);
|
||||
HitZed(bullet, niceRI, kfZed, hitLocation, hitNormal, headshotLevel);
|
||||
if (
|
||||
niceVet != none &&
|
||||
nicePlayer.IsZedTimeActive() &&
|
||||
bullet.insideBouncesLeft > 0 &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillSupportZEDBore')
|
||||
) {
|
||||
// Count one bounce
|
||||
bullet.insideBouncesLeft --;
|
||||
// Swap head-shot level
|
||||
if (headshotLevel <= 0.0) {
|
||||
headshotLevel = class'NiceSkillSupportZEDBore'.default.minHeadshotPrecision;
|
||||
} else {
|
||||
headshotLevel = -headshotLevel;
|
||||
}
|
||||
// Deal next batch of damage
|
||||
ZedPenetration(bullet.charDamage, bullet, kfZed, false, false);
|
||||
HitZed(bullet, niceRI, kfZed, hitLocation, hitNormal, headshotLevel);
|
||||
}
|
||||
bullet.insideBouncesLeft = 2;
|
||||
}
|
||||
static function bool ZedPenetration(out float Damage, NiceBullet bullet, KFMonster targetZed, bool bIsHeadshot, bool bIsPreciseHeadshot){
|
||||
|
||||
static function bool ZedPenetration(
|
||||
out float Damage,
|
||||
NiceBullet bullet,
|
||||
KFMonster targetZed,
|
||||
bool bIsHeadshot,
|
||||
bool bIsPreciseHeadshot
|
||||
) {
|
||||
local float reductionMod;
|
||||
local NiceMonster niceZed;
|
||||
local NicePlayerController nicePlayer;
|
||||
@ -144,52 +258,74 @@ static function bool ZedPenetration(out float Damage, NiceBullet bullet, KFMonst
|
||||
local class<NiceWeaponDamageType> niceDmgType;
|
||||
// True if we can penetrate even body, but now penetrating a head and shouldn't reduce damage too much
|
||||
local bool bEasyHeadPenetration;
|
||||
|
||||
// Init variables
|
||||
niceZed = NiceMonster(targetZed);
|
||||
nicePlayer = NicePlayerController(bullet.Instigator.Controller);
|
||||
niceVet = none;
|
||||
if(nicePlayer != none)
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
if (nicePlayer != none) {
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
}
|
||||
niceDmgType = bullet.charDamageType;
|
||||
bEasyHeadPenetration = bIsHeadshot && !niceDmgType.default.bPenetrationHSOnly;
|
||||
reductionMod = 1.0f;
|
||||
// Apply zed reduction and perk reduction of reduction`
|
||||
if(niceZed != none){
|
||||
// Railgun skill exception
|
||||
if(niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterZEDRailgun') && nicePlayer.IsZedTimeActive())
|
||||
return true;
|
||||
if(niceZed.default.Health >= default.BigZedMinHealth && !bEasyHeadPenetration)
|
||||
reductionMod *= niceDmgType.default.BigZedPenDmgReduction;
|
||||
else if(niceZed.default.Health >= default.MediumZedMinHealth && !bEasyHeadPenetration)
|
||||
reductionMod *= niceDmgType.default.MediumZedPenDmgReduction;
|
||||
}
|
||||
else
|
||||
if (niceZed != none) {
|
||||
// Railgun skill exception
|
||||
if (
|
||||
niceVet != none &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterZEDRailgun') &&
|
||||
nicePlayer.IsZedTimeActive()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (niceZed.default.Health >= default.BigZedMinHealth && !bEasyHeadPenetration) {
|
||||
reductionMod *= niceDmgType.default.BigZedPenDmgReduction;
|
||||
} else if (niceZed.default.Health >= default.MediumZedMinHealth && !bEasyHeadPenetration) {
|
||||
reductionMod *= niceDmgType.default.MediumZedPenDmgReduction;
|
||||
}
|
||||
} else {
|
||||
reductionMod *= niceDmgType.default.BigZedPenDmgReduction;
|
||||
if(niceVet != none)
|
||||
reductionMod = niceVet.static.GetPenetrationDamageMulti(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo), reductionMod, niceDmgType);
|
||||
actualMaxPenetrations = niceDmgType.default.maxPenetrations;
|
||||
if(niceVet != none && !bullet.charWasHipFired && niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterSurgical') && bIsHeadshot){
|
||||
actualMaxPenetrations += 1;
|
||||
reductionMod = FMax(reductionMod, class'NiceSkillSharpshooterSurgical'.default.penDmgReduction);
|
||||
}
|
||||
}
|
||||
if (niceVet != none) {
|
||||
reductionMod = niceVet.static.GetPenetrationDamageMulti(
|
||||
KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo),
|
||||
reductionMod,
|
||||
niceDmgType
|
||||
);
|
||||
}
|
||||
actualMaxPenetrations = niceDmgType.default.maxPenetrations;
|
||||
if (
|
||||
niceVet != none &&
|
||||
!bullet.charWasHipFired &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillSharpshooterSurgical') &&
|
||||
bIsHeadshot
|
||||
) {
|
||||
actualMaxPenetrations += 1;
|
||||
reductionMod = FMax(reductionMod, class'NiceSkillSharpshooterSurgical'.default.penDmgReduction);
|
||||
}
|
||||
// Assign new damage value and tell us if we should stop with penetration
|
||||
Damage *= reductionMod * niceDmgType.default.PenDmgReduction;
|
||||
bullet.decapMod *= reductionMod * niceDmgType.default.PenDecapReduction;
|
||||
bullet.incapMod *= reductionMod * niceDmgType.default.PenIncapReduction;
|
||||
if(niceVet != none && actualMaxPenetrations >= 0)
|
||||
actualMaxPenetrations +=
|
||||
niceVet.static.GetAdditionalPenetrationAmount(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
if(!bIsHeadshot && niceDmgType.default.bPenetrationHSOnly)
|
||||
return false;
|
||||
if(actualMaxPenetrations < 0)
|
||||
return true;
|
||||
if(Damage / bullet.charOrigDamage < (niceDmgType.default.PenDmgReduction ** (actualMaxPenetrations + 1)) + 0.0001 || Damage < 1)
|
||||
return false;
|
||||
if (niceVet != none && actualMaxPenetrations >= 0) {
|
||||
actualMaxPenetrations +=
|
||||
niceVet.static.GetAdditionalPenetrationAmount(KFPlayerReplicationInfo(nicePlayer.PlayerReplicationInfo));
|
||||
}
|
||||
if (!bIsHeadshot && niceDmgType.default.bPenetrationHSOnly) {
|
||||
return false;
|
||||
}
|
||||
if (actualMaxPenetrations < 0) {
|
||||
return true;
|
||||
}
|
||||
if (Damage / bullet.charOrigDamage < (niceDmgType.default.PenDmgReduction ** (actualMaxPenetrations + 1)) + 0.0001 || Damage < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
BigZedMinHealth=1000
|
||||
MediumZedMinHealth=500
|
||||
}
|
||||
defaultproperties {
|
||||
BigZedMinHealth=1000
|
||||
MediumZedMinHealth=500
|
||||
}
|
@ -1,76 +1,160 @@
|
||||
class NiceProjectileSpawner extends Actor
|
||||
dependson(NiceBullet);
|
||||
|
||||
// NICETODO: use flags correctly
|
||||
static function MakeProjectile(Vector start, Rotator dir, NiceFire.ShotType shotParams, NiceFire.FireModeContext fireContext, optional bool bForceComplexTraj,
|
||||
optional bool bDuplReal, optional bool bSkipGhosts){
|
||||
static function MakeProjectile(
|
||||
Vector start,
|
||||
Rotator dir,
|
||||
NiceFire.ShotType shotParams,
|
||||
NiceFire.FireModeContext fireContext,
|
||||
optional bool bForceComplexTraj,
|
||||
optional bool bDuplReal,
|
||||
optional bool bSkipGhosts
|
||||
) {
|
||||
local int i;
|
||||
local NicePack niceMut;
|
||||
|
||||
niceMut = class'NicePack'.static.Myself(fireContext.Instigator.Level);
|
||||
if(niceMut == none)
|
||||
return;
|
||||
if(fireContext.Instigator.Role < ROLE_Authority || bDuplReal)
|
||||
SpawnProjectile(Start, Dir, shotParams, fireContext, false, bForceComplexTraj);
|
||||
if(fireContext.Instigator.Role == ROLE_Authority && niceMut != none && !bSkipGhosts){
|
||||
for(i = 0;i < niceMut.playersList.Length;i ++){
|
||||
if(niceMut.playersList[i] != fireContext.Instigator.Controller)
|
||||
niceMut.playersList[i].ClientSpawnGhostProjectile(start, dir.pitch, dir.yaw, dir.roll, shotParams, fireContext, bForceComplexTraj);
|
||||
}
|
||||
if (niceMut == none) {
|
||||
return;
|
||||
}
|
||||
if (fireContext.Instigator.Role < ROLE_Authority || bDuplReal) {
|
||||
SpawnProjectile(Start, Dir, shotParams, fireContext, false, bForceComplexTraj);
|
||||
}
|
||||
if (fireContext.Instigator.Role == ROLE_Authority && niceMut != none && !bSkipGhosts) {
|
||||
for (i = 0; i < niceMut.playersList.Length; i++) {
|
||||
if (niceMut.playersList[i] != fireContext.Instigator.Controller) {
|
||||
niceMut.playersList[i].ClientSpawnGhostProjectile(
|
||||
start,
|
||||
dir.pitch,
|
||||
dir.yaw,
|
||||
dir.roll,
|
||||
shotParams,
|
||||
fireContext,
|
||||
bForceComplexTraj
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static function StickProjectile(KFHumanPawn instigator, Actor base, name bone, Vector shift, Rotator direction,
|
||||
NiceBullet.ExplosionData expData, optional bool bDuplReal, optional bool bSkipGhosts){
|
||||
|
||||
static function StickProjectile(
|
||||
KFHumanPawn instigator,
|
||||
Actor base,
|
||||
name bone,
|
||||
Vector shift,
|
||||
Rotator direction,
|
||||
NiceBullet.ExplosionData expData,
|
||||
optional bool bDuplReal,
|
||||
optional bool bSkipGhosts
|
||||
) {
|
||||
local int i;
|
||||
local NicePack niceMut;
|
||||
|
||||
niceMut = class'NicePack'.static.Myself(expData.Instigator.Level);
|
||||
if(niceMut == none)
|
||||
return;
|
||||
if (niceMut == none) {
|
||||
return;
|
||||
}
|
||||
niceMut.stuckCounter ++;
|
||||
if(expData.Instigator.Role < ROLE_Authority)
|
||||
SpawnStuckProjectile(instigator, base, bone, shift, direction, expData, false, niceMut.stuckCounter);
|
||||
if(expData.Instigator.Role == ROLE_Authority && niceMut != none){
|
||||
for(i = 0;i < niceMut.playersList.Length;i ++){
|
||||
if( (niceMut.playersList[i] != expData.Instigator.Controller && !bSkipGhosts)
|
||||
|| (niceMut.playersList[i] == expData.Instigator.Controller && bDuplReal) )
|
||||
niceMut.playersList[i].ClientStickGhostProjectile(instigator, base, bone, shift, direction, expData,
|
||||
niceMut.stuckCounter);
|
||||
}
|
||||
if (expData.Instigator.Role < ROLE_Authority) {
|
||||
SpawnStuckProjectile(
|
||||
instigator,
|
||||
base,
|
||||
bone,
|
||||
shift,
|
||||
direction,
|
||||
expData,
|
||||
false,
|
||||
niceMut.stuckCounter
|
||||
);
|
||||
}
|
||||
if (expData.Instigator.Role == ROLE_Authority && niceMut != none) {
|
||||
for (i = 0; i < niceMut.playersList.Length; i++) {
|
||||
if (
|
||||
(niceMut.playersList[i] != expData.Instigator.Controller && !bSkipGhosts) ||
|
||||
(niceMut.playersList[i] == expData.Instigator.Controller && bDuplReal)
|
||||
) {
|
||||
niceMut.playersList[i].ClientStickGhostProjectile(
|
||||
instigator,
|
||||
base,
|
||||
bone,
|
||||
shift,
|
||||
direction,
|
||||
expData,
|
||||
niceMut.stuckCounter
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static function NiceBullet SpawnProjectile(Vector Start, Rotator Dir, NiceFire.ShotType shotParams, NiceFire.FireModeContext fireContext, optional bool bIsGhost, optional bool bForceComplexTraj){
|
||||
|
||||
static function NiceBullet SpawnProjectile(
|
||||
Vector Start,
|
||||
Rotator Dir,
|
||||
NiceFire.ShotType shotParams,
|
||||
NiceFire.FireModeContext fireContext,
|
||||
optional bool bIsGhost,
|
||||
optional bool bForceComplexTraj
|
||||
) {
|
||||
local Actor other;
|
||||
local NiceBullet niceProj;
|
||||
local Vector HitLocation, HitNormal;
|
||||
local NicePlayerController nicePlayer;
|
||||
local class<NiceVeterancyTypes> niceVet;
|
||||
|
||||
// No class - no projectile
|
||||
if(shotParams.bulletClass == none)
|
||||
return none;
|
||||
if (shotParams.bulletClass == none) {
|
||||
return none;
|
||||
}
|
||||
// Try to spawn
|
||||
if(fireContext.Instigator != none)
|
||||
niceProj = fireContext.Instigator.Spawn(shotParams.bulletClass,,, Start, Dir);
|
||||
if (fireContext.Instigator != none) {
|
||||
niceProj = fireContext.Instigator.Spawn(shotParams.bulletClass,,, Start, Dir);
|
||||
}
|
||||
// Try harder
|
||||
if(niceProj == none && fireContext.Instigator != none){
|
||||
other = fireContext.Instigator.Trace(HitLocation, HitNormal, Start, fireContext.Instigator.Location + fireContext.Instigator.EyePosition(), false, Vect(0,0,1));
|
||||
if(other != none)
|
||||
Start = HitLocation;
|
||||
niceProj = fireContext.Instigator.Spawn(shotParams.bulletClass,,, Start, Dir);
|
||||
if (niceProj == none && fireContext.Instigator != none) {
|
||||
other = fireContext.Instigator.Trace(
|
||||
HitLocation,
|
||||
HitNormal,
|
||||
Start,
|
||||
fireContext.Instigator.Location + fireContext.Instigator.EyePosition(),
|
||||
false,
|
||||
Vect(0, 0, 1)
|
||||
);
|
||||
if (other != none) {
|
||||
Start = HitLocation;
|
||||
}
|
||||
niceProj = fireContext.Instigator.Spawn(shotParams.bulletClass,,, Start, Dir);
|
||||
}
|
||||
// Give up if failed after these two attempts
|
||||
if(niceProj == none)
|
||||
return none;
|
||||
if (niceProj == none) {
|
||||
return none;
|
||||
}
|
||||
niceProj.Renew();
|
||||
// Initialize projectile
|
||||
if(fireContext.Instigator != none)
|
||||
nicePlayer = NicePlayerController(fireContext.Instigator.Controller);
|
||||
if(nicePlayer != none)
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(nicePlayer.PlayerReplicationInfo);
|
||||
if (fireContext.Instigator != none) {
|
||||
nicePlayer = NicePlayerController(fireContext.Instigator.Controller);
|
||||
}
|
||||
if (nicePlayer != none) {
|
||||
niceVet = class'NiceVeterancyTypes'.static.GetVeterancy(nicePlayer.PlayerReplicationInfo);
|
||||
}
|
||||
niceProj.bGhost = bIsGhost;
|
||||
// Fill-up data about what damage should projectile deal
|
||||
niceProj.charDamage = shotParams.damage;
|
||||
if(niceVet != none && fireContext.bIsBursting && niceVet.static.hasSkill(nicePlayer, class'NiceSkillCommandoExplosivePower'))
|
||||
if (
|
||||
niceVet != none &&
|
||||
fireContext.bIsBursting &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillCommandoExplosivePower')
|
||||
) {
|
||||
niceProj.charDamage *= class'NiceSkillCommandoExplosivePower'.default.dmgMod;
|
||||
if(niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillSupportZEDBulletStorm') && nicePlayer.IsZedTimeActive())
|
||||
}
|
||||
if (
|
||||
niceVet != none &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillSupportZEDBulletStorm') &&
|
||||
nicePlayer.IsZedTimeActive()
|
||||
) {
|
||||
niceProj.charDamage = shotParams.damage * class'NiceSkillSupportZEDBulletStorm'.default.damageCut;
|
||||
}
|
||||
|
||||
niceProj.charOrigDamage = niceProj.charDamage;
|
||||
niceProj.charDamageType = shotParams.shotDamageType;
|
||||
niceProj.charExplosionDamageType = shotParams.explosionDamageType;
|
||||
@ -92,76 +176,94 @@ static function NiceBullet SpawnProjectile(Vector Start, Rotator Dir, NiceFire.S
|
||||
niceProj.charContiniousBonus = fireContext.continiousBonus;
|
||||
// Fill-up data about at what speed should projectile travel
|
||||
niceProj.movementSpeed = shotParams.projSpeed;
|
||||
if(niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoOnperk'))
|
||||
if (niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoOnperk')) {
|
||||
niceProj.movementSpeed *= class'NiceSkillDemoOnperk'.default.speedBonus;
|
||||
}
|
||||
niceProj.movementDirection = Vector(niceProj.rotation);
|
||||
niceProj.charAffectedByScream = shotParams.projAffectedByScream;
|
||||
niceProj.charIsSticky = shotParams.bShouldStick;
|
||||
niceProj.nicePlayer = nicePlayer;
|
||||
if(niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoVolatile')){
|
||||
if (niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoVolatile')) {
|
||||
niceProj.charExplosionRadius *= class'NiceSkillDemoVolatile'.default.explRangeMult;
|
||||
niceProj.charExplosionExponent *= class'NiceSkillDemoVolatile'.default.falloffMult;
|
||||
niceProj.charMinExplosionDist *= class'NiceSkillDemoVolatile'.default.safeDistanceMult;
|
||||
}
|
||||
if(niceVet != none && niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoZEDFullBlast') && nicePlayer.IsZedTimeActive()){
|
||||
niceProj.charExplosionRadius *= class'NiceSkillDemoZEDFullBlast'.default.explRadiusMult;
|
||||
niceProj.charExplosionExponent = 0.0;
|
||||
if (
|
||||
niceVet != none &&
|
||||
niceVet.static.hasSkill(nicePlayer, class'NiceSkillDemoZEDFullBlast') &&
|
||||
nicePlayer.IsZedTimeActive()
|
||||
) {
|
||||
niceProj.charExplosionRadius *= class'NiceSkillDemoZEDFullBlast'.default.explRadiusMult;
|
||||
niceProj.charExplosionExponent = 0.0;
|
||||
}
|
||||
if (bForceComplexTraj) {
|
||||
niceProj.bDisableComplexMovement = false;
|
||||
}
|
||||
if (niceProj.Instigator != none && NicePlayerController(niceProj.Instigator.Controller) != none) {
|
||||
niceProj.niceRI = NicePlayerController(niceProj.Instigator.Controller).NiceRI;
|
||||
}
|
||||
if(bForceComplexTraj)
|
||||
niceProj.bDisableComplexMovement = false;
|
||||
if(niceProj.Instigator != none && NicePlayerController(niceProj.Instigator.Controller) != none)
|
||||
niceProj.niceRI = NicePlayerController(niceProj.Instigator.Controller).NiceRI;
|
||||
// And some leftovers
|
||||
//niceProj.bShouldBounce = shotParams.bShouldBounce;
|
||||
niceProj.bInitFinished = true;
|
||||
|
||||
return niceProj;
|
||||
}
|
||||
static function SpawnStuckProjectile(KFHumanPawn instigator, Actor base, name bone, Vector shift, Rotator direction,
|
||||
NiceBullet.ExplosionData expData, bool bIsGhost, int stuckID){
|
||||
local Pawn justPawn;
|
||||
local NiceFire.ShotType shotParams;
|
||||
local NiceFire.FireModeContext fireContext;
|
||||
local NiceBullet spawnedBullet;
|
||||
local NicePlayerController nicePlayer;
|
||||
|
||||
static function SpawnStuckProjectile(
|
||||
KFHumanPawn instigator,
|
||||
Actor base,
|
||||
name bone,
|
||||
Vector shift,
|
||||
Rotator direction,
|
||||
NiceBullet.ExplosionData expData,
|
||||
bool bIsGhost,
|
||||
int stuckID
|
||||
) {
|
||||
local Pawn justPawn;
|
||||
local NiceFire.ShotType shotParams;
|
||||
local NiceFire.FireModeContext fireContext;
|
||||
local NiceBullet spawnedBullet;
|
||||
local NicePlayerController nicePlayer;
|
||||
|
||||
nicePlayer = NicePlayerController(instigator.Controller);
|
||||
if(base == none || nicePlayer == none)
|
||||
return;
|
||||
if (base == none || nicePlayer == none) {
|
||||
return;
|
||||
}
|
||||
justPawn = Pawn(base);
|
||||
fireContext.instigator = NiceHumanPawn(instigator);
|
||||
fireContext.sourceWeapon = expData.sourceWeapon;
|
||||
shotParams.bulletClass = expData.bulletClass;
|
||||
shotParams.explosionDamageType = expData.explosionDamageType;
|
||||
shotParams.explosionDamage = expData.explosionDamage;
|
||||
shotParams.explosionRadius = expData.explosionRadius;
|
||||
shotParams.explosionExponent = expData.explosionExponent;
|
||||
shotParams.explosionMomentum = expData.explosionMomentum;
|
||||
shotParams.fuseTime = expData.fuseTime;
|
||||
shotParams.explodeOnFuse = expData.explodeOnFuse;
|
||||
fireContext.instigator = NiceHumanPawn(instigator);
|
||||
fireContext.sourceWeapon = expData.sourceWeapon;
|
||||
shotParams.bulletClass = expData.bulletClass;
|
||||
shotParams.explosionDamageType = expData.explosionDamageType;
|
||||
shotParams.explosionDamage = expData.explosionDamage;
|
||||
shotParams.explosionRadius = expData.explosionRadius;
|
||||
shotParams.explosionExponent = expData.explosionExponent;
|
||||
shotParams.explosionMomentum = expData.explosionMomentum;
|
||||
shotParams.fuseTime = expData.fuseTime;
|
||||
shotParams.explodeOnFuse = expData.explodeOnFuse;
|
||||
shotParams.projAffectedByScream = expData.affectedByScream;
|
||||
spawnedBullet = SpawnProjectile(base.location, direction, shotParams, fireContext, bIsGhost);
|
||||
if(spawnedBullet == none)
|
||||
return;
|
||||
if (spawnedBullet == none) {
|
||||
return;
|
||||
}
|
||||
spawnedBullet.stuckID = stuckID;
|
||||
spawnedBullet.bStuck = true;
|
||||
nicePlayer.RegisterStuckBullet(spawnedBullet);
|
||||
if(justPawn != none){
|
||||
spawnedBullet.bStuckToHead = expData.stuckToHead;
|
||||
spawnedBullet.SetBase(base);
|
||||
justPawn.AttachToBone(spawnedBullet, bone);
|
||||
spawnedBullet.SetRelativeLocation(shift);
|
||||
spawnedBullet.SetRelativeRotation(Rotator(Vector(direction) << justPawn.GetBoneRotation(bone, 0)));
|
||||
spawnedBullet.bUseBone = true;
|
||||
spawnedBullet.stuckBone = bone;
|
||||
}
|
||||
else{
|
||||
spawnedBullet.SetBase(base);
|
||||
spawnedBullet.SetRelativeLocation(shift);
|
||||
if (justPawn != none) {
|
||||
spawnedBullet.bStuckToHead = expData.stuckToHead;
|
||||
spawnedBullet.SetBase(base);
|
||||
justPawn.AttachToBone(spawnedBullet, bone);
|
||||
spawnedBullet.SetRelativeLocation(shift);
|
||||
spawnedBullet.SetRelativeRotation(Rotator(Vector(direction) << justPawn.GetBoneRotation(bone, 0)));
|
||||
spawnedBullet.bUseBone = true;
|
||||
spawnedBullet.stuckBone = bone;
|
||||
} else {
|
||||
spawnedBullet.SetBase(base);
|
||||
spawnedBullet.SetRelativeLocation(shift);
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bHidden=True
|
||||
RemoteRole=ROLE_SimulatedProxy
|
||||
LifeSpan=1.000000
|
||||
}
|
||||
defaultproperties {
|
||||
bHidden=True
|
||||
RemoteRole=ROLE_SimulatedProxy
|
||||
LifeSpan=1.000000
|
||||
}
|
Loading…
Reference in New Issue
Block a user