This commit is contained in:
lifestorm
2024-08-04 22:55:00 +03:00
parent 8064ba84d8
commit 73479cff9e
7338 changed files with 1718883 additions and 14 deletions

View File

@@ -0,0 +1,46 @@
--[[
| 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/
--]]
include("shared.lua")
function ENT:OnPopulateEntityInfo(container)
local GrowthPercent = self:GetNWFloat("GrowthPercent")
local hydration = math.floor(self:GetNWFloat("Hydration"))
local fertilizer = math.floor(self:GetNWFloat("Fertilizer"))
local maturity = container:AddRow("maturity")
maturity:SetImportant()
maturity:SetText("Maturity: " .. GrowthPercent .. "%")
maturity:SizeToContents()
local fertilization = container:AddRow("fertilizer")
fertilization:SetImportant()
fertilization:SetText("Fertilizer: " .. tostring(fertilizer) .. "%")
fertilization:SizeToContents()
local water = container:AddRow("hydration")
water:SetImportant()
water:SetText("Hydration: " .. tostring(hydration) .. "%")
water:SizeToContents()
end
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
end
function ENT:Think()
end

View File

@@ -0,0 +1,144 @@
--[[
| 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
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:Initialize()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetSolid(SOLID_VPHYSICS)
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
self:DrawShadow(false)
local phys = self:GetPhysicsObject()
if (IsValid(phys)) then
phys:EnableMotion(false)
phys:Sleep()
end
self:SetModelScale(0.25)
timer.Create("PlantGrowthTimer_" .. self:EntIndex(), 1, 0, function()
local hydration = self.Hydration
local fertilizerFactor = self.Fertilizer
local growTime = self.GrowTime
fertilizerFactor = math.max(0, math.min(fertilizerFactor, 100))
growTime = math.max(math.floor(growTime - (1 * (1 + fertilizerFactor / 100))), 0)
hydration = math.max(hydration - 0.0111, 0)
local initialGrowTime = self.InitialGrowTime
if growTime > 0 and self.isRuined != true then
local growthPercent = 100 * (1 - (growTime / initialGrowTime))
if hydration <= 0 or self.HasSun then
self:Wither(0.15)
end
self.GrowTime = growTime
self.Hydration = hydration
self.GrowthPercent = math.Round(growthPercent)
self:SetNWFloat("GrowTime", growTime)
self:SetNWFloat("Hydration", hydration)
self:SetNWFloat("GrowthPercent", math.Round(growthPercent))
self:SetModelScale(0.25 + (1.0 - 0.25) * (growthPercent / 100), 0.1)
else
timer.Remove("PlantGrowthTimer_" .. self:EntIndex())
end
end)
end
function ENT:Wither(amount)
if amount and not self.isRuined then
self.witherchance = self.witherchance or 0 + amount
if self.witherchance > 60 then
if math.random(1, 50) == 50 then
self:SetColor(Color(74,73,0))
self.isRuined = true
end
elseif self.witherchance >= 80 then
self:SetColor(Color(74,73,0))
self.isRuined = true
end
end
end
function ENT:OnTakeDamage(dmg)
local player = dmg:GetAttacker()
if (player:IsPlayer()) then
self:Remove()
end
end
function ENT:Use(activator)
if self.isRuined == true and not self.isGathering then
self.isGathering = true
activator:Freeze(true)
activator:SetAction("Harvesting...", 5, function()
self.isGathering = false
activator:Freeze(false)
activator:ChatNotify("It was too much for the plant...")
self:Remove()
end)
end
if self.GrowthPercent >= 100 and not self.isGathering then
if not activator:Crouching() then
activator:Notify("You need to be crouching to harvest this plant!")
return false
end
self.isGathering = true
activator:Freeze(true)
activator:SetAction("Harvesting...", 5, function()
local seed = self.Harvest
self.isGathering = false
activator:Freeze(false)
character = activator:GetCharacter()
cookingSkill = 0
local extraHarvest = (cookingSkill / 10) or 0
local plusHarvest = math.floor(extraHarvest)
local totalHarvest = self.baseHarvest + plusHarvest
for i = 1, totalHarvest do
activator:GetCharacter():GetInventory():Add(seed)
end
activator:GetCharacter():DoAction("harvest_plant")
activator:ChatNotify("You've gained:" ..totalHarvest.. " total fruits from this plant!")
activator:ChatNotify("The harvest is bountiful.")
self:Remove()
end)
else
activator:Notify("This plant has not yet matured. You need to wait a while longer!")
end
end
function ENT:OnRemove()
timer.Remove("PlantGrowthTimer_" .. self:EntIndex())
end

View File

@@ -0,0 +1,26 @@
--[[
| 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/
--]]
--[[
Catwork © 2016-2017 TeslaCloud Studios
Do not share.
Original code by Alex Grist, 'impulse and Conna Wiles
with contributions from Cloud Sixteen community.
--]]
DEFINE_BASECLASS("base_gmodentity")
ENT.Type = "anim"
ENT.Author = "AleXXX_007, modified by gb"
ENT.PrintName = "Plant Base"
ENT.Spawnable = true
ENT.AdminSpawnable = false
ENT.PhysgunDisabled = false

View File

@@ -0,0 +1,59 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Garden Bed"
ENT.Category = "WN7 Farming"
ENT.Spawnable = true
local PLUGIN = PLUGIN
if (SERVER) then
function ENT:Initialize()
self:SetModel("models/wn7new/advcrates/n7_planter_wood.mdl")
self.fence = ents.Create("prop_physics")
self.fence:SetModel("models/wn7new/advcrates/n7_planter_dirt.mdl")
self.fence:SetPos(self:GetPos())
self.fence:SetAngles(self:GetAngles())
self.fence:SetParent(self)
self.fence:PhysicsInit(SOLID_BBOX)
self.fence:SetSolid(SOLID_BBOX)
self.fence:SetSolidFlags(FSOLID_NOT_STANDABLE)
self.fence:Spawn()
self.fence:DeleteOnRemove( self )
self:DeleteOnRemove( self.fence )
self:PhysicsInit(SOLID_NONE)
self:SetSolid(SOLID_NONE)
self:SetUseType(SIMPLE_USE)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:Wake()
end
end
function ENT:Use( activator )
end
function ENT:OnRemove()
if IsValid(self.fence) then
self.fence:Remove()
end
if (!ix.shuttingDown) then
PLUGIN:SaveCrops()
end
end
else
function ENT:Draw()
self:DrawModel()
end
end

View File

@@ -0,0 +1,78 @@
--[[
| 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/
--]]
AddCSLuaFile()
ENT.Type = "anim"
ENT.PrintName = "Sun Lamp"
ENT.Category = "WN7 Farming"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = false
ENT.bNoPersist = true
if (SERVER) then
function ENT:Initialize()
self:SetModel("models/props/hr_massive/survival_lighting/survival_ceiling_lamp.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetSkin(1)
local physics = self:GetPhysicsObject()
if IsValid(physics) then
physics:EnableMotion(false)
physics:Sleep()
end
self:SetAngles(Angle(180, 0, 0))
local newPos = self:GetPos() - Vector(0, 0, 10)
self:SetPos(newPos)
end
function ENT:OnRemove()
if IsValid(self.light) then
self.light:Remove()
end
end
function ENT:Use() -- code taken from the ix_light entity made by aspect
self:EmitSound("buttons/lightswitch2.wav")
self:SetNetVar("enabled", !self:GetNetVar("enabled"))
self:SetSkin(self:GetNetVar("enabled") and 1 or 0)
end
else
function ENT:Think() -- code taken from the ix_light entity made by aspect
if (self:GetNetVar("enabled")) then
local light = DynamicLight(self:EntIndex())
if light then
light.pos = self:GetPos()
light.r = 255
light.g = 255
light.b = 255
light.brightness = 0.5
light.Decay = 1000
light.Size = 250
light.DieTime = CurTime() + 1
end
self.light = light
end
end
function ENT:Draw()
self:DrawModel()
end
end

View File

@@ -0,0 +1,114 @@
--[[
| 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.functions.plant = {
name = "Plant",
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("You can't plant it that far away!")
return false
end
if (trace.Entity:GetModel() != "models/wn7new/advcrates/n7_planter_dirt.mdl") then
client:Notify("This can only be planted in suitable soil.")
return false
end
local check = true
for k, v in pairs(ents.FindInSphere(trace.HitPos, 10)) do
if v:GetClass() == "cw_plant" then
check = false
end
end
if (!check) then
client:Notify("You can't plant this close to another plant!")
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 * 10)
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 = 10
seed:Spawn()
seed:SetModel(item.PlantModel)
client:Notify("You have successfully planted the seeds")
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(self:GetPos(), 1500)) do
if IsValid(ent) and ent:GetClass() == "wn_sunlamp" and ent:GetNetVar("enabled") then
seed.HasSun = true
break
end
end
if !seed.HasSun then
client:ChatNotify("The plant won't survive for long as it's not in an open area with sunlight.")
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("You can plant these seeds in a special garden.")
data:SizeToContents()
end
-- Called when a player drops the item.
function ITEM:OnDrop(player, position) end

View File

@@ -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 = "Graines de Pomme"
ITEM.description = "Une petite boîte avec quelques pépins de pomme à l'intérieur."
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"

View File

@@ -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 = "Graines de Banane"
ITEM.description = "Une boîte avec quelques pépins de banane à l'intérieur."
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"

View File

@@ -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 = "Graines de Baies"
ITEM.description = "Une petite boîte avec quelques graines de baies à l'intérieur."
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"

View File

@@ -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 = "Graines d'orange"
ITEM.description = "Quelques graines d'orange, à l'intérieur d'une boîte."
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"

View File

@@ -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 = "Graines de poire"
ITEM.description = "Une petite boîte avec quelques graines de poire à l'intérieur."
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"

View File

@@ -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 = "Graines d'ananas"
ITEM.description = "Une petite boîte avec quelques graines d'ananas à l'intérieur."
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"

View File

@@ -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 = "Graines de pomme de terre"
ITEM.description = "Une petite boîte avec quelques graines de pomme de terre à l'intérieur."
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"

View File

@@ -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 = "Graines de tomate"
ITEM.description = "Une boîte avec quelques graines de tomate à l'intérieur. Elles ne sont pas rouges."
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"

View File

@@ -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 = "Graines de pastèque"
ITEM.description = "Une petite boîte avec quelques graines de pastèque à l'intérieur."
ITEM.model = "models/props_lab/box01a.mdl"
ITEM.category = "Farming"
ITEM.PlantModel = "models/props/de_inferno/claypot03_damage_01.mdl"
ITEM.GrowTime = {16034, 16596}
ITEM.baseHarvest = {2, 3}
ITEM.Harvest = "fruit_watermelon"

View File

@@ -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 = "Graines de baies de Xen"
ITEM.description = "Une boîte fluorescente avec des graines étranges à l'intérieur..."
ITEM.model = "models/props_lab/box01a.mdl"
ITEM.category = "Farming"
ITEM.PlantModel = "models/jq/hlvr/props/xenpack/xen_vort_plant.mdl"
ITEM.GrowTime = {17430, 18346}
ITEM.baseHarvest = {4, 6}
ITEM.Harvest = "xen_berries"

View File

@@ -0,0 +1,46 @@
--[[
| 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 = "Engrais avancé"
ITEM.description = "Un petit sac rempli de petits morceaux d'engrais, de salpêtre et de tous les bons produits de jardinage dont vous avez besoin pour obtenir une récolte abondante et réussie. Celui-ci a été fabriqué avec maîtrise pour répondre à tous les besoins des plantes."
ITEM.model = "models/props/de_dust/hr_dust/dust_flour_sack/dust_flour_sack.mdl"
ITEM.category = "Farming"
if (CLIENT) then
function ITEM:PopulateTooltip(tooltip)
local data = tooltip:AddRow("data")
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
data:SetText("Vous pouvez utiliser cet article pour augmenter la fertilité et l'hydratation d'une plante.")
data:SizeToContents()
end
end
ITEM.functions.Water = {
name = "Fertiliser",
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 = 100
trace.Entity.Hydration = 100
player:ChatNotify("Vous avez épandu de l'engrais autour de la plante... la plante est contente !!")
return true
else
player:Notify("Vous ne regardez pas une plante valide.")
return false
end
end
end
}

View 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 = "Fertilisant"
ITEM.description = "Un petit sac rempli de petits morceaux d'engrais, de salpêtre et de toutes les bonnes choses de jardinage dont vous avez besoin pour obtenir une récolte réussie et abondante."
ITEM.model = "models/props/de_dust/hr_dust/dust_flour_sack/dust_flour_sack.mdl"
ITEM.category = "Farming"
if (CLIENT) then
function ITEM:PopulateTooltip(tooltip)
local data = tooltip:AddRow("data")
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
data:SetText("Vous pouvez utiliser cet objet pour augmenter le niveau de fertilité d'une plante.")
data:SizeToContents()
end
end
ITEM.functions.Water = {
name = "Fertiliser",
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("Vous avez répandu de l'engrais autour de la plante....")
return true
else
player:Notify("Vous ne regardez pas une plante valide.")
return false
end
end
end
}

View 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 = "Arrosoir"
ITEM.description = "Un petit seau d'eau qui peut être rempli d'eau, spécialement conçu pour arroser les plantes."
ITEM.model = "models/props/de_inferno/hr_i/inferno_gardening_tools/inferno_watering_can.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("You can use this bucket directly on plants to water them and increase their Hydration levels\nYou can fill it at bodies of water or Water Caches.")
data:SizeToContents()
local water = tooltip:AddRow("water")
water:SetBackgroundColor(derma.GetColor("Error", tooltip))
water:SetText("Water: " ..self:GetData("water", 0).. "%")
water:SizeToContents()
end
end
ITEM.functions.Water = {
name = "Arroser la plante",
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("You water the plant with the contents of the bucket!")
else
player:Notify("You are not looking at a valid plant.")
end
end
else
player:Notify("There's not enough water on the bucket!")
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
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("You've refilled the Water Bucket to the brim with the waters from the wasteland to "..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("You've refilled the Watering Can to "..newValue.."%")
item:SetData("water", newValue)
client:EmitSound("ambient/water/water_spray1.wav")
else
client:ChatNotify("The bucket is full!")
end
else
client:ChatNotify("You are not looking at a valid Water Source!")
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

View File

@@ -0,0 +1,17 @@
--[[
| 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
PLUGIN.name = "Farming"
PLUGIN.author = "AleXXX_007, Legion (Ported from CatWork), modified by gb"
PLUGIN.description = "Farming system to grow some stuff."
ix.util.Include("sv_plugin.lua")

View File

@@ -0,0 +1,91 @@
--[[
| 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/
--]]
function PLUGIN:SaveCrops() -- this actually saves the garden beds, go figure?
local crops = {}
for k, v in pairs(ents.FindByClass("wn_crop")) do
crops[#crops + 1] = {
v:GetAngles(),
v:GetPos()
}
end
ix.data.Set("crops", crops)
end
function PLUGIN:LoadCrops()
local crops = ix.data.Get("crops")
if crops then
for k, v in pairs(crops) do
local entity = ents.Create("wn_crop")
entity:SetAngles(v[1])
entity:SetPos(v[2])
entity:Spawn()
end
end
end
function PLUGIN:SavePlants() -- need to work with mysql later cuz this might get heavy
local data = {}
for _, v in pairs(ents.FindByClass("cw_plant")) do
data[#data + 1] = {
position = v:GetPos(),
angles = v:GetAngles(),
grow = v.GrowTime,
initialgrow = v.InitialGrowTime,
harvest = v.Harvest,
baseharvest = v.baseHarvest,
growthPercent = v.GrowthPercent,
isRuined = v.isRuined,
hydration = v.Hydration,
fertilizer = v.Fertilizer,
model = v:GetModel()
}
end
ix.data.Set("wn7farming", data)
end
function PLUGIN:LoadPlants()
local plantsData = ix.data.Get("wn7farming")
if plantsData then
for _, data in pairs(plantsData) do
local entity = ents.Create("cw_plant")
entity:SetPos(data.position)
entity:SetAngles(data.angles)
entity.GrowTime = data.grow
entity.InitialGrowTime = data.initialgrow
entity.Harvest = data.harvest
entity.baseHarvest = data.baseharvest
entity.GrowthPercent = data.growthPercent
entity.isRuined = data.isRuined or false
entity.Hydration = data.hydration or 10
entity.Fertilizer = data.fertilizer or 0
entity:Spawn()
entity:SetModel(data.model)
end
end
end
function PLUGIN:SaveData()
self:SaveCrops()
self:SavePlants()
end
function PLUGIN:LoadData()
self:LoadCrops()
self:LoadPlants()
end