diff options
Diffstat (limited to 'gamemode/itemsystem/items')
| -rw-r--r-- | gamemode/itemsystem/items/bananaseeds.lua | 15 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/berry.lua | 35 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/grainseeds.lua | 6 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/herbs.lua | 2 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/melonseeds.lua | 13 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/orangeseeds.lua | 21 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/sprout.lua | 1 |
7 files changed, 75 insertions, 18 deletions
diff --git a/gamemode/itemsystem/items/bananaseeds.lua b/gamemode/itemsystem/items/bananaseeds.lua index 72e14b0..4a9d0c0 100644 --- a/gamemode/itemsystem/items/bananaseeds.lua +++ b/gamemode/itemsystem/items/bananaseeds.lua @@ -5,6 +5,21 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false + +--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 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 + + 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) diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua index acf018d..77a3a35 100644 --- a/gamemode/itemsystem/items/berry.lua +++ b/gamemode/itemsystem/items/berry.lua @@ -9,29 +9,30 @@ if(SERVER) then util.AddNetworkString( "gms_eatberry" ) end +local eat_client = function(ln, player) + net.Start("gms_eatberry") + net.SendToServer() +end + +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 eat = function(ln, player) - if(CLIENT) then - net.Start("gms_eatberry") - net.SendToServer() - end - if(SERVER) then - 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,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) + 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 = {} genericMakeDroppable(ITEM) -ITEM.Actions["Eat Berry"] = eat +ITEM.Actions["Eat Berry"] = eat_client GMS.RegisterResource(ITEM) diff --git a/gamemode/itemsystem/items/grainseeds.lua b/gamemode/itemsystem/items/grainseeds.lua index 9057df8..5b7ba3c 100644 --- a/gamemode/itemsystem/items/grainseeds.lua +++ b/gamemode/itemsystem/items/grainseeds.lua @@ -5,6 +5,12 @@ ITEM.Description = "Something you can plant, or mash up into flour" ITEM.Icon = "test.png" ITEM.UniqueData = false + +--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 genericMakePlantable(ITEM) genericMakeDroppable(ITEM) diff --git a/gamemode/itemsystem/items/herbs.lua b/gamemode/itemsystem/items/herbs.lua index c9339ce..f0b9dc8 100644 --- a/gamemode/itemsystem/items/herbs.lua +++ b/gamemode/itemsystem/items/herbs.lua @@ -1,7 +1,7 @@ ITEM = {} ITEM.Name = "Herbs" -ITEM.Description = "Something you can plant!" +ITEM.Description = "Blech, vegtables..." ITEM.Icon = "test.png" ITEM.UniqueData = false diff --git a/gamemode/itemsystem/items/melonseeds.lua b/gamemode/itemsystem/items/melonseeds.lua index 8ddaea5..8d82f7a 100644 --- a/gamemode/itemsystem/items/melonseeds.lua +++ b/gamemode/itemsystem/items/melonseeds.lua @@ -5,6 +5,19 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false +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 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 + + 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 genericMakeDroppable(ITEM) genericMakePlantable(ITEM) diff --git a/gamemode/itemsystem/items/orangeseeds.lua b/gamemode/itemsystem/items/orangeseeds.lua index 01122c3..c9c3963 100644 --- a/gamemode/itemsystem/items/orangeseeds.lua +++ b/gamemode/itemsystem/items/orangeseeds.lua @@ -5,6 +5,27 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false +--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 + + 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 + + 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 + genericMakePlantable(ITEM) genericMakeDroppable(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!") |
