aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/runeenergy.lua
blob: a19880e771e454f4fe6f307db0964135d34978ee (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
local ITEM = {}
ITEM.Name 			= "Energy Rune"
ITEM.Class 			= "resource"
ITEM.Desc 			= "A rune infused with energy!\nYou could probably run really far with one of these"
ITEM.Model 			= "models/props_junk/Rock001a.mdl"
ITEM.Icon 			= Material("wintersurvival2/hud/ws2_icons/icon_runeelectric.png")

ITEM.Structure = {
	{
		Bone = "ValveBiped.Bip01_R_Hand",
		Model = "models/props_junk/rock001a.mdl",
		Size = Vector(1,1,1),
		Pos = Vector(3,-1.6,0.5),
		Ang = Angle(0,0,0),
	},
}

ITEM.Recipe		= {
	Resources = {
		["Blank Rune"] = 1,
		["Juice"] = 1,
	},
	Tools = {},
}



ITEM.Damage 	= 1
ITEM.Range 		= 64
ITEM.CD 		= 1

function ITEM:OnPrimary(user)
	if user:HasItem("Energy Rune",1) then
		self:OnUse(user)
	else
		user:UnEquipWeaponSlot(user:GetSelectedWeapon())
		self:OnUse(user)
	end
end

function ITEM:OnUse(user)
	if CLIENT then return end
	user:SetFatigue(math.max(0,user:GetFatigue()-20))
	user:RemoveItem(self.Name,1)
end

function ITEM:OnCraft(ply)
	ply:AddFatigue(25)
end
RegisterItem(ITEM)