From 0ceb38e8a1f26716fe4756c1cfbdbbedd1fae5f1 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 28 Dec 2016 18:46:17 -0600 Subject: Fixed some stuff --- doc/gmodserver.txt | 27 ---------- doc/notes.txt | 30 ----------- entities/entities/ws_projectile/shared.lua | 2 +- gamemode/init.lua | 6 ++- gamemode/itemsystem/items/alter.lua | 4 +- gamemode/itemsystem/items/ancientlog.lua | 3 +- gamemode/itemsystem/items/ancientwood.lua | 17 +++--- gamemode/itemsystem/items/arrow.lua | 3 +- gamemode/itemsystem/items/axe.lua | 11 ++-- gamemode/itemsystem/items/barrel.lua | 3 +- gamemode/itemsystem/items/base.lua | 5 +- gamemode/itemsystem/items/battleaxe.lua | 10 ++-- gamemode/itemsystem/items/berry.lua | 7 +-- gamemode/itemsystem/items/bow.lua | 3 +- gamemode/itemsystem/items/campfire.lua | 3 +- gamemode/itemsystem/items/charcoal.lua | 2 + gamemode/itemsystem/items/chitin.lua | 2 + gamemode/itemsystem/items/cookedmeat.lua | 3 +- gamemode/itemsystem/items/crystal.lua | 4 +- gamemode/itemsystem/items/crystalaxe.lua | 11 ++-- gamemode/itemsystem/items/crystalhammer.lua | 3 +- gamemode/itemsystem/items/crystalpickaxe.lua | 13 ++--- gamemode/itemsystem/items/crystalsickle.lua | 11 ++-- gamemode/itemsystem/items/cup.lua | 3 +- gamemode/itemsystem/items/diamond.lua | 4 +- gamemode/itemsystem/items/diamondaxe.lua | 3 +- gamemode/itemsystem/items/diamondhammer.lua | 3 +- gamemode/itemsystem/items/diamondpickaxe.lua | 13 ++--- gamemode/itemsystem/items/diamondsickle.lua | 11 ++-- gamemode/itemsystem/items/feather.lua | 3 +- gamemode/itemsystem/items/fence.lua | 3 +- gamemode/itemsystem/items/fencehalf.lua | 3 +- gamemode/itemsystem/items/flint.lua | 3 +- gamemode/itemsystem/items/floor.lua | 3 +- gamemode/itemsystem/items/floorhalf.lua | 3 +- gamemode/itemsystem/items/infuser.lua | 2 + gamemode/itemsystem/items/juice.lua | 3 +- gamemode/itemsystem/items/knife.lua | 11 ++-- gamemode/itemsystem/items/log.lua | 3 +- gamemode/itemsystem/items/magicwood.lua | 2 + gamemode/itemsystem/items/maul.lua | 10 ++-- gamemode/itemsystem/items/meat.lua | 7 +-- gamemode/itemsystem/items/mortarandpestle.lua | 3 +- gamemode/itemsystem/items/pickaxe.lua | 13 ++--- gamemode/itemsystem/items/pitch.lua | 3 +- gamemode/itemsystem/items/plank.lua | 5 +- gamemode/itemsystem/items/ramp.lua | 3 +- gamemode/itemsystem/items/ramphalf.lua | 3 +- gamemode/itemsystem/items/recipe_battleaxe.lua | 13 ++--- gamemode/itemsystem/items/recipe_crystalhammer.lua | 13 ++--- gamemode/itemsystem/items/recipe_diamondhammer.lua | 13 ++--- gamemode/itemsystem/items/recipe_maul.lua | 13 ++--- gamemode/itemsystem/items/recipe_shack.lua | 13 ++--- gamemode/itemsystem/items/recipe_stoneblock.lua | 13 ++--- gamemode/itemsystem/items/recipe_tent.lua | 13 ++--- gamemode/itemsystem/items/researchtable.lua | 2 + gamemode/itemsystem/items/rock.lua | 17 +++--- gamemode/itemsystem/items/rope.lua | 3 +- gamemode/itemsystem/items/runeblank.lua | 3 +- gamemode/itemsystem/items/runeblink.lua | 3 +- gamemode/itemsystem/items/runeenergy.lua | 3 +- gamemode/itemsystem/items/runeexplosive.lua | 3 +- gamemode/itemsystem/items/runefeatherfall.lua | 3 +- gamemode/itemsystem/items/runefire.lua | 3 +- gamemode/itemsystem/items/runemagic.lua | 3 +- gamemode/itemsystem/items/runenature.lua | 3 +- gamemode/itemsystem/items/sap.lua | 3 +- gamemode/itemsystem/items/shack.lua | 3 +- gamemode/itemsystem/items/sickle.lua | 11 ++-- gamemode/itemsystem/items/spell_fireball.lua | 3 +- gamemode/itemsystem/items/spell_teleport.lua | 3 +- gamemode/itemsystem/items/stoneblock.lua | 3 +- gamemode/itemsystem/items/sword.lua | 3 +- gamemode/itemsystem/items/tent.lua | 3 +- gamemode/itemsystem/items/vine.lua | 3 +- gamemode/itemsystem/items/wood.lua | 3 +- gamemode/itemsystem/loaditems.lua | 62 ++++------------------ gamemode/shared.lua | 1 + wintersurvival2.txt | 42 --------------- wintersurvival_ex.txt | 10 ++++ 80 files changed, 274 insertions(+), 322 deletions(-) delete mode 100644 doc/gmodserver.txt delete mode 100644 doc/notes.txt delete mode 100644 wintersurvival2.txt create mode 100644 wintersurvival_ex.txt diff --git a/doc/gmodserver.txt b/doc/gmodserver.txt deleted file mode 100644 index 8d45710..0000000 --- a/doc/gmodserver.txt +++ /dev/null @@ -1,27 +0,0 @@ -There's lots of stuff that is modified on this server, I will briefly explain the gist of the changes - -My test server, Alec's Otherwise, is running on a Debian Linux server. Instructions for installing gmod dedicated server on linux can be found here: -http://wiki.garrysmod.com/page/Linux_Dedicated_Server_Hosting -There is a saved version of the webpage (saved 1/1/2016) in -wintersurvival2/to-do/notes-resource/Linux Dedicated Server Hosting - Garry's Mod.htm - -using the fallowing starting script: -located at /home/steam/server_1/run_server.sh ----------------------------run_server.sh---------------------------------------- - -#update the server with the code from queue branch -cd garrysmod/gamemodes/wintersurvival2/ -sudo git checkout master -sudo git merge queue -cd ../../../ - -#run the gmod server -./srcds_run -game garrysmod -disableluarefresh +maxplayers 28 +map ws_abandon_night +gamemode wintersurvival2 - ------------------------end run_server.sh---------------------------------------- - -As the script might suggest, gamemodes/wintersurvival2 is a git directory that is symlinked to another user's directory that I use to manage all the git directories. - -Additionally, this server will not automatically refresh lua code (doing so breaks the gamemode slightly) so that I can checkout and merge code while the server is running. (this can be reset by remove the -disableluarefresh flag) - -as an additional note, I usually run the script from a tmux session, so that I can log in remotely later and still attach to the tmux session diff --git a/doc/notes.txt b/doc/notes.txt deleted file mode 100644 index c186101..0000000 --- a/doc/notes.txt +++ /dev/null @@ -1,30 +0,0 @@ -There's lots of stuff that is modified on this server, I will briefly explain the gist of the changes - -My test server, Alec's Otherwise, is running on a Debian Linux server. Instructions for installing gmod dedicated server on linux can be found here: -http://wiki.garrysmod.com/page/Linux_Dedicated_Server_Hosting -There is a saved version of the webpage (saved 1/1/2016) in -wintersurvival2/to-do/notes-resource/Linux Dedicated Server Hosting - Garry's Mod.htm - -I have downloaded the following packages for the server: - - -using the fallowing starting script: - ----------------------------run_server.sh---------------------------------------- - -#update the server with the code from queue branch -cd garrysmod/gamemodes/wintersurvival2/ -sudo git checkout master -sudo git merge queue -cd ../../../ - -#run the gmod server -./srcds_run -game garrysmod -disableluarefresh +maxplayers 28 +map ws_abandon_night +gamemode wintersurvival2 - ------------------------end run_server.sh---------------------------------------- - -As the script might suggest, gamemodes/wintersurvival2 is a git directory that is symlinked to another user's directory that I use to manage all the git directories. - -Additionally, this server will not automatically refresh lua code (doing so breaks the gamemode slightly) so that I can checkout and merge code while the server is running. (this can be reset by remove the -disableluarefresh flag) - -as an additional note, I usually run the script from a tmux session, so that I can log in remotely later and still attach to the tmux session diff --git a/entities/entities/ws_projectile/shared.lua b/entities/entities/ws_projectile/shared.lua index 039a216..7876a27 100644 --- a/entities/entities/ws_projectile/shared.lua +++ b/entities/entities/ws_projectile/shared.lua @@ -6,5 +6,5 @@ end function ENT:PhysicsCollide(data, phys) print("We're collideing!") - if(self.onhit) then self:onhit(self,data,phys) end + if(self.onhit) then self:onhit(data,phys) end end diff --git a/gamemode/init.lua b/gamemode/init.lua index 1515aac..38e49a9 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -50,7 +50,11 @@ end function GM:PlayerInitialSpawn(pl) if (!self.CountDown and #player.GetAll() > 1) then self:StartCountDown() end - pl:SetHuman(false) + if(#GetAllHumans() == 1) then + pl:SetHuman(true) + else + pl:SetHuman(false) + end end function GM:PlayerSpawn(pl) diff --git a/gamemode/itemsystem/items/alter.lua b/gamemode/itemsystem/items/alter.lua index c661ebb..e9c5f95 100644 --- a/gamemode/itemsystem/items/alter.lua +++ b/gamemode/itemsystem/items/alter.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Alter" ITEM.Class = "structure" ITEM.Desc = "This allows you to sacrifice your soul for a player.\nHold down shift to snap" @@ -73,3 +73,5 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end + +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/ancientlog.lua b/gamemode/itemsystem/items/ancientlog.lua index 2948d08..5d1e0d7 100644 --- a/gamemode/itemsystem/items/ancientlog.lua +++ b/gamemode/itemsystem/items/ancientlog.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Ancient Log" ITEM.Class = "resource" ITEM.Desc = "Powerful wood." @@ -15,3 +15,4 @@ ITEM.Recipe = { ["Crystal Hammer"] = 1, }, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/ancientwood.lua b/gamemode/itemsystem/items/ancientwood.lua index 8f38c17..616ac57 100644 --- a/gamemode/itemsystem/items/ancientwood.lua +++ b/gamemode/itemsystem/items/ancientwood.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Ancient Wood" ITEM.Class = "weapon" ITEM.Desc = "A stronger type of wood.\nUsed for advanced equipment." @@ -21,15 +21,15 @@ 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 @@ -48,13 +48,12 @@ 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 - - +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/arrow.lua b/gamemode/itemsystem/items/arrow.lua index 30047d8..ef6f6a3 100644 --- a/gamemode/itemsystem/items/arrow.lua +++ b/gamemode/itemsystem/items/arrow.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Arrow" ITEM.Class = "ammo" ITEM.Desc = "An arrow, used for bows." @@ -23,3 +23,4 @@ ITEM.Recipe = { }, Tools = {}, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/axe.lua b/gamemode/itemsystem/items/axe.lua index b5d2063..cb5e5f1 100644 --- a/gamemode/itemsystem/items/axe.lua +++ b/gamemode/itemsystem/items/axe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Axe" ITEM.Class = "weapon" ITEM.Desc = "A primitive axe held together with sap." @@ -39,20 +39,20 @@ 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)) @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/barrel.lua b/gamemode/itemsystem/items/barrel.lua index 6f99d7e..939ea06 100644 --- a/gamemode/itemsystem/items/barrel.lua +++ b/gamemode/itemsystem/items/barrel.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Barrel" ITEM.Class = "structure" ITEM.Desc = "Barrel for storage of items." @@ -56,3 +56,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/base.lua b/gamemode/itemsystem/items/base.lua index a3b6b31..de04739 100644 --- a/gamemode/itemsystem/items/base.lua +++ b/gamemode/itemsystem/items/base.lua @@ -1,3 +1,4 @@ +local ITEM = {} 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" @@ -15,7 +16,7 @@ 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. +--These are just here to tell the editors/developers what functions are available.. dont un-comment them out, as this could affect all the items. /* function ITEM:OnPrimary(user,tr) end @@ -35,3 +36,5 @@ end function ITEM:OnCraft(player) end */ + +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/battleaxe.lua b/gamemode/itemsystem/items/battleaxe.lua index 96b3cf6..70223c4 100644 --- a/gamemode/itemsystem/items/battleaxe.lua +++ b/gamemode/itemsystem/items/battleaxe.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = [[Battle Axe]] ITEM.Desc = [[The vikings once used these]] ITEM.Model = [[models/props_junk/Rock001a.mdl]] @@ -42,15 +43,15 @@ 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 @@ -62,4 +63,5 @@ function ITEM:OnPrimary(pl,tr) else pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(60,80)) end -end \ No newline at end of file +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua index 90ec4c4..c03d395 100644 --- a/gamemode/itemsystem/items/berry.lua +++ b/gamemode/itemsystem/items/berry.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Berry" ITEM.Class = "food" ITEM.Desc = "Berries..." @@ -17,8 +17,9 @@ ITEM.Structure = { 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/bow.lua b/gamemode/itemsystem/items/bow.lua index 4a7f203..ed82229 100644 --- a/gamemode/itemsystem/items/bow.lua +++ b/gamemode/itemsystem/items/bow.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Bow" ITEM.Class = "weapon" ITEM.Desc = "A primitive bow made from vine, sap, and wood." @@ -80,3 +80,4 @@ function ITEM:OnPrimary(pl,tr) pl:RemoveItem("Arrow",1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/campfire.lua b/gamemode/itemsystem/items/campfire.lua index 5295552..2a39a84 100644 --- a/gamemode/itemsystem/items/campfire.lua +++ b/gamemode/itemsystem/items/campfire.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Campfire" ITEM.Class = "structure" ITEM.Desc = "Ready to be lit. Some assembly required.\nHold down shift to snap" @@ -89,3 +89,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/charcoal.lua b/gamemode/itemsystem/items/charcoal.lua index ed5e900..c716e06 100644 --- a/gamemode/itemsystem/items/charcoal.lua +++ b/gamemode/itemsystem/items/charcoal.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = "Charcoal" ITEM.Class = "resource" ITEM.Desc = "A hunk of carbon" @@ -8,3 +9,4 @@ ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_coal.png") function ITEM:OnCooked(campfire) campfire:Ignite(1000) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/chitin.lua b/gamemode/itemsystem/items/chitin.lua index 3ae082e..34417f5 100644 --- a/gamemode/itemsystem/items/chitin.lua +++ b/gamemode/itemsystem/items/chitin.lua @@ -1,5 +1,7 @@ +local ITEM = {} ITEM.Name = "Chitin" ITEM.Class = "resource" ITEM.Desc = "Some hard outer-skeleton" ITEM.Model = "models/props_junk/Rock001a.mdl" ITEM.Icon = Material("wintersurvival2/hud/ws2_icons/icon_chitin.png") +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/cookedmeat.lua b/gamemode/itemsystem/items/cookedmeat.lua index b8b1999..c1565fa 100644 --- a/gamemode/itemsystem/items/cookedmeat.lua +++ b/gamemode/itemsystem/items/cookedmeat.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Cooked Meat" ITEM.Class = "food" ITEM.Desc = "Delicious... and prepared!" @@ -22,3 +22,4 @@ function ITEM:OnUse(user) user:AddHunger(-90) user:RemoveItem(self.Name,1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/crystal.lua b/gamemode/itemsystem/items/crystal.lua index ef9c12e..72d08d8 100644 --- a/gamemode/itemsystem/items/crystal.lua +++ b/gamemode/itemsystem/items/crystal.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Crystal" ITEM.Class = "resource" ITEM.Desc = "A noteworthy stone." @@ -14,4 +14,4 @@ ITEM.Structure = { Ang = Angle(0,0,0), }, } - +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/crystalaxe.lua b/gamemode/itemsystem/items/crystalaxe.lua index c9acf71..2417c0e 100644 --- a/gamemode/itemsystem/items/crystalaxe.lua +++ b/gamemode/itemsystem/items/crystalaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Crystal Axe" ITEM.Class = "weapon" ITEM.Desc = "A more advanced axe made from crystals." @@ -42,21 +42,21 @@ 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)) @@ -68,3 +68,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/crystalhammer.lua b/gamemode/itemsystem/items/crystalhammer.lua index 4348d0f..9c1007a 100644 --- a/gamemode/itemsystem/items/crystalhammer.lua +++ b/gamemode/itemsystem/items/crystalhammer.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Crystal Hammer" ITEM.Class = "resource" ITEM.Desc = "A tool used for crystal equipment" @@ -22,3 +22,4 @@ ITEM.Recipe = { }, Tools = {}, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/crystalpickaxe.lua b/gamemode/itemsystem/items/crystalpickaxe.lua index 8c981e1..7e3f127 100644 --- a/gamemode/itemsystem/items/crystalpickaxe.lua +++ b/gamemode/itemsystem/items/crystalpickaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Crystal Pickaxe" ITEM.Class = "weapon" ITEM.Desc = "An advanced crystal pickaxe. More efficient than an ordinary pickaxe." @@ -12,7 +12,7 @@ ITEM.Structure = { 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", @@ -42,15 +42,15 @@ 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 @@ -58,7 +58,7 @@ function ITEM:OnPrimary(pl,tr) 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)) @@ -70,3 +70,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/crystalsickle.lua b/gamemode/itemsystem/items/crystalsickle.lua index 1753a2a..6d4e4d3 100644 --- a/gamemode/itemsystem/items/crystalsickle.lua +++ b/gamemode/itemsystem/items/crystalsickle.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Crystal Sickle" ITEM.Class = "weapon" ITEM.Desc = "A sickle. Used for bushes for vines and berries" @@ -42,21 +42,21 @@ 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)) @@ -68,3 +68,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/cup.lua b/gamemode/itemsystem/items/cup.lua index 92e2a7e..cbcf7e7 100644 --- a/gamemode/itemsystem/items/cup.lua +++ b/gamemode/itemsystem/items/cup.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Cup" ITEM.Class = "resource" ITEM.Desc = "It could hold some liquid" @@ -18,3 +18,4 @@ ITEM.Recipe = { function ITEM:OnPrimary() end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/diamond.lua b/gamemode/itemsystem/items/diamond.lua index d491638..0065397 100644 --- a/gamemode/itemsystem/items/diamond.lua +++ b/gamemode/itemsystem/items/diamond.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Diamond" ITEM.Class = "resource" ITEM.Desc = "A very powerful resource for use with more advanced equipment." @@ -14,4 +14,4 @@ ITEM.Structure = { Ang = Angle(0,0,0), }, } - +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/diamondaxe.lua b/gamemode/itemsystem/items/diamondaxe.lua index 9edc6e4..a8cf79a 100644 --- a/gamemode/itemsystem/items/diamondaxe.lua +++ b/gamemode/itemsystem/items/diamondaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Diamond Axe" ITEM.Class = "weapon" ITEM.Desc = "An axe made from diamonds and ancient wood." @@ -68,3 +68,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/diamondhammer.lua b/gamemode/itemsystem/items/diamondhammer.lua index 56cab21..91b3eb0 100644 --- a/gamemode/itemsystem/items/diamondhammer.lua +++ b/gamemode/itemsystem/items/diamondhammer.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Diamond Hammer" ITEM.Class = "resource" ITEM.Desc = "A tool used for diamond equipment" @@ -26,3 +26,4 @@ ITEM.Recipe = { ["Crystal Hammer"] = 1, }, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/diamondpickaxe.lua b/gamemode/itemsystem/items/diamondpickaxe.lua index f0599a3..d38ad31 100644 --- a/gamemode/itemsystem/items/diamondpickaxe.lua +++ b/gamemode/itemsystem/items/diamondpickaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Diamond Pickaxe" ITEM.Class = "weapon" ITEM.Desc = "An advanced pickaxe. Made from ancient wood and diamonds." @@ -12,7 +12,7 @@ ITEM.Structure = { 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", @@ -42,15 +42,15 @@ 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 @@ -58,7 +58,7 @@ function ITEM:OnPrimary(pl,tr) 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)) @@ -70,3 +70,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/diamondsickle.lua b/gamemode/itemsystem/items/diamondsickle.lua index 0fd2688..37afc99 100644 --- a/gamemode/itemsystem/items/diamondsickle.lua +++ b/gamemode/itemsystem/items/diamondsickle.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Diamond Sickle" ITEM.Class = "weapon" ITEM.Desc = "A sickle made from ancient wood and diamonds" @@ -42,21 +42,21 @@ 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)) @@ -68,3 +68,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/feather.lua b/gamemode/itemsystem/items/feather.lua index d53acc8..02eda1f 100644 --- a/gamemode/itemsystem/items/feather.lua +++ b/gamemode/itemsystem/items/feather.lua @@ -1,6 +1,7 @@ - +local ITEM = {} 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") +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/fence.lua b/gamemode/itemsystem/items/fence.lua index 2d767d4..94c9bd9 100644 --- a/gamemode/itemsystem/items/fence.lua +++ b/gamemode/itemsystem/items/fence.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Fence" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -63,3 +63,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/fencehalf.lua b/gamemode/itemsystem/items/fencehalf.lua index f121292..0776ab5 100644 --- a/gamemode/itemsystem/items/fencehalf.lua +++ b/gamemode/itemsystem/items/fencehalf.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Half Fence" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/flint.lua b/gamemode/itemsystem/items/flint.lua index 63fd085..aa16f7f 100644 --- a/gamemode/itemsystem/items/flint.lua +++ b/gamemode/itemsystem/items/flint.lua @@ -1,6 +1,7 @@ - +local ITEM = {} 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") +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/floor.lua b/gamemode/itemsystem/items/floor.lua index bef9ad4..9f1d6ac 100644 --- a/gamemode/itemsystem/items/floor.lua +++ b/gamemode/itemsystem/items/floor.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Floor" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/floorhalf.lua b/gamemode/itemsystem/items/floorhalf.lua index 9a43cc2..7caf0d9 100644 --- a/gamemode/itemsystem/items/floorhalf.lua +++ b/gamemode/itemsystem/items/floorhalf.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Half Floor" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/infuser.lua b/gamemode/itemsystem/items/infuser.lua index 53aedf7..54a549e 100644 --- a/gamemode/itemsystem/items/infuser.lua +++ b/gamemode/itemsystem/items/infuser.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = "Infuser" ITEM.Class = "structure" ITEM.Desc = "Cast enchantments\nPlace runes nearby to boost magical power and have different effects\nHold down shift to snap" @@ -63,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/juice.lua b/gamemode/itemsystem/items/juice.lua index b9de641..db27938 100644 --- a/gamemode/itemsystem/items/juice.lua +++ b/gamemode/itemsystem/items/juice.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Juice" ITEM.Class = "food" ITEM.Desc = "Restores some thirst." @@ -20,3 +20,4 @@ function ITEM:OnUse(user) user:RemoveItem(self.Name,1) user:AddItem(GetItemByName("Cup")) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/knife.lua b/gamemode/itemsystem/items/knife.lua index 63959ce..f41d82a 100644 --- a/gamemode/itemsystem/items/knife.lua +++ b/gamemode/itemsystem/items/knife.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Knife" ITEM.Class = "weapon" ITEM.Desc = "A knife, what do u expect?" @@ -33,20 +33,20 @@ 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)) @@ -58,3 +58,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/log.lua b/gamemode/itemsystem/items/log.lua index 07b8352..5d058c9 100644 --- a/gamemode/itemsystem/items/log.lua +++ b/gamemode/itemsystem/items/log.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Log" ITEM.Class = "resource" ITEM.Desc = "Bigger wood." @@ -13,3 +13,4 @@ ITEM.Recipe = { }, Tools = {}, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/magicwood.lua b/gamemode/itemsystem/items/magicwood.lua index a871c72..660462a 100644 --- a/gamemode/itemsystem/items/magicwood.lua +++ b/gamemode/itemsystem/items/magicwood.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = "Magic Wood" ITEM.Class = "weapon" ITEM.Desc = "Some magically infused wood" @@ -55,3 +56,4 @@ function ITEM:OnSecondary(pl, tr) pl:RemoveItem(self.Name, 1) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"), 100, math.random(40, 60)) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/maul.lua b/gamemode/itemsystem/items/maul.lua index 2189eef..2c2e6fe 100644 --- a/gamemode/itemsystem/items/maul.lua +++ b/gamemode/itemsystem/items/maul.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = [[Maul]] ITEM.Desc = [[The ultimate nutcracker!]] ITEM.Model = [[models/props_debris/wood_board02a.mdl]] @@ -35,15 +36,15 @@ 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 @@ -55,4 +56,5 @@ function ITEM:OnPrimary(pl,tr) else pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(50,60)) end -end \ No newline at end of file +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/meat.lua b/gamemode/itemsystem/items/meat.lua index d26d3c1..907e2d1 100644 --- a/gamemode/itemsystem/items/meat.lua +++ b/gamemode/itemsystem/items/meat.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Meat" ITEM.Class = "food" ITEM.Desc = "Delicious..." @@ -17,7 +17,7 @@ ITEM.Structure = { 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) @@ -25,4 +25,5 @@ end function ITEM:OnCooked(campfire) campfire:AddItem("Cooked Meat",1) -end \ No newline at end of file +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/mortarandpestle.lua b/gamemode/itemsystem/items/mortarandpestle.lua index 42b1baa..6fcdcb4 100644 --- a/gamemode/itemsystem/items/mortarandpestle.lua +++ b/gamemode/itemsystem/items/mortarandpestle.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Mortar and Pestle" ITEM.Class = "tool" ITEM.Desc = "Something to grind things down in" @@ -18,3 +18,4 @@ ITEM.Recipe = { function ITEM:OnPrimary() end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/pickaxe.lua b/gamemode/itemsystem/items/pickaxe.lua index 2032d12..44a44dc 100644 --- a/gamemode/itemsystem/items/pickaxe.lua +++ b/gamemode/itemsystem/items/pickaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Pickaxe" ITEM.Class = "weapon" ITEM.Desc = "A primitive axe held together with sap." @@ -12,7 +12,7 @@ ITEM.Structure = { 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", @@ -39,22 +39,22 @@ 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)) @@ -66,3 +66,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/pitch.lua b/gamemode/itemsystem/items/pitch.lua index 40c2a57..6863e20 100644 --- a/gamemode/itemsystem/items/pitch.lua +++ b/gamemode/itemsystem/items/pitch.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Pitch" ITEM.Class = "resource" ITEM.Desc = "A sticky stubstance, probably flamable" @@ -23,3 +23,4 @@ end function ITEM:OnCooked(campfire) campfire:Ignite(500) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/plank.lua b/gamemode/itemsystem/items/plank.lua index 5726434..8c46311 100644 --- a/gamemode/itemsystem/items/plank.lua +++ b/gamemode/itemsystem/items/plank.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Plank" ITEM.Class = "resource" ITEM.Desc = "Advanced wood material." @@ -22,4 +22,5 @@ ITEM.Structure = { Pos = Vector(4,-3,-1), Ang = Angle(0,0,0), }, -} \ No newline at end of file +} +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/ramp.lua b/gamemode/itemsystem/items/ramp.lua index 1b4a29f..8506317 100644 --- a/gamemode/itemsystem/items/ramp.lua +++ b/gamemode/itemsystem/items/ramp.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Ramp" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/ramphalf.lua b/gamemode/itemsystem/items/ramphalf.lua index 1673834..3819c8c 100644 --- a/gamemode/itemsystem/items/ramphalf.lua +++ b/gamemode/itemsystem/items/ramphalf.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Half Ramp" ITEM.Class = "structure" ITEM.Desc = "Some basic wood structure for setting up camps.\nHold down shift to snap" @@ -64,3 +64,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_battleaxe.lua b/gamemode/itemsystem/items/recipe_battleaxe.lua index 2ae7c9b..406ea1d 100644 --- a/gamemode/itemsystem/items/recipe_battleaxe.lua +++ b/gamemode/itemsystem/items/recipe_battleaxe.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Battle Axe" ITEM.Class = "account" ITEM.Desc = "A recipe. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_crystalhammer.lua b/gamemode/itemsystem/items/recipe_crystalhammer.lua index 097aa1a..c5ad6b7 100644 --- a/gamemode/itemsystem/items/recipe_crystalhammer.lua +++ b/gamemode/itemsystem/items/recipe_crystalhammer.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Crystal Hammer" ITEM.Class = "account" ITEM.Desc = "A recipe. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_diamondhammer.lua b/gamemode/itemsystem/items/recipe_diamondhammer.lua index aab1a74..d73703b 100644 --- a/gamemode/itemsystem/items/recipe_diamondhammer.lua +++ b/gamemode/itemsystem/items/recipe_diamondhammer.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Diamond Hammer" ITEM.Class = "account" ITEM.Desc = "A recipe. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_maul.lua b/gamemode/itemsystem/items/recipe_maul.lua index 04c78f1..351b57e 100644 --- a/gamemode/itemsystem/items/recipe_maul.lua +++ b/gamemode/itemsystem/items/recipe_maul.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Maul" ITEM.Class = "account" ITEM.Desc = "A recipe. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_shack.lua b/gamemode/itemsystem/items/recipe_shack.lua index 060fccb..465b65c 100644 --- a/gamemode/itemsystem/items/recipe_shack.lua +++ b/gamemode/itemsystem/items/recipe_shack.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Shack" ITEM.Class = "account" ITEM.Desc = "A recipe for the shack. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_stoneblock.lua b/gamemode/itemsystem/items/recipe_stoneblock.lua index ba1447d..9119592 100644 --- a/gamemode/itemsystem/items/recipe_stoneblock.lua +++ b/gamemode/itemsystem/items/recipe_stoneblock.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Stoneblock" ITEM.Class = "account" ITEM.Desc = "A recipe. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/recipe_tent.lua b/gamemode/itemsystem/items/recipe_tent.lua index fd810af..eee94eb 100644 --- a/gamemode/itemsystem/items/recipe_tent.lua +++ b/gamemode/itemsystem/items/recipe_tent.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Recipe: Tent" ITEM.Class = "account" ITEM.Desc = "A recipe for the tent. Use it to print it on chat!" @@ -7,21 +7,22 @@ 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 +end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/researchtable.lua b/gamemode/itemsystem/items/researchtable.lua index 25c8201..b3a6b0f 100644 --- a/gamemode/itemsystem/items/researchtable.lua +++ b/gamemode/itemsystem/items/researchtable.lua @@ -1,3 +1,4 @@ +local ITEM = {} ITEM.Name = "Research Table" ITEM.Class = "structure" ITEM.Desc = "A table to find recepies\nHold down shift to snap" @@ -61,3 +62,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/rock.lua b/gamemode/itemsystem/items/rock.lua index 5ee7e09..ee41e40 100644 --- a/gamemode/itemsystem/items/rock.lua +++ b/gamemode/itemsystem/items/rock.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Rock" ITEM.Class = "weapon" ITEM.Desc = "A rock.\nIt is somewhat jagged." @@ -21,20 +21,20 @@ 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)) @@ -50,11 +50,12 @@ 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 +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/rope.lua b/gamemode/itemsystem/items/rope.lua index 9872d0f..2fd7e09 100644 --- a/gamemode/itemsystem/items/rope.lua +++ b/gamemode/itemsystem/items/rope.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Rope" ITEM.Class = "resource" ITEM.Desc = "Handy rope for more advanced structures and tools." @@ -12,3 +12,4 @@ ITEM.Recipe = { }, Tools = {}, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runeblank.lua b/gamemode/itemsystem/items/runeblank.lua index c5da275..e6c7af6 100644 --- a/gamemode/itemsystem/items/runeblank.lua +++ b/gamemode/itemsystem/items/runeblank.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Blank Rune" ITEM.Class = "resource" ITEM.Desc = "A blank peice of stone" @@ -32,3 +32,4 @@ ITEM.CD = 1 function ITEM:OnEnchanted(enchanttable, nearbyrunes) enchanttable:AddItem("Magic Rune", 1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runeblink.lua b/gamemode/itemsystem/items/runeblink.lua index c1c2694..00d7b06 100644 --- a/gamemode/itemsystem/items/runeblink.lua +++ b/gamemode/itemsystem/items/runeblink.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Blink Rune" ITEM.Class = "resource" ITEM.Desc = "Jump Forward a little" @@ -52,3 +52,4 @@ function ITEM:OnUse(user) --local adjustedlen = math.min(250,edist) user:RemoveItem(self.Name,1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runeenergy.lua b/gamemode/itemsystem/items/runeenergy.lua index 9230984..a19880e 100644 --- a/gamemode/itemsystem/items/runeenergy.lua +++ b/gamemode/itemsystem/items/runeenergy.lua @@ -1,4 +1,4 @@ - +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" @@ -47,3 +47,4 @@ end function ITEM:OnCraft(ply) ply:AddFatigue(25) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runeexplosive.lua b/gamemode/itemsystem/items/runeexplosive.lua index 4e7436c..6d54143 100644 --- a/gamemode/itemsystem/items/runeexplosive.lua +++ b/gamemode/itemsystem/items/runeexplosive.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Explosive Rune" ITEM.Class = "resource" ITEM.Desc = "A highly volitile rune! Handle with care." @@ -57,3 +57,4 @@ function ITEM:OnUse(user) exp:Fire("Explode","",0) exp:Spawn() end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runefeatherfall.lua b/gamemode/itemsystem/items/runefeatherfall.lua index c42b120..ebecbed 100644 --- a/gamemode/itemsystem/items/runefeatherfall.lua +++ b/gamemode/itemsystem/items/runefeatherfall.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Feather-fall Rune" ITEM.Class = "resource" ITEM.Desc = "A rune that's lighter than air.\nCancels fall dammage" @@ -32,3 +32,4 @@ ITEM.CD = 1 function ITEM:OnCraft(ply) ply:AddFatigue(25) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runefire.lua b/gamemode/itemsystem/items/runefire.lua index b71e7cc..ade81d3 100644 --- a/gamemode/itemsystem/items/runefire.lua +++ b/gamemode/itemsystem/items/runefire.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Fire Rune" ITEM.Class = "resource" ITEM.Desc = "A perpetually warm stone" @@ -49,3 +49,4 @@ function ITEM:OnPrimary(ply,tr) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runemagic.lua b/gamemode/itemsystem/items/runemagic.lua index ed86e26..e08e9ff 100644 --- a/gamemode/itemsystem/items/runemagic.lua +++ b/gamemode/itemsystem/items/runemagic.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Magic Rune" ITEM.Class = "resource" ITEM.Desc = "A stone infused with magic" @@ -19,3 +19,4 @@ ITEM.Structure = { ITEM.Damage = 1 ITEM.Range = 64 ITEM.CD = 1 +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/runenature.lua b/gamemode/itemsystem/items/runenature.lua index c528fc0..f2327b4 100644 --- a/gamemode/itemsystem/items/runenature.lua +++ b/gamemode/itemsystem/items/runenature.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Nature Rune" ITEM.Class = "resource" ITEM.Desc = "A blank peice of stone" @@ -38,3 +38,4 @@ function ITEM:OnUse(user) user:AddFatigue(10) user:RemoveItem(self.Name,1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/sap.lua b/gamemode/itemsystem/items/sap.lua index 18ff486..62aa381 100644 --- a/gamemode/itemsystem/items/sap.lua +++ b/gamemode/itemsystem/items/sap.lua @@ -1,6 +1,7 @@ - +local ITEM = {} 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") +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/shack.lua b/gamemode/itemsystem/items/shack.lua index 96790d6..29eca83 100644 --- a/gamemode/itemsystem/items/shack.lua +++ b/gamemode/itemsystem/items/shack.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Shack" ITEM.Class = "structure" ITEM.Desc = "An actual building... how convenient.\nHold down shift to snap" @@ -116,3 +116,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/sickle.lua b/gamemode/itemsystem/items/sickle.lua index 4703655..9a634bd 100644 --- a/gamemode/itemsystem/items/sickle.lua +++ b/gamemode/itemsystem/items/sickle.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Sickle" ITEM.Class = "weapon" ITEM.Desc = "A sickle. Used for bushes for vines and berries" @@ -39,21 +39,21 @@ 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)) @@ -65,3 +65,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/spell_fireball.lua b/gamemode/itemsystem/items/spell_fireball.lua index 481fd2f..14bca66 100644 --- a/gamemode/itemsystem/items/spell_fireball.lua +++ b/gamemode/itemsystem/items/spell_fireball.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Fireball" ITEM.Class = "weapon" ITEM.Desc = "Warning: Warm" @@ -102,3 +102,4 @@ function ITEM:OnPrimary(pl,tr) print("Attempting to cast...") pl:Cast("Fireball",fireballfunc,self) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/spell_teleport.lua b/gamemode/itemsystem/items/spell_teleport.lua index 9c31f25..38bbac6 100644 --- a/gamemode/itemsystem/items/spell_teleport.lua +++ b/gamemode/itemsystem/items/spell_teleport.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Teleport" ITEM.Class = "weapon" ITEM.Desc = "Right click to set target location, left click to open a portal there." @@ -79,3 +79,4 @@ function ITEM:OnPrimary(pl,tr) print("Attempting to cast...") pl:Cast("Gateway",teleportfunc,self) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/stoneblock.lua b/gamemode/itemsystem/items/stoneblock.lua index 36f1c35..aa1fd39 100644 --- a/gamemode/itemsystem/items/stoneblock.lua +++ b/gamemode/itemsystem/items/stoneblock.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Stoneblock" ITEM.Class = "resource" ITEM.Desc = "A useful building material." @@ -12,3 +12,4 @@ ITEM.Recipe = { }, Tools = {}, } +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/sword.lua b/gamemode/itemsystem/items/sword.lua index 0da38c3..6dc6787 100644 --- a/gamemode/itemsystem/items/sword.lua +++ b/gamemode/itemsystem/items/sword.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Sword" ITEM.Class = "weapon" ITEM.Desc = "A sword for combat." @@ -56,3 +56,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/tent.lua b/gamemode/itemsystem/items/tent.lua index 2c65eca..0df60d0 100644 --- a/gamemode/itemsystem/items/tent.lua +++ b/gamemode/itemsystem/items/tent.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Tent" ITEM.Class = "structure" ITEM.Desc = "Something to duck under.\nHold down shift to snap" @@ -83,3 +83,4 @@ function ITEM:OnPrimary(pl,tr) pl:EmitSound(Sound("weapons/iceaxe/iceaxe_swing1.wav"),100,math.random(90,110)) end end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/vine.lua b/gamemode/itemsystem/items/vine.lua index beeb5d4..8cf15a8 100644 --- a/gamemode/itemsystem/items/vine.lua +++ b/gamemode/itemsystem/items/vine.lua @@ -1,6 +1,7 @@ - +local ITEM = {} 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") +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/items/wood.lua b/gamemode/itemsystem/items/wood.lua index 9d2d976..034eaa2 100644 --- a/gamemode/itemsystem/items/wood.lua +++ b/gamemode/itemsystem/items/wood.lua @@ -1,4 +1,4 @@ - +local ITEM = {} ITEM.Name = "Wood" ITEM.Class = "weapon" ITEM.Desc = "Lumber. Maybe timber." @@ -64,3 +64,4 @@ end function ITEM:OnEnchanted(enchanttable, runes) enchanttable:AddItem("Magic Wood", 1) end +RegisterItem(ITEM) diff --git a/gamemode/itemsystem/loaditems.lua b/gamemode/itemsystem/loaditems.lua index a593e0d..6d42f87 100644 --- a/gamemode/itemsystem/loaditems.lua +++ b/gamemode/itemsystem/loaditems.lua @@ -1,62 +1,20 @@ local Folder = GM.Folder:gsub("gamemodes/","").."/gamemode/itemsystem/items" local insert = table.insert +print("Hello from loaditems.lua!") -function GM:LoadItems() - local Items = file.Find(Folder.."/*.lua","LUA") - local BaseItem = {} +--This is so that the client can store info about items/recepies too. +local gmitems = GAMEMODE.Items or {} +local gmrecepies = GAMEMODE.Recipes or {} - 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 +function RegisterItem(tbl) + assert(gmitems[tbl] == nil, "Cannot register 2 items with the same name!") + insert(gmitems,tbl) + if tbl.Recipe then + insert(gmrecepies,tbl) end + print("Registered item:", tbl.Name) 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 diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 81b1232..22905c9 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -6,6 +6,7 @@ AddLuaCSFolder("hud/games") AddLuaSHFolder("shared") AddLuaSHFolder("itemsystem") +AddLuaSHFolder("itemsystem/items") AddLuaSHFolder("npcsystem") AddLuaSVFolder("server") diff --git a/wintersurvival2.txt b/wintersurvival2.txt deleted file mode 100644 index 656b92e..0000000 --- a/wintersurvival2.txt +++ /dev/null @@ -1,42 +0,0 @@ -"wintersurvival2" -{ - "base" "gearfox" - "title" "Winter Survival 2 - Anarchy" - "menusystem" "1" - "maps" "^ws_|^ws2_" - "settings" - { - 1 - { - "name" "wss_regtomaster" - "text" "Register to master server" - "help" "Should this server request to be put on the master server list?" - "type" "Checkbox" - "default" "1" - } - 2 - { - "name" "wss_masterserverurl" - "text" "Master server URL" - "help" "The URL that holds the master server list" - "type" "Text" - "default" "http://cogarr.net/servers.sh" - } - 3 - { - "name" "wss_serverurlorip" - "text" "Server url" - "help" "The server's url (for dedicated servers, listen servers can ignore this)" - "type" "Text" - "default" "127.0.0.1" - } - 4 - { - "name" "wss_serverurlport" - "text" "Server port" - "help" "The server's port (for dedicated servers, listen servers can ignore this)" - "type" "Numeric" - "default" "27015" - } - } -} diff --git a/wintersurvival_ex.txt b/wintersurvival_ex.txt new file mode 100644 index 0000000..c13da65 --- /dev/null +++ b/wintersurvival_ex.txt @@ -0,0 +1,10 @@ +"wintersurvival2" +{ + "base" "gearfox" + "title" "Winter Survival 2 Extended" + "menusystem" "1" + "maps" "^ws_|^ws2_" + "settings" + { + } +} -- cgit v1.2.3-70-g09d2