This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 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,156 @@
--[[
| 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 !(activator:GetCharacter():GetFaction() == FACTION_VORT) && self.vortOnly then
activator:Notify("You have no idea how to work with this strange plant.")
return false
end
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...")
if (self.returnSeed) then
activator:GetCharacter():GetInventory():Add(self.usedSeed)
end
self:Remove()
end)
end
if self.GrowthPercent >= 99 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
if (self.returnSeed) then
activator:GetCharacter():GetInventory():Add(self.usedSeed)
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,60 @@
--[[
| 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()
physObj:EnableMotion(false)
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,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 = "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
if !(client:GetCharacter():GetFaction() == FACTION_VORT) && item.vortOnly then
client:Notify("You have no idea how to work with these strange seeds.")
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("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 * 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("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(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("The plant won't survive for long as it's not in an open area with sunlight.")
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("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 = "Apple Seeds"
ITEM.description = "A tiny box with some apple seeds inside of it."
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 = "Banana Seeds"
ITEM.description = "A box with some banana seeds inside."
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 = "Berries Seeds"
ITEM.description = "A tiny box with some berries seeds inside of it."
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 = "Orange seeds"
ITEM.description = "Some orange orange seeds, inside of a box."
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 = "Pear Seeds"
ITEM.description = "A tiny box with some pear seeds inside of it."
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 = "Pineapple Seeds"
ITEM.description = "A tiny box with some pineapple seeds inside of it."
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 = "Potato Seeds"
ITEM.description = "A tiny box with some potato seeds inside of it."
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 = "Tomato Seeds"
ITEM.description = "A box with some tomato seeds inside. They're not red."
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 = "Watermelon Seeds"
ITEM.description = "A tiny box with some watermelon seeds inside of it."
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"

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 = "Xen Berries Seeds"
ITEM.description = "A fluroescent box with some weird seeds inside..."
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

View File

@@ -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 = "Xen Herbs Seeds"
ITEM.description = "A fluroescent box with some weird seeds inside..."
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

View File

@@ -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 = "Advanced Fertilizer"
ITEM.description = "A small sack filled with small lumps of fertilizer, saltpetre and all the gardening goodies that you need to make a succesful and bountiful harvest. This one has been masterfully crafted to feed all of the plant's needs."
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("You can use this item to increase the fertility & hydration of a plant")
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:SetNWInt("Fertilizer", 100)
trace.Entity.Fertilizer = 100
trace.Entity.Hydration = 100
player:ChatNotify("You spread some fertilizer around the plant... the plant is happy!")
return true
else
player:Notify("You are not looking at a valid plant.")
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 = "Gübre"
ITEM.description = "Başarılı ve bol bir hasat yapmak için ihtiyacınız olan küçük gübre topakları, güherçile ve tüm bahçe ürünleriyle dolu küçük bir çuval."
ITEM.model = "models/props_junk/garbage_milkcarton001a.mdl"
ITEM.category = "Çiftçilik"
if (CLIENT) then
function ITEM:PopulateTooltip(tooltip)
local data = tooltip:AddRow("data")
data:SetBackgroundColor(derma.GetColor("Error", tooltip))
data:SetText("You can use this item to increase the fertility level of a plant")
data:SizeToContents()
end
end
ITEM.functions.Water = {
name = "Gübrele",
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("You spread some fertilizer around the plant...")
return true
else
player:Notify("You are not looking at a valid plant.")
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 = "Sulama Kabı"
ITEM.description = "Metal bir kutu, özellikle Bitkileri sulamak için suyla doldurulabilen bir sulama kabı olarak yeniden kullanılabilir."
ITEM.model = "models/props_junk/metalgascan.mdl"
ITEM.category = "Çiftçilik"
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 = "Bitkiyi Sula",
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 = "Suyla Doldur",
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 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 Watering Can 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