mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-18 22:23:46 +03:00
Upload
This commit is contained in:
127
gamemodes/ixhl2rp/plugins/wn7farming/items/base/sh_seeds.lua
Normal file
127
gamemodes/ixhl2rp/plugins/wn7farming/items/base/sh_seeds.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Seeds Base"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.useSound = {"player/footsteps/dirt1.wav", "player/footsteps/dirt2.wav", "player/footsteps/dirt3.wav", "player/footsteps/dirt4.wav"}
|
||||
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
|
||||
ITEM.GrowTime = {14400, 14600}
|
||||
ITEM.Harvest = "fruit_apple"
|
||||
ITEM.baseHarvest = {5, 15}
|
||||
ITEM.outlineColor = Color(0, 255, 0, 100)
|
||||
ITEM.vortOnly = false
|
||||
ITEM.returnSeed = true
|
||||
ITEM.functions.plant = {
|
||||
name = "Posadź",
|
||||
icon = "icon16/brick_add.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
|
||||
if trace.HitPos:DistToSqr(client:GetShootPos()) > 192 * 192 then
|
||||
client:Notify("Nie możesz tego posadzić tak daleko od siebie!!")
|
||||
return false
|
||||
end
|
||||
|
||||
if trace.Entity:GetModel() != "models/wn7new/advcrates/n7_planter_dirt.mdl" then
|
||||
client:Notify("Możesz to sadzić tylko w odpowiedniej glebie..")
|
||||
return false
|
||||
end
|
||||
|
||||
if !(client:GetCharacter():GetFaction() == FACTION_VORT) && item.vortOnly then
|
||||
client:Notify("Nie masz pojęcia, jak obchodzić się z tymi dziwnymi nasionami.")
|
||||
return false
|
||||
end
|
||||
|
||||
local check = true
|
||||
|
||||
for _, v in pairs(ents.FindInSphere(trace.HitPos, 20)) do
|
||||
if v:GetClass() == "cw_plant" then
|
||||
check = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not check then
|
||||
client:Notify("Nie możesz sadzić tak blisko innej rośliny!")
|
||||
return false
|
||||
end
|
||||
|
||||
local seed = ents.Create("cw_plant")
|
||||
local growtimeItem = math.random(item.GrowTime[1], item.GrowTime[2])
|
||||
local baseHarvest = math.random(item.baseHarvest[1], item.baseHarvest[2])
|
||||
local character = client:GetCharacter()
|
||||
local cookingSkill = character:GetSkillLevel("cooking")
|
||||
local growtime = growtimeItem - (cookingSkill * 100)
|
||||
|
||||
character:DoAction("plant_seed")
|
||||
|
||||
seed:SetPos(trace.HitPos + trace.HitNormal + trace.Entity:GetUp() * -3)
|
||||
seed.Harvest = item.Harvest
|
||||
seed.baseHarvest = baseHarvest
|
||||
seed.GrowthPercent = 0
|
||||
seed.GrowTime = growtime
|
||||
seed.InitialGrowTime = growtime
|
||||
seed.BaseHarvest = baseHarvest
|
||||
seed.Fertilizer = 0
|
||||
seed.Hydration = math.random(1, 10)
|
||||
seed.usedSeed = item.uniqueID
|
||||
seed.returnSeed = item.returnSeed
|
||||
seed.vortOnly = item.vortOnly
|
||||
seed:Spawn()
|
||||
|
||||
seed:SetModel(item.PlantModel)
|
||||
client:Notify("Udało ci się zasiać nasiona")
|
||||
|
||||
local startPos = seed:GetPos() + Vector(0, 0, 10)
|
||||
local endPos = startPos + Vector(0, 0, 32768)
|
||||
local skyCheckTrace = util.TraceLine({
|
||||
start = startPos,
|
||||
endpos = endPos,
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
seed.HasSun = skyCheckTrace.HitSky
|
||||
|
||||
for _, ent in pairs(ents.FindInSphere(seed:GetPos(), 1500)) do
|
||||
if IsValid(ent) and ent:GetClass() == "wn_sunlamp" and ent:GetNetVar("enabled") then
|
||||
seed.HasSun = true
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if not seed.HasSun then
|
||||
client:Notify("Roślina nie przetrwa długo, ponieważ nie znajduje się na otwartej przestrzeni z dostępem do słońca.")
|
||||
return true
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
if (IsValid(item.entity)) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local data = tooltip:AddRow("data")
|
||||
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
|
||||
data:SetText("Nasiona te można zasadzić w specjalnym ogrodzie.")
|
||||
data:SizeToContents()
|
||||
end
|
||||
|
||||
|
||||
-- Called when a player drops the item.
|
||||
function ITEM:OnDrop(player, position) end
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona jabłoni"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona jabłka."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_dust/hr_dust/foliage/olive_tree_small_01.mdl"
|
||||
ITEM.GrowTime = {14000, 14400}
|
||||
ITEM.baseHarvest = {2, 3}
|
||||
ITEM.Harvest = "fruit_apple"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona bananowca"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona banana."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_dust/hr_dust/foliage/banana_plant_01.mdl"
|
||||
ITEM.GrowTime = {14000, 14400}
|
||||
ITEM.baseHarvest = {3, 6}
|
||||
ITEM.Harvest = "fruit_banana"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona jagody"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona jagody."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
|
||||
ITEM.GrowTime = {14280, 14628}
|
||||
ITEM.baseHarvest = {3, 6}
|
||||
ITEM.Harvest = "fruit_berries"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona pomarańczy"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona pomarańczy."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_dust/hr_dust/foliage/olive_tree_small_01.mdl"
|
||||
ITEM.GrowTime = {14568, 14975}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "fruit_orange"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona gruszy"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona gruszki."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_dust/hr_dust/foliage/olive_tree_small_01.mdl"
|
||||
ITEM.GrowTime = {14833, 15277}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "fruit_pear"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona ananasa"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona ananasa."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_dust/hr_dust/foliage/palm_tree_small_04.mdl"
|
||||
ITEM.GrowTime = {15118, 15591}
|
||||
ITEM.baseHarvest = {4, 5}
|
||||
ITEM.Harvest = "fruit_pineapple"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona ziemniaka"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona ziemniaka."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
|
||||
ITEM.GrowTime = {15413, 15915}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "veg_potato"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona pomidora"
|
||||
ITEM.description = "Małe pudełko, a w nim nasiona pomidora. Nie, nie są czerwone."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
|
||||
ITEM.GrowTime = {15718, 16250}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "veg_tomato"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona arbuza"
|
||||
ITEM.description = "AMałe pudełko, a w nim nasiona arbuza."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
|
||||
ITEM.GrowTime = {18034, 19996}
|
||||
ITEM.baseHarvest = {2, 3}
|
||||
ITEM.Harvest = "fruit_watermelon"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona jagód Xen"
|
||||
ITEM.description = "Fluorescencyjne pudełko z dziwnymi nasionami w środku..."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/jq/hlvr/props/xenpack/xen_vort_plant.mdl"
|
||||
ITEM.GrowTime = {14280, 14628}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "ing_xenberries"
|
||||
ITEM.vortOnly = true
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nasiona ziół Xen"
|
||||
ITEM.description = "Fluorescencyjne pudełko z dziwnymi nasionami w środku..."
|
||||
ITEM.model = "models/props_lab/box01a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
ITEM.PlantModel = "models/jq/hlvr/props/xenpack/xen_blob_corner_small_blob001_stack.mdl"
|
||||
ITEM.GrowTime = {14280, 14628}
|
||||
ITEM.baseHarvest = {4, 6}
|
||||
ITEM.Harvest = "ing_xen_herb"
|
||||
ITEM.vortOnly = true
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Zaawansowany nawóz"
|
||||
ITEM.description = "Niewielki worek wypełniony małymi bryłkami nawozu, saletry i innymi artykułami ogrodniczymi, które są niezbędne do uzyskania udanych i obfitych zbiorów. Ten został mistrzowsko wykonany, aby zaspokoić wszystkie potrzeby roślin."
|
||||
ITEM.model = "models/props_junk/garbage_milkcarton001a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local data = tooltip:AddRow("data")
|
||||
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
|
||||
data:SetText("Możesz użyć tego przedmiotu, aby zwiększyć płodność i nawodnienie rośliny")
|
||||
data:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.Water = {
|
||||
name = "Nawoź",
|
||||
icon = "icon16/brick.png",
|
||||
OnRun = function(item)
|
||||
local player = item.player
|
||||
local trace = player:GetEyeTraceNoCursor()
|
||||
|
||||
if (trace.HitPos:Distance(player:GetShootPos()) <= 192) then
|
||||
if (trace.Entity:GetClass() == "cw_plant") then
|
||||
trace.Entity:SetNWInt("Fertilizer", 100)
|
||||
trace.Entity.Fertilizer = 100
|
||||
trace.Entity.Hydration = 100
|
||||
|
||||
player:ChatNotify("Rozsypujesz trochę nawozu wokół rośliny... jest szczęśliwa!")
|
||||
return true
|
||||
else
|
||||
player:Notify("Nie patrzysz na prawidłową roślinę.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
48
gamemodes/ixhl2rp/plugins/wn7farming/items/sh_fertilizer.lua
Normal file
48
gamemodes/ixhl2rp/plugins/wn7farming/items/sh_fertilizer.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Nawóz"
|
||||
ITEM.description = "Niewielki worek wypełniony małymi bryłkami nawozu, saletry i innymi artykułami ogrodniczymi, które są niezbędne do uzyskania udanych i obfitych zbiorów."
|
||||
ITEM.model = "models/props_junk/garbage_milkcarton001a.mdl"
|
||||
ITEM.category = "Farming"
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local data = tooltip:AddRow("data")
|
||||
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
|
||||
data:SetText("Możesz użyć tego przedmiotu, aby zwiększyć poziom płodności rośliny")
|
||||
data:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.Water = {
|
||||
name = "Fertilize",
|
||||
icon = "icon16/brick.png",
|
||||
OnRun = function(item)
|
||||
local player = item.player
|
||||
local trace = player:GetEyeTraceNoCursor()
|
||||
|
||||
if (trace.HitPos:Distance(player:GetShootPos()) <= 192) then
|
||||
if (trace.Entity:GetClass() == "cw_plant") then
|
||||
trace.Entity.Fertilizer = math.min(trace.Entity.Fertilizer + 25, 100)
|
||||
trace.Entity:SetNWInt("Fertilizer", math.min(trace.Entity:GetNWInt("Fertilizer", 0) + 25, 100))
|
||||
|
||||
|
||||
player:ChatNotify("Rozsypujesz trochę nawozu wokół rośliny...")
|
||||
return true
|
||||
|
||||
else
|
||||
player:Notify("Nie patrzysz na prawidłową roślinę.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
117
gamemodes/ixhl2rp/plugins/wn7farming/items/sh_water_bucket.lua
Normal file
117
gamemodes/ixhl2rp/plugins/wn7farming/items/sh_water_bucket.lua
Normal file
@@ -0,0 +1,117 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Konewka"
|
||||
ITEM.description = "Metalowa puszka po gazie zmieniona w konewkę, którą można napełnić wodą. Specjalnie stworzona do podlewania roślin."
|
||||
ITEM.model = "models/props_junk/metalgascan.mdl"
|
||||
ITEM.category = "Farming"
|
||||
|
||||
if (CLIENT) then
|
||||
local color_green = Color(0, 255, 0, 255)
|
||||
local color_red = Color(255, 50, 50, 255)
|
||||
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local data = tooltip:AddRow("data")
|
||||
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
|
||||
data:SetText("Możesz używać tego wiadra bezpośrednio na roślinach, aby je podlewać i zwiększać ich poziom nawodnienia.\n Możesz napełnić wiadro w zbiornikach wodnych lub zaworach wody.")
|
||||
data:SizeToContents()
|
||||
|
||||
local water = tooltip:AddRow("water")
|
||||
water:SetBackgroundColor(derma.GetColor("Error", tooltip))
|
||||
water:SetText("Woda: " ..self:GetData("water", 0).. "%")
|
||||
water:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.Water = {
|
||||
name = "Nawodnij roślinę",
|
||||
icon = "icon16/drink.png",
|
||||
OnRun = function(item)
|
||||
local player = item.player
|
||||
local trace = player:GetEyeTraceNoCursor()
|
||||
|
||||
if item:GetData("water") > 0 then
|
||||
if (trace.HitPos:Distance(player:GetShootPos()) <= 192) then
|
||||
if (trace.Entity:GetClass() == "cw_plant") then
|
||||
|
||||
local hydration = trace.Entity.Hydration
|
||||
trace.Entity.Hydration = math.min(hydration + 25, 100)
|
||||
|
||||
local newValue = item:GetData("water", 0) - 25
|
||||
item:SetData("water", newValue)
|
||||
player:EmitSound("ambient/water/water_spray1.wav")
|
||||
player:ChatNotify("Podlewasz roślinę zawartością wiadra!")
|
||||
else
|
||||
player:Notify("Nie patrzysz na prawidłową roślinę.")
|
||||
end
|
||||
end
|
||||
else
|
||||
player:Notify("W wiadrze nie ma wystarczającej ilości wody!")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
ITEM.functions.fill = {
|
||||
name = "Napełnij wodą",
|
||||
tip = "applyTip",
|
||||
icon = "icon16/arrow_in.png",
|
||||
OnRun = function(item)
|
||||
if (SERVER) then
|
||||
local client = item.player
|
||||
local targetEnt = client:GetEyeTraceNoCursor().Entity
|
||||
|
||||
if item:IsWaterDeepEnough(client) then
|
||||
if item:GetData("water") != 100 then
|
||||
local newValue = item:GetData("water", 0) + 25
|
||||
client:ChatNotify("Napełniłeś wiadro do "..newValue.."%")
|
||||
|
||||
item:SetData("water", newValue)
|
||||
client:EmitSound("ambient/water/water_spray1.wav")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if targetEnt:GetClass() == "ix_watercache" or (targetEnt:GetClass() == "ix_cleanwatercache" and targetEnt:GetNetVar("broken", false)) then
|
||||
if item:GetData("water") != 100 then
|
||||
local newValue = item:GetData("water", 0) + 25
|
||||
client:ChatNotify("Napełniłeś wiadro do "..newValue.."%")
|
||||
|
||||
item:SetData("water", newValue)
|
||||
client:EmitSound("ambient/water/water_spray1.wav")
|
||||
else
|
||||
client:ChatNotify("Wiadro jest pełne!")
|
||||
end
|
||||
else
|
||||
client:ChatNotify("Nie patrzysz na prawdłowe źródło wody!!")
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:IsWaterDeepEnough(client)
|
||||
local pos = client:GetPos() + Vector(0, 0, 15)
|
||||
local trace = {}
|
||||
trace.start = pos
|
||||
trace.endpos = pos + Vector(0, 0, 1)
|
||||
trace.mask = bit.bor( MASK_WATER )
|
||||
local tr = util.TraceLine(trace)
|
||||
|
||||
return tr.Hit
|
||||
end
|
||||
|
||||
function ITEM:OnInstanced(index, x, y, item)
|
||||
self:SetData("water", 0)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user