summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem
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 /gamemode/itemsystem
parentf797cbe348dd52b51da4cd4812cfa291d1434095 (diff)
downloadgmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.tar.gz
gmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.tar.bz2
gmstranded-e879c365577b0cc51c48bace7cd5fb52cdc26eaa.zip
Re-syncing last updated copyHEADmaster
Diffstat (limited to 'gamemode/itemsystem')
-rw-r--r--gamemode/itemsystem/items/armor.lua77
1 files changed, 77 insertions, 0 deletions
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