Add dynamic spread mechanic
This commit is contained in:
		
							parent
							
								
									f8cf67e117
								
							
						
					
					
						commit
						796b699825
					
				| @ -38,6 +38,10 @@ var bool    projAffectedByScream; | ||||
| var bool    bShouldStick; | ||||
| var int resetTicks; | ||||
| var float niceNextFireTime; | ||||
| var float minimalSpreadScale; | ||||
| var float activeSpreadScale; | ||||
| var float spreadGainedPerShot; | ||||
| var float spreadLostPerSecond; | ||||
| struct FireModeContext{ | ||||
|     var bool            bHipfire; | ||||
|     var NiceWeapon      sourceWeapon; | ||||
| @ -152,9 +156,15 @@ simulated function int GetBurstLength(){ | ||||
|    } | ||||
|    return currentContext.burstLength; | ||||
| } | ||||
| 
 | ||||
| simulated function ModeTick(float delta){ | ||||
|     local float headLevel; | ||||
|     local NiceMonster currTarget; | ||||
|     if (spreadLostPerSecond > 0 && activeSpreadScale > minimalSpreadScale | ||||
|          && niceNextFireTime + fireRate <= Level.TimeSeconds) { | ||||
|       activeSpreadScale -= spreadLostPerSecond * delta; | ||||
|       activeSpreadScale = FMax(minimalSpreadScale, activeSpreadScale); | ||||
|     } | ||||
|     if(currentContext.Instigator == none) | ||||
|        currentContext.Instigator = NiceHumanPawn(Instigator); | ||||
|     if(currentContext.sourceWeapon == none) | ||||
| @ -548,7 +558,7 @@ function DoFireEffect(){ | ||||
|     if(!Weapon.WeaponCentered() && !KFWeap.bAimingRifle) | ||||
|        StartProj = StartProj + Weapon.Hand * Y * ProjSpawnOffset.Y + Z * ProjSpawnOffset.Z; | ||||
|     other = Weapon.Trace(HitLocation, HitNormal, StartProj, StartTrace, false); | ||||
|     activeSpread = fireShots[currentShot].spread; | ||||
|     activeSpread = fireShots[currentShot].spread * activeSpreadScale; | ||||
|     if(class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerBombard')){ | ||||
|        bPinpoint = true; | ||||
|        activeSpread *= class'NiceSkillEnforcerBombard'.default.spreadMult; | ||||
| @ -607,6 +617,15 @@ function DoFireEffect(){ | ||||
|        else if(Instigator.Physics == PHYS_Falling && Instigator.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z) | ||||
|            Instigator.AddVelocity((KickMomentum * LowGravKickMomentumScale) >> Instigator.GetViewRotation()); | ||||
|     } | ||||
|     if (activeSpreadScale < 1.0) { | ||||
|       if (KFWeap.bAimingRifle) { | ||||
|          activeSpreadScale += spreadGainedPerShot * 0.5; | ||||
|       } | ||||
|       else { | ||||
|          activeSpreadScale += spreadGainedPerShot; | ||||
|       } | ||||
|       activeSpreadScale = FMin(1.0, activeSpreadScale); | ||||
|     } | ||||
| } | ||||
| simulated function float TraceZed(out NiceMonster tracedZed, optional out Vector hitLoc, optional out Vector hitNorm, | ||||
|     optional float hsMultiplier){ | ||||
| @ -712,13 +731,17 @@ simulated function float UpdateNextFireTime(float fireTimeVar){ | ||||
| 
 | ||||
| defaultproperties | ||||
| { | ||||
|      zedTimeFireSpeedUp=1.000000 | ||||
|      ProjPerFire=1 | ||||
|      ProjectileSpeed=1524.000000 | ||||
|      MaxBurstLength=3 | ||||
|      bulletClass=class'NiceBullet' | ||||
|      contBonus=1.200000 | ||||
|      contBonusReset=True | ||||
|      maxBonusContLenght=1 | ||||
|      AmmoPerFire=1 | ||||
|    zedTimeFireSpeedUp=1.000000 | ||||
|    ProjPerFire=1 | ||||
|    ProjectileSpeed=1524.000000 | ||||
|    MaxBurstLength=3 | ||||
|    bulletClass=class'NiceBullet' | ||||
|    contBonus=1.200000 | ||||
|    contBonusReset=True | ||||
|    maxBonusContLenght=1 | ||||
|    AmmoPerFire=1 | ||||
|    minimalSpreadScale=1 | ||||
|    activeSpreadScale=1 | ||||
|    spreadGainedPerShot=0 | ||||
|    spreadLostPerSecond=0 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user