add sborka
This commit is contained in:
215
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_afak.lua
Normal file
215
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_afak.lua
Normal file
@@ -0,0 +1,215 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_afak" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "AFAK First Aid Kit"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals up to 30HP
|
||||
Cures Bleeding
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Medkits"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/afak/v_meds_afak.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/afak/w_meds_afak.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "afak"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 400
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 30
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_afak"
|
||||
local ID_PRIMARYAMMO = "afak"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
if owner:HaveEffect("Bleeding") then
|
||||
owner:RemoveEffect("Bleeding")
|
||||
owner:RemoveAmmo(30, ID_PRIMARYAMMO)
|
||||
end
|
||||
end
|
||||
|
||||
if INI_VIVO == true then
|
||||
math.Round(OJSWounds:HealHP(owner, self.MaxHeal, VarHealHealth), 0)
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Bleed")) then
|
||||
OJSWounds:HealBleed(owner)
|
||||
owner:RemoveAmmo(30, ID_PRIMARYAMMO)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(VarHealHealth, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IniAnimBandage = 1
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
|
||||
timer.Simple(0.6, function() -- Audio Timer
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
if owner:GetActiveWeapon():GetClass() == ID_WEAPON then owner:EmitSound("MedsGrizzly.Open") end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if SERVER then
|
||||
if self.IniHeal == 1 and self.IdleTimer <= CurTime() then -- Initialize Heal
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
|
||||
if self.IniAnimBandage == 1 and self.AnimTimes <= 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
if math.random(1,2) == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL2)
|
||||
else
|
||||
self:SendWeaponAnim(ACT_VM_HITRIGHT)
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimBandage == 1 and self.AnimTimes == 2 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL3)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
end
|
||||
|
||||
-- if SERVER then return end
|
||||
-- if GetConVar("cl_eftmeds_quick"):GetBool() then
|
||||
-- LocalPlayer():ConCommand("+attack")
|
||||
-- if self.IniHeal == 1 then
|
||||
-- print("hi")
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
function SWEP:Holster()
|
||||
if CLIENT then LocalPlayer():ConCommand("-attack") end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -4, 3)
|
||||
local offsetAng = Angle(-0, -0, -180)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,179 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_alusplint" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Aluminium Splint"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Cures Fatigue
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Injury Treatment"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/alusplint/v_meds_alusplint.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/alusplint/w_meds_alusplint.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "alusplint"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 5
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_alusplint"
|
||||
local ID_PRIMARYAMMO = "alusplint"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
owner:RemoveEffect("Fatigue")
|
||||
end
|
||||
|
||||
if INI_VIVO == true then
|
||||
OJSWounds:HealFracture(owner)
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
|
||||
timer.Simple(1.5, function() -- Audio Timer
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
if owner:GetActiveWeapon():GetClass() == "weapon_eft_alusplint" then owner:EmitSound("MedsSplint.Middle") end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(0, -5, -0)
|
||||
local offsetAng = Angle(-90, 180, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
191
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_anaglin.lua
Normal file
191
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_anaglin.lua
Normal file
@@ -0,0 +1,191 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_alusplint" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Anaglin"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Gives On Painkillers, 95s
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Drugs"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/anaglin/v_meds_anaglin.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/anaglin/w_meds_anaglin.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "anaglin"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 4
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_anaglin"
|
||||
local ID_PRIMARYAMMO = "anaglin"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
|
||||
OJSWounds:HealPain(owner)
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("OnPainkillers", 5)
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("OnPainkillers", 95)
|
||||
end
|
||||
if INI_VIVO == true then
|
||||
OJSWounds:AddStatus(owner,"Head","Painkillers", 95, 1)
|
||||
for i=1,7 do
|
||||
OJSWounds:HealPain(owner)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(4, -3, -2)
|
||||
local offsetAng = Angle(-90, 180, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,178 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_augmentin" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Augmentin Antibiotic's"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Gives Tenacity (20%)
|
||||
Cures Dark Vision
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Drugs"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/augmentin/v_meds_augmentin.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/augmentin/w_meds_augmentin.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "augmentin"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 5
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_augmentin"
|
||||
local ID_PRIMARYAMMO = "augmentin"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Tenacity", 155, 20)
|
||||
owner:ApplyEffect("OnPainkillers", 155)
|
||||
owner:RemoveEffect("DarkVision")
|
||||
end
|
||||
if INI_VIVO == true then
|
||||
OJSWounds:AddStatus(owner,"Head","Painkillers", 155, 1)
|
||||
for i=1,7 do
|
||||
OJSWounds:HealPain(owner)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(0, -5, -0)
|
||||
local offsetAng = Angle(-90, 180, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,246 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_carfirstaidkit" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Car First Aid Kit"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals up to 35HP
|
||||
Cures Bleeding
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Medkits"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/automedkit/v_meds_automedkit.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/automedkit/w_meds_automedkit.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "carfirstaidkit"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 220
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 35
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_automedkit"
|
||||
local ID_PRIMARYAMMO = "carfirstaidkit"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
if owner:HaveEffect("Bleeding") then
|
||||
owner:RemoveEffect("Bleeding")
|
||||
owner:RemoveAmmo(50, ID_PRIMARYAMMO)
|
||||
end
|
||||
end
|
||||
|
||||
if INI_VIVO == true then
|
||||
math.Round(OJSWounds:HealHP(owner, self.MaxHeal, VarHealHealth), 0)
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Bleed")) then
|
||||
OJSWounds:HealBleed(owner)
|
||||
owner:RemoveAmmo(50, ID_PRIMARYAMMO)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(VarHealHealth, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
|
||||
local RndAnim = math.random(1,3)
|
||||
if (InitializeSEF == true and owner:HaveEffect("Bleeding")) or (INI_VIVO == true and (OJSWounds:HasStatusWholeBody(owner, "Bleed"))) then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 2 then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_HIGH)
|
||||
self.IniAnimSyringe = 1
|
||||
else
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IniAnimPills = 1
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
|
||||
timer.Simple(0.55, function() -- Audio Timer
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
if owner:GetActiveWeapon():GetClass() == "weapon_eft_automedkit" then owner:EmitSound("MedsGrizzly.Open") end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if SERVER then
|
||||
if self.IniHeal == 1 and self.IdleTimer <= CurTime() then -- Initialize Heal
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
|
||||
if self.IniAnimBandage == 1 and self.AnimTimes <= 2 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
if math.random(1,2) == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT2)
|
||||
else
|
||||
self:SendWeaponAnim(ACT_VM_MISSCENTER)
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimBandage == 1 and self.AnimTimes == 3 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_MISSCENTER2)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
|
||||
if self.IniAnimSyringe == 1 and self.AnimTimes <= 2 and self.IdleTimer <= CurTime() then -- Syringe Sequence
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimSyringe == 1 and self.AnimTimes == 3 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_LOW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
|
||||
if self.IniAnimPills == 1 and self.AnimTimes <= 1 and self.IdleTimer <= CurTime() then -- Syringe Sequence
|
||||
if self.AnimTimes == 0 then
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL3)
|
||||
else
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL2)
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimPills == 1 and self.AnimTimes == 2 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PICKUP)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -5, 3)
|
||||
local offsetAng = Angle(-0, 0, 180)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
187
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_cat.lua
Normal file
187
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_cat.lua
Normal file
@@ -0,0 +1,187 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_cat" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "CAT hemostatic tourniquet"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Cures Bleeding
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Injury Treatment"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/cat/v_meds_cat.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/cat/w_meds_cat.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "cattourniquet"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 90
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_cat"
|
||||
local ID_PRIMARYAMMO = "cattourniquet"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
owner:RemoveEffect("Bleeding")
|
||||
end
|
||||
if INI_VIVO == true then
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Bleed")) then
|
||||
OJSWounds:HealBleed(owner)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(ID_PRIMARYAMMO) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniHeal == 1 and self.IdleTimer <= CurTime() then -- Initialize Heal
|
||||
self.IniHeal = 0
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
|
||||
if self.IniAnimBandage == 1 and self.AnimTimes <= 0 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL2)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimBandage == 1 and self.AnimTimes == 1 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL3)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(0, -5, -0)
|
||||
local offsetAng = Angle(-90, 180, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
245
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_grizzly.lua
Normal file
245
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_grizzly.lua
Normal file
@@ -0,0 +1,245 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_grizzly" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Grizzly Medical Kit"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals up to 90HP
|
||||
Cures Bleeding
|
||||
Cures Concussion
|
||||
Cures Fatigue
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Medkits"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/grizzly/v_meds_grizzly.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/grizzly/w_meds_grizzly.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "grizzlykit"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1800
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 90
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_grizzly"
|
||||
local ID_PRIMARYAMMO = "grizzlykit"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
if owner:HaveEffect("Bleeding") then
|
||||
owner:RemoveEffect("Bleeding")
|
||||
owner:RemoveAmmo(40, ID_PRIMARYAMMO)
|
||||
end
|
||||
if owner:HaveEffect("Fatigue") then
|
||||
owner:RemoveEffect("Fatigue")
|
||||
owner:SoftRemoveEffect("Fatigue")
|
||||
owner:RemoveAmmo(50, ID_PRIMARYAMMO)
|
||||
end
|
||||
owner:RemoveEffect("Concussion")
|
||||
end
|
||||
|
||||
if INI_VIVO == true then
|
||||
math.Round(OJSWounds:HealHP(owner, self.MaxHeal, VarHealHealth), 0)
|
||||
OJSWounds:HealPain(owner)
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Bleed")) then
|
||||
OJSWounds:HealBleed(owner)
|
||||
owner:RemoveAmmo(40, ID_PRIMARYAMMO)
|
||||
end
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Fractured")) then
|
||||
OJSWounds:HealFracture(owner)
|
||||
owner:RemoveAmmo(50, ID_PRIMARYAMMO)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(VarHealHealth, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
local RndAnim = math.random(1,2)
|
||||
if InitializeSEF == true and owner:HaveEffect("Bleeding") or (INI_VIVO == true and (OJSWounds:HasStatusWholeBody(owner, "Bleed"))) then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 2 then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_HIGH)
|
||||
self.IniAnimSyringe = 1
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
|
||||
timer.Simple(0.4, function() -- Audio Timer
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
if owner:GetActiveWeapon():GetClass() == "weapon_eft_grizzly" then owner:EmitSound("MedsGrizzly.Open") end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if SERVER then
|
||||
if self.IniHeal == 1 and self.IdleTimer <= CurTime() then -- Initialize Heal
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
|
||||
if self.IniAnimBandage == 1 and self.AnimTimes <= 2 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT2)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimBandage == 1 and self.AnimTimes == 3 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_MISSCENTER2)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
|
||||
if self.IniAnimSyringe == 1 and self.AnimTimes <= 0 and self.IdleTimer <= CurTime() then -- Syringe Sequence
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimSyringe == 1 and self.AnimTimes == 1 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PICKUP)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimSyringe == 1 and self.AnimTimes == 2 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimSyringe == 1 and self.AnimTimes == 3 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_LOW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
self.IniHeal = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -7, 5)
|
||||
local offsetAng = Angle(-0, -0, -180)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,177 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_eftadrenaline" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Adrenaline"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals 15HP over 15s
|
||||
Gives Haste 65s
|
||||
Gives Vulnerability 60s
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Stimulants"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "injectoradrenaline"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectoradrenaline"
|
||||
local ID_PRIMARYAMMO = "injectoradrenaline"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(7)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Haste", 65, 40)
|
||||
owner:ApplyEffect("Vuln", 60)
|
||||
owner:ApplyEffect("Healing", 15, 1, 1)
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(7)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,177 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_eTG" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "eTG-Change Regenerative"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals 45HP over 90s
|
||||
Removes 10HP
|
||||
Cures Concussion
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Stimulants"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "etg"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectoretg"
|
||||
local ID_PRIMARYAMMO = "etg"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(5)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Healing", 90, 1, 2)
|
||||
owner:ApplyEffect("Wither", 5, 2, 1)
|
||||
owner:RemoveEffect("Concussion")
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(5)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,178 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_L1" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "L1 Norepinephrine"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Gives Tenacity 3s, 35%
|
||||
Gives Exhausted 60s
|
||||
Cures Dark Vision
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Stimulants"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "l1"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectorl1"
|
||||
local ID_PRIMARYAMMO = "l1"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(4)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Exhaust", 93)
|
||||
owner:ApplyEffect("Tenacity", 3, 35)
|
||||
|
||||
owner:RemoveEffect("DarkVision")
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(4)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,179 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_morphine" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Morphine"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Gives Endurance 305s, 15%
|
||||
Gives Hindered 120s, -30u
|
||||
Cures Concussion
|
||||
Cures Dark Vision
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Drugs"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "morphine"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectormorphine"
|
||||
local ID_PRIMARYAMMO = "morphine"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Endurance", 305, 15)
|
||||
owner:ApplyEffect("Hindered", 120, 30)
|
||||
owner:RemoveEffect("Concussion")
|
||||
owner:RemoveEffect("DarkVision")
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(1)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,175 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_propital" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Propital Regenerative Stimulant"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals 100HP over 300s
|
||||
Gives Dark Vision 20s
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Stimulants"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "propital"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectorpropital"
|
||||
local ID_PRIMARYAMMO = "propital"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(9)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Healing", 300, 1, 3)
|
||||
owner:ApplyEffect("DarkVision", 20)
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(9)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,175 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_TG12" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "xTG-12 Antidote"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Cures Poison
|
||||
Gives Wither -5HP over 60s
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Stimulants"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/injector/v_meds_injector.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/injector/w_meds_injector.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "tg12"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local ID_WEAPON = "weapon_eft_injectortg12"
|
||||
local ID_PRIMARYAMMO = "tg12"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
else
|
||||
INI_SEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) and IsValid(self.Owner) then
|
||||
local vm = self.Owner:GetViewModel()
|
||||
if IsValid(vm) then
|
||||
vm:SetSkin(13)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:ApplyEffect("Wither", 60, 1, 12)
|
||||
owner:RemoveEffect("Poison")
|
||||
end
|
||||
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(13)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(3, -1, 2)
|
||||
local offsetAng = Angle(-180, 0, 0)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
221
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_salewa.lua
Normal file
221
garrysmod/addons/other_sweps/lua/weapons/weapon_eft_salewa.lua
Normal file
@@ -0,0 +1,221 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_salewa" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Salewa First Aid Kit"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals up to 45HP
|
||||
Cures Bleeding
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Medkits"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/salewa/v_meds_salewa.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/salewa/w_meds_salewa.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "salewafirstaidkit"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 400
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 45
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_salewa"
|
||||
local ID_PRIMARYAMMO = "salewafirstaidkit"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
if owner:HaveEffect("Bleeding") then
|
||||
owner:RemoveEffect("Bleeding")
|
||||
owner:RemoveAmmo(45, ID_PRIMARYAMMO)
|
||||
end
|
||||
end
|
||||
|
||||
if INI_VIVO == true then
|
||||
math.Round(OJSWounds:HealHP(owner, self.MaxHeal, VarHealHealth), 0)
|
||||
if (OJSWounds:HasStatusWholeBody(owner, "Bleed")) then
|
||||
OJSWounds:HealBleed(owner)
|
||||
owner:RemoveAmmo(45, ID_PRIMARYAMMO)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(VarHealHealth, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 or self.IniAnimSyringe == 1 or self.IniAnimPills == 1 then return end
|
||||
|
||||
local RndAnim = math.random(1,2)
|
||||
if (INI_SEF == true and owner:HaveEffect("Bleeding")) or (INI_VIVO == true and (OJSWounds:HasStatusWholeBody(owner, "Bleed"))) then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT)
|
||||
self.IniAnimBandage = 1
|
||||
elseif RndAnim == 2 then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_HIGH)
|
||||
self.IniAnimSyringe = 1
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if SERVER then
|
||||
if self.IniHeal == 1 and self.IdleTimer <= CurTime() then -- Initialize Heal
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
|
||||
if self.IniAnimBandage == 1 and self.AnimTimes <= 2 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
if math.random(1,2) == 1 then
|
||||
self:SendWeaponAnim(ACT_VM_MISSRIGHT2)
|
||||
else
|
||||
self:SendWeaponAnim(ACT_VM_MISSCENTER)
|
||||
end
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimBandage == 1 and self.AnimTimes == 3 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_MISSCENTER2)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
|
||||
if self.IniAnimSyringe == 1 and self.AnimTimes <= 6 and self.IdleTimer <= CurTime() then -- Syringe Sequence
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.AnimTimes = self.AnimTimes + 1
|
||||
elseif self.IniAnimSyringe == 1 and self.AnimTimes == 7 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_PULLBACK_LOW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniHeal = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(4, -4, 5)
|
||||
local offsetAng = Angle(-0, -90, -180)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,194 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/vgui_surgicalkit" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "CMS Surgical Kit"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Cures Broken
|
||||
]]
|
||||
SWEP.Category = "EFT"
|
||||
SWEP.Category1 = "EFT"
|
||||
SWEP.Category2 = "Injury Treatment"
|
||||
|
||||
SWEP.ViewModelFOV = 85
|
||||
SWEP.ViewModel = "models/weapons/sweps/eft/surgicalkit/v_meds_surgicalkit.mdl"
|
||||
SWEP.WorldModel = "models/weapons/sweps/eft/surgicalkit/w_meds_surgicalkit.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 5
|
||||
SWEP.SlotPos = 7
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.SwayScale = 0.15
|
||||
SWEP.BobScale = 0.75
|
||||
|
||||
SWEP.Primary.Ammo = "surgicalkit"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 5
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.MaxHeal = 0
|
||||
|
||||
local INI_SEF = false
|
||||
local INI_VIVO = false
|
||||
local ID_WEAPON = "weapon_eft_surgicalkit"
|
||||
local ID_PRIMARYAMMO = "surgicalkit"
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
INI_SEF = true
|
||||
end
|
||||
|
||||
local FilePathVIVO = "lua/autorun/ojsshared.lua"
|
||||
if file.Exists(FilePathVIVO, "GAME") then
|
||||
INI_VIVO = true
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self.IniAnimBandage = 0
|
||||
self.IniAnimSyringe = 0
|
||||
self.IniAnimPills = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then
|
||||
owner:StripWeapon(ID_WEAPON)
|
||||
owner:SelectWeapon(owner:GetPreviousWeapon())
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if IsValid(self) then
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then -- Heal logic
|
||||
if INI_SEF == true then
|
||||
owner:RemoveEffect("Broken")
|
||||
owner:RemoveEffect("Deathsdoorrecovery")
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
end
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Heal(owner)
|
||||
local owner = self:GetOwner()
|
||||
local VarMissingHealth = owner:GetMaxHealth() - owner:Health()
|
||||
local VarGetHealth = math.min(VarMissingHealth, owner:GetAmmoCount(ID_PRIMARYAMMO))
|
||||
local VarHealHealth = math.min(VarGetHealth, self.MaxHeal)
|
||||
|
||||
if IsValid(owner) and SERVER and owner:GetActiveWeapon():GetClass() == ID_WEAPON then
|
||||
if INI_SEF == true then
|
||||
owner:RemoveEffect("Broken")
|
||||
owner:RemoveEffect("Deathsdoorrecovery")
|
||||
end
|
||||
if INI_VIVO == true then
|
||||
if (OJSWounds:HasBlackoutWholeBody(owner)) then
|
||||
OJSWounds:HealBlackout(owner)
|
||||
end
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + VarHealHealth))
|
||||
end
|
||||
owner:RemoveAmmo(1, ID_PRIMARYAMMO)
|
||||
self:Deploy()
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
if self.IniAnimBandage == 1 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_RECOIL1)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.IniAnimBandage = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
if self.IniAnimBandage == 1 and self.IdleTimer <= CurTime() then -- Bandage Sequence
|
||||
self.IniAnimBandage = 0
|
||||
self.AnimTimes = 0
|
||||
self.IniHeal = 0
|
||||
self:Heal(owner)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
|
||||
if CLIENT then -- Worldmodel offset
|
||||
local WorldModel = ClientsideModel(SWEP.WorldModel)
|
||||
|
||||
WorldModel:SetSkin(0)
|
||||
WorldModel:SetNoDraw(true)
|
||||
|
||||
function SWEP:DrawWorldModel()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
if (IsValid(owner)) then
|
||||
local offsetVec = Vector(4, -1, -1)
|
||||
local offsetAng = Angle(-90, 180, -90)
|
||||
|
||||
local boneid = owner:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
if !boneid then return end
|
||||
|
||||
local matrix = owner:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
WorldModel:SetPos(newPos)
|
||||
WorldModel:SetAngles(newAng)
|
||||
|
||||
WorldModel:SetupBones()
|
||||
else
|
||||
|
||||
WorldModel:SetPos(self:GetPos())
|
||||
WorldModel:SetAngles(self:GetAngles())
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
WorldModel:DrawModel()
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,230 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/item_bandages" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Bandage"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals 20HP
|
||||
]]
|
||||
SWEP.Category = "NMRIH"
|
||||
|
||||
SWEP.ViewModelFOV = 65
|
||||
SWEP.ViewModel = "models/weapons/nmrih/items/bandage/v_item_bandages.mdl"
|
||||
SWEP.WorldModel = "models/weapons/nmrih/items/bandage/w_bandages.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.Primary.Ammo = "bandage"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.HitDistance = 90
|
||||
SWEP.PrimaryCD = 1
|
||||
SWEP.PrimaryHitTime = 0.1
|
||||
|
||||
local HealAmount = 20
|
||||
local ArmorAmount = 0
|
||||
local InitializeSEF = false
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
InitializeSEF = true
|
||||
else
|
||||
InitializeSEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 0
|
||||
self.InitializeHealing = 0
|
||||
self.vmcamera = nil
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then owner:StripWeapon("weapon_nmrih_bandage") end -- Reminder
|
||||
return true
|
||||
end
|
||||
|
||||
local function Heal(owner, weapon)
|
||||
local activeWeapon = owner:GetActiveWeapon()
|
||||
|
||||
if IsValid(weapon) then
|
||||
if IsValid(owner) and SERVER and activeWeapon:GetClass() == "weapon_nmrih_bandage" then -- Reminder
|
||||
|
||||
if InitializeSEF == true then
|
||||
owner:ApplyEffect("Healing", 1, 20, 1)
|
||||
owner:RemoveEffect("Bleeding")
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + HealAmount))
|
||||
owner:SetArmor(math.min(owner:GetMaxArmor(), owner:Armor() + ArmorAmount))
|
||||
end
|
||||
owner:RemoveAmmo(1, "bandage") -- Reminder
|
||||
-- owner:EmitSound("nil")
|
||||
weapon:Deploy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration() + 0)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.InitializeHealing = 1
|
||||
self.Idle = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
local owner = self:GetOwner()
|
||||
local dmginfo = DamageInfo()
|
||||
local tr = util.TraceLine( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
if ( !IsValid( tr.Entity ) ) then
|
||||
tr = util.TraceHull( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mins = Vector( -10, -10, -8 ),
|
||||
maxs = Vector( 10, 10, 8 ),
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_HITCENTER)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self:SetNextSecondaryFire(CurTime() + 0.9)
|
||||
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
|
||||
timer.Create("TimerHitWhen", self.PrimaryHitTime, 1, function() -- Impact Timer
|
||||
if SERVER then
|
||||
if ( SERVER and IsValid( tr.Entity ) and ( tr.Entity:IsNPC() or tr.Entity:IsPlayer() or tr.Entity:Health() > 0 ) ) then
|
||||
dmginfo:SetDamage(10)
|
||||
dmginfo:SetAttacker(self.Owner)
|
||||
dmginfo:SetInflictor(self)
|
||||
dmginfo:SetDamageType(DMG_CRUSH)
|
||||
tr.Entity:TakeDamageInfo(dmginfo)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
local owner = self:GetOwner()
|
||||
local trace = owner:GetEyeTrace()
|
||||
|
||||
if self.Give == 1 then return end
|
||||
|
||||
if IsValid(trace.Entity) and trace.Entity:IsPlayer() then
|
||||
local targetPlayer = trace.Entity
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_THROW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 1
|
||||
|
||||
owner:RemoveAmmo(1, "bandage")
|
||||
|
||||
if CLIENT then return end
|
||||
timer.Create("TimerNMRIHBandageGive", 1.2, 1, function()
|
||||
if targetPlayer:HasWeapon("weapon_nmrih_bandage") then
|
||||
targetPlayer:GiveAmmo( 1, "bandage")
|
||||
else
|
||||
targetPlayer:Give("weapon_nmrih_bandage")
|
||||
end
|
||||
-- print(owner:Nick() .. " gave a bandage to " .. targetPlayer:Nick())
|
||||
self:Deploy()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
local owner = self.Owner
|
||||
if self.InitializeHealing == 1 and self.IdleTimer <= CurTime() then
|
||||
if IsValid(self) then
|
||||
Heal(owner, self)
|
||||
end
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
if (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT) and owner:KeyDown(IN_SPEED)) then -- If Sprinting
|
||||
if self.Sprint == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
|
||||
self.Sprint = 1
|
||||
self.Walk = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT)) then -- If Walking
|
||||
if self.Walk == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_IDLE_LOWERED)
|
||||
self.Walk = 1
|
||||
self.Sprint = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif self.Idle == 0 and self.IdleTimer <= CurTime() then -- Idle Sequence
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
self.Idle = 1
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
timer.Remove("TimerHitWhen")
|
||||
timer.Remove("TimerNMRIHBandageGive")
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
@@ -0,0 +1,227 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/item_gene_therapy" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Genetherapy"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
]]
|
||||
SWEP.Category = "NMRIH"
|
||||
|
||||
SWEP.ViewModelFOV = 65
|
||||
SWEP.ViewModel = "models/weapons/nmrih/items/genetherapy/v_item_genetherapy.mdl"
|
||||
SWEP.WorldModel = "models/weapons/nmrih/items/genetherapy/w_genetherapy.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.Primary.Ammo = "genetherapy"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.HitDistance = 90
|
||||
SWEP.PrimaryHitTime = 0.1
|
||||
|
||||
local HealAmount = 0
|
||||
local ArmorAmount = 50
|
||||
local InitializeSEF = false
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
InitializeSEF = true
|
||||
else
|
||||
InitializeSEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 0
|
||||
self.InitializeHealing = 0
|
||||
self.vmcamera = nil
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then owner:StripWeapon("weapon_nmrih_genetherapy") end -- Reminder
|
||||
return true
|
||||
end
|
||||
|
||||
local function Heal(owner, weapon)
|
||||
local activeWeapon = owner:GetActiveWeapon()
|
||||
|
||||
if IsValid(weapon) then
|
||||
if IsValid(owner) and SERVER and activeWeapon:GetClass() == "weapon_nmrih_genetherapy" then -- Reminder
|
||||
|
||||
if InitializeSEF == true then
|
||||
owner:ApplyEffect("Tenacity", math.huge)
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + HealAmount))
|
||||
owner:SetArmor(math.min(owner:GetMaxArmor(), owner:Armor() + ArmorAmount))
|
||||
end
|
||||
owner:RemoveAmmo(1, "genetherapy") -- Reminder
|
||||
-- owner:EmitSound("nil")
|
||||
weapon:Deploy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration() + 0)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.InitializeHealing = 1
|
||||
self.Idle = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
local owner = self:GetOwner()
|
||||
local dmginfo = DamageInfo()
|
||||
local tr = util.TraceLine( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
if ( !IsValid( tr.Entity ) ) then
|
||||
tr = util.TraceHull( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mins = Vector( -10, -10, -8 ),
|
||||
maxs = Vector( 10, 10, 8 ),
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_HITCENTER)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self:SetNextSecondaryFire(CurTime() + 0.9)
|
||||
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
|
||||
timer.Create("TimerHitWhen", self.PrimaryHitTime, 1, function() -- Impact Timer
|
||||
if SERVER then
|
||||
if ( SERVER and IsValid( tr.Entity ) and ( tr.Entity:IsNPC() or tr.Entity:IsPlayer() or tr.Entity:Health() > 0 ) ) then
|
||||
dmginfo:SetDamage(10)
|
||||
dmginfo:SetAttacker(self.Owner)
|
||||
dmginfo:SetInflictor(self)
|
||||
dmginfo:SetDamageType(DMG_CRUSH)
|
||||
tr.Entity:TakeDamageInfo(dmginfo)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
local owner = self:GetOwner()
|
||||
local trace = owner:GetEyeTrace()
|
||||
|
||||
if self.Give == 1 then return end
|
||||
|
||||
if IsValid(trace.Entity) and trace.Entity:IsPlayer() then
|
||||
local targetPlayer = trace.Entity
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_THROW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 1
|
||||
|
||||
owner:RemoveAmmo(1, "genetherapy")
|
||||
|
||||
if CLIENT then return end
|
||||
timer.Create("TimerNMRIHBandageGive", 1.2, 1, function()
|
||||
if targetPlayer:HasWeapon("weapon_nmrih_genetherapy") then
|
||||
targetPlayer:GiveAmmo( 1, "genetherapy")
|
||||
else
|
||||
targetPlayer:Give("weapon_nmrih_genetherapy")
|
||||
end
|
||||
-- print(owner:Nick() .. " gave a bandage to " .. targetPlayer:Nick())
|
||||
self:Deploy()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
local owner = self.Owner
|
||||
if self.InitializeHealing == 1 and self.IdleTimer <= CurTime() then
|
||||
if IsValid(self) then
|
||||
Heal(owner, self)
|
||||
end
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
if (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT) and owner:KeyDown(IN_SPEED)) then -- If Sprinting
|
||||
if self.Sprint == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
|
||||
self.Sprint = 1
|
||||
self.Walk = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT)) then -- If Walking
|
||||
if self.Walk == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_IDLE_LOWERED)
|
||||
self.Walk = 1
|
||||
self.Sprint = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif self.Idle == 0 and self.IdleTimer <= CurTime() then -- Idle Sequence
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
self.Idle = 1
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
timer.Remove("TimerHitWhen")
|
||||
timer.Remove("TimerNMRIHBandageGive")
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
228
garrysmod/addons/other_sweps/lua/weapons/weapon_nmrih_medkit.lua
Normal file
228
garrysmod/addons/other_sweps/lua/weapons/weapon_nmrih_medkit.lua
Normal file
@@ -0,0 +1,228 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/item_first_aid" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "First Aid"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
Heals 100HP
|
||||
]]
|
||||
SWEP.Category = "NMRIH"
|
||||
|
||||
SWEP.ViewModelFOV = 65
|
||||
SWEP.ViewModel = "models/weapons/nmrih/items/medkit/v_item_firstaid.mdl"
|
||||
SWEP.WorldModel = "models/weapons/nmrih/items/medkit/w_firstaidkit.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.Primary.Ammo = "medkit"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.HitDistance = 90
|
||||
SWEP.PrimaryCD = 1
|
||||
SWEP.PrimaryHitTime = 0.1
|
||||
|
||||
local HealAmount = 100
|
||||
local ArmorAmount = 0
|
||||
local InitializeSEF = false
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
InitializeSEF = true
|
||||
else
|
||||
InitializeSEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 0
|
||||
self.InitializeHealing = 0
|
||||
self.vmcamera = nil
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then owner:StripWeapon("weapon_nmrih_medkit") end -- Reminder
|
||||
return true
|
||||
end
|
||||
|
||||
local function Heal(owner, weapon)
|
||||
local activeWeapon = owner:GetActiveWeapon()
|
||||
|
||||
if IsValid(weapon) then
|
||||
if IsValid(owner) and SERVER and activeWeapon:GetClass() == "weapon_nmrih_medkit" then -- Reminder
|
||||
|
||||
if InitializeSEF == true then
|
||||
owner:ApplyEffect("Healing", 1, 100, 1)
|
||||
owner:RemoveEffect("Bleeding")
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + HealAmount))
|
||||
owner:SetArmor(math.min(owner:GetMaxArmor(), owner:Armor() + ArmorAmount))
|
||||
end
|
||||
owner:RemoveAmmo(1, "medkit") -- Reminder
|
||||
-- owner:EmitSound("nil")
|
||||
weapon:Deploy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration() + 0)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.InitializeHealing = 1
|
||||
self.Idle = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
local owner = self:GetOwner()
|
||||
local dmginfo = DamageInfo()
|
||||
local tr = util.TraceLine( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
if ( !IsValid( tr.Entity ) ) then
|
||||
tr = util.TraceHull( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mins = Vector( -10, -10, -8 ),
|
||||
maxs = Vector( 10, 10, 8 ),
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_HITCENTER)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self:SetNextSecondaryFire(CurTime() + 0.9)
|
||||
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
|
||||
timer.Create("TimerHitWhen", self.PrimaryHitTime, 1, function() -- Impact Timer
|
||||
if SERVER then
|
||||
if ( SERVER and IsValid( tr.Entity ) and ( tr.Entity:IsNPC() or tr.Entity:IsPlayer() or tr.Entity:Health() > 0 ) ) then
|
||||
dmginfo:SetDamage(10)
|
||||
dmginfo:SetAttacker(self.Owner)
|
||||
dmginfo:SetInflictor(self)
|
||||
dmginfo:SetDamageType(DMG_CRUSH)
|
||||
tr.Entity:TakeDamageInfo(dmginfo)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
local owner = self:GetOwner()
|
||||
local trace = owner:GetEyeTrace()
|
||||
|
||||
if self.Give == 1 then return end
|
||||
|
||||
if IsValid(trace.Entity) and trace.Entity:IsPlayer() then
|
||||
local targetPlayer = trace.Entity
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_THROW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 1
|
||||
|
||||
owner:RemoveAmmo(1, "medkit")
|
||||
|
||||
if CLIENT then return end
|
||||
timer.Create("TimerNMRIHMedkitGive", 1.2, 1, function()
|
||||
if targetPlayer:HasWeapon("weapon_nmrih_medkit") then
|
||||
targetPlayer:GiveAmmo( 1, "medkit")
|
||||
else
|
||||
targetPlayer:Give("weapon_nmrih_medkit")
|
||||
end
|
||||
-- print(owner:Nick() .. " gave a bandage to " .. targetPlayer:Nick())
|
||||
self:Deploy()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
local owner = self.Owner
|
||||
if self.InitializeHealing == 1 and self.IdleTimer <= CurTime() then
|
||||
if IsValid(self) then
|
||||
Heal(owner, self)
|
||||
end
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
if (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT) and owner:KeyDown(IN_SPEED)) then -- If Sprinting
|
||||
if self.Sprint == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
|
||||
self.Sprint = 1
|
||||
self.Walk = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT)) then -- If Walking
|
||||
if self.Walk == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_IDLE_LOWERED)
|
||||
self.Walk = 1
|
||||
self.Sprint = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif self.Idle == 0 and self.IdleTimer <= CurTime() then -- Idle Sequence
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
self.Idle = 1
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
timer.Remove("TimerHitWhen")
|
||||
timer.Remove("TimerNMRIHMedkitGive")
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
@@ -0,0 +1,241 @@
|
||||
if CLIENT then
|
||||
SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/item_pills" )
|
||||
SWEP.BounceWeaponIcon = true
|
||||
SWEP.DrawWeaponInfoBox = true
|
||||
end
|
||||
|
||||
SWEP.PrintName = "Phalanx"
|
||||
SWEP.Author = "Craft_Pig"
|
||||
SWEP.Purpose =
|
||||
[[
|
||||
]]
|
||||
SWEP.Category = "NMRIH"
|
||||
|
||||
SWEP.ViewModelFOV = 65
|
||||
SWEP.ViewModel = "models/weapons/nmrih/items/phalanx/v_item_phalanx.mdl"
|
||||
SWEP.WorldModel = "models/weapons/nmrih/items/phalanx/w_phalanx.mdl"
|
||||
SWEP.UseHands = true
|
||||
SWEP.DrawCrosshair = false
|
||||
|
||||
SWEP.Spawnable = true
|
||||
SWEP.Slot = 0
|
||||
SWEP.SlotPos = 5
|
||||
SWEP.DrawAmmo = true
|
||||
|
||||
SWEP.Primary.Ammo = "phalanx"
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = 1
|
||||
SWEP.Primary.Automatic = false
|
||||
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
|
||||
SWEP.HitDistance = 90
|
||||
SWEP.PrimaryCD = 1
|
||||
SWEP.PrimaryHitTime = 0.1
|
||||
|
||||
local HealAmount = 1
|
||||
local ArmorAmount = 0
|
||||
local RegenAmount = 3
|
||||
local RegenDuration = 10
|
||||
local InitializeSEF = false
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType("slam")
|
||||
|
||||
local FilePathSEF = "lua/SEF/SEF_Functions.lua"
|
||||
if file.Exists(FilePathSEF, "GAME") then
|
||||
InitializeSEF = true
|
||||
else
|
||||
InitializeSEF = false
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Deploy()
|
||||
local owner = self:GetOwner()
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 0
|
||||
self.InitializeHealing = 0
|
||||
self.vmcamera = nil
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then owner:StripWeapon("weapon_nmrih_phalanx") end -- Reminder
|
||||
return true
|
||||
end
|
||||
|
||||
local function Heal(owner, weapon)
|
||||
local activeWeapon = owner:GetActiveWeapon()
|
||||
|
||||
if IsValid(weapon) then
|
||||
if IsValid(owner) and SERVER and activeWeapon:GetClass() == "weapon_nmrih_phalanx" then -- Reminder
|
||||
|
||||
if InitializeSEF == true then
|
||||
owner:ApplyEffect("Healing", 10, 1, 0.32)
|
||||
owner:ApplyEffect("Tenacity", 10)
|
||||
else
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + HealAmount))
|
||||
owner:SetArmor(math.min(owner:GetMaxArmor(), owner:Armor() + ArmorAmount))
|
||||
end
|
||||
owner:RemoveAmmo(1, "phalanx") -- Reminder
|
||||
-- owner:EmitSound("nil")
|
||||
weapon:Deploy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Regenerate(owner, weapon)
|
||||
timer.Create("TimerHealthRegenPainkillersSCPSL", 0.5, RegenDuration, function()
|
||||
if IsValid(owner) and owner:Alive() then
|
||||
owner:SetHealth(math.min(owner:Health() + RegenAmount, owner:GetMaxHealth()))
|
||||
else
|
||||
timer.Remove("TimerHealthRegenPainkillersSCPSL")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
local owner = self.Owner
|
||||
|
||||
if owner:GetAmmoCount(self.Primary.Ammo) == 0 then return end
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self.Owner:GetViewModel():SequenceDuration() + 0)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.InitializeHealing = 1
|
||||
self.Idle = 1
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
local owner = self:GetOwner()
|
||||
local dmginfo = DamageInfo()
|
||||
local tr = util.TraceLine( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
if ( !IsValid( tr.Entity ) ) then
|
||||
tr = util.TraceHull( {
|
||||
start = owner:GetShootPos(),
|
||||
endpos = owner:GetShootPos() + owner:GetAimVector() * self.HitDistance,
|
||||
filter = owner,
|
||||
mins = Vector( -10, -10, -8 ),
|
||||
maxs = Vector( 10, 10, 8 ),
|
||||
mask = MASK_SHOT_HULL
|
||||
} )
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_HITCENTER)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self:SetNextSecondaryFire(CurTime() + 0.9)
|
||||
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
|
||||
timer.Create("TimerHitWhen", self.PrimaryHitTime, 1, function() -- Impact Timer
|
||||
if SERVER then
|
||||
if ( SERVER and IsValid( tr.Entity ) and ( tr.Entity:IsNPC() or tr.Entity:IsPlayer() or tr.Entity:Health() > 0 ) ) then
|
||||
dmginfo:SetDamage(10)
|
||||
dmginfo:SetAttacker(self.Owner)
|
||||
dmginfo:SetInflictor(self)
|
||||
dmginfo:SetDamageType(DMG_CRUSH)
|
||||
tr.Entity:TakeDamageInfo(dmginfo)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
local owner = self:GetOwner()
|
||||
local trace = owner:GetEyeTrace()
|
||||
|
||||
if self.Give == 1 then return end
|
||||
|
||||
if IsValid(trace.Entity) and trace.Entity:IsPlayer() then
|
||||
local targetPlayer = trace.Entity
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_THROW)
|
||||
self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration()
|
||||
self.Idle = 0
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
self.Give = 1
|
||||
|
||||
owner:RemoveAmmo(1, "phalanx")
|
||||
|
||||
if CLIENT then return end
|
||||
timer.Create("TimerNMRIHPhalanxGive", 1.2, 1, function()
|
||||
if targetPlayer:HasWeapon("weapon_nmrih_phalanx") then
|
||||
targetPlayer:GiveAmmo( 1, "phalanx")
|
||||
else
|
||||
targetPlayer:Give("weapon_nmrih_phalanx")
|
||||
end
|
||||
-- print(owner:Nick() .. " gave a bandage to " .. targetPlayer:Nick())
|
||||
self:Deploy()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
local owner = self.Owner
|
||||
if self.InitializeHealing == 1 and self.IdleTimer <= CurTime() then
|
||||
if IsValid(self) then
|
||||
Heal(owner, self)
|
||||
if InitializeSEF == false then Regenerate(owner, weapon) end
|
||||
end
|
||||
end
|
||||
|
||||
if self.InitializeHealing == 1 then return end
|
||||
if (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT) and owner:KeyDown(IN_SPEED)) then -- If Sprinting
|
||||
if self.Sprint == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
|
||||
self.Sprint = 1
|
||||
self.Walk = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif (owner:KeyDown(IN_FORWARD + IN_BACK + IN_MOVELEFT + IN_MOVERIGHT)) then -- If Walking
|
||||
if self.Walk == 0 and self.IdleTimer <= CurTime() then
|
||||
self:SendWeaponAnim(ACT_VM_IDLE_LOWERED)
|
||||
self.Walk = 1
|
||||
self.Sprint = 0
|
||||
self.Idle = 0
|
||||
end
|
||||
elseif self.Idle == 0 and self.IdleTimer <= CurTime() then -- Idle Sequence
|
||||
self:SendWeaponAnim(ACT_VM_IDLE)
|
||||
self.Idle = 1
|
||||
self.Sprint = 0
|
||||
self.Walk = 0
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
timer.Remove("TimerHitWhen")
|
||||
timer.Remove("TimerNMRIHPhalanxGive")
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:PostDrawViewModel( vm )
|
||||
local attachment = vm:GetAttachment(1)
|
||||
if attachment then
|
||||
self.vmcamera = vm:GetAngles() - attachment.Ang
|
||||
else
|
||||
self.vmcamera = Angle(0, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:CalcView( ply, pos, ang, fov )
|
||||
self.vmcamera = self.vmcamera or Angle(0, 0, 0)
|
||||
return pos, ang + self.vmcamera, fov
|
||||
end
|
||||
Reference in New Issue
Block a user