mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-18 14:13:46 +03:00
Upload
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user