Advertisement
jordan3012000

executioner staff

Apr 14th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.07 KB | None | 0 0
  1. AddCSLuaFile()
  2. AddCSLuaFile( "base/scifi_base.lua" )
  3. include( "base/scifi_base.lua" )
  4.  
  5. hook.Add( "GetFallDamage", "rmt_nofall_trump", function( ply, speed )
  6. if ( IsValid( ply ) && IsValid( ply:GetActiveWeapon() ) && ply:GetActiveWeapon():GetClass() == "sfw_eblade" ) then
  7. local wep = ply:GetActiveWeapon()
  8.  
  9. if ( ply:KeyDown( IN_DUCK ) ) then
  10. ply:SetNWFloat( "SWL_FeatherFall", CurTime() )
  11. wep:SetNextAttack( 0.5 )
  12. ply:ViewPunch( Angle( speed / 32, 0, math.random( -speed, speed ) / 128 ) )
  13. return 0
  14. end
  15. end
  16. end )
  17.  
  18. SWEP.PrintName = "Executioner Staff"
  19. SWEP.Author = "Bill Nye"
  20.  
  21. SWEP.Purpose = "Combat variant weapon of the honorary Executioner"
  22. SWEP.Instructions = "Mouse1 to strike, Mouse2 to leap"
  23.  
  24. SWEP.Slot = 0
  25. SWEP.SlotPos = 4
  26.  
  27. SWEP.ViewModel = "models/weapons/v_knife_t.mdl" -- Weapon view model
  28. SWEP.WorldModel = "models/weapons/cstrike/w_knife_t.mdl"
  29. SWEP.ShowviewModel = false
  30. SWEP.ShowWorldModel = false
  31. SWEP.HoldType = "wos-energy-staff"
  32. SWEP.DeploySpeed = 2.8
  33. SWEP.ViewModelFOV = 64
  34. SWEP.Weight = 1
  35.  
  36. SWEP.ViewModelBoneMods = {
  37. ["ValveBiped.Bip01_R_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(44.908, 0, 0) },
  38. ["ValveBiped.Bip01_L_Finger1"] = { scale = Vector(1, 1, 1), pos = Vector(0, -0.06, 0), angle = Angle(-1.116, 15.425, 0) },
  39. ["ValveBiped.Bip01_L_Finger21"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-0.23, 20.188, 0) },
  40. ["ValveBiped.Bip01_L_Finger11"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-0.608, 0, 0) },
  41. ["ValveBiped.Bip01_L_Finger4"] = { scale = Vector(1, 1, 1), pos = Vector(0.629, -1.045, 0), angle = Angle(-6.178, 0.275, 0) },
  42. ["ValveBiped.Bip01_L_Finger2"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0.171, 7.776, 0) },
  43. ["ValveBiped.Bip01_L_Finger3"] = { scale = Vector(1, 1, 1), pos = Vector(0.061, -0.504, 0.225), angle = Angle(-4.911, 16.455, 3.701) },
  44. ["ValveBiped.Bip01_L_Finger31"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0.485, -9.593, 0) }
  45. }
  46.  
  47. SWEP.SciFiSkin = "nil"
  48. SWEP.SciFiWorld = "nil"
  49.  
  50. if ( CLIENT ) then
  51. SWEP.WepSelectIcon = surface.GetTextureID( "/vgui/icons/icon_vapor.vmt" )
  52. end
  53.  
  54. SWEP.Primary.ClipSize = 100
  55. SWEP.Primary.DefaultClip = 100
  56. SWEP.Primary.Automatic = true
  57. SWEP.Primary.Ammo = "none"
  58.  
  59. SWEP.Secondary.Automatic = true
  60.  
  61. SWEP.ViewModelSprintAng = Angle( -10, -10, 0 )
  62.  
  63. SWEP.SciFiFamily = { "vtec", "melee_simple", "useshook", "infammo", "autoregen" }
  64. SWEP.SciFiWorldStats = {
  65. ["1"] = { text = "Damage: 15 - 50, +5", color = Color( 180, 180, 180 ) },
  66. ["2"] = { text = "Crit. mul.: --", color = Color( 180, 180, 180 ) },
  67. ["3"] = { text = "Damage type: Impact, Energy", color = Color( 110, 180, 255 ) },
  68. ["4"] = { text = "Attack speed: (max.) 2.5", color = Color( 180, 180, 180 ) },
  69. ["5"] = { text = "Range: 82 units", color = Color( 180, 180, 180 ) },
  70. ["6"] = { text = "Recharge rate: 60", color = Color( 180, 180, 180 ) },
  71. ["7"] = { text = "Damage is positively effected by the wielder's movement speed.", color = Color( 180, 180, 180 ) },
  72. ["8"] = { text = "Damage decreases with lower blade charge.", color = Color( 180, 180, 180 ) },
  73. -- ["9"] = { text = "... They ask for your allegiance, and you shall give it ...", color = Color( 255, 20, 20 ) }
  74. }
  75.  
  76. SWEP.ViewModelMeleePos = Vector( 2, 4, -2 )
  77. SWEP.ViewModelMeleeAng = Angle( 10, 20, -20 )
  78.  
  79. SWEP.SciFiMeleeTime = 0
  80. SWEP.SciFiMeleeASpeed = 0.45
  81. SWEP.SciFiMeleeRange = 52
  82. SWEP.SciFiMeleeDamage = 3
  83. SWEP.SciFiMeleeSound = "scifi.melee.swing.light"
  84.  
  85. SWEP.HitDistance = 82
  86.  
  87. SWEP.SciFiRegenDelay = 0.6
  88.  
  89.  
  90.  
  91.  
  92.  
  93. --[[SWEP.VElements = {
  94. ["0"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 2.476, 4.776), angle = Angle(-4.618, 70.052, 72), size = Vector(0.402, 0.547, 1.143), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/saphyre/saph_core", skin = 0, bodygroup = {} },
  95. ["0+"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6, 3, 4.2), angle = Angle(173.481, 70, 95), size = Vector(0.402, 0.547, 1.536), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/saphyre/saph_core", skin = 0, bodygroup = {} },
  96. ["0++"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5, 2.476, 2), angle = Angle(-4.618, 70.052, 72), size = Vector(0.402, 0.547, 1.143), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/saphyre/saph_core", skin = 0, bodygroup = {} },
  97. ["0+++"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(6, 2, -2), angle = Angle(173.481, 70, 95), size = Vector(0.402, 0.547, 1.536), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/weapons/saphyre/saph_core", skin = 0, bodygroup = {} },
  98. ["1"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(18, 6, 2.2), angle = Angle(170, 70, 102), size = Vector(0.402, 0.547, 3), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/weapons/misc/energy_surf", skin = 0, bodygroup = {} },
  99. ["1+"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(16, 5.5, 3), angle = Angle(-4.618, 72, 72), size = Vector(0.402, 0.547, 3), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/weapons/misc/energy_surf", skin = 0, bodygroup = {} },
  100. ["1++"] = { type = "Model", model = "models/gibs/hgibs_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8, 3, 2), angle = Angle(-4.618, 70.052, 72), size = Vector(0.402, 0.547, 1.143), color = Color(255, 255, 255, 255), surpresslightning = true, material = "models/weapons/misc/energy_surf", skin = 0, bodygroup = {} }
  101. }--]]
  102.  
  103.  
  104. SWEP.VElements = {
  105. ["FX1"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-18.701, 0, 0), angle = Angle(0, 0, 0), size = { x = 4, y = 4 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true},
  106. ["FX1++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "FX1", pos = Vector(-1.558, 0, 0), angle = Angle(0, 0, 0), size = { x = 4, y = 4 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true},
  107. ["FX1+++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "FX1", pos = Vector(-3.636, 0, 0), angle = Angle(0, 0, 0), size = { x = 4, y = 4 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true},
  108. ["FX1+"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "FX1", pos = Vector(-5.2, 0, 0, 0), angle = Angle(0, 0, 0), size = { x = 4, y = 4 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true},
  109. ["Staff"] = { type = "Model", model = "models/tfa/comm/gg/prp_magna_guard_weapon_combined.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-6.753, 1.557, -9.87), angle = Angle(80, 68.96, -31.559), size = Vector(0.625, 0.625, 0.625), color = Color(150, 150, 150, 255), surpresslightning = true, material = "", skin = 0, bodygroup = {} }
  110. }
  111.  
  112. SWEP.WElements = {
  113. ["FX++++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-27.532, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  114. ["FX+++++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-28.571, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  115. ["FX++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(26.493, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  116. ["FX"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-32.728, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  117. ["FX+++++++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-30.65, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  118. ["FX+++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-32.728, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  119. ["FX+"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-24.417, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  120. ["FX+++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(25.454, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  121. ["FX++++++++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-31.688, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  122. ["FX++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(31.687, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  123. ["FX+++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(27.531, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  124. ["FX++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(29.61, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  125. ["FX+++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-26.494, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  126. ["FX++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-25.455, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  127. ["FX++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-30.65, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  128. ["FX+++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-24.417, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  129. ["FX++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(29.61, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  130. ["FX++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(24.416, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  131. ["FX+++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(30.649, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  132. ["Staff"] = { type = "Model", model = "models/tfa/comm/gg/prp_magna_guard_weapon_combined.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.299, 1, 0.675), angle = Angle(72.986, 140.636, -47.923), size = Vector(0.85, 1, 1), color = Color(150, 150, 150, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
  133. ["FX+++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(32.727, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  134. ["FX++++++++++++++++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-29.611, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  135. ["FX+++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(27.531, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  136. ["FX++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(24.416, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  137. ["FX++++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(28.57, 0, 0), size = { x = 3.545, y = 3.545 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  138. ["FX+++++++++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(32.727, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  139. ["FX+++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-28.571, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
  140. ["FX++"] = { type = "Sprite", sprite = "particle/particle_glow_04", bone = "ValveBiped.Bip01_R_Hand", rel = "Staff", pos = Vector(-26.494, 0, 0), size = { x = 5.816, y = 5.816 }, color = Color(0, 116, 183, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}
  141. }
  142.  
  143.  
  144.  
  145.  
  146. local SwingElectric = { "Scifi.Blade.Swing01", "Scifi.Blade.Swing02", "Scifi.Blade.Swing03" }
  147. local HitElectric = { "Scifi.Blade.Hit.Electric01", "Scifi.Blade.Hit.Electric02" }
  148. local HitDefault = Sound( "Scifi.Blade.Hit" )
  149. local comfort = 0
  150.  
  151. function SWEP:SubInit()
  152.  
  153. self.NextRegenTime = 0
  154. comfort = 52
  155.  
  156. end
  157.  
  158.  
  159.  
  160.  
  161. function SWEP:SetupDataTables()
  162.  
  163. self:NetworkVar( "Int", 0, "SciFiMelee" )
  164. self:NetworkVar( "Float", 0, "NextMeleeAttack" )
  165. self:NetworkVar( "Float", 1, "NextIdle" )
  166.  
  167. end
  168.  
  169. if ( CLIENT ) then
  170.  
  171. function SWEP:CustomAmmoDisplay()
  172.  
  173. self.AmmoDisplay = self.AmmoDisplay or {}
  174. self.AmmoDisplay.Draw = true
  175.  
  176. if ( self.Primary.ClipSize > -1 ) then
  177. self.AmmoDisplay.PrimaryClip = self:Clip1()
  178. end
  179.  
  180. return self.AmmoDisplay
  181.  
  182. end
  183.  
  184. end
  185.  
  186. function SWEP:UpdateNextIdle()
  187.  
  188. local vm = self.Owner:GetViewModel()
  189. self:SetNextIdle( CurTime() + vm:SequenceDuration() )
  190.  
  191. end
  192.  
  193. function SWEP:Think()
  194.  
  195. if ( self.Owner:GetActiveWeapon() ~= self.Weapon ) then return end
  196.  
  197. local vm = self.Owner:GetViewModel()
  198. local curtime = CurTime()
  199. local idletime = self:GetNextIdle()
  200.  
  201. if ( IsExistent( self ) ) and ( IsExistent( self:GetNWEntity( "blade" ) ) ) then
  202.  
  203. local blade = self:GetNWEntity( "blade" )
  204. local vm_blade = self.Owner:GetVelocity()
  205. local velo = math.Clamp( ( math.Round( ( math.abs( vm_blade.y ) + math.abs( vm_blade.x ) + math.abs( vm_blade.z ) ) ) / 3000 ), 0.01, 0.25 )
  206.  
  207. if ( CLIENT ) then
  208. EmitSound( "", blade:GetPos(), blade:EntIndex(), CHAN_STATIC, velo, 50, SND_CHANGE_PITCH, 60 + velo * 10 )
  209.  
  210. end
  211.  
  212. if ( self:GetNWBool( "eblade_active" ) == true ) then
  213. -- CreateParticleSystem( blade, "blade_glow", PATTACH_POINT_FOLLOW, 1, Vector( 0, 0, 0 ) )
  214. -- ParticleEffectAttach( "blade_glow", PATTACH_POINT_FOLLOW, blade, 0 ) -- wtf, garry? why you rekt this function?
  215. self:SetNWBool( "eblade_active", false )
  216. end
  217.  
  218. end
  219.  
  220. if ( idletime > 0 && CurTime() > idletime ) and ( SERVER ) then
  221.  
  222. vm:SendViewModelMatchingSequence( vm:LookupSequence( "idle_cycle" ) )
  223.  
  224. self:UpdateNextIdle()
  225.  
  226. end
  227.  
  228. local meleetime = self:GetNextMeleeAttack()
  229.  
  230. if ( meleetime > 0 && CurTime() > meleetime ) then
  231.  
  232. self:DealDamage()
  233.  
  234. self:SetNextMeleeAttack( 0 )
  235.  
  236. end
  237.  
  238. if ( SERVER ) then
  239.  
  240. if( self.NextRegenTime <= CurTime() ) then
  241. if ( self.Weapon:Clip1() < self.Primary.ClipSize ) then
  242. self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
  243. end
  244. end
  245.  
  246. if ( self.Weapon:Clip1() >= 101 ) then
  247. self.Weapon:SetClip1( 100 )
  248. end
  249.  
  250. end
  251.  
  252. self:SciFiMath()
  253. self:SciFiMelee()
  254.  
  255. end
  256.  
  257. function SWEP:Deploy()
  258.  
  259. if ( self.Owner:IsNPC() ) then self:Remove() end --Those NPC-peasants aren't mighty enough to use this weapon.
  260.  
  261. local vm = self.Owner:GetViewModel()
  262.  
  263. self.Weapon:SetHoldType( "wos-energy-staff" )
  264.  
  265. self.Weapon:EmitSound("weapons/smack.wav", 50, 100)
  266.  
  267. vm:SendViewModelMatchingSequence( vm:LookupSequence( "draw" ) )
  268.  
  269. self:UpdateNextIdle()
  270.  
  271. self:SetClip1( 60 )
  272. end
  273.  
  274.  
  275. function SWEP:PrimaryAttack()
  276.  
  277. self:SetNWBool( "eblade_active", true )
  278.  
  279. --[[if !self.Owner:KeyDown(IN_RIGHT) then
  280. self.Owner:SelectWeightedSequence(ACT_MP_ATTACK_STAND_PRIMARYFIRE)
  281. else
  282. self.Owner:SelectWeightedSequence(ACT_MP_ATTACK_STAND_PRIMARY)
  283. end--]]
  284.  
  285. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  286.  
  287. local vmanims = {ACT_VM_HITCENTER, ACT_VM_PRIMARYATTACK}
  288.  
  289. self.Weapon:SendWeaponAnim( vmanims[math.random( 1, #vmanims )] )
  290.  
  291. local anim = ""
  292.  
  293. if ( GetRelChance( comfort ) ) then
  294. self.Owner:ViewPunch( Angle( 0, 2, 0 ) )
  295. anim = "midslash1"
  296. comfort = comfort - 10
  297. else
  298. self.Owner:ViewPunch( Angle( 0, -2, 0 ) )
  299. anim = "midslash2"
  300. comfort = comfort + 10
  301. end
  302.  
  303. --local vm = self.Owner:GetViewModel()
  304. --vm:SendViewModelMatchingSequence( vm:LookupSequence( anim ) )
  305.  
  306.  
  307.  
  308. self:EmitSound( SwingElectric[ math.random( 1, #SwingElectric ) ] )
  309.  
  310. local weaken = 0.4 + ( self.SciFiACC / 30 )
  311.  
  312. self:UpdateNextIdle()
  313. self:SetNextMeleeAttack( CurTime() + 0.2 )
  314.  
  315. self:SetNextPrimaryFire( CurTime() + weaken )
  316. --self:SetNextSecondaryFire( CurTime() + weaken + 0.1 )
  317.  
  318. self.NextRegenTime = CurTime() + self.SciFiRegenDelay
  319.  
  320. self:AddSciFiACC( 12 )
  321.  
  322. end
  323.  
  324. function SWEP:SecondaryAttack()
  325.  
  326. self.Weapon:SetNextSecondaryFire(CurTime() + 1.4)
  327. self.Owner:SetVelocity( self.Owner:GetAimVector() * 250 + Vector( 0, 0, 250 ) )
  328.  
  329.  
  330. end
  331.  
  332. function SWEP:DealDamage()
  333.  
  334. local anim = self:GetSequenceName( self.Owner:GetViewModel():GetSequence() )
  335. local amp = GetConVarNumber( "sfw_damageamp" )
  336. local playervelo = self.Owner:GetVelocity()
  337. local velo = math.Clamp( ( math.Round( ( math.abs( playervelo.y ) + math.abs( playervelo.x ) + math.abs( playervelo.z ) ) ) / 64 ), 1, 10 )
  338.  
  339. self.Owner:LagCompensation( true )
  340.  
  341. local tr = util.TraceLine( {
  342. start = self.Owner:GetShootPos(),
  343. endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
  344. filter = self.Owner,
  345. mask = MASK_SHOT_HULL
  346. } )
  347.  
  348. if ( !IsValid( tr.Entity ) ) then
  349. tr = util.TraceHull( {
  350. start = self.Owner:GetShootPos(),
  351. endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance,
  352. filter = self.Owner,
  353. mins = Vector( -16, -16, -8 ),
  354. maxs = Vector( 16, 16, 8 ),
  355. mask = MASK_SHOT_HULL
  356. } )
  357. end
  358.  
  359. if ( tr.Hit && !( game.SinglePlayer() && CLIENT ) ) then
  360.  
  361. self:EmitSound( HitElectric[ math.random( 1, #HitElectric ) ] )
  362.  
  363. util.Decal( "manhackcut", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
  364.  
  365. if ( anim == "stab" ) then
  366. ParticleEffect( "blade_hit", tr.HitPos, self.Owner:EyeAngles(), self )
  367. else
  368. ParticleEffect( "saphyre_hit", tr.HitPos, self.Owner:EyeAngles(), self )
  369. end
  370.  
  371. if ( self:Clip1() > 0 ) then
  372. if ( !game.SinglePlayer() && SERVER ) then
  373. local fx2 = ents.Create( "light_dynamic" )
  374. if ( !IsValid( fx2 ) ) then return end
  375. fx2:SetKeyValue( "_light", "70 110 255 255" )
  376. fx2:SetKeyValue( "spotlight_radius", 256 )
  377. fx2:SetKeyValue( "distance", 512 )
  378. fx2:SetKeyValue( "brightness", 2 )
  379. fx2:SetPos( tr.HitPos )
  380. fx2:Spawn()
  381. fx2:Fire( "kill", "", 0.12 )
  382. end
  383. self:EmitSound( HitDefault )
  384. end
  385.  
  386. end
  387.  
  388. local hit = false
  389.  
  390. if ( SERVER && IsValid( tr.Entity ) && ( tr.Entity:IsNPC() || tr.Entity:IsPlayer() || tr.Entity:Health() > 0 ) ) then
  391.  
  392. local dmginfo = DamageInfo()
  393. local dmgforce = self.Owner:GetRight() * 100 + self.Owner:GetForward() * 1000 + playervelo * 10
  394.  
  395. local attacker = self.Owner
  396. if ( !IsValid( attacker ) ) then attacker = self end
  397. dmginfo:SetAttacker( attacker )
  398. dmginfo:SetInflictor( self )
  399.  
  400. if ( self:Clip1() > 0 ) then
  401. -- self:DealAoeDamage( bit.bor( DMG_AIRBOAT, DMG_NEVERGIB ), 25 * amp, self.Owner:GetShootPos() + self.Owner:GetAimVector() * 16, 64 )
  402. for k,v in pairs ( ents.FindInSphere( tr.HitPos, 56 ) ) do
  403. if ( v ~= self.Owner ) && ( v:GetOwner() ~= self.Owner ) then
  404. self:DealDirectDamage( bit.bor( DMG_AIRBOAT, DMG_NEVERGIB ), 25 * amp, v, self.Owner, dmgforce )
  405. end
  406. end
  407. dmginfo:SetDamage( ( math.random( 50, 80 ) + ( self:Clip1() / 4 ) ) * amp + velo )
  408. dmginfo:SetDamageType( bit.bor( DMG_ENERGYBEAM, DMG_NEVERGIB ) )
  409. self:TakePrimaryAmmo( math.Clamp( 25, 0, self:Clip1() ) )
  410. else
  411. dmginfo:SetDamage( math.random( 50, 80 ) * amp + velo )
  412. end
  413.  
  414. dmginfo:SetDamageForce( dmgforce )
  415.  
  416. tr.Entity:TakeDamageInfo( dmginfo )
  417.  
  418. hit = true
  419.  
  420. end
  421.  
  422. if ( SERVER && IsValid( tr.Entity ) ) then
  423. local phys = tr.Entity:GetPhysicsObject()
  424. if ( IsValid( phys ) ) then
  425. phys:ApplyForceOffset( self.Owner:GetAimVector() * 80 * phys:GetMass(), tr.HitPos )
  426. end
  427. end
  428.  
  429.  
  430. self:SetNWBool( "eblade_active", false )
  431.  
  432. self.Owner:LagCompensation( false )
  433.  
  434. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement