AddCSLuaFile()



if CLIENT then

	SWEP.PrintName = "'Savior' Medic Gun"

	SWEP.Description = "Fires medical darts which can heal at a range. Although less potent than a full medical kit, it can be fired rapidly and used at a range."

	SWEP.Slot = 4

	SWEP.SlotPos = 0

	

	SWEP.ViewModelFlip = false

	SWEP.ViewModelFOV = 60



	SWEP.HUD3DBone = "ValveBiped.square"

	SWEP.HUD3DPos = Vector(1.1, 0.25, -2)

	SWEP.HUD3DScale = 0.015



	SWEP.WElements = {

		["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.5, 2, -3.701), angle = Angle(0, -90, -8), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },

		["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },

		["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }

	}

	SWEP.VElements = {

		["base"] = { type = "Model", model = "models/healthvial.mdl", bone = "ValveBiped.square", rel = "", pos = Vector(0, 0.5, 3), angle = Angle(0, 0, 90), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },

		["2"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },

		["2+"] = { type = "Model", model = "models/airboatgun.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "base", pos = Vector(0, -3, 0), angle = Angle(0, 90, 180), size = Vector(0.25, 0.25, 0.25), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }

	}

end



SWEP.Base = "weapon_zs_base"



SWEP.HoldType = "pistol"



SWEP.ViewModel = "models/weapons/c_pistol.mdl"

SWEP.WorldModel = "models/weapons/w_pistol.mdl"

SWEP.UseHands = true



SWEP.CSMuzzleFlashes = false



SWEP.ReloadSound = Sound("Weapon_Pistol.Reload")



SWEP.Primary.Delay = 0.25



SWEP.Primary.ClipSize = 25

SWEP.Primary.DefaultClip = 150

SWEP.Primary.Ammo = "Battery"

SWEP.RequiredClip = 5



SWEP.WalkSpeed = SPEED_NORMAL



SWEP.NoMagazine = true



SWEP.ConeMax = 0.005

SWEP.ConeMin = 0.005



SWEP.IronSightsPos = Vector(-5.95, 3, 2.75)

SWEP.IronSightsAng = Vector(-0.15, -1, 2)



function SWEP:ShootBullets(dmg, numbul, cone)

	local owner = self.Owner

	self:SendWeaponAnimation()

	owner:DoAttackEvent()



	if CLIENT then return end



	local aimvec = owner:GetAimVector()



	local ent = ents.Create("projectile_healdart")

	if ent:IsValid() then

		ent:SetPos(owner:GetShootPos())

		ent:SetAngles(aimvec:Angle())

		ent:SetOwner(owner)

		ent:Spawn()



		ent.Heal = math.ceil(ent.Heal * (owner.HumanHealMultiplier or 1))



		local phys = ent:GetPhysicsObject()

		if phys:IsValid() then

			phys:Wake()

			phys:SetVelocityInstantaneous(aimvec * 2000)

		end

	end

end



--[[function SWEP:Initialize()

	if CLIENT and self:GetOwner() == LocalPlayer() and LocalPlayer():GetActiveWeapon() == self then

		hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)

	end

end]]



function SWEP:Deploy()

	gamemode.Call("WeaponDeployed", self.Owner, self)



	self.IdleAnimation = CurTime() + self:SequenceDuration()



	if CLIENT then

		hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)

	end



	return true

end



function SWEP:Holster()

	if CLIENT then

		hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical")

	end



	return true

end

