aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/diamondaxe.lua
blob: a8cf79a26b776642f71502184bb892cbba346bd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local ITEM = {}
ITEM.Name 			= "Diamond Axe"
ITEM.Class 			= "weapon"
ITEM.Desc 			= "An axe made from diamonds and ancient wood."
ITEM.Model 			= "models/props_debris/wood_board02a.mdl"
ITEM.Icon 			= Material("wintersurvival2/hud/ws1_icons/icon_axe")

ITEM.Structure = {
	{
		Bone = "ValveBiped.Bip01_R_Hand",
		Model = "models/props_combine/breenlight.mdl",
		Size = Vector(0.1,0.5,1),
		Pos = Vector(3,-4,-27),
		Ang = Angle(0,0,0),
	},
	{
		Bone = "ValveBiped.Bip01_R_Hand",
		Model = "models/props_debris/wood_board02a.mdl",
		Size = Vector(0.5,0.5,0.5),
		Pos = Vector(3,-1.5,-12),
		Ang = Angle(0,0,0),
	},
}

ITEM.Recipe		= {
	Resources = {
		["Ancient Log"] = 1,
		["Diamond"] = 1,
		["Rope"] = 1,
		["Vine"] = 1,
	},
	Tools = {
		["Diamond Hammer"] = 1,
	},
}



ITEM.Damage 	= 30
ITEM.Range 		= 64
ITEM.CD 		= 0.3

function ITEM:OnPrimary(pl,tr)
	if (CLIENT) then return end

	if (tr.Hit) then
		if (IsValid(tr.Entity)) then
			local ent = tr.Entity
			local class = ent:GetClass()

			if (class == "player" or class:find("npc_") or class == "ws_pigeon" or class == "ws_prop") then
				ent:TakeDamage(self.Damage,pl)

				if (class == "ws_prop") then pl:EmitSound(Sound("physics/wood/wood_plank_impact_hard"..math.random(1,3)..".wav"),100,math.random(90,110))
				else pl:EmitSound(Sound("physics/flesh/flesh_impact_hard"..math.random(1,6)..".wav"),100,math.random(90,110)) end
			elseif (ent:IsTree()) then
				if (math.random(1,100) < 90) then pl:AddItem("Wood",1) end
				if (math.random(1,100) < 20) then pl:AddItem("Ancient Wood",1) end

				pl:EmitSound(Sound("physics/concrete/rock_impact_hard"..math.random(1,6)..".wav"),100,math.random(90,110))
			else
				pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet"..math.random(1,4)..".wav"),100,math.random(90,110))
			end
		else
			pl:EmitSound(Sound("physics/surfaces/sand_impact_bullet"..math.random(1,4)..".wav"),100,math.random(90,110))
		end
	else
		pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110))
	end
end
RegisterItem(ITEM)