mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
153
gamemodes/darkrp/plugins/waterloot/items/sh_canteen.lua
Normal file
153
gamemodes/darkrp/plugins/waterloot/items/sh_canteen.lua
Normal file
@@ -0,0 +1,153 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ITEM.name = "Water Canteen"
|
||||
ITEM.model = "models/willardnetworks/food/prop_bar_bottle_e.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.description = "A refillable metal canteen. You can fill it up with water."
|
||||
ITEM.category = "Food"
|
||||
ITEM.maxDurability = 50
|
||||
ITEM.base = "base_tools"
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local water = self:GetData("water", 0)
|
||||
local filtrated = self:GetData("filtrated", false) and "YES" or "NO"
|
||||
|
||||
local panel = tooltip:AddRowAfter("name", "remaining tobacco")
|
||||
panel:SetBackgroundColor(derma.GetColor("Warning", tooltip))
|
||||
panel:SetText("Remaining Water: "..water.."%")
|
||||
panel:SizeToContents()
|
||||
|
||||
local panel2 = tooltip:AddRowAfter("remaining tobacco", "filtrated")
|
||||
panel2:SetBackgroundColor(Color(100, 100, 100, 255))
|
||||
panel2:SetText("Filtrated: "..filtrated)
|
||||
panel2:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.drink = {
|
||||
name = "Drink Water",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/drink.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:RequestDrinkWater(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.drinkquench = {
|
||||
name = "Drink Till Quenched",
|
||||
icon = "icon16/drink.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
local thirst = math.Round(client:GetCharacter():GetThirst())
|
||||
|
||||
if (!PLUGIN:CanDrinkWater(client, item)) then return false end
|
||||
if (thirst <= 1) then return false end
|
||||
|
||||
local water = item:GetData("water", 0)
|
||||
|
||||
if (water < thirst) then
|
||||
thirst = water
|
||||
end
|
||||
|
||||
PLUGIN:DrinkWater(client, item:GetID(), thirst)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.fill = {
|
||||
name = "Fill with Water",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/arrow_in.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:FillEmptyWaterCannister(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.empty = {
|
||||
name = "Empty All Water",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/cancel.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:EmptyWaterCannister(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.filtrate = {
|
||||
name = "Filtrate Water",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/shading.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:FiltrateWater(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.fillcan = {
|
||||
name = "Fill Empty Can",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/shading.png",
|
||||
OnRun = function(item)
|
||||
local target = ix.item.list["drink_breen_water"]
|
||||
local client = item.player
|
||||
local character = client:GetCharacter()
|
||||
local emptyCan = character:GetInventory():HasItem("junk_empty_water")
|
||||
|
||||
emptyCan:Remove()
|
||||
character:GetInventory():Add("drink_breen_water")
|
||||
item:SetData("water", item:GetData("water", 0) - target.thirst)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local target = ix.item.list["drink_breen_water"]
|
||||
if (!target or !target.thirst) then return false end
|
||||
|
||||
if (!item:GetData("filtrated", false) or item:GetData("water", 0) < target.thirst) then return false end
|
||||
|
||||
local client = item.player
|
||||
if (!IsValid(client)) then return false end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return false end
|
||||
|
||||
local emptyCan = character:GetInventory():HasItem("junk_empty_water")
|
||||
if (!emptyCan) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
153
gamemodes/darkrp/plugins/waterloot/items/sh_waterbottle.lua
Normal file
153
gamemodes/darkrp/plugins/waterloot/items/sh_waterbottle.lua
Normal file
@@ -0,0 +1,153 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ITEM.name = "Bouteille d'eau"
|
||||
ITEM.model = "models/props/cs_office/water_bottle.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.description = "Une bouteille d'eau est un récipient pratique et essentiel pour transporter et consommer de l'eau. Elle est généralement fabriquée en plastique ou en métal, et sa taille peut varier en fonction des besoins individuels. La bouteille d'eau est conçue pour être légère, portable et résistante aux fuites, ce qui en fait un compagnon idéal. Vous pouvez la remplir d'eau."
|
||||
ITEM.category = "Nourriture"
|
||||
ITEM.maxDurability = 25
|
||||
ITEM.base = "base_tools"
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local water = self:GetData("water", 0)
|
||||
local filtrated = self:GetData("filtrated", false) and "OUI" or "NON"
|
||||
|
||||
local panel = tooltip:AddRowAfter("name", "remaining tobacco")
|
||||
panel:SetBackgroundColor(derma.GetColor("Warning", tooltip))
|
||||
panel:SetText("Eau restante : "..water.."%")
|
||||
panel:SizeToContents()
|
||||
|
||||
local panel2 = tooltip:AddRowAfter("remaining tobacco", "filtrated")
|
||||
panel2:SetBackgroundColor(Color(100, 100, 100, 255))
|
||||
panel2:SetText("Filtrée : "..filtrated)
|
||||
panel2:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.drink = {
|
||||
name = "Boire de l'eau",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/drink.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:RequestDrinkWater(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.drinkquench = {
|
||||
name = "Boire jusqu'à la soif",
|
||||
icon = "icon16/drink.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
local thirst = math.Round(client:GetCharacter():GetThirst())
|
||||
|
||||
if (!PLUGIN:CanDrinkWater(client, item)) then return false end
|
||||
if (thirst <= 1) then return false end
|
||||
|
||||
local water = item:GetData("water", 0)
|
||||
|
||||
if (water < thirst) then
|
||||
thirst = water
|
||||
end
|
||||
|
||||
PLUGIN:DrinkWater(client, item:GetID(), thirst)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.fill = {
|
||||
name = "Remplir d'eau",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/arrow_in.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:FillEmptyWaterCannister(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.empty = {
|
||||
name = "Vider toute l'eau",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/cancel.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:EmptyWaterCannister(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.filtrate = {
|
||||
name = "Filtrer l'eau",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/shading.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
PLUGIN:FiltrateWater(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.fillcan = {
|
||||
name = "Remplir la canette vide",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/shading.png",
|
||||
OnRun = function(item)
|
||||
local target = ix.item.list["drink_breen_water"]
|
||||
local client = item.player
|
||||
local character = client:GetCharacter()
|
||||
local emptyCan = character:GetInventory():HasItem("crafting_water")
|
||||
|
||||
emptyCan:Remove()
|
||||
character:GetInventory():Add("drink_breen_water")
|
||||
item:SetData("water", item:GetData("water", 0) - target.thirst)
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local target = ix.item.list["drink_breen_water"]
|
||||
if (!target or !target.thirst) then return false end
|
||||
|
||||
if (!item:GetData("filtrated", false) or item:GetData("water", 0) < target.thirst) then return false end
|
||||
|
||||
local client = item.player
|
||||
if (!IsValid(client)) then return false end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return false end
|
||||
|
||||
local emptyCan = character:GetInventory():HasItem("crafting_water")
|
||||
if (!emptyCan) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
44
gamemodes/darkrp/plugins/waterloot/items/sh_watervalve.lua
Normal file
44
gamemodes/darkrp/plugins/waterloot/items/sh_watervalve.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ITEM.name = "Valve d'eau"
|
||||
ITEM.model = "models/props/de_nuke/hr_nuke/metal_pipe_001/metal_pipe_001_gauge_valve_low.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.description = "La valve d'eau est un dispositif mécanique utilisé pour contrôler et réguler le flux d'eau. Elle est généralement composée d'un boîtier en métal ou en plastique contenant une vanne qui peut être ouverte ou fermée pour permettre ou arrêter le passage de l'eau."
|
||||
ITEM.category = "Outils"
|
||||
|
||||
ITEM.functions.Place = {
|
||||
name = "Placer sur la valve d'eau",
|
||||
tip = "equipTip",
|
||||
icon = "icon16/link_add.png",
|
||||
OnRun = function(itemTable)
|
||||
if (SERVER) then
|
||||
local client = itemTable.player
|
||||
PLUGIN:PlaceValve(client, itemTable)
|
||||
|
||||
return false
|
||||
end
|
||||
end,
|
||||
|
||||
OnCanRun = function(itemTable)
|
||||
if IsValid(itemTable.entity) then return false end
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:OnTransferred(curInv, inventory)
|
||||
if (SERVER) then
|
||||
if self.waterCache and IsValid(self.waterCache) then
|
||||
self.waterCache.HasPotPlaced = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user