summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-06-20 15:33:39 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-06-20 15:33:39 -0400
commite879c365577b0cc51c48bace7cd5fb52cdc26eaa (patch)
tree822a52cf38efd6815f2b7483cf6369e68c3dab23
parentf797cbe348dd52b51da4cd4812cfa291d1434095 (diff)
downloadgmstranded-master.tar.gz
gmstranded-master.tar.bz2
gmstranded-master.zip
Re-syncing last updated copyHEADmaster
-rw-r--r--entities/entities/gms_base_entity.lua4
-rw-r--r--entities/entities/gms_buildsite.lua1
-rw-r--r--entities/entities/gms_generic_structure.lua5
-rw-r--r--gamemode/client/cl_inventory.lua149
-rw-r--r--gamemode/configure_me.lua1
-rw-r--r--gamemode/itemsystem/items/armor.lua77
-rw-r--r--gamemode/structuresystem/common.lua233
-rw-r--r--gamemode/structuresystem/loadstructures.lua16
-rw-r--r--gamemode/structuresystem/structures/aaaStructureExample.lua9
-rw-r--r--gamemode/structuresystem/structures/copperfurnace.lua68
-rw-r--r--gamemode/structuresystem/structures/factory.lua128
-rw-r--r--gamemode/structuresystem/structures/goldfurnace.lua48
-rw-r--r--gamemode/structuresystem/structures/ironfurnace.lua82
-rw-r--r--gamemode/structuresystem/structures/mithrilfactory.lua166
-rw-r--r--gamemode/structuresystem/structures/platinumfurnace.lua48
-rw-r--r--gamemode/structuresystem/structures/silverfurnace.lua48
-rw-r--r--gamemode/structuresystem/structures/steelfurnace.lua48
-rw-r--r--gamemode/structuresystem/structures/stonefurnace.lua39
-rw-r--r--gamemode/structuresystem/structures/techfurnace.lua48
19 files changed, 1183 insertions, 35 deletions
diff --git a/entities/entities/gms_base_entity.lua b/entities/entities/gms_base_entity.lua
index eff03cb..ee44f99 100644
--- a/entities/entities/gms_base_entity.lua
+++ b/entities/entities/gms_base_entity.lua
@@ -18,7 +18,9 @@ function ENT:Initialize()
self:SetSolid( SOLID_VPHYSICS )
end
- self:onInitialize()
+ if self.OnInitialize then
+ self:OnInitialize()
+ end
end
function ENT:Draw()
diff --git a/entities/entities/gms_buildsite.lua b/entities/entities/gms_buildsite.lua
index a0f8199..a2b7b82 100644
--- a/entities/entities/gms_buildsite.lua
+++ b/entities/entities/gms_buildsite.lua
@@ -72,6 +72,7 @@ function ENT:Finish()
end
function ENT:OnUse( ply )
+ if(!self.LastUsed) then self.LastUsed = 0 end
if ( CurTime() - self.LastUsed < 0.5 ) then return end
self.LastUsed = CurTime()
diff --git a/entities/entities/gms_generic_structure.lua b/entities/entities/gms_generic_structure.lua
index d76ed30..fdc584d 100644
--- a/entities/entities/gms_generic_structure.lua
+++ b/entities/entities/gms_generic_structure.lua
@@ -5,9 +5,10 @@ ENT.Type = "anim"
ENT.Base = "gms_base_entity"
function ENT:Initialize()
- print("Initalize called!")
+ --print("Initalize called!")
util.PrecacheModel(self.Model)
- if self.Model then self:SetModel(self.Model) end
+ --For some reason this bugs out if run client side
+ if SERVER then if self.Model then self:SetModel(self.Model) end end
if self.onInitialize then self:onInitialize() end
if CLIENT then return end
self:PhysicsInit( SOLID_VPHYSICS )
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index 8f8969a..057410f 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -1,3 +1,5 @@
+local invpanel = nil
+
local invxsize = 800
local invysize = 500
@@ -46,7 +48,7 @@ local buttons = {
txt = "Admin",
admin = true,
},
-
+
}
surface.CreateFont( "gmNameFont", {
@@ -178,7 +180,7 @@ function PANEL:Init()
surface.SetTextPos( (titlePanel:GetWide()/2) - ( surface.GetTextSize(gmod.GetGamemode().Name)/2 ), (titlePanel:GetTall()/2) - (select( 2, surface.GetTextSize( gmod.GetGamemode().Name ) )/2) )
surface.DrawText( gmod.GetGamemode().Name )
end
-
+
kk = 1
for k,v in pairs(buttons) do
@@ -327,6 +329,17 @@ function PANEL:Init()
i = 0
for k,v in SortedPairs(GMS.Combinations["Structures"]) do
+ local cancraft = true
+ for i,j in pairs(v.Req) do
+ if Resources[i] == nil then
+ cancraft = false
+ break
+ elseif(Resources[i] < j) then
+ cancraft = false
+ break
+ end
+ end
+
local slot = vgui.Create("DButton", dpnl)
slot:SetSize(dPanelWidth/5, 100)
slot:SetText("")
@@ -341,6 +354,14 @@ function PANEL:Init()
modelPanel.DoClick = function()
LocalPlayer():ConCommand("gms_MakeCombination Structures " .. k )
end
+ if(!cancraft) then
+ print("I don't have the resources to build a ")
+ PrintTable(v)
+ modelPanel:SetColor(Color(255,0,0))
+ else
+ print("I have the resource to build a ")
+ PrintTable(v)
+ end
if (i % 5 != 0 ) then
slot:SetPos(row*dPanelWidth/5, (col-1)*100)
@@ -443,7 +464,115 @@ vgui.Register( "Combinations", PANEL, "DPanel" )
local PANEL = {}
function PANEL:Init()
+ ASlot = {
+
+ "NONE", "Helmet", "NONE",
+ "WEAPON", "Chestplate", "SHIELD",
+ "NONE", "Platelegs", "NONE",
+ "NONE", "Boots", "NONE"
+
+ }
+ self.slotWidth = 64
+ self.slotHeight = 64
+ local armorPnl = vgui.Create("DPanel",self)
+ armorPnl:SetPos(2,2)
+ armorPnl:SetSize(dPanelWidth/2-4,dPanelHeight-4)
+ armorPnl:SetBackgroundColor(Color(49,49,49))
+ local infoPnl = vgui.Create("DPanel",self)
+ infoPnl:SetPos(dPanelWidth/2+2,2)
+ infoPnl:SetSize(dPanelWidth/2-4,dPanelHeight-4)
+ infoPnl.Item = "NAME - "
+ infoPnl.Type = "TYPE - "
+ infoPnl.Description = "DESCRIPTION - \n"
+ infoPnl.Text = infoPnl.Item.."\n\n"..infoPnl.Type.."\n\n"..infoPnl.Description.."\n\n"
+ local grid = self:ArmorGrid()
+ grid:SetParent( armorPnl )
+
+
+ for i=1,12 do
+
+ local slot = vgui.Create("DButton",self)
+ slot:SetSize(self.slotWidth,self.slotHeight)
+
+ slot.Type = ASlot[i]
+
+ slot:SetText("")
+
+ local img = vgui.Create("DImage", slot)
+ img:SetPos(0, 0)
+ img:SetSize(slot:GetWide(), slot:GetTall())
+
+ slot.Paint = function()
+ if slot.Type == "NONE" then return end
+ draw.RoundedBox(0,0,0,slot:GetWide(),slot:GetTall(),Color(95,95,95))
+
+ end
+
+ slot.Think = function()
+ if GMS.Equipped == nil then return end
+
+ for k,v in pairs(GMS.Equipped) do
+ if slot.Type == nil then return end
+ if slot.Type == v['Type'] then
+
+ slot.Item = v['Item']
+ if GMS.Resources[v['Item']] == nil or GMS.Resources[v['Item']].Icon == nil then slot.Icon = "test.png" else slot.Icon = GMS.Resources[v['Item']].Icon end
+ slot.Description = v['Description']
+ img:SetImage(slot.Icon)
+
+ end
+ end
+
+ end
+
+ slot.DoClick = function()
+ if slot.Type == "NONE" or slot.Item == nil then return end
+
+ local menu = DermaMenu()
+
+ menu:AddOption( "Examine", function()
+ if not invpanel:IsValid() then return end
+ infoPnl.Item = "NAME - "..slot.Item
+ infoPnl.Type = "TYPE - "..slot.Type
+ infoPnl.Description = "DESCRIPTION - \n\n"..slot.Description
+ infoPnl.Text = infoPnl.Item.."\n\n"..infoPnl.Type.."\n\n"..infoPnl.Description
+
+ end)
+ menu:AddOption( "Unequip", function()
+ if not invpanel:IsValid() then return end
+ net.Start('giveRes')
+ net.WriteEntity(LocalPlayer())
+ net.WriteString(slot.Item)
+ net.WriteInt(1,32)
+ net.SendToServer()
+ for k,v in pairs(GMS.Equipped) do
+ if v['Type'] == slot.Type then table.remove(GMS.Equipped,k) end
+ end
+ end)
+
+ menu:Open()
+
+ end
+
+ grid:AddItem(slot)
+ end
+
+ infoPnl.Paint = function()
+ draw.RoundedBox(0,0,0,infoPnl:GetWide(),infoPnl:GetTall(),Color(99,99,99))
+ draw.DrawText( infoPnl.Text, "TargetID", 10, 10, Color(255,255,255) )
+ end
+
+end
+function PANEL:ArmorGrid()
+
+ self.Grid = vgui.Create("DGrid")
+ self.Grid:SetPos(self.slotWidth/2-4,20)
+ self.Grid:SetColWide(self.slotWidth+10)
+ self.Grid:SetCols(3)
+ self.Grid:SetRowHeight(self.slotHeight+10)
+ return self.Grid
+
end
function PANEL:Paint()
@@ -509,10 +638,10 @@ local PANEL = {}
function PANEL:Init()
self.ActiveTool = "Weld"
-
+
self.pnl = vgui.Create("DPanel", self)
self.pnl:SetSize(dPanelWidth/3, dPanelHeight)
-
+
self.Tools = vgui.Create( "DListLayout", self.pnl )
self.Tools:SetPos(8,8)
self.Tools:SetSize(self.pnl:GetWide()-16, self:GetTall()-16)
@@ -713,9 +842,9 @@ function PANEL:EnableControlPanel( button )
LocalPlayer():ConCommand( button.Command )
end
]]
-
-
-
+
+
+
end
function PANEL:Paint()
@@ -1192,7 +1321,7 @@ vgui.Register( "Admin", PANEL, "DPanel" )
local PANEL = {}
function PANEL:Init()
-
+
local dpnl = vgui.Create( "DScrollPanel", self )
dpnl:SetSize( dPanelWidth, dPanelHeight )
dpnl:SetPos( 0, 0 )
@@ -1245,9 +1374,9 @@ end
vgui.Register( "Tribes", PANEL, "DPanel" )
//Bind it to open on q
-local invpanel = nil
-function GM:OnSpawnMenuOpen()
+function GM:OnSpawnMenuOpen()
+ if(not LocalPlayer():Alive()) then return end
if(invpanel == nil) then
invpanel = createPanel()
return
diff --git a/gamemode/configure_me.lua b/gamemode/configure_me.lua
index 15a86f4..104e518 100644
--- a/gamemode/configure_me.lua
+++ b/gamemode/configure_me.lua
@@ -18,6 +18,7 @@ GM.GAMEMODE_FOLDER_NAME = "gmstranded"
GMS = GMS or {}
+GMS.Equipped = {}
//If you're experienceing network latency, lowering this might help. If too low, might cause various errors
//max:32
diff --git a/gamemode/itemsystem/items/armor.lua b/gamemode/itemsystem/items/armor.lua
new file mode 100644
index 0000000..cf0ce40
--- /dev/null
+++ b/gamemode/itemsystem/items/armor.lua
@@ -0,0 +1,77 @@
+
+local materials = {
+
+ "Copper",
+ "Iron",
+ "Tech",
+ "Silver",
+ "Gold",
+ "Steel",
+ "Platinum",
+
+}
+
+local parts = {
+
+ "Helmet",
+ "Platebody",
+ "Platelegs",
+ "Boots",
+
+}
+
+if(SERVER) then
+ util.AddNetworkString( "gms_equip" )
+end
+
+local equip_server = function(ln,player)
+ tbl = net.ReadTable()
+ t = net.ReadString( 32 )
+ player:DecResource( tbl.Item, 1 )
+ player:SendMessage( tbl.Type.." Equipped!", 3, Color( 10, 200, 10, 255 ) )
+ bool = net.ReadBool()
+ sName = net.ReadString( 32 )
+ if !bool then return end
+ player:SendMessage( sName, 3, Color( 10, 200, 10, 255 ) )
+ player:IncResource( sName, 1 )
+
+end
+net.Receive( "gms_equip", equip_server )
+
+for k,v in pairs(parts) do
+ for o,p in pairs(materials) do
+
+ local ITEM = {}
+ ITEM.Name = p.." "..v
+ ITEM.Description = v.." that will protect you."
+ ITEM.Icon = "test.png"
+ ITEM.Type = v
+ ITEM.UniqueData = false
+ ITEM.Actions = {}
+ genericMakeDroppable(ITEM)
+ ITEM.Actions["Equip"] = function()
+
+ local tbl = { Item = ITEM.Name, Icon = ITEM.Icon, Type = ITEM.Type, Description = ITEM.Description }
+ local sName = "-"
+ for g,h in pairs(GMS.Equipped) do
+ if h['Type'] == tbl.Type then
+ tbl2 = table.remove(GMS.Equipped,g)
+ sName = tbl2.Item
+ break
+ end
+ end
+
+ table.insert( GMS.Equipped, tbl )
+ net.Start("gms_equip")
+ net.WriteTable( tbl )
+ net.WriteString( v, 32 )
+ if sName != "-" then net.WriteBool( true ) else net.WriteBool( false ) end
+ net.WriteString( sName, 32 )
+
+ net.SendToServer()
+
+ end
+ GMS.RegisterResource(ITEM)
+
+ end
+end
diff --git a/gamemode/structuresystem/common.lua b/gamemode/structuresystem/common.lua
new file mode 100644
index 0000000..56cb355
--- /dev/null
+++ b/gamemode/structuresystem/common.lua
@@ -0,0 +1,233 @@
+
+
+local buts = 90
+local recipeWidth = buts*4
+local recipeHeight = buts*1.5
+
+local function makeCraftingWindow(name)
+ local pw = 735
+ local ph = 500
+ local DermaPanel = vgui.Create( "DFrame" )
+ DermaPanel:SetPos( 100, 100 )
+ DermaPanel:SetSize( pw, ph )
+ DermaPanel:SetTitle( name )
+ DermaPanel:SetDraggable( true )
+ DermaPanel:Center()
+ DermaPanel.Paint = function(self,w,h)
+
+ draw.RoundedBox( 0, 0, 0, w, h, Color(86,86,86,200) )
+
+ end
+ DermaPanel.scroll = vgui.Create( "DScrollPanel", DermaPanel )
+ DermaPanel.scroll:Dock(FILL)
+ DermaPanel.scroll:SetPos( 0, 25 )
+ DermaPanel.Grid = vgui.Create("DGrid",DermaPanel.scroll)
+ DermaPanel.Grid:SetPos(0,0)
+ DermaPanel.Grid:SetColWide(recipeWidth+5)
+ DermaPanel.Grid:SetCols(pw / recipeWidth)
+ DermaPanel.Grid:SetRowHeight(recipeHeight+5)
+ return DermaPanel
+end
+
+if SERVER then
+ util.AddNetworkString( "makerecipe" )
+end
+
+function genericMakeCrafting(tbl)
+ local oldusefunc = tbl.onUse
+ local overrideuse = function(self, ply)
+ oldusefunc(self,ply)
+ if SERVER or ply != LocalPlayer() then return end
+
+ tbl.Recipes = {}
+ for k,v in pairs(tbl.genericRecipes) do
+ local mults = v.Mults
+ if v.SmeltAll == true and !table.HasValue(mults,-1) then table.insert(mults,-1) end
+ for i,j in pairs(mults) do
+ local thisrecipe = {}
+ thisrecipe.Req = {}
+ thisrecipe.Results = {}
+ thisrecipe.Ratio = v.Ratio
+ for l,m in pairs(v.Requirements) do
+ if v.SmeltAll and j == -1 then
+ thisrecipe.Req[l] = thisrecipe.Ratio[1] * m
+ break
+ end
+ thisrecipe.Req[l] = thisrecipe.Ratio[1] * j * m
+ end
+ for l,m in pairs(v.Results) do
+ thisrecipe.Results[l] = thisrecipe.Ratio[2] * j * m
+ end
+ thisrecipe.Name = v.Name .. " x" .. j
+ thisrecipe.Description = v.Description
+ thisrecipe.genericNum = k
+ thisrecipe.Image = v.Image
+ thisrecipe.haslevelsfor = v.CanCraft(ply)
+ thisrecipe.hasmatsfor = true
+ for l,m in pairs(thisrecipe.Req) do
+ if(Resources[l] == nil or Resources[l] < m) then
+ thisrecipe.hasmatsfor = false
+ break
+ end
+ end
+ thisrecipe.mult = j
+
+ if j == -1 then
+ thisrecipe.Name = "All "..v.Name
+ thisrecipe.hasmatsfor = true
+ thisrecipe.SmeltAll = true
+ thisrecipe.MaxAmount = v.MaxAmount
+ if(Resources[v.Name] == nil or Resources[v.Name] < 1) then
+ thisrecipe.hasmatsfor = false
+ else
+ thisrecipe.mult = Resources[v.Name]
+ end
+ end
+
+ table.insert(tbl.Recipes,0,thisrecipe)
+ end
+ end
+
+ local DermaPanel = makeCraftingWindow(tbl.Name)
+ local infoPosX = 130
+ local infoPosY = 0
+ for k,v in pairs(tbl.Recipes) do
+ local recipeButton = vgui.Create("DButton")
+ local text = v.Name .. "\n" .. v.Description .. "\nRequires:"
+ for i,j in pairs(v.Req) do
+ text = text .. "\n" .. i .. " x" .. j
+ if v.SmeltAll then text = text .. "\nMax Amount - " ..v.MaxAmount end
+ end
+ recipeButton.text = text
+ recipeButton:SetText("")
+ recipeButton:SetSize(recipeWidth,recipeHeight)
+
+ DermaPanel.infotext = vgui.Create("DLabel",recipeButton)
+ DermaPanel.infotext:SetText(text)
+ DermaPanel.infotext:SetPos(infoPosX,infoPosY)
+ DermaPanel.infotext:SetSize(recipeWidth-infoPosX,recipeHeight)
+ DermaPanel.infotext:SetFont( "TargetID" )
+ DermaPanel.infotext:SetWrap(true)
+
+ recipeButton.Paint = function()
+ //draw.RoundedBox( 8, 5, 5, w-10, h-10, Color( 0, 0, 0 ) )
+
+ local fillcolor = Color(255,255,255)
+ if v.haslevelsfor then
+ if v.hasmatsfor then
+ fillcolor = Color(23,180,23)
+ else
+ fillcolor = Color(200,0,0)
+ end
+ else
+ fillcolor = Color(200,200,0)
+ end
+ draw.RoundedBox(0,0,0,recipeWidth,recipeHeight,Color(48,48,48,255))
+ draw.RoundedBox(0,15,15,110,recipeHeight-30,fillcolor)
+ draw.RoundedBox(8,20,20,100,recipeHeight-40,Color(98,98,98))
+
+ for t,y in pairs(v.Req) do
+ if v.SmeltAll and Resources[t] != nil and Resources[t] >= 1 then
+ v.hasmatsfor = true
+ break
+ end
+ if Resources[t] != nil and Resources[t] < y then
+ v.hasmatsfor = false
+ break
+ end
+ end
+
+ end
+ recipeButton.DoClick = function(button)
+ DermaPanel.structname = tbl.Name
+ DermaPanel.recipeNum = v.genericNum
+ DermaPanel.recipeMult = v.mult
+ net.Start("makerecipe")
+ net.WriteString(DermaPanel.structname)
+ if tbl.uniquedata then net.WriteUInt(self:EntIndex(), GMS.NETINT_BITCOUNT) end
+ net.WriteUInt(DermaPanel.recipeNum, GMS.NETINT_BITCOUNT)
+ net.WriteUInt(DermaPanel.recipeMult, GMS.NETINT_BITCOUNT)
+ net.WriteTable(v.Ratio)
+ net.WriteBool(v.SmeltAll)
+ if v.SmeltAll then net.WriteUInt(v.MaxAmount, GMS.NETINT_BITCOUNT) end
+ net.SendToServer()
+
+ end
+
+ local img = vgui.Create("DImage", recipeButton)
+ img:SetPos(24, 20)
+ img:SetSize(buts, buts)
+ img:SetImage(v.Image)
+
+ DermaPanel.Grid:AddItem(recipeButton)
+ DermaPanel:MakePopup()
+ end
+ end
+ tbl.onUse = overrideuse
+end
+net.Receive( "makerecipe", function(ln,ply)
+ local tblname = net.ReadString()
+ local tbl = GMS.Structures[tblname]
+ assert(tbl != nil,"Tried to make a recipe in a structure that dosen't exist!")
+ if tbl.uniquedata then
+ local entnum = net.ReadUInt(GMS.NETINT_BITCOUNT)
+ tbl = GMS.UniqueStructures[entnum]
+ end
+ local recipenum = net.ReadUInt(GMS.NETINT_BITCOUNT)
+ local mult = net.ReadUInt(GMS.NETINT_BITCOUNT)
+ local recipe = tbl.genericRecipes[recipenum]
+ local ratio = net.ReadTable()
+ local SmeltAll = net.ReadBool()
+ local maxAmount
+ if SmeltAll then maxAmount = net.ReadUInt(GMS.NETINT_BITCOUNT) end
+
+ --Check that we have enough ingredients
+ for k,v in pairs(recipe.Requirements) do
+
+ if SmeltAll and ply:GetResource(k) > 1 then
+ mult = ply:GetResource(k)
+ if ply:GetResource(k) > maxAmount then mult = maxAmount end
+ else
+
+ if ply:GetResource(k) < ratio[1] * v * mult then
+ ply:SendMessage("You don't have enough!", 3, Color(255, 255, 255, 255))
+ return
+ end
+
+ end
+ end
+
+ --Check that we're allowed to craft this
+ if not recipe.CanCraft(ply) then
+ ply:SendMessage("You can't craft that!", 3, Color(255, 255, 255, 255))
+ return
+ end
+
+ --We have enough resources! make it!
+ local prsName = "Crafting"
+ if recipe.Skill != nil then prsName = recipe.Skill end
+ local prcName = prsName
+ if prcName == "Weapon_Crafting" then prcName = "Crafting" end
+ startProcessGeneric(ply,prcName.." " .. recipe.Name, recipe.Time(ply,mult), function(player)
+ for k,v in pairs(recipe.Requirements) do
+ player:DecResource(k,ratio[1]*v*mult)
+ end
+ for k,v in pairs(recipe.Results) do
+ player:IncResource(k,ratio[2]*v*mult)
+ end
+
+
+ if recipe.Skill != nil then
+ if recipe.Skill == "Smelting" then player:IncXP( prsName, math.Clamp( math.Round( ( mult * 10 ) / player:GetSkill( prsName ) ), 1, 1000 ) )
+ elseif recipe.Skill == "Weapon_Crafting" then player:IncXP( prsName, math.Clamp( math.Round( ( mult * 15 ) / player:GetSkill( prsName ) ), 1, 1000 ) )
+ --elseif recipe.Skill == "Swimming" then player:IncXP( recipe.Skill, math.Clamp( math.Round( 100 / player:GetSkill( prsName ) ), 1, 1000 ) )
+ else player:IncXP( prsName, math.Clamp( math.Round( 150 / player:GetSkill( prsName ) ), 1, 1000 ) ) end
+ end
+ end)
+
+end)
+
+function genericGiveRecipie(tbl, recipe)
+ tbl.genericRecipes = tbl.genericRecipes or {}
+ table.insert(tbl.genericRecipes, recipe)
+end \ No newline at end of file
diff --git a/gamemode/structuresystem/loadstructures.lua b/gamemode/structuresystem/loadstructures.lua
index 858d976..820f055 100644
--- a/gamemode/structuresystem/loadstructures.lua
+++ b/gamemode/structuresystem/loadstructures.lua
@@ -8,27 +8,29 @@ function registerStructure(tbl)
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!")
+function SpawnStructure(structname, ply)
+ assert(structname != "","Failed to find structure name")
+ assert(GMS.Structures[structname] != nil, "Structure \"" .. structname .. "\" does not exist!")
local tr = ply:GetEyeTrace()
local e = ents.Create("gms_generic_structure")
- local tbl = GMS.Structures[args[1]]
+ local tbl = GMS.Structures[structname]
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
+
+concommand.Add("gms_spawnstructure",function(ply,cmd,args)
+ if !ply:IsDeveloper() then return end
+ SpawnStructure(args[1],ply)
end)
diff --git a/gamemode/structuresystem/structures/aaaStructureExample.lua b/gamemode/structuresystem/structures/aaaStructureExample.lua
index abe91ba..f8abb3c 100644
--- a/gamemode/structuresystem/structures/aaaStructureExample.lua
+++ b/gamemode/structuresystem/structures/aaaStructureExample.lua
@@ -6,11 +6,11 @@ STRUCT = {}
STRUCT.Name = "Example Structure"
--The model for this structure.
-STRUCT.Model = "models/props/de_inferno/ClayOven.mdl"
+STRUCT.Model = "models/props_combine/breendesk.mdl"
--The initalize method. Called on both the server and the client
STRUCT.onInitialize = function(self)
- print("Initalize called!")
+ --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)
@@ -18,5 +18,8 @@ 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!")
+ --print("onUse called!")
end
+
+--Don't forget to register the structure when you're done!
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/copperfurnace.lua b/gamemode/structuresystem/structures/copperfurnace.lua
new file mode 100644
index 0000000..c115967
--- /dev/null
+++ b/gamemode/structuresystem/structures/copperfurnace.lua
@@ -0,0 +1,68 @@
+local STRUCT = {}
+
+STRUCT.Name = "Copper Furnace"
+STRUCT.Model = "models/props/cs_militia/furnace01.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local irontimefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+
+local sulphurtimefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(10,STRUCT.skillease)
+ return time
+end
+
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Iron",
+ ["Description"] = "Smelt some iron ore into iron!",
+ ["Requirements"] = {["Iron Ore"] = 1},
+ ["Results"] = {["Iron"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_iron.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = irontimefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Sulphur",
+ ["Description"] = "Make some sulphur!",
+ ["Requirements"] = {["Stone"] = 2},
+ ["Results"] = {["Sulphur"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/sulphur.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = sulphurtimefunc,
+ ["Mults"] = {5,10},
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/factory.lua b/gamemode/structuresystem/structures/factory.lua
new file mode 100644
index 0000000..ae5b442
--- /dev/null
+++ b/gamemode/structuresystem/structures/factory.lua
@@ -0,0 +1,128 @@
+local STRUCT = {}
+
+STRUCT.Name = "Factory"
+STRUCT.Model = "models/props_c17/factorymachine01.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+
+local noSkillTimeFunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(10,STRUCT.skillease)
+ return time
+end
+
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Iron",
+ ["Description"] = "Smelt some iron ore into iron!",
+ ["Requirements"] = {["Iron Ore"] = 1},
+ ["Results"] = {["Iron"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_iron.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 200,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Copper",
+ ["Description"] = "Smelt some copper ore into copper!",
+ ["Requirements"] = {["Copper Ore"] = 1},
+ ["Results"] = {["Copper"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_copper.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 200,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Resin",
+ ["Description"] = "Extracts the resin from the wood.",
+ ["Requirements"] = {["Water Bottles"] = 0.2, ["Wood"] = 3},
+ ["Results"] = {["Resin"] = 0.2},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/resin.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {5,10,25},
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Plastic",
+ ["Description"] = "Solidifies the Resin, creating a natural plastic.",
+ ["Requirements"] = {["Resin"] = 1},
+ ["Results"] = {["Plastic"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/plastic.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {10,25},
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Glass",
+ ["Description"] = "Heats sand to form glass.",
+ ["Requirements"] = {["Sand"] = 2.5},
+ ["Results"] = {["Glass"] = 1},
+ ["Ratio"] = {0.8,1},
+ ["Image"] = "items/glass.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {10,25,50},
+ ["Skill"] = "Weapon_Crafting",
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Sand",
+ ["Description"] = "Crushes stone to sand.",
+ ["Requirements"] = {["Stone"] = 1},
+ ["Results"] = {["Sand"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/sand.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {10,25,50},
+ ["Skill"] = "Weapon_Crafting",
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/goldfurnace.lua b/gamemode/structuresystem/structures/goldfurnace.lua
new file mode 100644
index 0000000..476758e
--- /dev/null
+++ b/gamemode/structuresystem/structures/goldfurnace.lua
@@ -0,0 +1,48 @@
+local STRUCT = {}
+
+STRUCT.Name = "Gold Furnace"
+STRUCT.Model = "models/props_industrial/oil_storage.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Steel",
+ ["Description"] = "Smelt some steel ore into steel!",
+ ["Requirements"] = {["Steel Ore"] = 1},
+ ["Results"] = {["Steel"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_steel.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/ironfurnace.lua b/gamemode/structuresystem/structures/ironfurnace.lua
new file mode 100644
index 0000000..81b6988
--- /dev/null
+++ b/gamemode/structuresystem/structures/ironfurnace.lua
@@ -0,0 +1,82 @@
+local STRUCT = {}
+
+STRUCT.Name = "Iron Furnace"
+STRUCT.Model = "models/props_c17/furniturefireplace001a.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+
+local noSkillTimeFunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(10,STRUCT.skillease)
+ return time
+end
+
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Tech",
+ ["Description"] = "Smelt some tech ore into tech!",
+ ["Requirements"] = {["Tech Ore"] = 1},
+ ["Results"] = {["Tech"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_tech.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Charcoal",
+ ["Description"] = "Used in the production of charcoal.",
+ ["Requirements"] = {["Wood"] = 5},
+ ["Results"] = {["Charcoal"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/coal.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {1,10},
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Glass",
+ ["Description"] = "Glass can be used for making bottles and lighting.",
+ ["Requirements"] = {["Sand"] = 2},
+ ["Results"] = {["Glass"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/glass.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = noSkillTimeFunc,
+ ["Mults"] = {1},
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/mithrilfactory.lua b/gamemode/structuresystem/structures/mithrilfactory.lua
new file mode 100644
index 0000000..aad02de
--- /dev/null
+++ b/gamemode/structuresystem/structures/mithrilfactory.lua
@@ -0,0 +1,166 @@
+local STRUCT = {}
+
+STRUCT.Name = "Mithril Factory"
+STRUCT.Model = "models/props_wasteland/laundry_washer001a.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Copper",
+ ["Description"] = "Smelt some copper ore into copper!",
+ ["Requirements"] = {["Copper Ore"] = 1},
+ ["Results"] = {["Copper"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_copper.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Iron",
+ ["Description"] = "Smelt some iron ore into iron!",
+ ["Requirements"] = {["Iron Ore"] = 1},
+ ["Results"] = {["Iron"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_iron.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Tech",
+ ["Description"] = "Smelt some tech ore into tech!",
+ ["Requirements"] = {["Tech Ore"] = 1},
+ ["Results"] = {["Tech"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_tech.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Silver",
+ ["Description"] = "Smelt some silver ore into silver!",
+ ["Requirements"] = {["Silver Ore"] = 1},
+ ["Results"] = {["Silver"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_silver.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Gold",
+ ["Description"] = "Smelt some gold ore into gold!",
+ ["Requirements"] = {["Gold Ore"] = 1},
+ ["Results"] = {["Gold"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_gold.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Steel",
+ ["Description"] = "Smelt some steel ore into steel!",
+ ["Requirements"] = {["Steel Ore"] = 1},
+ ["Results"] = {["Steel"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_steel.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Platinum",
+ ["Description"] = "Smelt some platinum ore into platinum!",
+ ["Requirements"] = {["Platinum Ore"] = 1},
+ ["Results"] = {["Platinum"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_platinum.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+local genericRecipe = {
+ ["Name"] = "Pure Mithril",
+ ["Description"] = "Smelt some mithril ore into pure mithril!",
+ ["Requirements"] = {["Mithril Ore"] = 2},
+ ["Results"] = {["Pure Mithril"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_puremithril.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 100,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/platinumfurnace.lua b/gamemode/structuresystem/structures/platinumfurnace.lua
new file mode 100644
index 0000000..44f8e06
--- /dev/null
+++ b/gamemode/structuresystem/structures/platinumfurnace.lua
@@ -0,0 +1,48 @@
+local STRUCT = {}
+
+STRUCT.Name = "Platinum Furnace"
+STRUCT.Model = "models/xeon133/slider/slider_stand_12x12x24.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Pure Mithril",
+ ["Description"] = "Smelt some mithril ore into pure mithril!",
+ ["Requirements"] = {["Mithril Ore"] = 2},
+ ["Results"] = {["Pure Mithril"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_puremithril.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/silverfurnace.lua b/gamemode/structuresystem/structures/silverfurnace.lua
new file mode 100644
index 0000000..ecb774d
--- /dev/null
+++ b/gamemode/structuresystem/structures/silverfurnace.lua
@@ -0,0 +1,48 @@
+local STRUCT = {}
+
+STRUCT.Name = "Silver Furnace"
+STRUCT.Model = "models/props_wasteland/laundry_basket001.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Gold",
+ ["Description"] = "Smelt some gold ore into gold!",
+ ["Requirements"] = {["Gold Ore"] = 1},
+ ["Results"] = {["Gold"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_gold.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/steelfurnace.lua b/gamemode/structuresystem/structures/steelfurnace.lua
new file mode 100644
index 0000000..9c40161
--- /dev/null
+++ b/gamemode/structuresystem/structures/steelfurnace.lua
@@ -0,0 +1,48 @@
+local STRUCT = {}
+
+STRUCT.Name = "Steel Furnace"
+STRUCT.Model = "models/props_industrial/winch_deck.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Platinum",
+ ["Description"] = "Smelt some platinum ore into platinum!",
+ ["Requirements"] = {["Platinum Ore"] = 1},
+ ["Results"] = {["Platinum"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_platinum.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/stonefurnace.lua b/gamemode/structuresystem/structures/stonefurnace.lua
index 84c0311..c5b4c4d 100644
--- a/gamemode/structuresystem/structures/stonefurnace.lua
+++ b/gamemode/structuresystem/structures/stonefurnace.lua
@@ -3,29 +3,44 @@ 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!")
+ --print("Initalize called!")
end
STRUCT.uniquedata = false
STRUCT.onUse = function(self, ply)
- print("I am the old use function!")
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
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})
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Copper",
+ ["Description"] = "Smelt some copper ore into copper!",
+ ["Requirements"] = {["Copper Ore"] = 1},
+ ["Results"] = {["Copper"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_copper.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
-print("stone furnace's recipies:")
-PrintTable(STRUCT.Recipes)
+genericGiveRecipie(STRUCT,genericRecipe)
+genericMakeCrafting(STRUCT)
registerStructure(STRUCT)
diff --git a/gamemode/structuresystem/structures/techfurnace.lua b/gamemode/structuresystem/structures/techfurnace.lua
new file mode 100644
index 0000000..fb93855
--- /dev/null
+++ b/gamemode/structuresystem/structures/techfurnace.lua
@@ -0,0 +1,48 @@
+local STRUCT = {}
+
+STRUCT.Name = "Tech Furnace"
+STRUCT.Model = "models/props/cs_militia/dryer.mdl"
+
+STRUCT.onInitialize = function(self)
+ --print("Initalize called!")
+end
+
+STRUCT.uniquedata = false
+
+STRUCT.onUse = function(self, ply)
+ if CLIENT and ply != LocalPlayer() then return end
+ --print("onUse called!")
+end
+
+STRUCT.timemult = 0.5
+STRUCT.skillease = 0.25
+
+local timefunc = function(ply, num)
+ local time = math.pow(num,STRUCT.timemult)*4 - math.pow(ply:GetSkill("Smelting"),STRUCT.skillease)
+ return time
+end
+local checkfunc = function(ply)
+ return true
+end
+
+local genericRecipe = {
+ ["Name"] = "Silver",
+ ["Description"] = "Smelt some silver ore into silver!",
+ ["Requirements"] = {["Silver Ore"] = 1},
+ ["Results"] = {["Silver"] = 1},
+ ["Ratio"] = {1,1},
+ ["Image"] = "items/ingot_silver.png",
+ ["CanCraft"] = checkfunc,
+ ["Time"] = timefunc,
+ ["Mults"] = {1,5,10,25},
+ ["Skill"] = "Smelting",
+ ["SmeltAll"] = true,
+ ["MaxAmount"] = 50,
+}
+
+genericGiveRecipie(STRUCT,genericRecipe)
+
+
+genericMakeCrafting(STRUCT)
+
+registerStructure(STRUCT)