diff options
| author | Scott <scotth0828@gmail.com> | 2016-04-30 20:34:42 -0400 |
|---|---|---|
| committer | Scott <scotth0828@gmail.com> | 2016-04-30 20:34:42 -0400 |
| commit | bdf6cacc1fe7af364b93604253f3229d842d6170 (patch) | |
| tree | 21015081b4d66d45390ba625c09fb84d143f63db /gamemode/itemsystem/items | |
| parent | e8fc8b5bf824ed3283dede946e66f5fd843d54ff (diff) | |
| parent | c6b56a911622f9a52fd92293074192d1f13d3e96 (diff) | |
| download | gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.tar.gz gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.tar.bz2 gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.zip | |
Merge branch 'master' of ssh://cogarr.net:43/home/git/gmsurvival
Diffstat (limited to 'gamemode/itemsystem/items')
21 files changed, 239 insertions, 125 deletions
diff --git a/gamemode/itemsystem/items/admantineore.lua b/gamemode/itemsystem/items/admantineore.lua new file mode 100644 index 0000000..2b1ac16 --- /dev/null +++ b/gamemode/itemsystem/items/admantineore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Adamantine Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/anexample.lua b/gamemode/itemsystem/items/anexample.lua index 19cdbd7..100096f 100644 --- a/gamemode/itemsystem/items/anexample.lua +++ b/gamemode/itemsystem/items/anexample.lua @@ -14,5 +14,23 @@ ITEM.Icon = "test.png" --If this item has "unique data", for example batteries that run out of charge ITEM.UniqueData = false +--A table of strings to functions that show up when the player clicks the item in their inventory. +--The you may also use strings to tables of strings to functions (and so on) to make drop-down menus. +--Example: +--[[ +ITEM.Actions = { + "Click me!" = functions(player) print("I was clicked!") end + "Or me!" = functions(player) print("I was clicked by " .. player:Name()) end + "Drop down" = { + "This is an item in a drop down" = function(player) print("Drop1") end + "Drop downs can have more drop downs!" = { + "Drop2" = function(player) print("Drop2") end + "Drop3" = function(player) print("Drop3") end + } + } +} +--]] +ITEM.Actions = {} + --Be sure to register when everything is said and done! GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/baits.lua b/gamemode/itemsystem/items/baits.lua index 47bf1d0..47a6fbb 100644 --- a/gamemode/itemsystem/items/baits.lua +++ b/gamemode/itemsystem/items/baits.lua @@ -1,26 +1,10 @@ ITEM = {} ITEM.Name = "Baits" -ITEM.Description = "Something you can plant!" +ITEM.Description = "Something you can use to fish with! (Consumed automatically)" ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end - -local dropall = function(player) - print("Drop all called") -end - -local dropx = function(player) - print("Drop x called") -end - -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakeDroppable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/bananaseeds.lua b/gamemode/itemsystem/items/bananaseeds.lua index 358ed63..4a9d0c0 100644 --- a/gamemode/itemsystem/items/bananaseeds.lua +++ b/gamemode/itemsystem/items/bananaseeds.lua @@ -5,22 +5,22 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end -local dropall = function(player) - print("Drop all called") -end +--Things needed to make something plantable +ITEM.GrowTime = 1 +ITEM.OnGrow = function(self, aor, owner) + local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, -3 ), "models/props/de_dust/du_palm_tree01_skybx.mdl" ) + plant.Children = 0 -local dropx = function(player) - print("Drop x called") -end + local num = 1 + if ( IsValid( ply ) && ply:HasUnlock( "Adept_Farmer" ) ) then num = num + math.random( 0, 1 ) end + if ( IsValid( ply ) && ply:HasUnlock( "Expert_Farmer" ) ) then num = num + math.random( 0, 2 ) end -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx + for i = 1, num do + GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -7, 7 ), math.random( -7, 7 ), math.random( 48, 55 ) ), "models/props/cs_italy/bananna_bunch.mdl", plant ) + end +end +genericMakePlantable(ITEM) +genericMakeDroppable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua index 2021ffd..77a3a35 100644 --- a/gamemode/itemsystem/items/berry.lua +++ b/gamemode/itemsystem/items/berry.lua @@ -9,45 +9,30 @@ if(SERVER) then util.AddNetworkString( "gms_eatberry" ) end -local eat = function(ln, player) - if(CLIENT) then - net.Start("gms_eatberry") - net.SendToServer() - end - if(SERVER) then - if(player.Resources[ITEM.Name] <= 0) then - player:SendMessage( "You don't have enough to do that!", 3, Color( 10, 200, 10, 255 ) ) - return - end - startProcessGeneric(player,"Eating some berries",3,function() - player:DecResource( "Berries", 1 ) - player:SendMessage( "You're a little less hungry and thirsty now.", 3, Color( 10, 200, 10, 255 ) ) - --Set hunger and thirst - player:SetFood(math.Clamp(player.Hunger+100,0,1000)) - player:SetThirst(math.Clamp(player.Thirst+100,0,1000)) - end) - end -end -net.Receive( "gms_eatberry", eat) - -local drop1 = function(player) - genericDropResource(player,ITEM.Name,1) +local eat_client = function(ln, player) + net.Start("gms_eatberry") + net.SendToServer() end -local dropall = function(player) - genericDropResource(player,ITEM.Name,9999) +local finishedeating = function() + player:DecResource( "Berries", 1 ) + player:SendMessage( "You're a little less hungry and thirsty now.", 3, Color( 10, 200, 10, 255 ) ) + --Set hunger and thirst + player:SetFood(math.Clamp(player.Hunger+100,0,1000)) + player:SetThirst(math.Clamp(player.Thirst+100,0,1000)) end -local dropx = function(player) - print("Drop x called") +local eat = function(ln, player) + if(player.Resources["Berries"] <= 0) then + player:SendMessage( "You don't have enough to do that!", 3, Color( 10, 200, 10, 255 ) ) + return + end + startProcessGeneric(player,"Eating some berries",3,finishedeating) end +net.Receive( "gms_eatberry", eat) ITEM.Actions = {} -ITEM.Actions["EatBerry"] = eat - -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakeDroppable(ITEM) +ITEM.Actions["Eat Berry"] = eat_client GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/copperore.lua b/gamemode/itemsystem/items/copperore.lua new file mode 100644 index 0000000..c7e1fea --- /dev/null +++ b/gamemode/itemsystem/items/copperore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Copper Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/goldore.lua b/gamemode/itemsystem/items/goldore.lua new file mode 100644 index 0000000..a5b1a53 --- /dev/null +++ b/gamemode/itemsystem/items/goldore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Gold Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/grainseeds.lua b/gamemode/itemsystem/items/grainseeds.lua index 9b22a0b..5b7ba3c 100644 --- a/gamemode/itemsystem/items/grainseeds.lua +++ b/gamemode/itemsystem/items/grainseeds.lua @@ -5,22 +5,13 @@ ITEM.Description = "Something you can plant, or mash up into flour" ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end - -local dropall = function(player) - print("Drop all called") -end -local dropx = function(player) - print("Drop x called") +--Things needed to make something plantable +ITEM.GrowTime = 1 +ITEM.OnGrow = function(self, aor, owner) + GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( math.random( -10, 10 ), math.random( -10, 10 ), 0 ), "models/props_foliage/cattails.mdl" ) end - -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakePlantable(ITEM) +genericMakeDroppable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/herbs.lua b/gamemode/itemsystem/items/herbs.lua index 9db5417..f0b9dc8 100644 --- a/gamemode/itemsystem/items/herbs.lua +++ b/gamemode/itemsystem/items/herbs.lua @@ -1,26 +1,10 @@ ITEM = {} ITEM.Name = "Herbs" -ITEM.Description = "Something you can plant!" +ITEM.Description = "Blech, vegtables..." ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end - -local dropall = function(player) - print("Drop all called") -end - -local dropx = function(player) - print("Drop x called") -end - -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakeDroppable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/ironore.lua b/gamemode/itemsystem/items/ironore.lua new file mode 100644 index 0000000..b94d9eb --- /dev/null +++ b/gamemode/itemsystem/items/ironore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Iron Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/melonseeds.lua b/gamemode/itemsystem/items/melonseeds.lua index 874ac46..8d82f7a 100644 --- a/gamemode/itemsystem/items/melonseeds.lua +++ b/gamemode/itemsystem/items/melonseeds.lua @@ -5,22 +5,20 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end +ITEM.GrowTime = 1 +ITEM.OnGrow = function(self, aor, owner) + local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, 13 ), "models/props/CS_militia/fern01.mdl" ) + plant.Children = 0 -local dropall = function(player) - print("Drop all called") -end + local num = 1 + if ( IsValid( ply ) && ply:HasUnlock( "Adept_Farmer" ) ) then num = num + math.random( 0, 1 ) end + if ( IsValid( ply ) && ply:HasUnlock( "Expert_Farmer" ) ) then num = num + math.random( 0, 2 ) end -local dropx = function(player) - print("Drop x called") + for i = 1, num do + GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -25, 25 ), math.random( -25, 25 ), math.random( 5, 7 ) ), "models/props_junk/watermelon01.mdl", plant ) + end end - -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakeDroppable(ITEM) +genericMakePlantable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/mithirilore.lua b/gamemode/itemsystem/items/mithirilore.lua new file mode 100644 index 0000000..da3dea8 --- /dev/null +++ b/gamemode/itemsystem/items/mithirilore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Mithril Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/orangeseeds.lua b/gamemode/itemsystem/items/orangeseeds.lua index 33fd698..c9c3963 100644 --- a/gamemode/itemsystem/items/orangeseeds.lua +++ b/gamemode/itemsystem/items/orangeseeds.lua @@ -5,22 +5,28 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false -local drop1 = function(player) - print("Drop 1 called") -end +--Things needed to make something plantable +ITEM.GrowTime = 1 +ITEM.OnGrow = function(self, aor, owner) + print("Owner:") + print(owner) + local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, -12 ), "models/props/cs_office/plant01_p1.mdl" ) + plant.Children = 0 -local dropall = function(player) - print("Drop all called") -end + plant:SetCollisionGroup( 0 ) + plant:SetSolid( SOLID_NONE ) + plant.Children = 0 + + local num = 1 + if ( IsValid( owner ) && owner:HasUnlock( "Adept_Farmer" ) ) then num = num + math.random( 0, 1 ) end + if ( IsValid( owner ) && owner:HasUnlock( "Expert_Farmer" ) ) then num = num + math.random( 0, 2 ) end -local dropx = function(player) - print("Drop x called") + for i = 1, num do + GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -5, 5 ), math.random( -5, 5 ), math.random( 13, 30 ) ), "models/props/cs_italy/orange.mdl", plant ) + end end -ITEM.Actions = {} -ITEM.Actions["Drop"] = {} -ITEM.Actions["Drop"]["Drop 1"] = drop1 -ITEM.Actions["Drop"]["Drop all"] = dropall -ITEM.Actions["Drop"]["Drop X"] = dropx +genericMakePlantable(ITEM) +genericMakeDroppable(ITEM) GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/platinumore.lua b/gamemode/itemsystem/items/platinumore.lua new file mode 100644 index 0000000..14b3f62 --- /dev/null +++ b/gamemode/itemsystem/items/platinumore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Platinum Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/silverore.lua b/gamemode/itemsystem/items/silverore.lua new file mode 100644 index 0000000..f0b0505 --- /dev/null +++ b/gamemode/itemsystem/items/silverore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Silver Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/sprout.lua b/gamemode/itemsystem/items/sprout.lua new file mode 100644 index 0000000..218ff2c --- /dev/null +++ b/gamemode/itemsystem/items/sprout.lua @@ -0,0 +1 @@ +print("Hello from sprout.lua!") diff --git a/gamemode/itemsystem/items/steelore.lua b/gamemode/itemsystem/items/steelore.lua new file mode 100644 index 0000000..c245ade --- /dev/null +++ b/gamemode/itemsystem/items/steelore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Steel Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/stone.lua b/gamemode/itemsystem/items/stone.lua new file mode 100644 index 0000000..d288d27 --- /dev/null +++ b/gamemode/itemsystem/items/stone.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Stone" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/strangestone.lua b/gamemode/itemsystem/items/strangestone.lua new file mode 100644 index 0000000..9d684ce --- /dev/null +++ b/gamemode/itemsystem/items/strangestone.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Strange Stone" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/techore.lua b/gamemode/itemsystem/items/techore.lua new file mode 100644 index 0000000..cc494e6 --- /dev/null +++ b/gamemode/itemsystem/items/techore.lua @@ -0,0 +1,10 @@ +ITEM = {} + +ITEM.Name = "Tech Ore" +ITEM.Description = "Something you can craft with!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +genericMakeDroppable(ITEM) + +GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/waterbottle.lua b/gamemode/itemsystem/items/waterbottle.lua new file mode 100644 index 0000000..df43749 --- /dev/null +++ b/gamemode/itemsystem/items/waterbottle.lua @@ -0,0 +1,37 @@ +ITEM = {} + +ITEM.Name = "Water Bottle" +ITEM.Description = "A delicious edible!" +ITEM.Icon = "test.png" +ITEM.UniqueData = false + +if(SERVER) then + util.AddNetworkString( "gms_drinkwaterbottle" ) +end + +local eat_client = function(ln, player) + net.Start("gms_drinkwaterbottle") + net.SendToServer() +end + +local finisheddrink = function() + player:DecResource( "Water Bottle", 1 ) + player:SendMessage( "You're a little less hungry and thirsty now.", 3, Color( 10, 200, 10, 255 ) ) + --Set thirst + player:SetThirst(math.Clamp(player.Thirst+100,0,1000)) +end + +local drink = function(ln, player) + if(player.Resources["Water Bottle"] <= 0) then + player:SendMessage( "You don't have enough to do that!", 3, Color( 10, 200, 10, 255 ) ) + return + end + startProcessGeneric(player,"Drinking some water",1,finisheddrink) +end +net.Receive( "gms_drinkwaterbottle", drink) + +ITEM.Actions = {} +genericMakeDroppable(ITEM) +ITEM.Actions["Drink Water"] = drink_client + +GMS.RegisterResource(ITEM) |
