Advertisement
Guest User

Untitled

a guest
Jul 14th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // KFWeap_Blunt_BALROG9
  3. //=============================================================================
  4.  
  5. class KFWeap_Blunt_Balrog9 extends KFWeap_MeleeBase;
  6.  
  7. const ShootAnim_L = 'Atk_H_B';
  8. const ShootAnim_R = 'Atk_H_R';
  9. const ShootAnim_F = 'Atk_H_F';
  10. const ShootAnim_B = 'Atk_H_B';
  11.  
  12. var bool bWasTimeDilated;
  13.  
  14. /** Explosion actor class to spawn */
  15. var class<KFExplosionActor> ExplosionActor${1}< ${3} >
  16. var() KFGameExplosion ExplosionTemplate;
  17. /** If true, use an alternate set of explosion effects */
  18. var bool    bAltExploEffects;
  19. var KFImpactEffectInfo AltExploEffects;
  20.  
  21. var transient Actor BlastAttachee;
  22.  
  23. /** Spawn location offset to improve cone hit detection */
  24. var transient float BlastSpawnOffset;
  25.  
  26. /** If set, heavy attack button has been released during the attack */
  27. var transient bool bPulverizerFireReleased;
  28.  
  29. var bool bFriendlyFireEnabled;
  30.  
  31. var class<KFExplosionActor> NukeExplosionActor${1}< ${3} >
  32.  
  33. replication
  34. {
  35.     if (bNetInitial)
  36.         bFriendlyFireEnabled;
  37. }
  38.  
  39. simulated event PreBeginPlay()
  40. {
  41.     Super.PreBeginPlay();
  42.  
  43.     /** Initially check whether friendly fire is on or not. */
  44.     if(Role == ROLE_Authority && KFGameInfo(WorldInfo.Game).FriendlyFireScale != 0.f)
  45.     {
  46.         bFriendlyFireEnabled = true;
  47.     }
  48. }
  49.  
  50. /** Pulverizer should be able to interrupt its reload state with any melee attack */
  51. //simulated function bool CanOverrideMagReload(byte FireModeNum)
  52. //{
  53. //  return FireModeNum != RELOAD_FIREMODE;
  54. //}
  55.  
  56. /** Explosion Actor version */
  57. simulated function CustomFire()
  58. {
  59.     local KFExplosionActor ExploActor;
  60.     local vector SpawnLoc;
  61.     local rotator SpawnRot;
  62.  
  63.     if ( Instigator.Role < ROLE_Authority )
  64.     {
  65.         return;
  66.     }
  67.  
  68.     // On local player or server, we cache off our time dilation setting here
  69.     if (WorldInfo.NetMode == NM_ListenServer || WorldInfo.NetMode == NM_DedicatedServer || Instigator.Controller != None)
  70.     {
  71.         bWasTimeDilated = WorldInfo.TimeDilation < 1.f;
  72.     }
  73.  
  74.     PrepareExplosionTemplate();
  75.     SetExplosionActorClass();
  76.  
  77.     SpawnLoc = Instigator.GetWeaponStartTraceLocation();
  78.     SpawnRot = GetPulverizerAim(SpawnLoc);
  79.  
  80.     // nudge backwards to give a wider code near the player
  81.     SpawnLoc += vector(SpawnRot) * BlastSpawnOffset;
  82.  
  83.     // explode using the given template
  84.     ExploActor = Spawn(ExplosionActorClass, self,, SpawnLoc, SpawnRot,, true);
  85.     if (ExploActor != None)
  86.     {
  87.         ExploActor.InstigatorController = Instigator.Controller;
  88.         ExploActor.Instigator = Instigator;
  89.  
  90.         // Force the actor we collided with to get hit again (when DirectionalExplosionAngleDeg is small)
  91.         // This is only necessary on server since GetEffectCheckRadius() will be zero on client
  92.         ExploActor.Attachee = BlastAttachee;
  93.         ExplosionTemplate.bFullDamageToAttachee = true;
  94.  
  95.         // enable muzzle location sync
  96.         ExploActor.bReplicateInstigator = true;
  97.         ExploActor.SetSyncToMuzzleLocation(true);
  98.  
  99.         ExploActor.Explode(ExplosionTemplate, vector(SpawnRot));
  100.     }
  101.  
  102.     // tell remote clients that we fired, to trigger effects in third person
  103.     IncrementFlashCount();
  104.  
  105.     if ( bDebug )
  106.     {
  107.         DrawDebugCone(SpawnLoc, vector(SpawnRot), ExplosionTemplate.DamageRadius, ExplosionTemplate.DirectionalExplosionAngleDeg * DegToRad,
  108.             ExplosionTemplate.DirectionalExplosionAngleDeg * DegToRad, 16, MakeColor(64,64,255,0), TRUE);
  109.     }
  110. }
  111.  
  112. // for nukes && concussive force
  113. simulated protected function PrepareExplosionTemplate()
  114. {
  115.     local KFPlayerReplicationInfo InstigatorPRI;
  116.     local KFPlayerController KFPC;
  117.     local KFPerk InstigatorPerk;
  118.  
  119.     if (bWasTimeDilated)
  120.     {
  121.         InstigatorPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
  122.         if (InstigatorPRI != none)
  123.         {
  124.             if (InstigatorPRI.bNukeActive)
  125.             {
  126.                 ExplosionTemplate = class'KFPerk_Demolitionist'.static.GetNukeExplosionTemplate();
  127.                 ExplosionTemplate.Damage = ExplosionTemplate.Damage * class'KFPerk_Demolitionist'.static.GetNukeDamageModifier();
  128.                 ExplosionTemplate.DamageRadius = ExplosionTemplate.DamageRadius * class'KFPerk_Demolitionist'.static.GetNukeRadiusModifier();
  129.                 ExplosionTemplate.DamageFalloffExponent = ExplosionTemplate.DamageFalloffExponent;
  130.             }
  131.             else if (InstigatorPRI.bConcussiveActive && AltExploEffects != none)
  132.             {
  133.                 ExplosionTemplate.ExplosionEffects = AltExploEffects;
  134.                 ExplosionTemplate.ExplosionSound = class'KFPerk_Demolitionist'.static.GetConcussiveExplosionSound();
  135.             }
  136.         }
  137.     }
  138.     else
  139.     {
  140.         ExplosionTemplate = default.ExplosionTemplate;
  141.         ExplosionTemplate.ExplosionEffects = default.ExplosionTemplate.ExplosionEffects;
  142.         ExplosionTemplate.ExplosionSound = default.ExplosionTemplate.ExplosionSound;
  143.         ExplosionTemplate.Damage = ExplosionTemplate.default.Damage;
  144.         ExplosionTemplate.DamageRadius = ExplosionTemplate.default.DamageRadius;
  145.         ExplosionTemplate.DamageFalloffExponent = ExplosionTemplate.default.DamageFalloffExponent;
  146.     }
  147.  
  148.     // Change the radius and damage based on the perk
  149.     if (Owner.Role == ROLE_Authority)
  150.     {
  151.         KFPC = KFPlayerController(Instigator.Controller);
  152.         if (KFPC != none)
  153.         {
  154.             InstigatorPerk = KFPC.GetPerk();
  155.             ExplosionTemplate.DamageRadius *= InstigatorPerk.GetAoERadiusModifier();
  156.         }
  157.     }
  158. }
  159.  
  160. simulated protected function SetExplosionActorClass()
  161. {
  162.     local KFPlayerReplicationInfo InstigatorPRI;
  163.  
  164.     if (bWasTimeDilated && Instigator != none)
  165.     {
  166.         InstigatorPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
  167.         if (InstigatorPRI != none)
  168.         {
  169.             if (InstigatorPRI.bNukeActive)
  170.             {
  171.                 ExplosionActorClass = NukeExplosionActor${1}< ${3} >
  172.                 return;
  173.             }
  174.         }
  175.     }
  176.     ExplosionActorClass = default.ExplosionActor${1}< ${3} >
  177. }
  178.  
  179. /** Called by CustomFire when shotgun blast is fired */
  180. simulated function Rotator GetPulverizerAim( vector StartFireLoc )
  181. {
  182.     local Rotator R;
  183.  
  184.     R = GetAdjustedAim(StartFireLoc);
  185.  
  186.     // Adjust cone fire angle based on swing direction
  187.     switch (MeleeAttackHelper.CurrentAttackDir)
  188.     {
  189.         case DIR_Left:
  190.             R.Yaw += 5461;
  191.             break;
  192.         case DIR_Right:
  193.             R.Yaw -= 5461;
  194.         break;
  195.         case DIR_Forward:
  196.             R.Pitch -= 2048;
  197.         break;
  198.         case DIR_Backward:
  199.             R.Pitch += 2048;
  200.         break;
  201.     }
  202.  
  203.     return R;
  204. }
  205.  
  206. /** Don't play a shoot anim when FireAmmunition is called */
  207. simulated function name GetWeaponFireAnim(byte FireModeNum)
  208. {
  209.     // Adjust cone fire angle based on swing direction
  210.     switch (MeleeAttackHelper.CurrentAttackDir)
  211.     {
  212.         case DIR_Forward:
  213.         case DIR_ForwardLeft:
  214.         case DIR_ForwardRight:
  215.             return ShootAnim_F;
  216.         case DIR_Backward:
  217.         case DIR_BackwardLeft:
  218.         case DIR_BackwardRight:
  219.             return ShootAnim_B;
  220.         case DIR_Left:
  221.             return ShootAnim_L;
  222.         case DIR_Right:
  223.             return ShootAnim_R;
  224.     }
  225.     return '';
  226. }
  227.  
  228. /** Called on the server alongside PulverizerFired */
  229. reliable server private function ServerBeginPulverizerFire(Actor HitActor, optional vector HitLocation)
  230. {
  231.     // Ignore if too far away (something went wrong!)
  232.     if ( VSizeSq2D(HitLocation - Instigator.Location) > Square(500) )
  233.     {
  234.         `log("ServerBeginPulverizerFire outside of range!");
  235.         return;
  236.     }
  237.  
  238.     BlastAttachee = HitActor;
  239.     SendToFiringState(CUSTOM_FIREMODE);
  240. }
  241.  
  242. /** Called when altfire melee attack hits a target and there is ammo left */
  243. simulated function BeginPulverizerFire()
  244. {
  245.     SendToFiringState(CUSTOM_FIREMODE);
  246. }
  247.  
  248. /** Skip calling StillFiring/PendingFire to fix log warning */
  249. simulated function bool ShouldRefire()
  250. {
  251.     if ( CurrentFireMode == CUSTOM_FIREMODE )
  252.         return false;
  253.  
  254.     return Super.ShouldRefire();
  255. }
  256.  
  257. /** Debugging */
  258. `if(`notdefined(ShippingPC))
  259. exec function ToggleWeaponDebug()
  260. {
  261.     bDebug = !bDebug;
  262. }
  263. `endif
  264.  
  265. /*********************************************************************************************
  266.  * State MeleeHeavyAttacking
  267.  * This is the alt-fire Melee State.
  268.  *********************************************************************************************/
  269.  
  270. simulated state MeleeHeavyAttacking
  271. {
  272.     /** Reset bPulverizerFireReleased */
  273.     simulated event BeginState(Name PreviousStateName)
  274.     {
  275.         Super.BeginState(PreviousStateName);
  276.         bPulverizerFireReleased = false;
  277.     }
  278.  
  279.     /** Set bPulverizerFireReleased to ignore NotifyMeleeCollision */
  280.     simulated function StopFire(byte FireModeNum)
  281.     {
  282.         Super.StopFire(FireModeNum);
  283.         bPulverizerFireReleased = true;
  284.     }
  285.  
  286.     /** Network: Local Player */
  287.     simulated function NotifyMeleeCollision(Actor HitActor, optional vector HitLocation)
  288.     {
  289.         local KFPawn Victim;
  290.  
  291.         // If fire button is being held down, try firing pulverizer
  292.         if ( Instigator != None && Instigator.IsLocallyControlled() /*&& !bPulverizerFireReleased*/ )
  293.         {
  294.             // only detonate when the pulverizer hits a pawn so that level geometry doesn't get in the way
  295.             if ( HitActor.bWorldGeometry )
  296.             {
  297.                 return;
  298.             }
  299.  
  300.             Victim = KFPawn(HitActor);
  301.             if ( Victim == None ||
  302.                 (!bFriendlyFireEnabled && Victim.GetTeamNum() == Instigator.GetTeamNum()) ||
  303.                 (Victim.bPlayedDeath && `TimeSince(Victim.TimeOfDeath) > 0.f) )
  304.             {
  305.                 return;
  306.             }
  307.  
  308.             if ( !IsTimerActive(nameof(BeginPulverizerFire)) )
  309.             {
  310.                 BlastAttachee = HitActor;
  311.  
  312.                 // need to delay one frame, since this is called from AnimNotify
  313.                 SetTimer(0.001f, false, nameof(BeginPulverizerFire));
  314.  
  315.                 if ( Role < ROLE_Authority )
  316.                 {
  317.                     if( HitActor.bTearOff && Victim != none )
  318.                     {
  319.                         Victim.TakeRadiusDamage(Instigator.Controller, ExplosionTemplate.Damage, ExplosionTemplate.DamageRadius, ExplosionTemplate.MyDamageType,
  320.                             ExplosionTemplate.MomentumTransferScale, Location, true, (Owner != None) ? Owner : self);
  321.                     }
  322.                     else
  323.                     {
  324.                         ServerBeginPulverizerFire(HitActor, HitLocation);
  325.                     }
  326.                 }
  327.             }
  328.         }
  329.     }
  330. }
  331.  
  332. defaultproperties
  333. {
  334.  
  335.     AssociatedPerkClasses(0)=class'KFPerk_Berserker'
  336.  
  337.     // Content
  338.     PackageKey="BALROG9"
  339.     FirstPersonMeshName="WEP_BALROG_MESH.Wep_1stP_Balrog9s_Rig"
  340.     FirstPersonAnimSetNames(0)="wep_1p_static_strikers_anim.wep_1p_static_strikers_anim"
  341.     PickupMeshName="WEP_BALROG_MESH.Wep_3rdP_Balrog9_Pickup"
  342.     AttachmentArchetypeName="WEP_BALROG9_ARCH.Wep_Balrog9_3P"
  343.  
  344.     Begin Object Name=MeleeHelper_0
  345.         MaxHitRange=120 //150 //190
  346.         // Override automatic hitbox creation (advanced)
  347.         HitboxChain.Add((BoneOffset=(Y=+5,Z=250)))
  348.         HitboxChain.Add((BoneOffset=(Y=+5,Z=170)))
  349.         HitboxChain.Add((BoneOffset=(Y=+5,Z=150)))
  350.         HitboxChain.Add((BoneOffset=(Y=-5,Z=130)))
  351.         HitboxChain.Add((BoneOffset=(Y=+5,Z=110)))
  352.         HitboxChain.Add((BoneOffset=(Y=-5,Z=90)))
  353.         HitboxChain.Add((BoneOffset=(Y=+5,Z=70)))
  354.         HitboxChain.Add((BoneOffset=(Y=-5,Z=50)))
  355.         HitboxChain.Add((BoneOffset=(Y=+5,Z=30)))
  356.         HitboxChain.Add((BoneOffset=(Y=-4,Z=250)))
  357.         HitboxChain.Add((BoneOffset=(Y=-4,Z=170)))
  358.         HitboxChain.Add((BoneOffset=(Y=+4,Z=150)))
  359.         HitboxChain.Add((BoneOffset=(Y=-4,Z=130)))
  360.         HitboxChain.Add((BoneOffset=(Y=+4,Z=110)))
  361.         HitboxChain.Add((BoneOffset=(Y=-4,Z=90)))
  362.         HitboxChain.Add((BoneOffset=(Y=+4,Z=70)))
  363.         HitboxChain.Add((BoneOffset=(Y=-4,Z=50)))
  364.         HitboxChain.Add((BoneOffset=(Y=+4,Z=30)))
  365.         HitboxChain.Add((BoneOffset=(Y=-4,Z=10)))
  366.         HitboxChain.Add((BoneOffset=(Y=+3,Z=250)))
  367.         HitboxChain.Add((BoneOffset=(Y=+3,Z=170)))
  368.         HitboxChain.Add((BoneOffset=(Y=+3,Z=150)))
  369.         HitboxChain.Add((BoneOffset=(Y=-3,Z=130)))
  370.         HitboxChain.Add((BoneOffset=(Y=+3,Z=110)))
  371.         HitboxChain.Add((BoneOffset=(Y=-3,Z=90)))
  372.         HitboxChain.Add((BoneOffset=(Y=+3,Z=70)))
  373.         HitboxChain.Add((BoneOffset=(Y=-3,Z=50)))
  374.         HitboxChain.Add((BoneOffset=(Y=+3,Z=30)))
  375.         HitboxChain.Add((BoneOffset=(Z=10)))
  376.         HitboxChain.Add((BoneOffset=(Z=-10)))
  377.         WorldImpactEffects=KFImpactEffectInfo'FX_Impacts_ARCH.Blunted_melee_impact'
  378.  
  379.         // modified combo sequences
  380.         MeleeImpactCamShakeScale=0.035f //0.4
  381.         ChainSequence_F=(DIR_Left, DIR_ForwardRight, DIR_ForwardLeft, DIR_ForwardRight, DIR_ForwardLeft)
  382.         ChainSequence_B=(DIR_BackwardLeft, DIR_Left, DIR_Right, DIR_ForwardRight, DIR_Left, DIR_Right, DIR_Left)
  383.         ChainSequence_L=(DIR_Right, DIR_BackwardRight, DIR_ForwardRight, DIR_ForwardLeft, DIR_Right, DIR_Left)
  384.         ChainSequence_R=(DIR_Left, DIR_BackwardLeft, DIR_ForwardLeft, DIR_ForwardRight, DIR_Left, DIR_Right)
  385.     End Object
  386.  
  387.     // Zooming/Position
  388.     PlayerViewOffset=(X=20,Y=0,Z=0)
  389.  
  390.     // Inventory
  391.     GroupPriority=150
  392.     InventorySize=8
  393.     WeaponSelectTexture=Texture2D'WEP_UI_BALROG_TEX.UI_BALROG9_TEX'
  394.  
  395.     FireModeIconPaths(DEFAULT_FIREMODE)=Texture2D'ui_firemodes_tex.UI_FireModeSelect_BluntMelee'
  396.     InstantHitDamage(DEFAULT_FIREMODE)=190
  397.     InstantHitDamageTypes(DEFAULT_FIREMODE)=class'KFDT_Bludgeon_Balrog9'
  398.  
  399.     // Trigger explosion as Heavy Attack
  400.     FireModeIconPaths(HEAVY_ATK_FIREMODE)=Texture2D'ui_firemodes_tex.UI_FireModeSelect_BluntMelee'
  401.     InstantHitDamage(HEAVY_ATK_FIREMODE)=250
  402.     InstantHitDamageTypes(HEAVY_ATK_FIREMODE)=class'KFDT_Bludgeon_Balrog9Heavy'
  403.  
  404.     InstantHitDamageTypes(BASH_FIREMODE)=class'KFDT_Bludgeon_Balrog9'
  405.     InstantHitDamage(BASH_FIREMODE)=140
  406.  
  407.     // Trigger explosion
  408.     FireModeIconPaths(CUSTOM_FIREMODE)=Texture2D'ui_firemodes_tex.UI_FireModeSelect_ShotgunSingle'
  409.     FiringStatesArray(CUSTOM_FIREMODE)=WeaponSingleFiring
  410.     WeaponFireTypes(CUSTOM_FIREMODE)=EWFT_Custom
  411.     FireInterval(CUSTOM_FIREMODE)=1.0f
  412.  
  413.     BlastSpawnOffset=-10.f
  414.  
  415.     // Explosion settings.  Using archetype so that clients can serialize the content
  416.     // without loading the 1st person weapon content (avoid 'Begin Object')!
  417.     ExplosionActorClass=class'KFExplosionActorReplicated'
  418.     ExplosionTemplate=KFGameExplosion'WEP_BALROG9_ARCH.Wep_BALROG9_Explosion'
  419.     AltExploEffects = KFImpactEffectInfo'WEP_RPG7_ARCH.RPG7_Explosion_Concussive_Force' //Leave this alone until we want it
  420.  
  421.     NukeExplosionActorClass=class'KFExplosion_ReplicatedNuke'
  422.  
  423.     // Fire Effects
  424.     WeaponFireSnd(CUSTOM_FIREMODE)=(DefaultCue=AkEvent'WW_WEP_MEL_Pulverizer.Play_WEP_MEL_Pulverizer_Fire_3P', FirstPersonCue=AkEvent'WW_WEP_MEL_Pulverizer.Play_WEP_MEL_Pulverizer_Fire_1P')
  425.  
  426.     // Block Effects
  427.     BlockSound=AkEvent'WW_WEP_Bullet_Impacts.Play_Block_MEL_Hammer'
  428.     ParrySound=AkEvent'WW_WEP_Bullet_Impacts.Play_Parry_Wood'
  429.  
  430.     // Trader
  431.     ParryStrength=7
  432.     ParryDamageMitigationPercent=0.50
  433.     BlockDamageMitigation=0.50
  434.  
  435.     // Weapon Upgrade stat boosts
  436.     WeaponUpgrades[1]=(IncrementDamage=1.2f,IncrementWeight=0)
  437.     WeaponUpgrades[2]=(IncrementDamage=1.4f,IncrementWeight=0)
  438. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement