From 5c4ebc932d8c02522802c842d43d863d89aca162 Mon Sep 17 00:00:00 2001 From: Apickx Date: Mon, 28 Dec 2015 19:10:44 -0500 Subject: Initial commit --- gamemode/itemsystem/items/alter.lua | 66 ++++++++++++ gamemode/itemsystem/items/ancientlog.lua | 17 ++++ gamemode/itemsystem/items/ancientwood.lua | 60 +++++++++++ gamemode/itemsystem/items/arrow.lua | 25 +++++ gamemode/itemsystem/items/axe.lua | 66 ++++++++++++ gamemode/itemsystem/items/barrel.lua | 58 +++++++++++ gamemode/itemsystem/items/base.lua | 37 +++++++ gamemode/itemsystem/items/battleaxe.lua | 65 ++++++++++++ gamemode/itemsystem/items/berry.lua | 24 +++++ gamemode/itemsystem/items/bow.lua | 59 +++++++++++ gamemode/itemsystem/items/campfire.lua | 82 +++++++++++++++ gamemode/itemsystem/items/charcoal.lua | 10 ++ gamemode/itemsystem/items/cookedmeat.lua | 24 +++++ gamemode/itemsystem/items/crystal.lua | 17 ++++ gamemode/itemsystem/items/crystalaxe.lua | 70 +++++++++++++ gamemode/itemsystem/items/crystalhammer.lua | 24 +++++ gamemode/itemsystem/items/crystalpickaxe.lua | 72 +++++++++++++ gamemode/itemsystem/items/crystalsickle.lua | 70 +++++++++++++ gamemode/itemsystem/items/cup.lua | 20 ++++ gamemode/itemsystem/items/diamond.lua | 17 ++++ gamemode/itemsystem/items/diamondaxe.lua | 70 +++++++++++++ gamemode/itemsystem/items/diamondhammer.lua | 28 ++++++ gamemode/itemsystem/items/diamondpickaxe.lua | 72 +++++++++++++ gamemode/itemsystem/items/diamondsickle.lua | 70 +++++++++++++ gamemode/itemsystem/items/feather.lua | 6 ++ gamemode/itemsystem/items/fence.lua | 59 +++++++++++ gamemode/itemsystem/items/flint.lua | 6 ++ gamemode/itemsystem/items/floor.lua | 60 +++++++++++ gamemode/itemsystem/items/infuser.lua | 57 +++++++++++ gamemode/itemsystem/items/juice.lua | 21 ++++ gamemode/itemsystem/items/knife.lua | 60 +++++++++++ gamemode/itemsystem/items/log.lua | 15 +++ gamemode/itemsystem/items/magicwood.lua | 58 +++++++++++ gamemode/itemsystem/items/maul.lua | 58 +++++++++++ gamemode/itemsystem/items/meat.lua | 28 ++++++ gamemode/itemsystem/items/mortarandpestle.lua | 20 ++++ gamemode/itemsystem/items/pickaxe.lua | 68 +++++++++++++ gamemode/itemsystem/items/pitch.lua | 25 +++++ gamemode/itemsystem/items/plank.lua | 25 +++++ gamemode/itemsystem/items/ramp.lua | 60 +++++++++++ gamemode/itemsystem/items/recipe_battleaxe.lua | 27 +++++ gamemode/itemsystem/items/recipe_crystalhammer.lua | 27 +++++ gamemode/itemsystem/items/recipe_diamondhammer.lua | 27 +++++ gamemode/itemsystem/items/recipe_maul.lua | 27 +++++ gamemode/itemsystem/items/recipe_shack.lua | 27 +++++ gamemode/itemsystem/items/recipe_stoneblock.lua | 27 +++++ gamemode/itemsystem/items/recipe_tent.lua | 27 +++++ gamemode/itemsystem/items/researchtable.lua | 55 ++++++++++ gamemode/itemsystem/items/rock.lua | 60 +++++++++++ gamemode/itemsystem/items/rope.lua | 14 +++ gamemode/itemsystem/items/runeblank.lua | 34 +++++++ gamemode/itemsystem/items/runeenergy.lua | 45 +++++++++ gamemode/itemsystem/items/runefire.lua | 48 +++++++++ gamemode/itemsystem/items/runemagic.lua | 21 ++++ gamemode/itemsystem/items/runenature.lua | 39 ++++++++ gamemode/itemsystem/items/sap.lua | 6 ++ gamemode/itemsystem/items/shack.lua | 111 +++++++++++++++++++++ gamemode/itemsystem/items/sickle.lua | 67 +++++++++++++ gamemode/itemsystem/items/stoneblock.lua | 14 +++ gamemode/itemsystem/items/sword.lua | 58 +++++++++++ gamemode/itemsystem/items/tent.lua | 79 +++++++++++++++ gamemode/itemsystem/items/vine.lua | 6 ++ gamemode/itemsystem/items/wood.lua | 66 ++++++++++++ gamemode/itemsystem/loaditems.lua | 83 +++++++++++++++ 64 files changed, 2744 insertions(+) create mode 100644 gamemode/itemsystem/items/alter.lua create mode 100644 gamemode/itemsystem/items/ancientlog.lua create mode 100644 gamemode/itemsystem/items/ancientwood.lua create mode 100644 gamemode/itemsystem/items/arrow.lua create mode 100644 gamemode/itemsystem/items/axe.lua create mode 100644 gamemode/itemsystem/items/barrel.lua create mode 100644 gamemode/itemsystem/items/base.lua create mode 100644 gamemode/itemsystem/items/battleaxe.lua create mode 100644 gamemode/itemsystem/items/berry.lua create mode 100644 gamemode/itemsystem/items/bow.lua create mode 100644 gamemode/itemsystem/items/campfire.lua create mode 100644 gamemode/itemsystem/items/charcoal.lua create mode 100644 gamemode/itemsystem/items/cookedmeat.lua create mode 100644 gamemode/itemsystem/items/crystal.lua create mode 100644 gamemode/itemsystem/items/crystalaxe.lua create mode 100644 gamemode/itemsystem/items/crystalhammer.lua create mode 100644 gamemode/itemsystem/items/crystalpickaxe.lua create mode 100644 gamemode/itemsystem/items/crystalsickle.lua create mode 100644 gamemode/itemsystem/items/cup.lua create mode 100644 gamemode/itemsystem/items/diamond.lua create mode 100644 gamemode/itemsystem/items/diamondaxe.lua create mode 100644 gamemode/itemsystem/items/diamondhammer.lua create mode 100644 gamemode/itemsystem/items/diamondpickaxe.lua create mode 100644 gamemode/itemsystem/items/diamondsickle.lua create mode 100644 gamemode/itemsystem/items/feather.lua create mode 100644 gamemode/itemsystem/items/fence.lua create mode 100644 gamemode/itemsystem/items/flint.lua create mode 100644 gamemode/itemsystem/items/floor.lua create mode 100644 gamemode/itemsystem/items/infuser.lua create mode 100644 gamemode/itemsystem/items/juice.lua create mode 100644 gamemode/itemsystem/items/knife.lua create mode 100644 gamemode/itemsystem/items/log.lua create mode 100644 gamemode/itemsystem/items/magicwood.lua create mode 100644 gamemode/itemsystem/items/maul.lua create mode 100644 gamemode/itemsystem/items/meat.lua create mode 100644 gamemode/itemsystem/items/mortarandpestle.lua create mode 100644 gamemode/itemsystem/items/pickaxe.lua create mode 100644 gamemode/itemsystem/items/pitch.lua create mode 100644 gamemode/itemsystem/items/plank.lua create mode 100644 gamemode/itemsystem/items/ramp.lua create mode 100644 gamemode/itemsystem/items/recipe_battleaxe.lua create mode 100644 gamemode/itemsystem/items/recipe_crystalhammer.lua create mode 100644 gamemode/itemsystem/items/recipe_diamondhammer.lua create mode 100644 gamemode/itemsystem/items/recipe_maul.lua create mode 100644 gamemode/itemsystem/items/recipe_shack.lua create mode 100644 gamemode/itemsystem/items/recipe_stoneblock.lua create mode 100644 gamemode/itemsystem/items/recipe_tent.lua create mode 100644 gamemode/itemsystem/items/researchtable.lua create mode 100644 gamemode/itemsystem/items/rock.lua create mode 100644 gamemode/itemsystem/items/rope.lua create mode 100644 gamemode/itemsystem/items/runeblank.lua create mode 100644 gamemode/itemsystem/items/runeenergy.lua create mode 100644 gamemode/itemsystem/items/runefire.lua create mode 100644 gamemode/itemsystem/items/runemagic.lua create mode 100644 gamemode/itemsystem/items/runenature.lua create mode 100644 gamemode/itemsystem/items/sap.lua create mode 100644 gamemode/itemsystem/items/shack.lua create mode 100644 gamemode/itemsystem/items/sickle.lua create mode 100644 gamemode/itemsystem/items/stoneblock.lua create mode 100644 gamemode/itemsystem/items/sword.lua create mode 100644 gamemode/itemsystem/items/tent.lua create mode 100644 gamemode/itemsystem/items/vine.lua create mode 100644 gamemode/itemsystem/items/wood.lua create mode 100644 gamemode/itemsystem/loaditems.lua (limited to 'gamemode/itemsystem') diff --git a/gamemode/itemsystem/items/alter.lua b/gamemode/itemsystem/items/alter.lua new file mode 100644 index 0000000..31d1b4f --- /dev/null +++ b/gamemode/itemsystem/items/alter.lua @@ -0,0 +1,66 @@ + +ITEM.Name = "Alter" +ITEM.Class = "structure" +ITEM.Desc = "This allows you to sacrifice your soul for a player." +ITEM.Model = "models/props_c17/gravestone003a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_crow.png") +ITEM.Recipe = { + Resources = { + ["Ancient Log"] = 20, + ["Plank"] = 16, + ["Rope"] = 16, + ["Sap"] = 30, + }, + Tools = { + ["Diamond Hammer"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_c17/gravestone003a.mdl", + Size = Vector(8,1,1), + Pos = Vector(22,0,0), + Ang = Angle(90,0,0), + }, + { + Model = "models/props_c17/gravestone003a.mdl", + Size = Vector(8,1,1), + Pos = Vector(-22,0,0), + Ang = Angle(-90,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_alter") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/ancientlog.lua b/gamemode/itemsystem/items/ancientlog.lua new file mode 100644 index 0000000..2948d08 --- /dev/null +++ b/gamemode/itemsystem/items/ancientlog.lua @@ -0,0 +1,17 @@ + +ITEM.Name = "Ancient Log" +ITEM.Class = "resource" +ITEM.Desc = "Powerful wood." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("settlement/icon_log") + +ITEM.Recipe = { + Resources = { + ["Vine"] = 1, + ["Sap"] = 1, + ["Ancient Wood"] = 3, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} diff --git a/gamemode/itemsystem/items/ancientwood.lua b/gamemode/itemsystem/items/ancientwood.lua new file mode 100644 index 0000000..8f38c17 --- /dev/null +++ b/gamemode/itemsystem/items/ancientwood.lua @@ -0,0 +1,60 @@ + +ITEM.Name = "Ancient Wood" +ITEM.Class = "weapon" +ITEM.Desc = "A stronger type of wood.\nUsed for advanced equipment." +ITEM.Model = "models/gibs/furniture_gibs/furniturewooddrawer003a_chunk04.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_ancientwood.png") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/gibs/furniture_gibs/furniturewooddrawer003a_chunk04.mdl", + Size = Vector(.5,.5,.5), + Pos = Vector(3,-1.5,-12), + Ang = Angle(0,0,0), + }, +} + +ITEM.Damage = 5 +ITEM.Range = 60 +ITEM.CD = 0.6 + +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:GetModel():find("tree")) then + 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 + +function ITEM:OnSecondary(pl,tr) + if (CLIENT) then return end + if (!pl:HasItem(self.Name)) then return end + + local drop = SpawnWSItem(self.Name,pl:GetShootPos()+pl:GetAimVector()*20) + drop:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 200) + + pl:RemoveItem(self.Name,1) + + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(40,60)) +end + + diff --git a/gamemode/itemsystem/items/arrow.lua b/gamemode/itemsystem/items/arrow.lua new file mode 100644 index 0000000..30047d8 --- /dev/null +++ b/gamemode/itemsystem/items/arrow.lua @@ -0,0 +1,25 @@ + +ITEM.Name = "Arrow" +ITEM.Class = "ammo" +ITEM.Desc = "An arrow, used for bows." +ITEM.Model = "models/mixerman3d/other/arrow.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_arrow") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/mixerman3d/other/arrow.mdl", + Pos = Vector(1,-1,-2.5), + Ang = Angle(0,90,180), + }, +} + +ITEM.Recipe = { + Resources = { + ["Rock"] = 1, + ["Flint"] = 1, + ["Sap"] = 1, + ["Wood"] = 1, + }, + Tools = {}, +} diff --git a/gamemode/itemsystem/items/axe.lua b/gamemode/itemsystem/items/axe.lua new file mode 100644 index 0000000..b5d2063 --- /dev/null +++ b/gamemode/itemsystem/items/axe.lua @@ -0,0 +1,66 @@ + +ITEM.Name = "Axe" +ITEM.Class = "weapon" +ITEM.Desc = "A primitive axe held together with sap." +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_junk/Rock001a.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 = { + ["Wood"] = 1, + ["Rock"] = 1, + ["Sap"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 30 +ITEM.Range = 64 +ITEM.CD = 0.5 + +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,35)/10 < 1) then pl:AddItem("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 diff --git a/gamemode/itemsystem/items/barrel.lua b/gamemode/itemsystem/items/barrel.lua new file mode 100644 index 0000000..6f99d7e --- /dev/null +++ b/gamemode/itemsystem/items/barrel.lua @@ -0,0 +1,58 @@ + +ITEM.Name = "Barrel" +ITEM.Class = "structure" +ITEM.Desc = "Barrel for storage of items." +ITEM.Model = "models/props_c17/oildrum001.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_fence") +ITEM.Recipe = { + Resources = { + ["Plank"] = 3, + ["Sap"] = 2, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_c17/oildrum001.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_barrel") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/base.lua b/gamemode/itemsystem/items/base.lua new file mode 100644 index 0000000..a3b6b31 --- /dev/null +++ b/gamemode/itemsystem/items/base.lua @@ -0,0 +1,37 @@ +ITEM.Name = "Winter Survival 2 Base Item" +ITEM.Desc = "Why the hell did I write this? No one will read it anyways!!" +ITEM.Class = "Other" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_rock") +ITEM.Burnable = false +ITEM.CD = 0.3 +ITEM.Range = 120 +ITEM.HoldType = "melee" + +ITEM.Structure = {} +ITEM.Recipe = nil +ITEM.Tools = nil +ITEM.CookCD = 1 +ITEM.CookProduct = nil +ITEM.Ghost = nil + +--These are just here to tell the editors/develoeprs what functions are available.. dont un-comment them out, as this could affect all the items. +/* +function ITEM:OnPrimary(user,tr) +end + +function ITEM:OnSecondary(user,tr) +end + +function ITEM:OnUse(user) +end + +function ITEM:OnCooked(campfire) +end + +function ITEM:OnEnchanted(enchanttalbe, nearbyrunes) +end + +function ITEM:OnCraft(player) +end +*/ diff --git a/gamemode/itemsystem/items/battleaxe.lua b/gamemode/itemsystem/items/battleaxe.lua new file mode 100644 index 0000000..96b3cf6 --- /dev/null +++ b/gamemode/itemsystem/items/battleaxe.lua @@ -0,0 +1,65 @@ +ITEM.Name = [[Battle Axe]] +ITEM.Desc = [[The vikings once used these]] +ITEM.Model = [[models/props_junk/Rock001a.mdl]] +ITEM.Icon = Material([[wintersurvival2/hud/ws1_icons/icon_axe]]) +ITEM.Structure = { + { + Bone="ValveBiped.Bip01_R_Hand", + Model="models/props_debris/wood_board02a.mdl", + Size=Vector(0.5,0.5,0.5), + Pos=Vector(3.182,-1.76,-11.64), + Ang=Angle(0,86.83,0), + }, + { + Bone="ValveBiped.Bip01_R_Hand", + Model="models/props_junk/Rock001a.mdl", + Size=Vector(1.18,0.06,1), + Pos=Vector(6,-1.76,-22.94), + Ang=Angle(0,0,0), + }, + { + Bone="ValveBiped.Bip01_R_Hand", + Model="models/props_junk/Rock001a.mdl", + Size=Vector(0.74,0.06,0.62), + Pos=Vector(4.24,-1.75,-14.82), + Ang=Angle(0,0,-180), + }, +} + +ITEM.Recipe = { + Resources = { + ["Plank"] = 2, + ["Flint"] = 1, + ["Sap"] = 1, + }, + Tools = {}, +} + +ITEM.HoldType = "melee2" +ITEM.Damage = 70 +ITEM.Range = 80 +ITEM.CD = 0.9 + +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 + 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(60,80)) + end +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua new file mode 100644 index 0000000..90ec4c4 --- /dev/null +++ b/gamemode/itemsystem/items/berry.lua @@ -0,0 +1,24 @@ + +ITEM.Name = "Berry" +ITEM.Class = "food" +ITEM.Desc = "Berries..." +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("settlement/icon_berries") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/Weapons/w_bugbait.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +function ITEM:OnUse(user) + if (CLIENT) then return end + + user:SetHealth(math.min(100,user:Health()+5)) + user:AddHunger(-25) + user:RemoveItem(self.Name,1) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/bow.lua b/gamemode/itemsystem/items/bow.lua new file mode 100644 index 0000000..8ecee8e --- /dev/null +++ b/gamemode/itemsystem/items/bow.lua @@ -0,0 +1,59 @@ + +ITEM.Name = "Bow" +ITEM.Class = "weapon" +ITEM.Desc = "A primitive bow made from vine, sap, and wood." +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_bow") +ITEM.HoldType = "smg" + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_L_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.35), + Pos = Vector(-1,-6,9), + Ang = Angle(-30,-65,180), + }, + { + Bone = "ValveBiped.Bip01_L_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.35), + Pos = Vector(-1,-6,-9), + Ang = Angle(30,-65,180), + }, + { + Bone = "ValveBiped.Bip01_L_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.05,.05,.51), + Pos = Vector(-3.3,-9.5,0), + Ang = Angle(0,-65,180), + }, +} + +ITEM.Recipe = { + Resources = { + ["Plank"] = 2, + ["Rope"] = 1, + ["Sap"] = 1, + }, + Tools = {}, +} + +ITEM.CD = 1 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + if (!pl:HasItem("Arrow",1)) then return end + + local aim = pl:GetAimVector() + + local D = ents.Create("ws_arrow") + D:SetPos(pl:GetShootPos()+aim*20) + D:SetOwner(pl) + D:SetAngles(aim:Angle()) + D:Spawn() + pl:EmitSound(Sound("physics/flesh/flesh_impact_hard.wav"),100,math.random(90,110)) + D:GetPhysicsObject():ApplyForceCenter(aim * 10000) + + pl:RemoveItem("Arrow",1) +end diff --git a/gamemode/itemsystem/items/campfire.lua b/gamemode/itemsystem/items/campfire.lua new file mode 100644 index 0000000..5cc4987 --- /dev/null +++ b/gamemode/itemsystem/items/campfire.lua @@ -0,0 +1,82 @@ + +ITEM.Name = "Campfire" +ITEM.Class = "structure" +ITEM.Desc = "Ready to be lit. Some assembly required." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_campfire") +ITEM.Recipe = { + Resources = { + ["Wood"] = 4, + ["Rock"] = 1, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, + { + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,10,0), + Ang = Angle(-45,90,0), + }, + { + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(-10,0,0), + Ang = Angle(-45,180,0), + }, + { + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,-10,0), + Ang = Angle(-45,-90,0), + }, + { + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(10,0,0), + Ang = Angle(-45,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit and tr.HitWorld) then + local drop = ents.Create("ws_campfire") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/charcoal.lua b/gamemode/itemsystem/items/charcoal.lua new file mode 100644 index 0000000..ed5e900 --- /dev/null +++ b/gamemode/itemsystem/items/charcoal.lua @@ -0,0 +1,10 @@ +ITEM.Name = "Charcoal" +ITEM.Class = "resource" +ITEM.Desc = "A hunk of carbon" +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_coal.png") + + +function ITEM:OnCooked(campfire) + campfire:Ignite(1000) +end diff --git a/gamemode/itemsystem/items/cookedmeat.lua b/gamemode/itemsystem/items/cookedmeat.lua new file mode 100644 index 0000000..b8b1999 --- /dev/null +++ b/gamemode/itemsystem/items/cookedmeat.lua @@ -0,0 +1,24 @@ + +ITEM.Name = "Cooked Meat" +ITEM.Class = "food" +ITEM.Desc = "Delicious... and prepared!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_meat.png") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/Weapons/w_bugbait.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +function ITEM:OnUse(user) + if (CLIENT) then return end + + user:SetHealth(math.min(100,user:Health()+40)) + user:AddHunger(-90) + user:RemoveItem(self.Name,1) +end diff --git a/gamemode/itemsystem/items/crystal.lua b/gamemode/itemsystem/items/crystal.lua new file mode 100644 index 0000000..ef9c12e --- /dev/null +++ b/gamemode/itemsystem/items/crystal.lua @@ -0,0 +1,17 @@ + +ITEM.Name = "Crystal" +ITEM.Class = "resource" +ITEM.Desc = "A noteworthy stone." +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_crystal") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + diff --git a/gamemode/itemsystem/items/crystalaxe.lua b/gamemode/itemsystem/items/crystalaxe.lua new file mode 100644 index 0000000..c9acf71 --- /dev/null +++ b/gamemode/itemsystem/items/crystalaxe.lua @@ -0,0 +1,70 @@ + +ITEM.Name = "Crystal Axe" +ITEM.Class = "weapon" +ITEM.Desc = "A more advanced axe made from crystals." +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 = { + ["Log"] = 1, + ["Crystal"] = 1, + ["Rope"] = 1, + ["Vine"] = 1, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} + + + +ITEM.Damage = 30 +ITEM.Range = 64 +ITEM.CD = 0.4 + +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,35)/10 < 2) then pl:AddItem("Wood",1) end + if (math.random(1,90)/10 < 1) 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 diff --git a/gamemode/itemsystem/items/crystalhammer.lua b/gamemode/itemsystem/items/crystalhammer.lua new file mode 100644 index 0000000..4348d0f --- /dev/null +++ b/gamemode/itemsystem/items/crystalhammer.lua @@ -0,0 +1,24 @@ + +ITEM.Name = "Crystal Hammer" +ITEM.Class = "resource" +ITEM.Desc = "A tool used for crystal equipment" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_crystal") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Crystal"] = 8, + ["Sap"] = 4, + }, + Tools = {}, +} diff --git a/gamemode/itemsystem/items/crystalpickaxe.lua b/gamemode/itemsystem/items/crystalpickaxe.lua new file mode 100644 index 0000000..8c981e1 --- /dev/null +++ b/gamemode/itemsystem/items/crystalpickaxe.lua @@ -0,0 +1,72 @@ + +ITEM.Name = "Crystal Pickaxe" +ITEM.Class = "weapon" +ITEM.Desc = "An advanced crystal pickaxe. More efficient than an ordinary pickaxe." +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_pickaxe") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.1,1,0.4), + Pos = Vector(3,-1,-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 = { + ["Log"] = 1, + ["Crystal"] = 2, + ["Rope"] = 1, + ["Vine"] = 1, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} + + + +ITEM.Damage = 30 +ITEM.Range = 64 +ITEM.CD = 0.4 + +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:IsRock()) then + if (math.random(1,35)/10 < 2) then pl:AddItem("Rock",1) end + if (math.random(1,55)/10 < 2) then pl:AddItem("Crystal",1) end + if (math.random(1,90)/10 < 1) then pl:AddItem("Diamond",1) end + if (math.random(1,90)/10 < 2) then pl:AddItem("Flint",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 diff --git a/gamemode/itemsystem/items/crystalsickle.lua b/gamemode/itemsystem/items/crystalsickle.lua new file mode 100644 index 0000000..1753a2a --- /dev/null +++ b/gamemode/itemsystem/items/crystalsickle.lua @@ -0,0 +1,70 @@ + +ITEM.Name = "Crystal Sickle" +ITEM.Class = "weapon" +ITEM.Desc = "A sickle. Used for bushes for vines and berries" +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_sickle") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.5,0.1,0.2), + Pos = Vector(3,-4,-22), + Ang = Angle(0,0,0), + }, + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.1), + Pos = Vector(3,-1.5,-6), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Log"] = 1, + ["Crystal"] = 2, + ["Rope"] = 1, + ["Vine"] = 1, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} + + + +ITEM.Damage = 10 +ITEM.Range = 64 +ITEM.CD = 0.4 + +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:IsPlant()) then + if (math.random(1,35)/10 < 2) then pl:AddItem("Vine",1) end + if (math.random(1,35)/10 < 2) then pl:AddItem("Berry",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 diff --git a/gamemode/itemsystem/items/cup.lua b/gamemode/itemsystem/items/cup.lua new file mode 100644 index 0000000..5c8e27d --- /dev/null +++ b/gamemode/itemsystem/items/cup.lua @@ -0,0 +1,20 @@ + +ITEM.Name = "Cup" +ITEM.Class = "resource" +ITEM.Desc = "It could hold some liquid" +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_cupempty.png") + +ITEM.Recipe = { + Resources = { + ["Log"] = 1, + ["Sap"] = 1, + }, + Tools = { + ["Knife"] = 1, + }, +} + +function ITEM:OnPrimary() + +end diff --git a/gamemode/itemsystem/items/diamond.lua b/gamemode/itemsystem/items/diamond.lua new file mode 100644 index 0000000..d491638 --- /dev/null +++ b/gamemode/itemsystem/items/diamond.lua @@ -0,0 +1,17 @@ + +ITEM.Name = "Diamond" +ITEM.Class = "resource" +ITEM.Desc = "A very powerful resource for use with more advanced equipment." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("settlement/icon_diamond") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + diff --git a/gamemode/itemsystem/items/diamondaxe.lua b/gamemode/itemsystem/items/diamondaxe.lua new file mode 100644 index 0000000..9edc6e4 --- /dev/null +++ b/gamemode/itemsystem/items/diamondaxe.lua @@ -0,0 +1,70 @@ + +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 diff --git a/gamemode/itemsystem/items/diamondhammer.lua b/gamemode/itemsystem/items/diamondhammer.lua new file mode 100644 index 0000000..56cab21 --- /dev/null +++ b/gamemode/itemsystem/items/diamondhammer.lua @@ -0,0 +1,28 @@ + +ITEM.Name = "Diamond Hammer" +ITEM.Class = "resource" +ITEM.Desc = "A tool used for diamond equipment" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_crystal") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Diamond"] = 8, + ["Ancient Wood"] = 8, + ["Rope"] = 4, + ["Sap"] = 6, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} diff --git a/gamemode/itemsystem/items/diamondpickaxe.lua b/gamemode/itemsystem/items/diamondpickaxe.lua new file mode 100644 index 0000000..f0599a3 --- /dev/null +++ b/gamemode/itemsystem/items/diamondpickaxe.lua @@ -0,0 +1,72 @@ + +ITEM.Name = "Diamond Pickaxe" +ITEM.Class = "weapon" +ITEM.Desc = "An advanced pickaxe. Made from ancient wood and diamonds." +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_pickaxe") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.1,1,0.4), + Pos = Vector(3,-1,-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"] = 2, + ["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:IsRock()) then + if (math.random(1,35)/10 < 3) then pl:AddItem("Rock",1) end + if (math.random(1,55)/10 < 3) then pl:AddItem("Crystal",1) end + if (math.random(1,90)/10 < 2) then pl:AddItem("Diamond",1) end + if (math.random(1,90)/10 < 3) then pl:AddItem("Flint",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 diff --git a/gamemode/itemsystem/items/diamondsickle.lua b/gamemode/itemsystem/items/diamondsickle.lua new file mode 100644 index 0000000..0fd2688 --- /dev/null +++ b/gamemode/itemsystem/items/diamondsickle.lua @@ -0,0 +1,70 @@ + +ITEM.Name = "Diamond Sickle" +ITEM.Class = "weapon" +ITEM.Desc = "A sickle made from ancient wood and diamonds" +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_sickle") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(0.5,0.1,0.2), + Pos = Vector(3,-4,-22), + Ang = Angle(0,0,0), + }, + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.1), + Pos = Vector(3,-1.5,-6), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Ancient Log"] = 1, + ["Diamond"] = 2, + ["Rope"] = 1, + ["Vine"] = 1, + }, + Tools = { + ["Diamond Hammer"] = 1, + }, +} + + + +ITEM.Damage = 10 +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:IsPlant()) then + if (math.random(1,35)/10 < 3) then pl:AddItem("Vine",1) end + if (math.random(1,35)/10 < 3) then pl:AddItem("Berry",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 diff --git a/gamemode/itemsystem/items/feather.lua b/gamemode/itemsystem/items/feather.lua new file mode 100644 index 0000000..d53acc8 --- /dev/null +++ b/gamemode/itemsystem/items/feather.lua @@ -0,0 +1,6 @@ + +ITEM.Name = "Feather" +ITEM.Class = "resource" +ITEM.Desc = "Material used for making arrows" +ITEM.Model = "models/Gibs/HGIBS_scapula.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_feather.png") diff --git a/gamemode/itemsystem/items/fence.lua b/gamemode/itemsystem/items/fence.lua new file mode 100644 index 0000000..e4a8217 --- /dev/null +++ b/gamemode/itemsystem/items/fence.lua @@ -0,0 +1,59 @@ + +ITEM.Name = "Fence" +ITEM.Class = "structure" +ITEM.Desc = "Some basic wood structure for setting up camps." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_fence") +ITEM.Recipe = { + Resources = { + ["Plank"] = 2, + ["Sap"] = 1, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_wasteland/wood_fence02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_prop") + drop:SetModel("models/props_wasteland/wood_fence02a.mdl") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/flint.lua b/gamemode/itemsystem/items/flint.lua new file mode 100644 index 0000000..63fd085 --- /dev/null +++ b/gamemode/itemsystem/items/flint.lua @@ -0,0 +1,6 @@ + +ITEM.Name = "Flint" +ITEM.Class = "resource" +ITEM.Desc = "Sharp stone" +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_flint.png") diff --git a/gamemode/itemsystem/items/floor.lua b/gamemode/itemsystem/items/floor.lua new file mode 100644 index 0000000..c02815b --- /dev/null +++ b/gamemode/itemsystem/items/floor.lua @@ -0,0 +1,60 @@ + +ITEM.Name = "Floor" +ITEM.Class = "structure" +ITEM.Desc = "Some basic wood structure for setting up camps." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_fence") +ITEM.Recipe = { + Resources = { + ["Plank"] = 2, + ["Wood"] = 3, + ["Sap"] = 1, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_wasteland/wood_fence02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,90), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_prop") + drop:SetModel("models/props_wasteland/wood_fence02a.mdl") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,90)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/infuser.lua b/gamemode/itemsystem/items/infuser.lua new file mode 100644 index 0000000..d2f72ad --- /dev/null +++ b/gamemode/itemsystem/items/infuser.lua @@ -0,0 +1,57 @@ +ITEM.Name = "Infuser" +ITEM.Class = "structure" +ITEM.Desc = "Cast enchantments\nPlace runes nearby to boost magical power and have different effects" +ITEM.Model = "models/props_junk/wood_crate002a.mdl" +ITEM.Icon = Material("settlement/icon_researchtable") +ITEM.Recipe = { + Resources = { + ["Log"] = 5, + ["Sap"] = 5, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/wood_crate002a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_junk/wood_crate002a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_infuser") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/juice.lua b/gamemode/itemsystem/items/juice.lua new file mode 100644 index 0000000..ff24b84 --- /dev/null +++ b/gamemode/itemsystem/items/juice.lua @@ -0,0 +1,21 @@ + +ITEM.Name = "Juice" +ITEM.Class = "food" +ITEM.Desc = "Restores some thirst." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_beer") + +ITEM.Recipe = { + Resources = { + ["Berry"] = 3, + ["Cup"] = 1, + }, + Tools = {}, +} + +function ITEM:OnUse(user) + if (CLIENT) then return end + + user:SetWater(0) + user:RemoveItem(self.Name,1) +end diff --git a/gamemode/itemsystem/items/knife.lua b/gamemode/itemsystem/items/knife.lua new file mode 100644 index 0000000..63959ce --- /dev/null +++ b/gamemode/itemsystem/items/knife.lua @@ -0,0 +1,60 @@ + +ITEM.Name = "Knife" +ITEM.Class = "weapon" +ITEM.Desc = "A knife, what do u expect?" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("settlement/icon_knife") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_combine/breenlight.mdl", + Size = Vector(.1,.5,.5), + Pos = Vector(3,-1.6,0.5), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Rock"] = 1, + ["Sap"] = 1, + ["Wood"] = 1, + ["Crystal"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 1 +ITEM.Range = 64 +ITEM.CD = 0.1 + +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,35)/10 < 1) then pl:AddItem("Sap",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 diff --git a/gamemode/itemsystem/items/log.lua b/gamemode/itemsystem/items/log.lua new file mode 100644 index 0000000..07b8352 --- /dev/null +++ b/gamemode/itemsystem/items/log.lua @@ -0,0 +1,15 @@ + +ITEM.Name = "Log" +ITEM.Class = "resource" +ITEM.Desc = "Bigger wood." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_log.png") + +ITEM.Recipe = { + Resources = { + ["Vine"] = 1, + ["Sap"] = 1, + ["Wood"] = 3, + }, + Tools = {}, +} diff --git a/gamemode/itemsystem/items/magicwood.lua b/gamemode/itemsystem/items/magicwood.lua new file mode 100644 index 0000000..00c1605 --- /dev/null +++ b/gamemode/itemsystem/items/magicwood.lua @@ -0,0 +1,58 @@ + +ITEM.Name = "Magic Wood" +ITEM.Class = "weapon" +ITEM.Desc = "Some magically infused wood" +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_magicwood.png") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.5), + Pos = Vector(3,-1.5,-12), + Ang = Angle(0,0,0), + }, +} + +ITEM.Damage = 2 +ITEM.Range = 60 +ITEM.CD = 1.0 + +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:GetModel():find("tree")) then + 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 + +function ITEM:OnSecondary(pl,tr) + if (CLIENT) then return end + if (!pl:HasItem(self.Name)) then return end + + local drop = SpawnWSItem(self.Name,pl:GetShootPos()+pl:GetAimVector()*20) + drop:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 200) + + pl:RemoveItem(self.Name,1) + + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(40,60)) +end diff --git a/gamemode/itemsystem/items/maul.lua b/gamemode/itemsystem/items/maul.lua new file mode 100644 index 0000000..2189eef --- /dev/null +++ b/gamemode/itemsystem/items/maul.lua @@ -0,0 +1,58 @@ +ITEM.Name = [[Maul]] +ITEM.Desc = [[The ultimate nutcracker!]] +ITEM.Model = [[models/props_debris/wood_board02a.mdl]] +ITEM.Icon = Material([[wintersurvival2/hud/ws2_icons/icon_sword.png]]) +ITEM.HoldType = [[melee2]] +ITEM.Structure = { + { + Bone ="ValveBiped.Bip01_R_Hand", + Model ="models/props_debris/wood_board02a.mdl", + Size =Vector(0.5,0.5,0.5), + Pos =Vector(3.8900001049042,-2.1099998950958,-11.640000343323), + Ang =Angle(0,74.120002746582,0), + }, + { + Bone ="ValveBiped.Bip01_R_Hand", + Model ="models/props_debris/wood_board02a.mdl", + Size =Vector(2.2999999523163,1.7999999523163,0.15000000596046), + Pos =Vector(3.8900001049042,-2.1099998950958,-22.579999923706), + Ang =Angle(0,78.360000610352,91.059997558594), + }, +} + +ITEM.Recipe = { + Resources = { + ["Plank"] = 4, + ["Log"] = 1, + ["Sap"] = 1, + }, + Tools = {}, +} + +ITEM.Damage = 70 +ITEM.Range = 80 +ITEM.CD = 1 + +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 + 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(50,60)) + end +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/meat.lua b/gamemode/itemsystem/items/meat.lua new file mode 100644 index 0000000..d26d3c1 --- /dev/null +++ b/gamemode/itemsystem/items/meat.lua @@ -0,0 +1,28 @@ + +ITEM.Name = "Meat" +ITEM.Class = "food" +ITEM.Desc = "Delicious..." +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_bugbait") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/Weapons/w_bugbait.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +function ITEM:OnUse(user) + if (CLIENT) then return end + + user:SetHealth(math.min(100,user:Health()+10)) + user:AddHunger(-30) + user:RemoveItem(self.Name,1) +end + +function ITEM:OnCooked(campfire) + campfire:AddItem("Cooked Meat",1) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/mortarandpestle.lua b/gamemode/itemsystem/items/mortarandpestle.lua new file mode 100644 index 0000000..42b1baa --- /dev/null +++ b/gamemode/itemsystem/items/mortarandpestle.lua @@ -0,0 +1,20 @@ + +ITEM.Name = "Mortar and Pestle" +ITEM.Class = "tool" +ITEM.Desc = "Something to grind things down in" +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_mortarandpestle.png") + +ITEM.Recipe = { + Resources = { + ["Cup"] = 1, + ["Rock"] = 1, + }, + Tools = { + ["Knife"] = 1, + }, +} + +function ITEM:OnPrimary() + +end diff --git a/gamemode/itemsystem/items/pickaxe.lua b/gamemode/itemsystem/items/pickaxe.lua new file mode 100644 index 0000000..2032d12 --- /dev/null +++ b/gamemode/itemsystem/items/pickaxe.lua @@ -0,0 +1,68 @@ + +ITEM.Name = "Pickaxe" +ITEM.Class = "weapon" +ITEM.Desc = "A primitive axe held together with sap." +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_pickaxe") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.1,1,0.4), + Pos = Vector(3,-1,-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 = { + ["Wood"] = 1, + ["Rock"] = 2, + ["Sap"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 30 +ITEM.Range = 64 +ITEM.CD = 0.5 + +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:IsRock()) then + if (math.random(1,35)/10 < 1) then pl:AddItem("Rock",1) end + if (math.random(1,55)/10 < 1) then pl:AddItem("Crystal",1) end + if (math.random(1,90)/10 < 1) then pl:AddItem("Flint",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 diff --git a/gamemode/itemsystem/items/pitch.lua b/gamemode/itemsystem/items/pitch.lua new file mode 100644 index 0000000..40c2a57 --- /dev/null +++ b/gamemode/itemsystem/items/pitch.lua @@ -0,0 +1,25 @@ + +ITEM.Name = "Pitch" +ITEM.Class = "resource" +ITEM.Desc = "A sticky stubstance, probably flamable" +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_pitch.png") + +ITEM.Recipe = { + Resources = { + ["Charcoal"] = 1, + ["Sap"] = 1, + }, + Tools = { + ["Mortar and Pestle"] = 1, + }, +} + +function ITEM:OnPrimary() + +end + + +function ITEM:OnCooked(campfire) + campfire:Ignite(500) +end diff --git a/gamemode/itemsystem/items/plank.lua b/gamemode/itemsystem/items/plank.lua new file mode 100644 index 0000000..5726434 --- /dev/null +++ b/gamemode/itemsystem/items/plank.lua @@ -0,0 +1,25 @@ + +ITEM.Name = "Plank" +ITEM.Class = "resource" +ITEM.Desc = "Advanced wood material." +ITEM.Model = "models/props_debris/wood_board06a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_plank") +ITEM.Recipe = { + Resources = { + ["Wood"] = 2, + ["Sap"] = 1, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} \ No newline at end of file diff --git a/gamemode/itemsystem/items/ramp.lua b/gamemode/itemsystem/items/ramp.lua new file mode 100644 index 0000000..96e6c27 --- /dev/null +++ b/gamemode/itemsystem/items/ramp.lua @@ -0,0 +1,60 @@ + +ITEM.Name = "Ramp" +ITEM.Class = "structure" +ITEM.Desc = "Some basic wood structure for setting up camps." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_fence") +ITEM.Recipe = { + Resources = { + ["Plank"] = 2, + ["Log"] = 1, + ["Sap"] = 1, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_wasteland/wood_fence02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,45), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_prop") + drop:SetModel("models/props_wasteland/wood_fence02a.mdl") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,45)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/recipe_battleaxe.lua b/gamemode/itemsystem/items/recipe_battleaxe.lua new file mode 100644 index 0000000..2ae7c9b --- /dev/null +++ b/gamemode/itemsystem/items/recipe_battleaxe.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Battle Axe" +ITEM.Class = "account" +ITEM.Desc = "A recipe. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Battle Axe") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_crystalhammer.lua b/gamemode/itemsystem/items/recipe_crystalhammer.lua new file mode 100644 index 0000000..097aa1a --- /dev/null +++ b/gamemode/itemsystem/items/recipe_crystalhammer.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Crystal Hammer" +ITEM.Class = "account" +ITEM.Desc = "A recipe. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Crystal Hammer") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_diamondhammer.lua b/gamemode/itemsystem/items/recipe_diamondhammer.lua new file mode 100644 index 0000000..aab1a74 --- /dev/null +++ b/gamemode/itemsystem/items/recipe_diamondhammer.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Diamond Hammer" +ITEM.Class = "account" +ITEM.Desc = "A recipe. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Diamond Hammer") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_maul.lua b/gamemode/itemsystem/items/recipe_maul.lua new file mode 100644 index 0000000..04c78f1 --- /dev/null +++ b/gamemode/itemsystem/items/recipe_maul.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Maul" +ITEM.Class = "account" +ITEM.Desc = "A recipe. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Maul") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_shack.lua b/gamemode/itemsystem/items/recipe_shack.lua new file mode 100644 index 0000000..060fccb --- /dev/null +++ b/gamemode/itemsystem/items/recipe_shack.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Shack" +ITEM.Class = "account" +ITEM.Desc = "A recipe for the shack. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Shack") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_stoneblock.lua b/gamemode/itemsystem/items/recipe_stoneblock.lua new file mode 100644 index 0000000..ba1447d --- /dev/null +++ b/gamemode/itemsystem/items/recipe_stoneblock.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Stoneblock" +ITEM.Class = "account" +ITEM.Desc = "A recipe. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Stoneblock") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/recipe_tent.lua b/gamemode/itemsystem/items/recipe_tent.lua new file mode 100644 index 0000000..fd810af --- /dev/null +++ b/gamemode/itemsystem/items/recipe_tent.lua @@ -0,0 +1,27 @@ + +ITEM.Name = "Recipe: Tent" +ITEM.Class = "account" +ITEM.Desc = "A recipe for the tent. Use it to print it on chat!" +ITEM.Model = "models/Weapons/w_bugbait.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") + +function ITEM:OnUse(user) + if (CLIENT) then return end + + local rec,item = GetRecipeForItem("Tent") + local txt = "Recipe: " + + txt = txt.." RESOURCES(" + for a,b in pairs(rec.Resources) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + txt = txt.." TOOLS(" + for a,b in pairs(rec.Tools) do + txt=txt..b.." x "..a..", " + end + txt = txt..")" + + user:ChatPrint(txt) +end \ No newline at end of file diff --git a/gamemode/itemsystem/items/researchtable.lua b/gamemode/itemsystem/items/researchtable.lua new file mode 100644 index 0000000..4b05cf2 --- /dev/null +++ b/gamemode/itemsystem/items/researchtable.lua @@ -0,0 +1,55 @@ +ITEM.Name = "Research Table" +ITEM.Class = "structure" +ITEM.Desc = "A table to find recepies\nPlace 10 wood, sap, and rock in the table to discover a new recipe." +ITEM.Model = "models/props_junk/wood_crate001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_recipe.png") +ITEM.Recipe = { + Resources = { + ["Wood"] = 10, + ["Sap"] = 5, + }, + Tools = {}, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/wood_crate001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props/cs_italy/it_mkt_table3.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,0), + Ang = Angle(0,0,0), + }, +} + +ITEM.Range = 200 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local drop = ents.Create("ws_researchtable") + drop:SetAngles(Angle(0,pl:GetAimVector():Angle().y+90,0)) + drop:SetPos(tr.HitPos) + drop:Spawn() + drop:Activate() + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/rock.lua b/gamemode/itemsystem/items/rock.lua new file mode 100644 index 0000000..5ee7e09 --- /dev/null +++ b/gamemode/itemsystem/items/rock.lua @@ -0,0 +1,60 @@ + +ITEM.Name = "Rock" +ITEM.Class = "weapon" +ITEM.Desc = "A rock.\nIt is somewhat jagged." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_rock") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Damage = 6 +ITEM.Range = 60 +ITEM.CD = .4 + +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,35)/10 < 1) then pl:AddItem("Sap",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 + +function ITEM:OnSecondary(pl,tr) + if (CLIENT) then return end + if (!pl:HasItem(self.Name)) then return end + + local drop = SpawnWSItem(self.Name,pl:GetShootPos()+pl:GetAimVector()*20) + drop:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 200) + + pl:RemoveItem(self.Name,1) + + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(40,60)) +end diff --git a/gamemode/itemsystem/items/rope.lua b/gamemode/itemsystem/items/rope.lua new file mode 100644 index 0000000..a9d0c53 --- /dev/null +++ b/gamemode/itemsystem/items/rope.lua @@ -0,0 +1,14 @@ + +ITEM.Name = "Rope" +ITEM.Class = "resource" +ITEM.Desc = "Handy rope for more advanced structures and tools." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("settlement/icon_rope") + +ITEM.Recipe = { + Resources = { + ["Vine"] = 3, + ["Sap"] = 1, + }, + Tools = {}, +} diff --git a/gamemode/itemsystem/items/runeblank.lua b/gamemode/itemsystem/items/runeblank.lua new file mode 100644 index 0000000..2935b4e --- /dev/null +++ b/gamemode/itemsystem/items/runeblank.lua @@ -0,0 +1,34 @@ + +ITEM.Name = "Blank Rune" +ITEM.Class = "resource" +ITEM.Desc = "A blank peice of stone" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_rune.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 = { + ["Rock"] = 3, + ["Sap"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 1 +ITEM.Range = 64 +ITEM.CD = 1 + +function ITEM:OnEnchanted(enchanttable, nearbyrunes) + enchanttable:AddItem("Magic Rune", 1) +end diff --git a/gamemode/itemsystem/items/runeenergy.lua b/gamemode/itemsystem/items/runeenergy.lua new file mode 100644 index 0000000..226344e --- /dev/null +++ b/gamemode/itemsystem/items/runeenergy.lua @@ -0,0 +1,45 @@ + +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_combine/breenlight.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) + user:UnEquipWeaponSlot(user:GetSelectedWeapon()) + self:OnUse(user) +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 diff --git a/gamemode/itemsystem/items/runefire.lua b/gamemode/itemsystem/items/runefire.lua new file mode 100644 index 0000000..419712e --- /dev/null +++ b/gamemode/itemsystem/items/runefire.lua @@ -0,0 +1,48 @@ + +ITEM.Name = "Fire Rune" +ITEM.Class = "resource" +ITEM.Desc = "A perpetually warm stone" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_runefire.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, + ["Pitch"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 1 +ITEM.Range = 500 +ITEM.CD = 1 + +function ITEM:OnUse(user) + if(CLIENT) then return end + user:Ignite(1) + user:SetHeat(0) + user:RemoveItem(self.Name,1) +end + +function ITEM:OnPrimary(ply,tr) + if(CLIENT) then + game.AddParticles("particles/particletest.pcf") + else + if(tr.Hit && tr.Entity && tr.Entity:IsPlayer()) then + tr.Entity:Ignite(5) + end + end + +end diff --git a/gamemode/itemsystem/items/runemagic.lua b/gamemode/itemsystem/items/runemagic.lua new file mode 100644 index 0000000..e999299 --- /dev/null +++ b/gamemode/itemsystem/items/runemagic.lua @@ -0,0 +1,21 @@ + +ITEM.Name = "Magic Rune" +ITEM.Class = "resource" +ITEM.Desc = "A stone infused with magic" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_runemagic.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.Damage = 1 +ITEM.Range = 64 +ITEM.CD = 1 diff --git a/gamemode/itemsystem/items/runenature.lua b/gamemode/itemsystem/items/runenature.lua new file mode 100644 index 0000000..286a957 --- /dev/null +++ b/gamemode/itemsystem/items/runenature.lua @@ -0,0 +1,39 @@ + +ITEM.Name = "Nature Rune" +ITEM.Class = "resource" +ITEM.Desc = "A blank peice of stone" +ITEM.Model = "models/props_combine/breenlight.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_runenature.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, + ["Sap"] = 1, + ["Berry"] = 1, + ["Vine"] = 1 + }, + Tools = {}, +} + + + +ITEM.Damage = 1 +ITEM.Range = 64 +ITEM.CD = 1 + +function ITEM:OnUse(user) + if(CLIENT) then return end + if not user then return end + user:SetHealth(math.min(100,user:Health()+25)) + user:AddFatigue(10) +end diff --git a/gamemode/itemsystem/items/sap.lua b/gamemode/itemsystem/items/sap.lua new file mode 100644 index 0000000..18ff486 --- /dev/null +++ b/gamemode/itemsystem/items/sap.lua @@ -0,0 +1,6 @@ + +ITEM.Name = "Sap" +ITEM.Class = "resource" +ITEM.Desc = "Tree sap. Very sticky, could be used as an adhesive." +ITEM.Model = "models/props_junk/Rock001a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_sap") diff --git a/gamemode/itemsystem/items/shack.lua b/gamemode/itemsystem/items/shack.lua new file mode 100644 index 0000000..f66fe38 --- /dev/null +++ b/gamemode/itemsystem/items/shack.lua @@ -0,0 +1,111 @@ + +ITEM.Name = "Shack" +ITEM.Class = "structure" +ITEM.Desc = "An actual building... how convenient." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("settlement/icon_shack") +ITEM.Recipe = { + Resources = { + ["Tent"] = 1, + ["Log"] = 1, + ["Rope"] = 1, + ["Stoneblock"] = 1, + }, + Tools = { + ["Crystal Hammer"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,30,130), + Ang = Angle(0,0,45), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,-30,130), + Ang = Angle(0,180,45), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,-55,40), + Ang = Angle(0,0,0), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(-55,0,40), + Ang = Angle(0,90,0), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,55,40), + Ang = Angle(0,180,0), + }, + { + Model = "models/props_wasteland/wood_fence02a.mdl", + Size = Vector(1,1,1), + Pos = Vector(55,27,40), + Ang = Angle(0,270,0), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(0,0,100), + Ang = Angle(0,0,90), + }, +} + +ITEM.Range = 300 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local Ang = Angle(0,pl:GetAimVector():Angle().y+90,0) + local Pos = tr.HitPos + + for k,v in pairs(self.Ghost) do + local Off = v.Pos*1 + Off:Rotate(Ang) + + local Roa = Ang*1 + + Roa:RotateAroundAxis(Ang:Right(),v.Ang.p) + Roa:RotateAroundAxis(Ang:Forward(),v.Ang.r) + Roa:RotateAroundAxis(Ang:Up(),v.Ang.y) + + local drop = ents.Create("ws_prop") + drop:SetModel(v.Model) + drop:SetAngles(Roa) + drop:SetPos(Pos+Off) + drop:Spawn() + drop:Activate() + end + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/sickle.lua b/gamemode/itemsystem/items/sickle.lua new file mode 100644 index 0000000..4703655 --- /dev/null +++ b/gamemode/itemsystem/items/sickle.lua @@ -0,0 +1,67 @@ + +ITEM.Name = "Sickle" +ITEM.Class = "weapon" +ITEM.Desc = "A sickle. Used for bushes for vines and berries" +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("settlement/icon_sickle") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.1,0.2), + Pos = Vector(3,-4,-22), + Ang = Angle(0,0,0), + }, + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.1), + Pos = Vector(3,-1.5,-6), + Ang = Angle(0,0,0), + }, +} + +ITEM.Recipe = { + Resources = { + ["Wood"] = 1, + ["Rock"] = 2, + ["Sap"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 10 +ITEM.Range = 64 +ITEM.CD = 0.5 + +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:IsPlant()) then + if (math.random(1,35)/10 < 1) then pl:AddItem("Vine",1) end + if (math.random(1,35)/10 < 1) then pl:AddItem("Berry",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 diff --git a/gamemode/itemsystem/items/stoneblock.lua b/gamemode/itemsystem/items/stoneblock.lua new file mode 100644 index 0000000..36f1c35 --- /dev/null +++ b/gamemode/itemsystem/items/stoneblock.lua @@ -0,0 +1,14 @@ + +ITEM.Name = "Stoneblock" +ITEM.Class = "resource" +ITEM.Desc = "A useful building material." +ITEM.Model = "models/props_junk/CinderBlock01a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_stoneblock.png") + +ITEM.Recipe = { + Resources = { + ["Rock"] = 4, + ["Sap"] = 2, + }, + Tools = {}, +} diff --git a/gamemode/itemsystem/items/sword.lua b/gamemode/itemsystem/items/sword.lua new file mode 100644 index 0000000..47388d2 --- /dev/null +++ b/gamemode/itemsystem/items/sword.lua @@ -0,0 +1,58 @@ + +ITEM.Name = "Sword" +ITEM.Class = "weapon" +ITEM.Desc = "A sword for combat." +ITEM.Model = "models/weapons/w_archersword/w_archersword.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_sword.png") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/weapons/w_archersword/w_archersword.mdl", + Size = Vector(1,1,1), + Pos = Vector(3,-1,0), + Ang = Angle(0,0,-90), + }, +} + +ITEM.Recipe = { + Resources = { + ["Wood"] = 1, + ["Crystal"] = 1, + ["Sap"] = 1, + }, + Tools = {}, +} + + + +ITEM.Damage = 60 +ITEM.Range = 64 +ITEM.CD = 0.4 + +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() + print("Class:") + print(class) + + 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 + 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 diff --git a/gamemode/itemsystem/items/tent.lua b/gamemode/itemsystem/items/tent.lua new file mode 100644 index 0000000..1d5a1b5 --- /dev/null +++ b/gamemode/itemsystem/items/tent.lua @@ -0,0 +1,79 @@ + +ITEM.Name = "Tent" +ITEM.Class = "structure" +ITEM.Desc = "Something to duck under." +ITEM.Model = "models/props_debris/wood_board07a.mdl" +ITEM.Icon = Material("settlement/icon_tent") +ITEM.Recipe = { + Resources = { + ["Fence"] = 4, + ["Rope"] = 2, + }, + Tools = { + ["Crystal"] = 1, + }, +} + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_junk/Rock001a.mdl", + Size = Vector(0.5,0.5,0.5), + Pos = Vector(4,-3,-1), + Ang = Angle(0,0,0), + }, +} + +ITEM.Ghost = { + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(30,0,40), + Ang = Angle(0,-90,45), + }, + { + Model = "models/props_wasteland/wood_fence01a.mdl", + Size = Vector(1,1,1), + Pos = Vector(-30,0,40), + Ang = Angle(0,90,45), + }, +} + +ITEM.Range = 300 +ITEM.CD = 0.5 + +function ITEM:OnPrimary(pl,tr) + if (CLIENT) then return end + + if (!pl:CanPlaceStructure(tr)) then pl:GhostStructure(self.Name) return end + + if (tr.Hit) then + local Ang = Angle(0,pl:GetAimVector():Angle().y+90,0) + local Pos = tr.HitPos + + for k,v in pairs(self.Ghost) do + local Off = v.Pos*1 + Off:Rotate(Ang) + + local Roa = Ang*1 + + Roa:RotateAroundAxis(Ang:Right(),v.Ang.p) + Roa:RotateAroundAxis(Ang:Forward(),v.Ang.r) + Roa:RotateAroundAxis(Ang:Up(),v.Ang.y) + + local drop = ents.Create("ws_prop") + drop:SetModel(v.Model) + drop:SetAngles(Roa) + drop:SetPos(Pos+Off) + drop:Spawn() + drop:Activate() + end + + if (pl:HasItem(self.Name)) then pl:RemoveItem(self.Name,1) + else pl:UnEquipWeaponSlot(pl.Select,true) end + + pl:GhostRemove() + else + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) + end +end diff --git a/gamemode/itemsystem/items/vine.lua b/gamemode/itemsystem/items/vine.lua new file mode 100644 index 0000000..beeb5d4 --- /dev/null +++ b/gamemode/itemsystem/items/vine.lua @@ -0,0 +1,6 @@ + +ITEM.Name = "Vine" +ITEM.Class = "resource" +ITEM.Desc = "A sturdy vine." +ITEM.Model = "models/Gibs/Antlion_gib_Large_2.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_vine") diff --git a/gamemode/itemsystem/items/wood.lua b/gamemode/itemsystem/items/wood.lua new file mode 100644 index 0000000..9d2d976 --- /dev/null +++ b/gamemode/itemsystem/items/wood.lua @@ -0,0 +1,66 @@ + +ITEM.Name = "Wood" +ITEM.Class = "weapon" +ITEM.Desc = "Lumber. Maybe timber." +ITEM.Model = "models/props_debris/wood_board02a.mdl" +ITEM.Icon = Material("wintersurvival2/hud/ws1_icons/icon_wood") + +ITEM.Structure = { + { + Bone = "ValveBiped.Bip01_R_Hand", + Model = "models/props_debris/wood_board02a.mdl", + Size = Vector(.5,.5,.5), + Pos = Vector(3,-1.5,-12), + Ang = Angle(0,0,0), + }, +} + +ITEM.Damage = 5 +ITEM.Range = 60 +ITEM.CD = 0.6 + +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:GetModel():find("tree")) then + 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 + +function ITEM:OnCooked(campfire) + campfire:AddItem("Charcoal",1) +end + +function ITEM:OnSecondary(pl,tr) + if (CLIENT) then return end + if (!pl:HasItem(self.Name)) then return end + + local drop = SpawnWSItem(self.Name,pl:GetShootPos()+pl:GetAimVector()*20) + drop:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 200) + + pl:RemoveItem(self.Name,1) + + pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(40,60)) +end + +function ITEM:OnEnchanted(enchanttable, runes) + enchanttable:AddItem("Magic Wood", 1) +end diff --git a/gamemode/itemsystem/loaditems.lua b/gamemode/itemsystem/loaditems.lua new file mode 100644 index 0000000..a593e0d --- /dev/null +++ b/gamemode/itemsystem/loaditems.lua @@ -0,0 +1,83 @@ +local Folder = GM.Folder:gsub("gamemodes/","").."/gamemode/itemsystem/items" +local insert = table.insert + +function GM:LoadItems() + local Items = file.Find(Folder.."/*.lua","LUA") + local BaseItem = {} + + GAMEMODE.Items = {} + GAMEMODE.Recipes = {} + + ITEM = {} + + AddCSLuaFile(Folder.."/base.lua") + include(Folder.."/base.lua") + + BaseItem = table.Copy(ITEM) + + for k,v in pairs(Items) do + if (v != "base.lua") then + AddCSLuaFile(Folder.."/"..v) + include(Folder.."/"..v) + + insert(GAMEMODE.Items,ITEM) + if (ITEM.Recipe) then insert(GAMEMODE.Recipes,ITEM) end + + ITEM = table.Copy(BaseItem) + + end + end +end + +hook.Add("Initialize","LoadItems",function() + local Items = file.Find(Folder.."/*.lua","LUA") + local BaseItem = {} + + GAMEMODE.Items = {} + GAMEMODE.Recipes = {} + + ITEM = {} + + AddCSLuaFile(Folder.."/base.lua") + include(Folder.."/base.lua") + + BaseItem = table.Copy(ITEM) + + for k,v in pairs(Items) do + if (v != "base.lua") then + AddCSLuaFile(Folder.."/"..v) + include(Folder.."/"..v) + + insert(GAMEMODE.Items,ITEM) + if (ITEM.Recipe) then insert(GAMEMODE.Recipes,ITEM) end + + ITEM = table.Copy(BaseItem) + + end + end +end) + +function GetItemByName(name) + for k,v in pairs( GAMEMODE.Items ) do + if (v.Name == name) then return v end + end + + return nil +end + +function GetRecipeForItem(name) + for k,v in pairs( GAMEMODE.Recipes ) do + if (v.Name == name) then return v.Recipe,v end + end + + return nil +end + +function GetItemsByClass(class) + local Dat = {} + for k,v in pairs( GAMEMODE.Items ) do + if (v.Class == class) then table.insert(Dat,v) end + end + + return Dat +end -- cgit v1.2.3-70-g09d2