mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if (SERVER) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 1
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortilight"
|
||||
SWEP.DrawCrosshair = true
|
||||
end
|
||||
|
||||
SWEP.Purpose = "Allows you to create green light around your character."
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "Adolphus"
|
||||
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "fist"
|
||||
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Ammo = ""
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.IsAlwaysRaised = true
|
||||
SWEP.vePerUse = 1
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
function SWEP:Initialize()
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- A function to set whether the SWEP is activated.
|
||||
function SWEP:SetActivated(bActivated)
|
||||
self.Activated = bActivated
|
||||
end
|
||||
|
||||
-- A function to get whether the SWEP is activated.
|
||||
function SWEP:IsActivated()
|
||||
return self.Activated
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
if (SERVER) then
|
||||
local ent = ents.Create("ix_nvlight")
|
||||
|
||||
if (!self.Activated) then
|
||||
local percentage = self.vePerUse / 100
|
||||
if !self:GetOwner():HasVortalEnergy(self.vePerUse + (percentage * self:GetOwner():Armor())) then
|
||||
return
|
||||
end
|
||||
self:GetOwner():TakeVortalEnergy(self.vePerUse + (percentage * self:GetOwner():Armor()))
|
||||
self:GetOwner():EmitSound("npc/vort/health_charge.wav")
|
||||
self.Activated = true
|
||||
|
||||
ent:SetOwner(self:GetOwner())
|
||||
ent:SetParent(self:GetOwner())
|
||||
ent:SetPos(self:GetOwner():GetPos())
|
||||
ent:SetOwnerVariable(self:GetOwner())
|
||||
else
|
||||
self:GetOwner():EmitSound("npc/vort/health_charge.wav")
|
||||
self.Activated = false
|
||||
ent:RemoveLight(self:GetOwner())
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self:SetNextPrimaryFire(CurTime() + 4)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (CLIENT or !IsValid(self:GetOwner())) then return end
|
||||
|
||||
local worldmodel = ents.FindInSphere(self:GetOwner():GetPos(), 1);
|
||||
|
||||
for _, v in pairs(worldmodel) do
|
||||
if (v:GetClass() == "ix_nvlight" and v:GetOwner() == self:GetOwner()) then
|
||||
v:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the player attempts to secondary fire.
|
||||
function SWEP:SecondaryAttack() end
|
||||
@@ -0,0 +1,404 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if (SERVER) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 1
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortimelee"
|
||||
SWEP.DrawCrosshair = true
|
||||
|
||||
game.AddParticles("particles/Vortigaunt_FX.pcf")
|
||||
end
|
||||
|
||||
PrecacheParticleSystem("vortigaunt_glow_beam_cp1")
|
||||
PrecacheParticleSystem("vortigaunt_glow_beam_cp1b")
|
||||
PrecacheParticleSystem("vortigaunt_charge_token")
|
||||
|
||||
SWEP.Purpose = "Melee and Shield"
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "Adolphus (& M!NT)"
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "fist"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Ammo = ""
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
SWEP.Primary.Damage = 7 --Fuck this rounding piece
|
||||
SWEP.Primary.Delay = 0.75
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.IsAlwaysRaised = true
|
||||
|
||||
SWEP.vePerShield = 10
|
||||
SWEP.vePerSlap = 5
|
||||
|
||||
SWEP.shieldActive = false
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
function SWEP:Initialize()
|
||||
self.lastHand = 0
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
if (!IsValid(owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, owner, self:GetOwner():LookupAttachment("leftclaw"))
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, owner, self:GetOwner():LookupAttachment("rightclaw"))
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
local owner = self:GetOwner()
|
||||
if (self.vSHIELD and !IsValid(owner)) then
|
||||
self.vSHIELD:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
local owner = self:GetOwner()
|
||||
if (!IsValid(owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
owner:StopParticles()
|
||||
|
||||
if (self.shieldActive) then
|
||||
if (SERVER) then
|
||||
if IsValid(self.vSHIELD) then
|
||||
self:GetOwner():EmitSound("npc/vort/health_charge.wav")
|
||||
maxHealth = self.vSHIELD:GetMaxHealth()
|
||||
currentHealth = self.vSHIELD:Health()
|
||||
self:GetOwner():GetCharacter():AddVortalEnergy(self.vePerShield * (currentHealth / maxHealth))
|
||||
self.vSHIELD:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.shieldActive = false
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:ValidateShield()
|
||||
for _, shield in ipairs(ents.FindByClass("ix_vortmeleeshield")) do
|
||||
if shield:GetOwner() == self:GetOwner() then
|
||||
shield:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoPunchAnimation()
|
||||
self.lastHand = math.abs(1 - self.lastHand)
|
||||
|
||||
local sequence = 3 + self.lastHand
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(0.5)
|
||||
viewModel:SetSequence(sequence)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration() * 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
if (!IsFirstTimePredicted()) then
|
||||
return
|
||||
end
|
||||
|
||||
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():EmitSound("npc/vort/claw_swing"..math.random(1, 2)..".wav")
|
||||
end
|
||||
|
||||
--self:DoPunchAnimation()
|
||||
|
||||
self:GetOwner():SetAnimation(PLAYER_ATTACK1)
|
||||
self:GetOwner():ViewPunch(Angle(self.lastHand + 2, self.lastHand + 5, 0.125))
|
||||
|
||||
if ix.plugin.Get("vortigaunts") then
|
||||
if (ix.config.Get("pushOnly")) and !self:GetOwner():IsVortigaunt() then
|
||||
local data = {}
|
||||
data.start = self.Owner:GetShootPos()
|
||||
data.endpos = data.start + self.Owner:GetAimVector() * 84
|
||||
data.filter = {self, self.Owner}
|
||||
local trace = util.TraceLine(data)
|
||||
local entity = trace.Entity
|
||||
|
||||
if (entity:IsPlayer() and ix.config.Get("allowPush", true)) then
|
||||
self:PushEntity(entity)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
else
|
||||
if (ix.config.Get("pushOnly")) then
|
||||
local data = {}
|
||||
data.start = self.Owner:GetShootPos()
|
||||
data.endpos = data.start + self.Owner:GetAimVector() * 84
|
||||
data.filter = {self, self.Owner}
|
||||
local trace = util.TraceLine(data)
|
||||
local entity = trace.Entity
|
||||
|
||||
if (entity:IsPlayer() and ix.config.Get("allowPush", true)) then
|
||||
self:PushEntity(entity)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
timer.Simple(0.055, function()
|
||||
if (IsValid(self) and IsValid(self:GetOwner())) then
|
||||
local damage = self.Primary.Damage
|
||||
local vortalSlash = false
|
||||
local percentage = self.vePerSlap / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
if ix.plugin.Get("vortigaunts") then
|
||||
if self:GetOwner():IsVortigaunt() then
|
||||
if (self.Owner:HasVortalEnergy(self.vePerSlap + (percentage * self.Owner:Armor()))) and !self.shieldActive then
|
||||
vortalSlash = true
|
||||
end
|
||||
damage = damage + self:GetOwner():GetCharacter():GetSkillLevel("melee")
|
||||
if (vortalSlash) then
|
||||
damage = damage + (self:GetOwner():GetCharacter():GetSkillLevel("vort") * 0.6)
|
||||
end
|
||||
end
|
||||
if (SERVER and self:GetOwner():IsPlayer() and self:GetOwner().GetCharacter and self:GetOwner():GetCharacter() and self:GetOwner():IsVortigaunt()) then
|
||||
self:GetOwner():GetCharacter():DoAction("melee_slash")
|
||||
end
|
||||
end
|
||||
local context = {damage = damage}
|
||||
local result = hook.Run("GetPlayerPunchDamage", self:GetOwner(), damage, context)
|
||||
if (result != nil) then
|
||||
damage = result
|
||||
else
|
||||
damage = context.damage
|
||||
end
|
||||
-- damage = damage * 1.7 --For some reason, punching only does 60% of the damage. 60% * 1.7 = 102%
|
||||
|
||||
local pos = self:GetOwner():GetShootPos()
|
||||
local ang = self:GetOwner():GetAimVector()
|
||||
|
||||
self:GetOwner():LagCompensation(true)
|
||||
|
||||
local data = {}
|
||||
data.start = pos
|
||||
data.endpos = pos + (ang * 100)
|
||||
data.filter = {self:GetOwner(), self.vSHIELD}
|
||||
data.mins = Vector(-5, -5, 0)
|
||||
data.maxs = Vector(5, 5, 5)
|
||||
local trace = util.TraceHull(data)
|
||||
|
||||
if (SERVER and trace.Hit) then
|
||||
local entity = trace.Entity
|
||||
|
||||
if (IsValid(entity)) then
|
||||
if ix.plugin.Get("vortigaunts") then
|
||||
if (self:GetOwner():IsPlayer() and self:GetOwner().GetCharacter and self:GetOwner():GetCharacter() and self:GetOwner():IsVortigaunt()) then
|
||||
self:GetOwner():GetCharacter():DoAction("melee_hit")
|
||||
end
|
||||
end
|
||||
local damageInfo = DamageInfo()
|
||||
damageInfo:SetAttacker(self:GetOwner())
|
||||
damageInfo:SetInflictor(self)
|
||||
damageInfo:SetDamage(damage)
|
||||
if (vortalSlash) then
|
||||
damageInfo:SetDamageType(DMG_SHOCK)
|
||||
else
|
||||
damageInfo:SetDamageType(DMG_GENERIC)
|
||||
end
|
||||
damageInfo:SetDamagePosition(trace.HitPos)
|
||||
damageInfo:SetDamageForce(self:GetOwner():GetAimVector() * 1024)
|
||||
entity:DispatchTraceAttack(damageInfo, data.start, data.endpos)
|
||||
|
||||
if (vortalSlash) then
|
||||
self.Owner:TakeVortalEnergy(self.vePerSlap + (percentage * self.Owner:Armor()))
|
||||
ParticleEffect("vortigaunt_glow_beam_cp1", trace.HitPos, Angle(0, 0, 0), entity)
|
||||
ParticleEffect("vortigaunt_glow_beam_cp1b", trace.HitPos, Angle(0, 0, 0), entity)
|
||||
if (entity:IsPlayer()) then
|
||||
if (!(entity:GetCharacter():GetBleedout() > 0) ) then
|
||||
entity:SetLocalVar("blur", 50)
|
||||
entity:SetEyeAngles(Angle(math.random(-89,89),math.random(0,359),0))
|
||||
entity:SetWalkSpeed(ix.config.Get("walkSpeed")/2)
|
||||
entity:SetRunSpeed(ix.config.Get("runSpeed")/2)
|
||||
timer.Simple(3, function()
|
||||
entity:SetLocalVar("blur", nil)
|
||||
entity:SetWalkSpeed(ix.config.Get("walkSpeed"))
|
||||
entity:SetRunSpeed(ix.config.Get("runSpeed"))
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (vortalSlash) then
|
||||
self:GetOwner():EmitSound("npc/vort/attack_shoot.wav", 80)
|
||||
else
|
||||
self:GetOwner():EmitSound("physics/body/body_medium_impact_hard"..math.random(1, 6)..".wav", 80)
|
||||
end
|
||||
end
|
||||
end
|
||||
hook.Run("PlayerThrowPunch", self:GetOwner(), trace)
|
||||
self:GetOwner():LagCompensation(false)
|
||||
|
||||
if (CLIENT and trace.Hit) then
|
||||
local entity = trace.Entity
|
||||
if (!vortalSlash and !self.shieldActive) then
|
||||
chat.AddText(Color(26, 171, 69), "[VORTESSENCE] You were too tired to empower your strikes!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
|
||||
if (!self.shieldActive) then
|
||||
local owner = self:GetOwner()
|
||||
|
||||
local percentage = self.vePerShield / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
if !self.Owner:HasVortalEnergy(self.vePerShield + (percentage * self.Owner:Armor())) then
|
||||
return
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
if (!IsValid(self.vSHIELD)) then
|
||||
self:SetNextSecondaryFire(CurTime() + 1)
|
||||
|
||||
self.Owner:TakeVortalEnergy(self.vePerShield + (percentage * self.Owner:Armor()))
|
||||
|
||||
self:ValidateShield()
|
||||
|
||||
self.vSHIELD = ents.Create("ix_vortmeleeshield")
|
||||
self.vSHIELD:SetPos(owner:GetPos() + owner:GetUp()*45)
|
||||
self.vSHIELD:Spawn()
|
||||
self.vSHIELD:Activate()
|
||||
self.vSHIELD:SetOwner(owner)
|
||||
self.vSHIELD:FollowBone(owner, 11)
|
||||
self.vSHIELD:SetLocalAngles(Angle(0, 0, -90))
|
||||
self.vSHIELD:SetLocalPos(Vector(0, 50, 0))
|
||||
owner:EmitSound("npc/vort/health_charge.wav")
|
||||
end
|
||||
end
|
||||
self.shieldActive = true
|
||||
return false
|
||||
else
|
||||
if (SERVER) then
|
||||
if IsValid(self.vSHIELD) then
|
||||
self:GetOwner():EmitSound("npc/vort/health_charge.wav")
|
||||
maxHealth = self.vSHIELD:GetMaxHealth()
|
||||
currentHealth = self.vSHIELD:Health()
|
||||
self:GetOwner():GetCharacter():AddVortalEnergy(self.vePerShield * (currentHealth / maxHealth))
|
||||
self.vSHIELD:Remove()
|
||||
end
|
||||
self:SetNextSecondaryFire(CurTime() + 1)
|
||||
end
|
||||
self.shieldActive = false
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,363 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortibeam Advanced"
|
||||
SWEP.DrawCrosshair = true
|
||||
|
||||
game.AddParticles("particles/Vortigaunt_FX.pcf")
|
||||
end
|
||||
|
||||
PrecacheParticleSystem("wn_vortigaunt_beam_colored")
|
||||
PrecacheParticleSystem("wn_vortigaunt_beam_charge_colored")
|
||||
PrecacheParticleSystem("wn_vortigaunt_hand_glow_colored")
|
||||
|
||||
SWEP.Instructions = "Primary Fire: Fire your beam."
|
||||
SWEP.Purpose = "Immediately kills the target that you fire it at."
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "RJ"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
player_manager.AddValidModel("vortigaunt_arms2", "models/willardnetworks/vortigaunt.mdl")
|
||||
player_manager.AddValidHands("vortigaunt_arms2", "models/willardnetworks/c_arms_vortigaunt.mdl", 1, "0000000")
|
||||
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.WorldModel = ""
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
|
||||
SWEP.Primary.IsAlwaysRaised = true
|
||||
SWEP.IsAlwaysRaised = true
|
||||
SWEP.HoldType = "pistol"
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Damage = 40
|
||||
SWEP.Primary.Delay = 3
|
||||
SWEP.Primary.Ammo = ""
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Delay = 0
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.vePerShot = 100
|
||||
SWEP.aoeRadius = 90
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
-- Called when the SWEP is deployed.
|
||||
function SWEP:Deploy()
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the SWEP is holstered.
|
||||
function SWEP:Holster(switchingTo)
|
||||
self:SendWeaponAnim(ACT_VM_HOLSTER)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (SERVER) then
|
||||
if self:GetOwner() then
|
||||
if self:GetOwner().DrawViewModel then
|
||||
self:GetOwner():DrawViewModel(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self:GetOwner().broomModel) then
|
||||
if (self:GetOwner().broomModel:IsValid()) then
|
||||
self:GetOwner().broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the SWEP is initialized.
|
||||
function SWEP:Initialize()
|
||||
self.Primary.Damage = ix.config.Get("advancedBeamDamage", 200)
|
||||
self:SetWeaponHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:CanPrimaryAttack()
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
|
||||
if !self:GetOwner():HasVortalEnergy(self.vePerShot) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():GetCharacter():CanDoAction("vort_beam_shoot")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():OnGround()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
if (self.bIsFiring or !self:CanPrimaryAttack()) then return end
|
||||
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||||
self.bIsFiring = true
|
||||
|
||||
if (CLIENT) then
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(-10, -5, -70)
|
||||
self.IronSightsAng = Vector(-5, 100, 10)
|
||||
end
|
||||
|
||||
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
|
||||
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
|
||||
|
||||
local chargeSound = CreateSound(self:GetOwner(), "npc/vort/attack_charge.wav")
|
||||
chargeSound:SetSoundLevel( 60 )
|
||||
chargeSound:Play()
|
||||
|
||||
ParticleEffectAttach("wn_vortigaunt_hand_glow_colored", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("leftclaw"))
|
||||
ParticleEffectAttach("wn_vortigaunt_hand_glow_colored", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("rightclaw"))
|
||||
util.ScreenShake( self:GetOwner():GetPos(), 8, 15, 1, 1000 )
|
||||
timer.Simple(0.6, function()
|
||||
chargeSound:Stop()
|
||||
|
||||
if (!IsValid(self)) then return end
|
||||
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
self.bIsFiring = false
|
||||
return
|
||||
end
|
||||
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
self.bIsFiring = false
|
||||
return v
|
||||
end
|
||||
self:GetOwner():EmitSound("npc/vort/attack_shoot.wav", 40)
|
||||
|
||||
local forward = self:GetOwner():EyeAngles():Forward()
|
||||
local tr = util.QuickTrace(self:GetOwner():EyePos(), (forward + VectorRand(-0.005, 0.005)) * 5000, self:GetOwner())
|
||||
|
||||
self:GetOwner():StopParticles()
|
||||
|
||||
local leftClaw = self:GetOwner():LookupAttachment("leftclaw")
|
||||
|
||||
if (leftClaw) then
|
||||
util.ParticleTracerEx(
|
||||
"wn_vortigaunt_beam_colored", self:GetOwner():GetAttachment(leftClaw).Pos, tr.HitPos, true, self:GetOwner():EntIndex(), leftClaw
|
||||
)
|
||||
end
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( tr.HitPos + Vector(0, 0, 50) )
|
||||
util.Effect( "vortibeam_explosion", effectdata )
|
||||
|
||||
if SERVER then
|
||||
self:GetOwner():TakeVortalEnergy(self.vePerShot)
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
local damage = self:GetOwner():GetCharacter():GetSkillScale("vort_beam") + self.Primary.Damage
|
||||
local damageInfo = DamageInfo()
|
||||
if self:GetOwner():GetNetVar("ixVortExtract") then
|
||||
damage = 999
|
||||
end
|
||||
damageInfo:SetAttacker(self:GetOwner())
|
||||
damageInfo:SetInflictor(self)
|
||||
damageInfo:SetDamage(damage)
|
||||
damageInfo:SetDamageForce(forward * damage)
|
||||
damageInfo:SetReportedPosition(leftClaw and self:GetOwner():GetAttachment(leftClaw).Pos or self:GetOwner():EyePos())
|
||||
damageInfo:SetDamagePosition(tr.HitPos)
|
||||
damageInfo:SetDamageType(DMG_SHOCK)
|
||||
for k, target in pairs(ents.FindInSphere(tr.HitPos, self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !target:IsLineOfSightClear(tr.HitPos) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (damageInfo:GetDamage() >= 1) then
|
||||
target:TakeDamageInfo(damageInfo)
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
hook.Run("PostCalculatePlayerDamage", target, damageInfo, HITGROUP_GENERIC)
|
||||
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:Name() .. " dealing " .. damage .. " with vortadvancedbeam")
|
||||
|
||||
ix.chat.Send(self:GetOwner(), "vortbeam", "has damaged " .. target:Name() .. ", dealing " .. damage .. " points of damage", false, attacker)
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:GetClass() .. ", dealing " .. damage .. " with vortadvancedbeam")
|
||||
end
|
||||
|
||||
if (target:IsNPC() or target:IsPlayer()) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_shoot")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
for k, target in pairs(ents.FindInSphere(tr.HitPos, self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !target:IsLineOfSightClear(tr.HitPos) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:Name() .. ", dealing " .. self:GetOwner():GetCharacter():GetSkillScale("vort_beam") + self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:GetClass() .. ", dealing " .. self:GetOwner():GetCharacter():GetSkillScale("vort_beam") + self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
timer.Simple(1, function()
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
|
||||
self.IronSightsPos = Vector(-5, -5, -105)
|
||||
self.IronSightsAng = Vector(35, 15, 10)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(2, function()
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(-5, -5, -55)
|
||||
end)
|
||||
|
||||
hook.Run("TFA_PostSecondaryAttack", self)
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_practice")
|
||||
end
|
||||
|
||||
self.bIsFiring = false
|
||||
end)
|
||||
hook.Run("TFA_PostSecondaryAttack", self, true)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,474 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortibeam"
|
||||
SWEP.DrawCrosshair = true
|
||||
|
||||
game.AddParticles("particles/Vortigaunt_FX.pcf")
|
||||
end
|
||||
|
||||
PrecacheParticleSystem("vortigaunt_beam")
|
||||
PrecacheParticleSystem("vortigaunt_beam_b")
|
||||
PrecacheParticleSystem("vortigaunt_charge_token")
|
||||
|
||||
SWEP.Instructions = "Primary Fire: Fire your beam."
|
||||
SWEP.Purpose = "Immediately kills the target that you fire it at."
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "RJ"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
player_manager.AddValidModel("vortigaunt_arms2", "models/willardnetworks/vortigaunt.mdl")
|
||||
player_manager.AddValidHands("vortigaunt_arms2", "models/willardnetworks/c_arms_vortigaunt.mdl", 1, "0000000")
|
||||
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "pistol"
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = true
|
||||
|
||||
SWEP.Primary.IsAlwaysRaised = true
|
||||
SWEP.IsAlwaysRaised = true
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Damage = 40
|
||||
SWEP.Primary.Delay = 1.5
|
||||
SWEP.Primary.Ammo = ""
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Delay = 0
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.vePerShot = 5
|
||||
SWEP.aoeRadius = 50
|
||||
|
||||
SWEP.lockAngle = 5
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
-- Called when the SWEP is deployed.
|
||||
function SWEP:Deploy()
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the SWEP is holstered.
|
||||
function SWEP:Holster(switchingTo)
|
||||
self:SendWeaponAnim(ACT_VM_HOLSTER)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (SERVER) then
|
||||
if self:GetOwner() then
|
||||
if self:GetOwner().DrawViewModel then
|
||||
self:GetOwner():DrawViewModel(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self:GetOwner().broomModel) then
|
||||
if (self:GetOwner().broomModel:IsValid()) then
|
||||
self:GetOwner().broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the SWEP is initialized.
|
||||
function SWEP:Initialize()
|
||||
self.Primary.Damage = ix.config.Get("vortBeamAdditionalDamage", 40)
|
||||
self.lockAngle = ix.config.Get("VortbeamAngle", 5)
|
||||
self:SetWeaponHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:CanPrimaryAttack()
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
|
||||
local percentage = self.vePerShot / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
if !self:GetOwner():HasVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor())) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():GetCharacter():CanDoAction("vort_beam_shoot")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():OnGround()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:InterestingHit(entity)
|
||||
if entity:IsPlayer() or entity:IsNextBot() or entity:IsNPC() or entity:IsVehicle() then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
if (self.bIsFiring or !self:CanPrimaryAttack() or self:GetOwner():IsSprinting()) then return end
|
||||
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||||
|
||||
self.bIsFiring = true
|
||||
|
||||
if (CLIENT) then
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(-10, -5, -70)
|
||||
self.IronSightsAng = Vector(-5, 100, 10)
|
||||
end
|
||||
|
||||
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
|
||||
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
local chargeSound = CreateSound(self:GetOwner(), "npc/vort/attack_charge.wav")
|
||||
chargeSound:SetSoundLevel( 60 )
|
||||
chargeSound:Play()
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():SprintDisable()
|
||||
end
|
||||
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("leftclaw"))
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("rightclaw"))
|
||||
|
||||
timer.Simple(0.6, function()
|
||||
chargeSound:Stop()
|
||||
if (SERVER) then
|
||||
self:GetOwner():SprintEnable()
|
||||
end
|
||||
|
||||
if (!IsValid(self)) then return end
|
||||
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
self.bIsFiring = false
|
||||
return
|
||||
end
|
||||
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
self.bIsFiring = false
|
||||
return v
|
||||
end
|
||||
self:GetOwner():EmitSound("npc/vort/attack_shoot.wav", 40)
|
||||
|
||||
local distance = nil;
|
||||
local closest = nil;
|
||||
local directAim = false;
|
||||
|
||||
local ang = self:GetOwner():GetAimVector()
|
||||
local pos = self:GetOwner():GetShootPos()
|
||||
|
||||
local trace = {}
|
||||
trace.start = pos
|
||||
trace.endpos = pos + (ang * 65535)
|
||||
trace.filter = {self:GetOwner()}
|
||||
trace.mask = 33570817
|
||||
local trace = util.TraceLine(trace)
|
||||
|
||||
local finalHitPos = trace.HitPos;
|
||||
|
||||
if (trace.Entity and (trace.Entity:IsPlayer() or trace.Entity:IsNPC())) then
|
||||
-- we are looking right at something, that is the closest thing for sure
|
||||
closest = trace.Entity;
|
||||
directAim = true;
|
||||
else
|
||||
local x1 = self.Owner:GetShootPos();
|
||||
local x2 = trace.HitPos;
|
||||
local x12 = x2 - x1;
|
||||
local difflength = x12:LengthSqr();
|
||||
|
||||
local maxangle = math.cos(3.14159265 * self.lockAngle / 180)
|
||||
maxangle = maxangle * maxangle --Square all the way
|
||||
|
||||
local entities = ents.GetAll();
|
||||
|
||||
for k, v in pairs(entities) do
|
||||
--loop through everything, skip invalid stuff
|
||||
if (!v:IsValid()) then
|
||||
continue;
|
||||
elseif (!v:IsPlayer() and !v:IsNPC() and !v:IsNextBot()) then
|
||||
continue;
|
||||
elseif ((v.Health and v:Health() <= 0) or (v.Alive and !v:Alive())) then
|
||||
continue;
|
||||
elseif (v == self.Owner or (v.IsNoClipping and v:IsNoClipping())) then
|
||||
continue;
|
||||
end;
|
||||
|
||||
local targetFeet = v:GetPos()
|
||||
local targetShootPos = v:EyePos()
|
||||
-- we grab something roughly between their eyes and feet
|
||||
local x0 = (targetShootPos + Vector(0, 0, -5)) * 0.80 + targetFeet * 0.20;
|
||||
|
||||
-- determine angle from our LOS to our LOS to them, if they are really close to us it might be they are too far off to the side, we don't want to snap someone hugging our shoulder because he is ~30 units away from the start of our LOS
|
||||
local x10 = x0 - x1;
|
||||
local x10x12Dot = x10:Dot(x12)
|
||||
x10x12Dot = x10x12Dot * x10x12Dot
|
||||
local angle = x10x12Dot / (difflength * x10:LengthSqr());
|
||||
if (angle < maxangle) then
|
||||
continue;
|
||||
end;
|
||||
|
||||
local x20 = x10 - x12;
|
||||
local angle2 = x20:Dot(x12 * -1)
|
||||
-- also determine the angle with the end hit marker, to be sure they aren't beyond where the trace hit
|
||||
if (angle2 < 0) then
|
||||
continue;
|
||||
end;
|
||||
|
||||
-- cool vector math to calculate distance to a line
|
||||
local dist = (x0 - x1):Cross(x0 - x2):LengthSqr() / difflength;
|
||||
|
||||
local maxDistBase = ix.config.Get("VortbeamBorders", 100)
|
||||
if dist > (maxDistBase * maxDistBase) then continue end
|
||||
|
||||
if (!distance or distance > dist) then
|
||||
local centerTrace = {};
|
||||
centerTrace.start = x1;
|
||||
centerTrace.endpos = x0;
|
||||
centerTrace.filter = {self:GetOwner()}
|
||||
centerTrace.mask = 33570817
|
||||
local centerTraceResult = util.TraceLine(centerTrace)
|
||||
|
||||
if (!centerTraceResult.Hit or (centerTraceResult.Entity and centerTraceResult.Entity == v)) then
|
||||
closest = v;
|
||||
distance = dist;
|
||||
finalHitPos = x0;
|
||||
else
|
||||
local feetTrace = {}
|
||||
feetTrace.start = x1
|
||||
feetTrace.endpos = targetFeet
|
||||
feetTrace.filter = {self:GetOwner()}
|
||||
feetTrace.mask = 33570817
|
||||
local feetTraceResult = util.TraceLine(feetTrace)
|
||||
|
||||
if (!feetTraceResult.Hit or (feetTraceResult.Entity and feetTraceResult.Entity == v)) then
|
||||
closest = v;
|
||||
distance = dist;
|
||||
finalHitPos = targetFeet
|
||||
else
|
||||
local headTrace = {}
|
||||
headTrace.start = x1
|
||||
headTrace.endpos = targetShootPos
|
||||
headTrace.filter = {self:GetOwner()}
|
||||
headTrace.mask = 33570817
|
||||
local headTraceResult = util.TraceLine(headTrace)
|
||||
|
||||
if (!headTraceResult.Hit or (headTraceResult.Entity and headTraceResult.Entity == v)) then
|
||||
closest = v;
|
||||
distance = dist;
|
||||
finalHitPos = targetShootPos;
|
||||
end
|
||||
end
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (closest) then
|
||||
if (SERVER) then
|
||||
local target = closest
|
||||
local damage = self:GetOwner():GetCharacter():GetSkillScale("vort_beam") + self.Primary.Damage
|
||||
-- damage = damage * 1.7
|
||||
local damageInfo = DamageInfo()
|
||||
if self:GetOwner():GetNetVar("ixVortExtract") then
|
||||
damage = 999
|
||||
end
|
||||
damageInfo:SetAttacker(self:GetOwner())
|
||||
damageInfo:SetInflictor(self)
|
||||
damageInfo:SetDamage(damage)
|
||||
damageInfo:SetDamageForce(ang * damage)
|
||||
damageInfo:SetReportedPosition(leftClaw and self:GetOwner():GetAttachment(leftClaw).Pos or self:GetOwner():EyePos())
|
||||
damageInfo:SetDamagePosition(finalHitPos)
|
||||
damageInfo:SetDamageType(DMG_SHOCK)
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if (damageInfo:GetDamage() >= 1) then
|
||||
target:TakeDamageInfo(damageInfo)
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
hook.Run("PostCalculatePlayerDamage", target, damageInfo, HITGROUP_GENERIC)
|
||||
|
||||
ix.log.AddRaw("[VORT] " .. self:GetOwner():Name() .. " has damaged " .. target:Name() .. ", dealing " .. damage .. " with vortbeam")
|
||||
|
||||
ix.chat.Send(self:GetOwner(), "vortbeam", "has damaged " .. target:Name() .. ", dealing " .. damage .. " points of damage", false, attacker)
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
ix.log.AddRaw("[VORT] " .. self:GetOwner():Name() .. " has damaged " .. target:GetClass() .. ", dealing " .. damage .. " with vortbeam")
|
||||
|
||||
ix.chat.Send(self:GetOwner(), "vortbeam", "has damaged " .. target:GetClass() .. ", dealing " .. damage .. " points of damage", false, attacker)
|
||||
end
|
||||
|
||||
if (target:IsNPC() or target:IsPlayer()) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_shoot")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- When you don't hit shit you don't hit shit.
|
||||
end;
|
||||
|
||||
self:GetOwner():StopParticles()
|
||||
|
||||
local leftClaw = self:GetOwner():LookupAttachment("leftclaw")
|
||||
|
||||
if (leftClaw) then
|
||||
util.ParticleTracerEx(
|
||||
"vortigaunt_beam", self:GetOwner():GetAttachment(leftClaw).Pos, finalHitPos, true, self:GetOwner():EntIndex(), leftClaw
|
||||
)
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
local percentage = self.vePerShot / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
self:GetOwner():TakeVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor()))
|
||||
end
|
||||
self.bIsFiring = false
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
timer.Simple(1, function()
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
|
||||
self.IronSightsPos = Vector(-5, -5, -105)
|
||||
self.IronSightsAng = Vector(35, 15, 10)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(1, function()
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(-5, -5, -55)
|
||||
end)
|
||||
|
||||
hook.Run("TFA_PostSecondaryAttack", self)
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_practice")
|
||||
end
|
||||
end)
|
||||
hook.Run("TFA_PostSecondaryAttack", self, true)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,295 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Channel Energy"
|
||||
SWEP.DrawCrosshair = true
|
||||
end
|
||||
|
||||
SWEP.Author = "Fruity"
|
||||
SWEP.Instructions = "Primary Fire: Heal/Overcharge Lock"
|
||||
SWEP.Purpose = "To heal people or overcharge combine equipment."
|
||||
SWEP.Contact = ""
|
||||
|
||||
SWEP.Primary.IsAlwaysRaised = true
|
||||
SWEP.IsAlwaysRaised = true
|
||||
SWEP.Category = "Vort Swep"
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.Weight = 5
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "smg"
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = -1
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.Ammo = "none"
|
||||
|
||||
SWEP.Secondary.ClipSize = 1
|
||||
SWEP.Secondary.DefaultClip = 1
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
|
||||
SWEP.vePerHP = 0.5
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
|
||||
function SWEP:Deploy()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
if (!self.HealSound) then
|
||||
self.HealSound = CreateSound( self.Weapon, "npc/vort/health_charge.wav" )
|
||||
end
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DispatchEffect(EFFECTSTR)
|
||||
local pPlayer=self:GetOwner()
|
||||
if !pPlayer then return end
|
||||
local view
|
||||
if CLIENT then view=GetViewEntity() else view=pPlayer:GetViewEntity() end
|
||||
|
||||
if ( !pPlayer:IsNPC() and view:IsPlayer() ) then
|
||||
ParticleEffectAttach( EFFECTSTR, PATTACH_POINT_FOLLOW, pPlayer, pPlayer:LookupAttachment( "leftclaw" ) )
|
||||
else
|
||||
ParticleEffectAttach( EFFECTSTR, PATTACH_POINT_FOLLOW, pPlayer, pPlayer:LookupAttachment( "leftclaw" ) )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
if (!self:GetOwner():Alive()) then return false end
|
||||
if (!self:GetOwner():GetCharacter():IsVortigaunt()) then return false end
|
||||
|
||||
if (!self:GetOwner():GetCharacter():CanDoAction("vort_channel")) then return false end
|
||||
|
||||
local eye = self:GetOwner():GetEyeTrace()
|
||||
if (!eye.Entity:IsPlayer()) and (eye.Entity:GetClass() != "prop_ragdoll" and eye.Entity:GetClass() != "ix_combinelock" and eye.Entity:GetClass() != "ix_combinelock_cmru" and eye.Entity:GetClass() != "ix_combinelock_cwu" and eye.Entity:GetClass() != "ix_combinelock_dob" and eye.Entity:GetClass() != "ix_combinelock_moe") then return end
|
||||
if (eye.Entity:GetClass() == "prop_ragdoll" and !eye.Entity.ixPlayer) then return end
|
||||
|
||||
local target = eye.Entity
|
||||
if (!IsValid(target)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (self:GetOwner():Health() <= 50) then
|
||||
if (SERVER) then
|
||||
self:GetOwner():NotifyLocalized("You are too weak to channel your energy!")
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if (IsValid(target.ixPlayer)) then
|
||||
target = target.ixPlayer
|
||||
end
|
||||
|
||||
if (target:GetPos():DistToSqr(self:GetOwner():GetShootPos()) > 105 * 105) then return end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
if (target:Health() >= target:GetMaxHealth()) then
|
||||
if (SERVER) then
|
||||
self:GetOwner():NotifyLocalized("The target is perfectly healthy!")
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if (target:GetCharacter() and target:GetCharacter():GetBleedout()) then
|
||||
if target:GetCharacter().SetBleedout then
|
||||
target:GetCharacter():SetBleedout(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:SetNextPrimaryFire( 10 )
|
||||
self:SendWeaponAnim( ACT_VM_SECONDARYATTACK )
|
||||
|
||||
if (CLIENT) then
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(0, -5, -55)
|
||||
self.IronSightsAng = Vector(35, 15, 10)
|
||||
end
|
||||
local healAmount = self:GetOwner():GetCharacter():GetSkillScale("vort_heal_amount")
|
||||
local veToApply = healAmount * self.vePerHP
|
||||
local percentage = self.vePerHP / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
percentage = healAmount * percentage
|
||||
|
||||
if !self:GetOwner():HasVortalEnergy(veToApply + (percentage * self:GetOwner():Armor())) then
|
||||
self:GetOwner():NotifyLocalized("You don't have enough vortal energy!")
|
||||
return
|
||||
end
|
||||
if (SERVER) then
|
||||
self:GetOwner():ForceSequence("heal_start", function()
|
||||
self:DispatchEffect("vortigaunt_charge_token")
|
||||
self:GetOwner():EmitSound( "npc/vort/health_charge.wav", 100, 150, 1, CHAN_AUTO )
|
||||
self:SendWeaponAnim( ACT_VM_RELOAD )
|
||||
self:GetOwner():ForceSequence("heal_cycle", function()
|
||||
if (!self:GetOwner():Alive()) then return end
|
||||
if (target:GetPos():DistToSqr(self:GetOwner():GetShootPos()) <= 105 * 105) then
|
||||
if (target:IsPlayer()) then
|
||||
self:GetOwner():TakeVortalEnergy(veToApply + (percentage * self:GetOwner():Armor()))
|
||||
target:SetHealth(math.Clamp(target:Health() + healAmount, 0, target:GetMaxHealth()))
|
||||
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has healed " .. target:Name())
|
||||
else
|
||||
ix.combineNotify:AddNotification("LOG:// Bio-Restrictor " .. (target:GetLocked() and "unlocked" or "locked") .. " by %USER-ERROR%", nil, self:GetOwner())
|
||||
|
||||
target:SetLocked(!target:GetLocked())
|
||||
|
||||
self:GetOwner():GetCharacter():DoAction("vort_channel")
|
||||
end
|
||||
else
|
||||
self:GetOwner():StopSound("npc/vort/health_charge.wav")
|
||||
end
|
||||
|
||||
self:GetOwner():StopParticles()
|
||||
self:SendWeaponAnim( ACT_VM_PULLBACK )
|
||||
self:GetOwner():ForceSequence("heal_end", function()
|
||||
self:SetNextPrimaryFire( 0 )
|
||||
self:GetOwner():StopSound("npc/vort/health_charge.wav")
|
||||
self:GetOwner():Freeze(false)
|
||||
|
||||
self:GetOwner().lastVortHeal = CurTime() + 30
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
self:GetOwner():Freeze(true)
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
timer.Simple(8, function()
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
self.IronSightsPos = Vector(-5, -5, -55)
|
||||
self.IronSightsAng = Vector(35, 15, 10)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,347 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortipyro"
|
||||
SWEP.DrawCrosshair = true
|
||||
|
||||
game.AddParticles("particles/Vortigaunt_FX.pcf")
|
||||
end
|
||||
|
||||
PrecacheParticleSystem("vortigaunt_beam")
|
||||
PrecacheParticleSystem("vortigaunt_beam_b")
|
||||
PrecacheParticleSystem("vortigaunt_charge_token")
|
||||
|
||||
SWEP.Instructions = "Primary Fire: Let them burn."
|
||||
SWEP.Purpose = "Immediately kills the target that you fire it at."
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "RJ"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
player_manager.AddValidModel("vortigaunt_arms2", "models/willardnetworks/vortigaunt.mdl")
|
||||
player_manager.AddValidHands("vortigaunt_arms2", "models/willardnetworks/c_arms_vortigaunt.mdl", 1, "0000000")
|
||||
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "pistol"
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
|
||||
SWEP.Primary.IsAlwaysRaised = true
|
||||
SWEP.IsAlwaysRaised = true
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Damage = 15
|
||||
SWEP.Primary.Delay = 3
|
||||
SWEP.Primary.Ammo = ""
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Delay = 0
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.vePerShot = 40
|
||||
SWEP.aoeRadius = 320
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
-- Called when the SWEP is deployed.
|
||||
function SWEP:Deploy()
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the SWEP is holstered.
|
||||
function SWEP:Holster(switchingTo)
|
||||
self:SendWeaponAnim(ACT_VM_HOLSTER)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (SERVER) then
|
||||
if self:GetOwner() then
|
||||
if self:GetOwner().DrawViewModel then
|
||||
self:GetOwner():DrawViewModel(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self:GetOwner().broomModel) then
|
||||
if (self:GetOwner().broomModel:IsValid()) then
|
||||
self:GetOwner().broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the SWEP is initialized.
|
||||
function SWEP:Initialize()
|
||||
self:SetWeaponHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:CanPrimaryAttack()
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
|
||||
local percentage = self.vePerShot / 100
|
||||
|
||||
if !self:GetOwner():HasVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor())) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():GetCharacter():CanDoAction("vort_beam_shoot")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():OnGround()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||||
|
||||
if (self.bIsFiring or !self:CanPrimaryAttack()) then return end
|
||||
self.bIsFiring = true
|
||||
|
||||
ParticleEffectAttach("vort_meditation", PATTACH_ABSORIGIN_FOLLOW, self:GetOwner(), 0)
|
||||
ParticleEffectAttach("vort_shield_parent", PATTACH_ABSORIGIN_FOLLOW, self:GetOwner(), 0)
|
||||
|
||||
if SERVER then
|
||||
local owner = self:GetOwner()
|
||||
owner:SetVelocity(-owner:GetVelocity())
|
||||
owner:SetRunSpeed(1)
|
||||
owner:SetWalkSpeed(1)
|
||||
owner:SetJumpPower(1)
|
||||
|
||||
timer.Simple(0.1, function()
|
||||
if !IsValid(owner) then return end
|
||||
owner:ForceSequence("Stomp", function()
|
||||
owner:SetRunSpeed(ix.config.Get("runSpeed") * 1.25)
|
||||
owner:SetWalkSpeed(ix.config.Get("walkSpeed"))
|
||||
owner:SetJumpPower(250)
|
||||
end, nil, true)
|
||||
end)
|
||||
end
|
||||
timer.Simple(0.2, function()
|
||||
if !IsValid(self:GetOwner()) then return end
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, self:GetOwner(), 12)
|
||||
end)
|
||||
local chargeSound = CreateSound(self:GetOwner(), "npc/vort/attack_charge.wav")
|
||||
chargeSound:SetSoundLevel( 90 )
|
||||
chargeSound:Play()
|
||||
|
||||
timer.Simple(1, function()
|
||||
chargeSound:Stop()
|
||||
if (!IsValid(self)) then return end
|
||||
|
||||
if (!IsValid(self:GetOwner()) or !self:GetOwner():Alive()) then
|
||||
self.bIsFiring = false
|
||||
return
|
||||
end
|
||||
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
self.bIsFiring = false
|
||||
return v
|
||||
end
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self:GetOwner():GetPos() )
|
||||
util.Effect( "vortipyro_explosion", effectdata )
|
||||
self:GetOwner():EmitSound("npc/vort/attack_shoot.wav", 40, 90)
|
||||
|
||||
local forward = self:GetOwner():EyeAngles():Forward()
|
||||
|
||||
self:GetOwner():StopParticles()
|
||||
|
||||
if SERVER then
|
||||
local percentage = self.vePerShot / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
self:GetOwner():TakeVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor()))
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
local damage = self.Primary.Damage
|
||||
local damageInfo = DamageInfo()
|
||||
damageInfo:SetAttacker(self:GetOwner())
|
||||
damageInfo:SetInflictor(self)
|
||||
damageInfo:SetDamage(damage)
|
||||
damageInfo:SetDamageForce(forward * damage)
|
||||
damageInfo:SetReportedPosition(self:GetOwner():GetPos())
|
||||
damageInfo:SetDamagePosition(self:GetOwner():GetPos())
|
||||
damageInfo:SetDamageType(DMG_BURN)
|
||||
for k, target in pairs(ents.FindInSphere(self:GetOwner():GetPos(), self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !self:GetOwner():IsLineOfSightClear(target) then
|
||||
continue
|
||||
end
|
||||
target:Ignite(12)
|
||||
|
||||
if (damageInfo:GetDamage() >= 1) then
|
||||
target:TakeDamageInfo(damageInfo)
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
hook.Run("PostCalculatePlayerDamage", target, damageInfo, HITGROUP_GENERIC)
|
||||
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:Name() .. " dealing " .. damage .. " with vortpyro")
|
||||
|
||||
ix.chat.Send(self:GetOwner(), "vortbeam", "has damaged " .. target:Name() .. ", dealing " .. damage .. " points of damage", false, attacker)
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:GetClass() .. ", dealing " .. damage .. " with vortpyro")
|
||||
end
|
||||
|
||||
if (target:IsNPC() or target:IsPlayer()) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_shoot")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
for k, target in pairs(ents.FindInSphere(self:GetOwner():GetPos(), self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !self:GetOwner():IsLineOfSightClear(target) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:Name() .. ", dealing " .. self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:GetClass() .. ", dealing " .. self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Run("TFA_PostSecondaryAttack", self)
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_practice")
|
||||
end
|
||||
|
||||
self.bIsFiring = false
|
||||
end)
|
||||
hook.Run("TFA_PostSecondaryAttack", self, true)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,346 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortislam"
|
||||
SWEP.DrawCrosshair = true
|
||||
|
||||
game.AddParticles("particles/Vortigaunt_FX.pcf")
|
||||
end
|
||||
|
||||
PrecacheParticleSystem("vortigaunt_beam")
|
||||
PrecacheParticleSystem("vortigaunt_beam_b")
|
||||
PrecacheParticleSystem("vortigaunt_charge_token")
|
||||
|
||||
SWEP.Instructions = "Primary Fire: Breaks the surface."
|
||||
SWEP.Purpose = "Immediately kills the target that you fire it at."
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "RJ"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
player_manager.AddValidModel("vortigaunt_arms2", "models/willardnetworks/vortigaunt.mdl")
|
||||
player_manager.AddValidHands("vortigaunt_arms2", "models/willardnetworks/c_arms_vortigaunt.mdl", 1, "0000000")
|
||||
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "pistol"
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
|
||||
SWEP.Primary.IsAlwaysRaised = true
|
||||
SWEP.IsAlwaysRaised = true
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Damage = 40
|
||||
SWEP.Primary.Delay = 3
|
||||
SWEP.Primary.Ammo = ""
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Delay = 0
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.vePerShot = 10
|
||||
SWEP.aoeRadius = 350
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
-- Called when the SWEP is deployed.
|
||||
function SWEP:Deploy()
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the SWEP is holstered.
|
||||
function SWEP:Holster(switchingTo)
|
||||
self:SendWeaponAnim(ACT_VM_HOLSTER)
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self:GetOwner())) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self:GetOwner():GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (SERVER) then
|
||||
if self:GetOwner() then
|
||||
if self:GetOwner().DrawViewModel then
|
||||
self:GetOwner():DrawViewModel(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self:GetOwner().broomModel) then
|
||||
if (self:GetOwner().broomModel:IsValid()) then
|
||||
self:GetOwner().broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the SWEP is initialized.
|
||||
function SWEP:Initialize()
|
||||
self.Primary.Damage = ix.config.Get("vortSlamBaseDamage", 40)
|
||||
self:SetWeaponHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:CanPrimaryAttack()
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
|
||||
local percentage = self.vePerShot / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
|
||||
if !self:GetOwner():HasVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor())) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():GetCharacter():CanDoAction("vort_beam_shoot")) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (!self:GetOwner():OnGround()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
|
||||
|
||||
if (self.bIsFiring or !self:CanPrimaryAttack()) then return end
|
||||
self.bIsFiring = true
|
||||
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("leftclaw"))
|
||||
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_POINT_FOLLOW, self:GetOwner(), self:GetOwner():LookupAttachment("rightclaw"))
|
||||
ParticleEffectAttach("vort_meditation", PATTACH_ABSORIGIN_FOLLOW, self:GetOwner(), 0)
|
||||
ParticleEffectAttach("vort_shield_parent", PATTACH_ABSORIGIN_FOLLOW, self:GetOwner(), 0)
|
||||
|
||||
if SERVER then
|
||||
local owner = self:GetOwner()
|
||||
owner:SetVelocity(-owner:GetVelocity())
|
||||
owner:SetRunSpeed(1)
|
||||
owner:SetWalkSpeed(1)
|
||||
owner:SetJumpPower(1)
|
||||
|
||||
timer.Simple(0.1, function()
|
||||
if !IsValid(owner) then return end
|
||||
owner:ForceSequence("Dispel", function()
|
||||
owner:SetRunSpeed(ix.config.Get("runSpeed") * 1.25)
|
||||
owner:SetWalkSpeed(ix.config.Get("walkSpeed"))
|
||||
owner:SetJumpPower(250)
|
||||
end, nil, true)
|
||||
end)
|
||||
end
|
||||
|
||||
timer.Simple(0.5, function()
|
||||
if !IsValid(self) or !IsValid(self:GetOwner()) then return end
|
||||
self:GetOwner():EmitSound("wn/vortigaunts/vort_dispell.wav", 95)
|
||||
end)
|
||||
|
||||
timer.Simple(2, function()
|
||||
if (!IsValid(self)) then return end
|
||||
|
||||
if (!IsValid(self:GetOwner()) or !self:GetOwner():Alive()) then
|
||||
self.bIsFiring = false
|
||||
return
|
||||
end
|
||||
|
||||
local v = hook.Run("TFA_CanSecondaryAttack", self)
|
||||
if v ~= nil then
|
||||
self.bIsFiring = false
|
||||
return v
|
||||
end
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self:GetOwner():GetPos() )
|
||||
util.Effect( "vortislam_impact", effectdata )
|
||||
|
||||
local forward = self:GetOwner():EyeAngles():Forward()
|
||||
self:GetOwner():StopParticles()
|
||||
|
||||
if SERVER then
|
||||
local percentage = self.vePerShot / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
self:GetOwner():TakeVortalEnergy(self.vePerShot + (percentage * self:GetOwner():Armor()))
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
local damage = self.Primary.Damage
|
||||
if self:GetOwner():GetNetVar("ixVortExtract") then
|
||||
damage = 999
|
||||
end
|
||||
local damageInfo = DamageInfo()
|
||||
damageInfo:SetAttacker(self:GetOwner())
|
||||
damageInfo:SetInflictor(self)
|
||||
damageInfo:SetDamage(damage)
|
||||
damageInfo:SetDamageForce(forward * damage)
|
||||
damageInfo:SetReportedPosition(self:GetOwner():GetPos())
|
||||
damageInfo:SetDamagePosition(self:GetOwner():GetPos())
|
||||
damageInfo:SetDamageType(DMG_SHOCK)
|
||||
for k, target in pairs(ents.FindInSphere(self:GetOwner():GetPos(), self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !self:GetOwner():IsLineOfSightClear(target) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (damageInfo:GetDamage() >= 1) then
|
||||
target:TakeDamageInfo(damageInfo)
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
hook.Run("PostCalculatePlayerDamage", target, damageInfo, HITGROUP_GENERIC)
|
||||
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:Name() .. " dealing " .. damage .. " with vortslam")
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
ix.log.AddRaw("[VORT] ".. self:GetOwner():Name() .." has damaged " .. target:GetClass() .. ", dealing " .. damage .. " with vortslam")
|
||||
end
|
||||
|
||||
if (target:IsNPC() or target:IsPlayer()) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_shoot")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
for k, target in pairs(ents.FindInSphere(self:GetOwner():GetPos(), self.aoeRadius)) do
|
||||
if target != self:GetOwner() and
|
||||
target:IsPlayer() or
|
||||
target:IsNextBot() or
|
||||
target:IsNPC() or
|
||||
target:IsVehicle() then
|
||||
if !self:GetOwner():IsLineOfSightClear(target) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (target:IsPlayer()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:Name() .. ", dealing " .. self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
|
||||
if (target:IsNPC()) then
|
||||
--chat.AddText(Color(217, 83, 83), "You have damaged " .. target:GetClass() .. ", dealing " .. self.Primary.Damage .. " points of damage.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Run("TFA_PostSecondaryAttack", self)
|
||||
|
||||
if (SERVER) then
|
||||
self:GetOwner():GetCharacter():DoAction("vort_beam_practice")
|
||||
end
|
||||
|
||||
self.bIsFiring = false
|
||||
end)
|
||||
hook.Run("TFA_PostSecondaryAttack", self, true)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,207 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if ( SERVER ) then
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 3
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Broom"
|
||||
SWEP.DrawCrosshair = true
|
||||
end
|
||||
|
||||
SWEP.Author = "JohnyReaper"
|
||||
SWEP.Instructions = "Primary Fire: Sweep"
|
||||
SWEP.Purpose = "To sweep up dirt and trash."
|
||||
SWEP.Contact = ""
|
||||
|
||||
SWEP.Category = "Vort Swep"
|
||||
SWEP.Slot = 3
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.Weight = 5
|
||||
SWEP.IsAlwaysRaised = true
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
SWEP.HoldType = "shotgun"
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.ViewModelFOV = 110
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = -1
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.Ammo = "none"
|
||||
|
||||
SWEP.Secondary.ClipSize = 1
|
||||
SWEP.Secondary.DefaultClip = 1
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
if (!IsValid(self.Owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
if (!self.Owner:Alive()) then return false end
|
||||
if (!self.Owner:GetCharacter():IsVortigaunt()) then return false end
|
||||
|
||||
|
||||
self.Owner.broomModel = ents.Create("prop_dynamic")
|
||||
self.Owner.broomModel:SetModel("models/props_c17/pushbroom.mdl")
|
||||
self.Owner.broomModel:SetMoveType(MOVETYPE_NONE)
|
||||
self.Owner.broomModel:SetSolid(SOLID_NONE)
|
||||
self.Owner.broomModel:SetParent(self.Owner)
|
||||
self.Owner.broomModel:DrawShadow(true)
|
||||
self.Owner.broomModel:Spawn()
|
||||
self.Owner.broomModel:Fire("setparentattachment", "cleaver_attachment", 0.01)
|
||||
end
|
||||
|
||||
local viewModel = self.Owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
if (!IsValid(self.Owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
if (self.Owner.broomModel) then
|
||||
if (self.Owner.broomModel:IsValid()) then
|
||||
self.Owner.broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
local viewModel = self.Owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
if (!IsValid(self.Owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self.Owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function SWEP:OnRemove()
|
||||
if (SERVER) then
|
||||
if self.Owner then
|
||||
if self.Owner.DrawViewModel then
|
||||
self.Owner:DrawViewModel(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (self.Owner.broomModel) then
|
||||
if (self.Owner.broomModel:IsValid()) then
|
||||
self.Owner.broomModel:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
|
||||
if (!self.Owner:Alive()) then return false end
|
||||
if (!self.Owner:GetCharacter():IsVortigaunt()) then return false end
|
||||
|
||||
self:SetNextPrimaryFire( CurTime() + 2 )
|
||||
-- self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
if (SERVER) then
|
||||
self.Owner:ForceSequence("sweep", nil,nil, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,208 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
if (SERVER) then
|
||||
AddCSLuaFile("shared.lua")
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
SWEP.Slot = 1
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.PrintName = "Vortishield"
|
||||
SWEP.DrawCrosshair = true
|
||||
end
|
||||
|
||||
SWEP.Purpose = "Allows you to create a shield from Vortal Energies"
|
||||
SWEP.Contact = ""
|
||||
SWEP.Author = "Adolphus (& M!NT)"
|
||||
SWEP.WorldModel = ""
|
||||
SWEP.HoldType = "fist"
|
||||
SWEP.Category = "Vort Swep"
|
||||
|
||||
SWEP.Primary.DefaultClip = 0
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.Ammo = ""
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = false
|
||||
|
||||
SWEP.Secondary.DefaultClip = 0
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.Ammo = ""
|
||||
|
||||
SWEP.ViewModelFOV = 110
|
||||
SWEP.ViewModel = Model("models/willardnetworks/c_arms_vortigaunt.mdl")
|
||||
SWEP.IsAlwaysRaised = true
|
||||
|
||||
SWEP.vePerUse = 20
|
||||
|
||||
if CLIENT then
|
||||
SWEP.NextAllowedPlayRateChange = 0
|
||||
end
|
||||
|
||||
function SWEP:Initialize()
|
||||
return
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
if (!IsValid(owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_DRAW)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:Think()
|
||||
local owner = self:GetOwner()
|
||||
if (self.vSHIELD and !IsValid(owner)) then
|
||||
self.vSHIELD:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel) and self.NextAllowedPlayRateChange < CurTime()) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
local owner = self:GetOwner()
|
||||
if (!IsValid(owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_VM_FISTS_HOLSTER)
|
||||
if CLIENT then
|
||||
self.NextAllowedPlayRateChange = CurTime() + viewModel:SequenceDuration()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:ValidateShield()
|
||||
for _, shield in ipairs(ents.FindByClass("ix_vortshield")) do
|
||||
if shield:GetOwner() == self:GetOwner() then
|
||||
shield:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Called when the player attempts to primary fire.
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (!owner:GetCharacter():HasFlags("q")) then
|
||||
if CLIENT then
|
||||
owner:NotifyLocalized("You do not have the required (q) flag!")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local percentage = self.vePerUse / 100
|
||||
percentage = percentage * ix.config.Get("additionalVortalEnergyDrainPerPointOfArmor", 1)
|
||||
if !self.Owner:HasVortalEnergy(self.vePerUse + (percentage * self.Owner:Armor())) then
|
||||
return
|
||||
end
|
||||
|
||||
if (SERVER) then
|
||||
if (!IsValid(self.vSHIELD)) then
|
||||
self:SetNextPrimaryFire(CurTime() + ix.config.Get("VortShieldRecharge", 20))
|
||||
|
||||
self.Owner:TakeVortalEnergy(self.vePerUse + (percentage * self.Owner:Armor()))
|
||||
|
||||
self:ValidateShield()
|
||||
|
||||
self.vSHIELD = ents.Create("ix_vortshield")
|
||||
self.vSHIELD:SetPos(owner:GetPos() + owner:GetUp()*45)
|
||||
self.vSHIELD:Spawn()
|
||||
self.vSHIELD:Activate()
|
||||
self.vSHIELD:SetOwner(owner)
|
||||
self.vSHIELD:FollowBone(owner, 11)
|
||||
self.vSHIELD:SetLocalAngles(Angle(0, 0, -90))
|
||||
self.vSHIELD:SetLocalPos(Vector(-20, 10, 0))
|
||||
owner:EmitSound("npc/vort/health_charge.wav")
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
function SWEP:SecondaryAttack()
|
||||
if (SERVER) then
|
||||
if IsValid(self.vSHIELD) then
|
||||
self:GetOwner():EmitSound("npc/vort/health_charge.wav")
|
||||
self.vSHIELD:Remove()
|
||||
end
|
||||
self:SetNextSecondaryFire(CurTime() + 4)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
function SWEP:PreDrawViewModel(viewModel, weapon, client)
|
||||
local hands = player_manager.TranslatePlayerHands(player_manager.TranslateToPlayerModelName(client:GetModel()))
|
||||
|
||||
if (hands and hands.model) then
|
||||
viewModel:SetModel(hands.model)
|
||||
viewModel:SetSkin(hands.skin)
|
||||
viewModel:SetBodyGroups(hands.body)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:DoDrawCrosshair(x, y)
|
||||
surface.SetDrawColor(255, 255, 255, 66)
|
||||
surface.DrawRect(x - 2, y - 2, 4, 4)
|
||||
end
|
||||
|
||||
-- Adjust these variables to move the viewmodel's position
|
||||
SWEP.IronSightsPos = Vector(-5, -5, -55)
|
||||
SWEP.IronSightsAng = Vector(35, 15, 10)
|
||||
|
||||
function SWEP:GetViewModelPosition(EyePos, EyeAng)
|
||||
local Mul = 1.0
|
||||
|
||||
local Offset = self.IronSightsPos
|
||||
|
||||
if (self.IronSightsAng) then
|
||||
EyeAng = EyeAng * 1
|
||||
|
||||
EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul)
|
||||
EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul)
|
||||
end
|
||||
|
||||
local Right = EyeAng:Right()
|
||||
local Up = EyeAng:Up()
|
||||
local Forward = EyeAng:Forward()
|
||||
|
||||
EyePos = EyePos + Offset.x * Right * Mul
|
||||
EyePos = EyePos + Offset.y * Forward * Mul
|
||||
EyePos = EyePos + Offset.z * Up * Mul
|
||||
|
||||
return EyePos, EyeAng
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user