INC_CLIENT()

SWEP.ViewModelFOV = 70

SWEP.ShowViewModel = false
SWEP.ShowWorldModel = false

SWEP.VElements = {
	["stick1+++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0, -0.327, -11.448), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["stick1+"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0, 2.653, 19.566), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["BLADE"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 34.348), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["BLADE+++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 12.956, 31.569), angle = Angle(-174.937, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["BLADE++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 32.708), angle = Angle(-171.433, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["stick1"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.157, 1.488, 2.286), angle = Angle(180, 78.477, -7.24), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["stick1++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 1.58, 34.312), angle = Angle(180, 0, 0), size = Vector(0.827, 0.652, 1.215), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["BACK"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.141, 0.136, 33.291), angle = Angle(7.782, -90, 99.166), size = Vector(0.061, 0.264, 0.065), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["BLADE+"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_Spine4", rel = "stick1", pos = Vector(0.056, 13.444, 33.519), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} }
}

SWEP.WElements = {
	["blade++++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 12.956, 31.569), angle = Angle(-174.937, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["pole+"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0, 2.812, 19.566), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["blade++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 13.444, 33.519), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["blade+"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 13.444, 34.348), angle = Angle(-166.478, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["blade+++"] = { type = "Model", model = "models/gibs/manhack_gib05.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 12.956, 32.708), angle = Angle(-171.433, 90, 90), size = Vector(1.981, 0.884, 1.981), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["pole++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.056, 1.58, 34.312), angle = Angle(180, 0, 0), size = Vector(0.827, 0.652, 1.215), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["back"] = { type = "Model", model = "models/Gibs/helicopter_brokenpiece_03.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0.141, 0.136, 33.291), angle = Angle(7.782, -90, 99.166), size = Vector(0.061, 0.264, 0.065), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_CANAL/metalwall005b", skin = 0, bodygroup = {} },
	["pole"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.213, 1.246, 2.063), angle = Angle(177.371, 63.734, -7.24), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} },
	["pole+++"] = { type = "Model", model = "models/Gibs/HGIBS_spine.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "pole", pos = Vector(0, -0.327, -11.448), angle = Angle(0, 0, 180), size = Vector(0.632, 0.632, 1.25), color = Color(105, 95, 85, 255), surpresslightning = false, material = "models/cs_italy/pwtrim2", skin = 0, bodygroup = {} }
}

local ghostlerp = 0
function SWEP:GetViewModelPosition(pos, ang)
	local owner = self:GetOwner()
	if self:IsSwinging() then
		local rot = self:GetDTInt(10) == 1 and Angle(0, -240, -70) or self.SwingRotation
		local offset = self:GetDTInt(10) == 1 and Vector(-200, 30, -40) or self.SwingOffset
		local armdelay = owner:GetMeleeSpeedMul()
		local swingtime = self.SwingTime * (owner.MeleeSwingDelayMul or 1) * armdelay

		ang = Angle(ang.pitch, ang.yaw, ang.roll) -- Copy

		local swingend = self:GetSwingEnd()
		local delta = swingtime - math.Clamp(swingend - CurTime(), 0, swingtime)
		local power = CosineInterpolation(0, 1, delta / swingtime)

		if power >= 0.9 then
			power = (1 - power) ^ 0.4 * 2
		end

		pos = pos + offset.x * power * ang:Right() + offset.y * power * ang:Forward() + offset.z * power * ang:Up()

		ang:RotateAroundAxis(ang:Right(), rot.pitch * power)
		ang:RotateAroundAxis(ang:Up(), rot.yaw * power)
		ang:RotateAroundAxis(ang:Forward(), rot.roll * power)
	end

	if owner:GetBarricadeGhosting() then
		ghostlerp = math.min(1, ghostlerp + FrameTime() * 4)
	elseif ghostlerp > 0 then
		ghostlerp = math.max(0, ghostlerp - FrameTime() * 5)
	end

	if ghostlerp > 0 then
		pos = pos + 3.5 * ghostlerp * ang:Up()
		ang:RotateAroundAxis(ang:Right(), -30 * ghostlerp)
	end

	return pos, ang
end
