diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-30 20:25:34 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-30 20:25:34 -0400 |
| commit | c6b56a911622f9a52fd92293074192d1f13d3e96 (patch) | |
| tree | 29f8a0a00a97afdfc84411965d6131f52d85d4f0 /gamemode/itemsystem | |
| parent | adcec79b09baa5b6804795077caae8ad7e6c0394 (diff) | |
| download | gmstranded-c6b56a911622f9a52fd92293074192d1f13d3e96.tar.gz gmstranded-c6b56a911622f9a52fd92293074192d1f13d3e96.tar.bz2 gmstranded-c6b56a911622f9a52fd92293074192d1f13d3e96.zip | |
Added water bottle
Diffstat (limited to 'gamemode/itemsystem')
| -rw-r--r-- | gamemode/itemsystem/items/platinumore.lua | 2 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/silverore.lua | 2 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/waterbottle.lua | 37 |
3 files changed, 39 insertions, 2 deletions
diff --git a/gamemode/itemsystem/items/platinumore.lua b/gamemode/itemsystem/items/platinumore.lua index b94d9eb..14b3f62 100644 --- a/gamemode/itemsystem/items/platinumore.lua +++ b/gamemode/itemsystem/items/platinumore.lua @@ -1,6 +1,6 @@ ITEM = {} -ITEM.Name = "Iron Ore" +ITEM.Name = "Platinum Ore" ITEM.Description = "Something you can craft with!" ITEM.Icon = "test.png" ITEM.UniqueData = false diff --git a/gamemode/itemsystem/items/silverore.lua b/gamemode/itemsystem/items/silverore.lua index b94d9eb..f0b0505 100644 --- a/gamemode/itemsystem/items/silverore.lua +++ b/gamemode/itemsystem/items/silverore.lua @@ -1,6 +1,6 @@ ITEM = {} -ITEM.Name = "Iron Ore" +ITEM.Name = "Silver Ore" ITEM.Description = "Something you can craft with!" ITEM.Icon = "test.png" ITEM.UniqueData = false 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) |
