summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-25 22:06:26 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-25 22:06:26 -0400
commit4adec24c3a2a53f518d817ae8a6ddd0c4c47422c (patch)
treeadb91a867dfda05f5c2880e19d0111fb657ecb9f
parent699df0d5df4e7d00a0d2b838b8c851c9b5027cea (diff)
downloadgmstranded-4adec24c3a2a53f518d817ae8a6ddd0c4c47422c.tar.gz
gmstranded-4adec24c3a2a53f518d817ae8a6ddd0c4c47422c.tar.bz2
gmstranded-4adec24c3a2a53f518d817ae8a6ddd0c4c47422c.zip
more work on the structure system
-rw-r--r--entities/entities/gms_antlionbarrow.lua2
-rw-r--r--entities/entities/gms_base_entity.lua12
-rw-r--r--entities/entities/gms_buildsite.lua2
-rw-r--r--entities/entities/gms_copperfurnace.lua7
-rw-r--r--entities/entities/gms_generic_structure.lua47
-rw-r--r--entities/entities/gms_seed.lua2
-rw-r--r--entities/entities/gms_tree.lua2
-rw-r--r--entities/weapons/gms_wand.lua40
-rw-r--r--gamemode/cl_init.lua1
-rw-r--r--gamemode/configure_me.lua2
-rw-r--r--gamemode/init.lua18
-rw-r--r--gamemode/itemsystem/items/sprout.lua2
-rw-r--r--gamemode/server/admin_commands.lua10
-rw-r--r--gamemode/server/player_functions.lua3
-rw-r--r--gamemode/spp/sv_init.lua2
-rw-r--r--gamemode/structuresystem/common_smelt.lua83
-rw-r--r--gamemode/structuresystem/loadstructures.lua34
-rw-r--r--gamemode/structuresystem/structures/aaaStructureExample.lua22
-rw-r--r--gamemode/structuresystem/structures/stonefurnace.lua31
19 files changed, 276 insertions, 46 deletions
diff --git a/entities/entities/gms_antlionbarrow.lua b/entities/entities/gms_antlionbarrow.lua
index 9c6000d..c06aa08 100644
--- a/entities/entities/gms_antlionbarrow.lua
+++ b/entities/entities/gms_antlionbarrow.lua
@@ -10,7 +10,7 @@ ENT.DoWake = true
if ( CLIENT ) then return end
function ENT:OnInitialize()
- self:SetNetworkedString( "Owner", "World" )
+ self:SetNWString( "Owner", "World" )
self:SetMoveType( MOVETYPE_NONE )
diff --git a/entities/entities/gms_base_entity.lua b/entities/entities/gms_base_entity.lua
index 074633e..eff03cb 100644
--- a/entities/entities/gms_base_entity.lua
+++ b/entities/entities/gms_base_entity.lua
@@ -16,19 +16,19 @@ function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
-
- if ( self.Color ) then self:SetColor( self.Color ) end
- if ( self.DoWake ) then self:Wake() end
- if ( self.DoFreeze ) then self:DoFreeze() end
end
- self:OnInitialize()
+ self:onInitialize()
+end
+
+function ENT:Draw()
+ self:DrawModel()
end
function ENT:OnInitialize()
end
-if ( CLIENT ) then return end
+--if ( CLIENT ) then return end
function ENT:Use( ply )
if ( !ply:KeyPressed( IN_USE ) ) then return end
diff --git a/entities/entities/gms_buildsite.lua b/entities/entities/gms_buildsite.lua
index 919c725..a0f8199 100644
--- a/entities/entities/gms_buildsite.lua
+++ b/entities/entities/gms_buildsite.lua
@@ -28,7 +28,7 @@ function ENT:AddResource( res, int )
for k, v in pairs( self.Costs ) do
str = str .. "\n" .. string.Replace( k, "_", " " ) .. " ( " .. v .. "x )"
end
- self:SetNetworkedString( "Resources", str )
+ self:SetNWString( "Resources", str )
end
function ENT:Setup( model, class )
diff --git a/entities/entities/gms_copperfurnace.lua b/entities/entities/gms_copperfurnace.lua
index 1aaa970..3dddd48 100644
--- a/entities/entities/gms_copperfurnace.lua
+++ b/entities/entities/gms_copperfurnace.lua
@@ -8,6 +8,11 @@ ENT.Model = "models/props/cs_militia/furnace01.mdl"
if ( CLIENT ) then return end
-function ENT:OnUse( ply )
+function ENT:onUse( ply )
+ print("use called")
ply:OpenCombiMenu( "gms_copperfurnace" )
end
+
+function ENT:onInitialize()
+ print("Initalize calleD")
+end
diff --git a/entities/entities/gms_generic_structure.lua b/entities/entities/gms_generic_structure.lua
new file mode 100644
index 0000000..d76ed30
--- /dev/null
+++ b/entities/entities/gms_generic_structure.lua
@@ -0,0 +1,47 @@
+
+AddCSLuaFile()
+
+ENT.Type = "anim"
+ENT.Base = "gms_base_entity"
+
+function ENT:Initialize()
+ print("Initalize called!")
+ util.PrecacheModel(self.Model)
+ if self.Model then self:SetModel(self.Model) end
+ if self.onInitialize then self:onInitialize() end
+ if CLIENT then return end
+ self:PhysicsInit( SOLID_VPHYSICS )
+ --self:SetMoveType( MOVETYPE_VPHYSICS )
+ self:SetSolid( SOLID_VPHYSICS )
+ if SERVER then self:SetUseType(SIMPLE_USE) end
+end
+
+if (SERVER) then
+ util.AddNetworkString( "ent_use" )
+end
+function ENT:Use( ply )
+ if self.onUse != nil then
+ self.onUse(self, ply)
+ net.Start("ent_use")
+ net.WriteUInt(self:EntIndex(), GMS.NETINT_BITCOUNT)
+ net.WriteString(self.Name)
+ net.WriteUInt(ply:UserID(), GMS.NETINT_BITCOUNT)
+ net.Send(ply)
+ end
+end
+if (CLIENT) then
+ net.Receive( "ent_use", function(ln,ply)
+ local ent = Entity(net.ReadUInt(GMS.NETINT_BITCOUNT))
+ local nam = net.ReadString()
+ local who = Player(net.ReadUInt(GMS.NETINT_BITCOUNT))
+ local tbl = GMS.Structures[nam]
+ if tbl != nil then
+ if tbl.uniquedata then
+ tbl = GMS.UniqueStructures[ent:EntIndex()]
+ end
+ if tbl.onUse != nil then
+ tbl.onUse(ent,who)
+ end
+ end
+ end)
+end
diff --git a/entities/entities/gms_seed.lua b/entities/entities/gms_seed.lua
index 626669f..be1cd07 100644
--- a/entities/entities/gms_seed.lua
+++ b/entities/entities/gms_seed.lua
@@ -117,7 +117,7 @@ function GAMEMODE.MakeTree( pos )
ent:SetPos( pos )
ent:Spawn()
ent.GMSAutoSpawned = true
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
end
function GAMEMODE.MakeGrain( pos, ply )
diff --git a/entities/entities/gms_tree.lua b/entities/entities/gms_tree.lua
index cd73761..746e3ad 100644
--- a/entities/entities/gms_tree.lua
+++ b/entities/entities/gms_tree.lua
@@ -15,7 +15,7 @@ ENT.Uses = 100
if ( CLIENT ) then return end
function ENT:OnInitialize()
- self:SetNetworkedString( "Owner", "World" )
+ self:SetNWString( "Owner", "World" )
self:SetMoveType( MOVETYPE_NONE )
diff --git a/entities/weapons/gms_wand.lua b/entities/weapons/gms_wand.lua
index cd71e2c..724b5d9 100644
--- a/entities/weapons/gms_wand.lua
+++ b/entities/weapons/gms_wand.lua
@@ -20,10 +20,14 @@ function SWEP:Initialize()
end
function SWEP:PrimaryAttack()
- ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, self, 0 )
+ if(SERVER) then
+ //if !(self:IsCarriedByLocalPlayer()) then return end
+ //ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, self, 0 )
+ //ParticleEffect("vortigaunt_hand_glow_c",self.Owner:GetPos() + Vector(0,0,64),self:GetAngles(),self)
+ end
//ParticleEffectAttach("vortigaunt_hand_glow_c",PATTACH_ABSORIGIN_FOLLOW,self,0)
self:throw_attack("models/props/cs_office/Chair_office.mdl")
-
+
end
local ShootSound = Sound("Metal.SawbladeStick")
@@ -31,46 +35,46 @@ local ShootSound = Sound("Metal.SawbladeStick")
function SWEP:throw_attack (model_file)
//Get an eye trace. This basically draws an invisible line from
- //the players eye. This SWep makes very little use of the trace, except to
+ //the players eye. This SWep makes very little use of the trace, except to
//calculate the amount of force to apply to the object thrown.
local tr = self.Owner:GetEyeTrace()
-
+
//Play some noises/effects using the sound we precached earlier
self:EmitSound(ShootSound)
self.BaseClass.ShootEffects(self)
-
+
//We now exit if this function is not running serverside
if (!SERVER) then return end
-
+
//The next task is to create a physics prop based on the supplied model
local ent = ents.Create("prop_physics")
ent:SetModel(model_file)
-
-
+
+
//Set the initial position and angles of the object. This might need some fine tuning;
//but it seems to work for the models I have tried.
ent:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
ent:SetAngles(self.Owner:EyeAngles())
-
+
ent:Spawn()
-
+
ParticleEffectAttach( "vortigaunt_hand_glow_c", PATTACH_ABSORIGIN_FOLLOW, ent, 0 )
-
-
+
+
//Now we need to get the physics object for our entity so we can apply a force to it
local phys = ent:GetPhysicsObject()
-
+
//Check if the physics object is valid. If not, remove the entity and stop the function
if !(phys && IsValid(phys)) then ent:Remove() return end
-
- //Time to apply the force. My method for doing this was almost entirely empirical
+
+ //Time to apply the force. My method for doing this was almost entirely empirical
//and it seems to work fairly intuitively with chairs.
phys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized() * math.pow(tr.HitPos:Length(), 3))
-
-
+
+
//Now for the important part of adding the spawned objects to the undo and cleanup lists.
cleanup.Add(self.Owner, "props", ent)
-
+
undo.Create ("Thrown_SWEP_Entity")
undo.AddEntity (ent)
undo.SetPlayer (self.Owner)
diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua
index bb9e7b4..3394874 100644
--- a/gamemode/cl_init.lua
+++ b/gamemode/cl_init.lua
@@ -4,6 +4,7 @@ includeFolder("craftablesystem",true)
includeFolder("itemsystem",true)
includeFolder("client",true)
includeFolder("shared",true)
+includeFolder("structuresystem",true)
include( "shared.lua" )
diff --git a/gamemode/configure_me.lua b/gamemode/configure_me.lua
index f7651af..15a86f4 100644
--- a/gamemode/configure_me.lua
+++ b/gamemode/configure_me.lua
@@ -19,7 +19,7 @@ GM.GAMEMODE_FOLDER_NAME = "gmstranded"
GMS = GMS or {}
-//If you're experienceing network latency, lowering this might help. If too low, might cause graphical errors on the client when displaying resources
+//If you're experienceing network latency, lowering this might help. If too low, might cause various errors
//max:32
GMS.NETINT_BITCOUNT = 16
diff --git a/gamemode/init.lua b/gamemode/init.lua
index 7ba8b25..50006b5 100644
--- a/gamemode/init.lua
+++ b/gamemode/init.lua
@@ -4,6 +4,7 @@ include( "init_static.lua")
includeFolder("server",true)
includeFolder("craftablesystem",true)
includeFolder("itemsystem",true)
+includeFolder("structuresystem",true)
includeFolder("shared",true)
AddCSLuaFile( "configure_me.lua" )
@@ -11,6 +12,7 @@ AddCSLuaFile( "utility.lua" )
AddCSLuaFolder("client",true)
AddCSLuaFolder("craftablesystem",true)
AddCSLuaFolder("itemsystem",true)
+AddCSLuaFolder("structuresystem",true)
AddCSLuaFolder("shared",true)
-- Send clientside files
@@ -155,7 +157,7 @@ hook.Add( "InitPostEntity", "gms_custom_antspawns", function()
ent:SetPos( pos )
ent:Spawn()
ent.GMSAutoSpawned = true
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
end
end )
@@ -169,7 +171,7 @@ hook.Add( "InitPostEntity", "gms_custom_treespawns", function()
ent:SetPos( pos )
ent:Spawn()
ent.GMSAutoSpawned = true
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
end
end )
@@ -252,7 +254,7 @@ function GM.ReproduceTrees()
seed:SetPos( pos )
seed:DropToGround()
seed:Setup( "tree", 180 )
- seed:SetNetworkedString( "Owner", "World" )
+ seed:SetNWString( "Owner", "World" )
seed:Spawn()
end
end
@@ -308,7 +310,7 @@ function GM.ReproduceTrees()
seed:SetPos( groundtrace.HitPos )
seed:DropToGround()
seed:Setup( "tree", 180 + math.random( -20, 20 ) )
- seed:SetNetworkedString( "Owner", "World" )
+ seed:SetNWString( "Owner", "World" )
seed:Spawn()
end
end
@@ -1235,7 +1237,7 @@ hook.Add( "PlayerDeath", "Death", function( ply )
grave:Spawn()
grave:SetplName(ply:Nick())
- grave:SetNetworkedString( "Owner", "Everyone" )
+ grave:SetNWString( "Owner", "Everyone" )
wepstbl = {}
restbl = {}
@@ -1800,7 +1802,7 @@ function GM:LoadMapEntity( savegame, max, k )
if ( ent.IsPlant ) then ent:SetNWEntity( "plantowner", player.FindByName( entry["owner"] ) ) end
SPropProtection.PlayerMakePropOwner( player.FindByName( entry["owner"] ), ent )
elseif ( entry["owner"] == "World" ) then
- ent:SetNetworkedString( "Owner", entry["owner"] )
+ ent:SetNWString( "Owner", entry["owner"] )
end
if ( entry["class"] == "gms_resourcedrop" ) then // RP
@@ -2055,7 +2057,7 @@ function gms_addbuildsiteresource( ent_resourcedrop, ent_buildsite )
for k, v in pairs( ent_buildsite.Costs ) do
str = str .. " " .. string.Replace( k, "_", " " ) .. " ( " .. v .. "x )"
end
- ent_buildsite:SetNetworkedString( "Resources", str )
+ ent_buildsite:SetNWString( "Resources", str )
end
end
end
@@ -2104,7 +2106,7 @@ function gms_addbuildsiteresourcePack( ent_resourcepack, ent_buildsite )
for k, v in pairs( ent_buildsite.Costs ) do
str = str .. " " .. string.Replace( k, "_", " " ) .. " ( " .. v .. "x )"
end
- ent_buildsite:SetNetworkedString( "Resources", str )
+ ent_buildsite:SetNWString( "Resources", str )
end
end
end
diff --git a/gamemode/itemsystem/items/sprout.lua b/gamemode/itemsystem/items/sprout.lua
index 3aab4c5..d5ae254 100644
--- a/gamemode/itemsystem/items/sprout.lua
+++ b/gamemode/itemsystem/items/sprout.lua
@@ -12,7 +12,7 @@ ITEM.OnGrow = function(self, aor, owner)
ent:SetPos( self:GetPos() )
ent:Spawn()
ent.GMSAutoSpawned = true
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
end
genericMakePlantable(ITEM)
diff --git a/gamemode/server/admin_commands.lua b/gamemode/server/admin_commands.lua
index 284792c..d21c884 100644
--- a/gamemode/server/admin_commands.lua
+++ b/gamemode/server/admin_commands.lua
@@ -1,7 +1,11 @@
concommand.Add( "gms_admin_maketree", function( ply )
if ( IsValid( ply ) && !ply:IsAdmin() ) then ply:SendMessage( "You need admin rights for this!", 3, Color( 200, 0, 0, 255 ) ) return end
local tr = ply:TraceFromEyes( 10000 )
- GAMEMODE.MakeTree( tr.HitPos )
+ local ent = ents.Create( "gms_tree" )
+ ent:SetPos( tr.HitPos )
+ ent:Spawn()
+ ent.GMSAutoSpawned = true
+ ent:SetNWString( "Owner", "World" )
end )
concommand.Add( "gms_admin_makerock", function( ply )
@@ -28,7 +32,7 @@ concommand.Add( "gms_admin_makeantlionbarrow", function( ply, cmd, args )
local ent = ents.Create( "gms_antlionbarrow" )
ent:SetPos( tr.HitPos )
ent:Spawn()
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
ent:SetKeyValue( "MaxAntlions", args[1] )
end )
@@ -132,7 +136,7 @@ concommand.Add( "gms_admin_populatearea", function( ply, cmd, args )
ent:SetModel( GMS.RockModels[math.random( 1, #GMS.RockModels )] )
ent:SetPos( groundtrace.HitPos )
ent:Spawn()
- ent:SetNetworkedString( "Owner", "World" )
+ ent:SetNWString( "Owner", "World" )
ent:Fadein()
ent.PhysgunDisabled = true
ent:GetPhysicsObject():EnableMotion( false )
diff --git a/gamemode/server/player_functions.lua b/gamemode/server/player_functions.lua
index 561a618..4da63c8 100644
--- a/gamemode/server/player_functions.lua
+++ b/gamemode/server/player_functions.lua
@@ -143,12 +143,9 @@ end
util.AddNetworkString( "gms_SetResource" )
function PlayerMeta:SetResource( resource, int )
- print("SetResource called!")
if(isstring(resource)) then
resource = GMS.GetResourceByName(resource)
end
- PrintTable(resource)
- print(int)
--if ( !self.Resources[resource] ) then self.Resources[resource] = 0 end
diff --git a/gamemode/spp/sv_init.lua b/gamemode/spp/sv_init.lua
index a4df311..d4eb2d2 100644
--- a/gamemode/spp/sv_init.lua
+++ b/gamemode/spp/sv_init.lua
@@ -223,7 +223,7 @@ hook.Add( "InitPostEntity", "spp_map_ents", function()
local WorldEnts = 0
for k, v in pairs( ents.GetAll() ) do
if ( !v:IsPlayer() and !v:GetNWString( "Owner", false ) ) then
- v:SetNetworkedString( "Owner", "World" )
+ v:SetNWString( "Owner", "World" )
WorldEnts = WorldEnts + 1
end
end
diff --git a/gamemode/structuresystem/common_smelt.lua b/gamemode/structuresystem/common_smelt.lua
new file mode 100644
index 0000000..bb34331
--- /dev/null
+++ b/gamemode/structuresystem/common_smelt.lua
@@ -0,0 +1,83 @@
+
+if SERVER then
+ util.AddNetworkString( "makerecipe" )
+end
+function genericMakeFurnace(tbl)
+ local oldusefunc = tbl.onUse
+ local overrideuse = function(self, ply)
+ if SERVER or ply != LocalPlayer() then return end
+ print("I am the local player!")
+ local DermaPanel = vgui.Create( "DFrame" )
+ DermaPanel:SetPos( 100, 100 )
+ DermaPanel:SetSize( ScrW() / 1.3, ScrH() / 1.4 )
+ DermaPanel:SetTitle( tbl.Name )
+ DermaPanel:SetDraggable( true )
+ DermaPanel:Center()
+ local Grid = vgui.Create("DGrid",DermaPanel)
+ Grid:SetPos(10,30)
+ Grid:SetColWide(128)
+ Grid:SetRowHeight(128)
+ for k,v in pairs(tbl.Recipes) do
+ local testbut = vgui.Create("DButton")
+ testbut:SetText(v.Name)
+ testbut:SetSize(128,128)
+ testbut.DoClick = function(button)
+ net.Start("makerecipe")
+ net.WriteString(tbl.Name)
+ if(tbl.uniquedata) then net.WriteUInt(self:EntIndex(), GMS.NETINT_BITCOUNT) end
+ net.WriteUInt(k, GMS.NETINT_BITCOUNT)
+ net.SendToServer()
+ end
+ Grid:AddItem(testbut)
+ DermaPanel:MakePopup()
+ end
+ oldusefunc(self,ply)
+ end
+ tbl.onUse = overrideuse
+end
+net.Receive( "makerecipe", function(ln,ply)
+ local tblname = net.ReadString()
+ local tbl = GMS.Structures[tblname]
+ print("Table is:")
+ PrintTable(tbl)
+ print("Recipes table is:")
+ PrintTable(tbl.Recipes)
+ assert(tbl != nil,"Maybe someone's trying to hack lol")
+ if tbl.uniquedata then
+ local entnum = net.ReadUInt(GMS.NETINT_BITCOUNT)
+ tbl = GMS.UniqueStructures[entnum]
+ end
+ local recipenum = net.ReadUInt(GMS.NETINT_BITCOUNT)
+ print("Useing recipes:")
+ PrintTable(tbl.Recipes)
+ print("And recipenum:")
+ PrintTable(tbl.Recipes[recipenum])
+ assert(tbl.Recipes != nil and tbl.Recipes[recipenum] != nil, "Invalid recpie!")
+ print("Attempting to craft recpie:")
+ PrintTable(tbl.Recipes[recipenum])
+ local recipe = tbl.Recipes[recipenum]
+ local numrequired = 1
+ for k, v in pairs( recipe.Req ) do
+ numrequired = numrequired + v
+ print("numrequired is now:" .. numrequired)
+ end
+ local time = math.pow(numrequired,tbl.timemult) - ((numrequired * tbl.timemult) * math.pow(ply:GetSkill("Smelting"),tbl.skillease))
+ time = time * numrequired / 5
+ --time = math.max( time - math.floor( ply:GetSkill( "Smelting" ) / 5 ), math.max( timecount * tbl.skillease, 2 ) )
+
+ print("I think smelting this should take " .. time .. " seconds")
+
+end)
+
+function recipieForSmelt(tbl, name, description, required, result, ratio, mults)
+ for k,v in pairs(mults) do
+ local thisrecipie = {}
+ thisrecipie.Name = name .. " x" .. v
+ thisrecipie.Description = description
+ thisrecipie.Req = {}
+ thisrecipie.Req[required] = ratio[1] * v
+ thisrecipie.Results = {}
+ thisrecipie.Results[result] = ratio[2] * v
+ table.insert(tbl,0,thisrecipie)
+ end
+end
diff --git a/gamemode/structuresystem/loadstructures.lua b/gamemode/structuresystem/loadstructures.lua
new file mode 100644
index 0000000..858d976
--- /dev/null
+++ b/gamemode/structuresystem/loadstructures.lua
@@ -0,0 +1,34 @@
+print("Loading structures!")
+GMS = GMS or {}
+GMS.Structures = GMS.Structures or {}
+GMS.UniqueStructures = {}
+
+function registerStructure(tbl)
+ assert(tbl.Name != nil, "Structure's name is nil!")
+ GMS.Structures[tbl.Name] = tbl
+end
+
+concommand.Add("gms_spawnstructure",function(ply,cmd,args)
+ if !ply:IsDeveloper() then return end
+ assert(args[1] != "","Failed to find structure name")
+ assert(GMS.Structures[args[1]] != nil, "Structure \"" .. args[1] .. "\" does not exist!")
+
+ local tr = ply:GetEyeTrace()
+ local e = ents.Create("gms_generic_structure")
+
+ local tbl = GMS.Structures[args[1]]
+ if tbl.uniquedata then
+ tbl = table.Copy(tbl)
+ GMS.UniqueStructures[e:EntIndex()] = tbl
+ end
+
+ for k,v in pairs(tbl) do
+ print("Setting " .. k .. " to")
+ print(v)
+ e[k] = v
+ end
+ e:Spawn()
+ e:SetPos(tr.HitPos)
+ SPropProtection.PlayerMakePropOwner( ply, e )
+ --e:SetNWString("Owner",ply:Nick())
+end)
diff --git a/gamemode/structuresystem/structures/aaaStructureExample.lua b/gamemode/structuresystem/structures/aaaStructureExample.lua
new file mode 100644
index 0000000..abe91ba
--- /dev/null
+++ b/gamemode/structuresystem/structures/aaaStructureExample.lua
@@ -0,0 +1,22 @@
+--This file is to help developers add new structures to the game!
+
+STRUCT = {}
+
+--A name for this structure, each type of structure must have a different name
+STRUCT.Name = "Example Structure"
+
+--The model for this structure.
+STRUCT.Model = "models/props/de_inferno/ClayOven.mdl"
+
+--The initalize method. Called on both the server and the client
+STRUCT.onInitialize = function(self)
+ print("Initalize called!")
+end
+
+--If this structure is not like every other structures of the same name (for example, if it has an internal inventory)
+STRUCT.uniquedata = false
+
+--Called when a player presses e on this structure, called on both the server and the client. Keep in mind that on the client side, ply may not be the local player!
+STRUCT.onUse = function(self,ply)
+ print("onUse called!")
+end
diff --git a/gamemode/structuresystem/structures/stonefurnace.lua b/gamemode/structuresystem/structures/stonefurnace.lua
new file mode 100644
index 0000000..84c0311
--- /dev/null
+++ b/gamemode/structuresystem/structures/stonefurnace.lua
@@ -0,0 +1,31 @@
+local STRUCT = {}
+
+STRUCT.Name = "Stone Furnace"
+STRUCT.Model = "models/props/de_inferno/ClayOven.mdl"
+
+STRUCT.Structure = {
+ {"models/props/de_inferno/ClayOven.mdl",Vector(0,0,0),Angle(0,0,0)}
+}
+
+STRUCT.onInitialize = function(self)
+ print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ print("I am the old use function!")
+end
+
+STRUCT.Recipes = {}
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+genericMakeFurnace(STRUCT)
+recipieForSmelt(STRUCT.Recipes,"Copper", "Smelt copper ore into copper", "Copper Ore", "Copper", {1,1}, {1,5,10})
+
+print("stone furnace's recipies:")
+PrintTable(STRUCT.Recipes)
+
+registerStructure(STRUCT)