rons0n Posted November 27, 2018 Share Posted November 27, 2018 Yeah I already know mods do this, but I tried it out with my custom fertilizer and normal fertilizer and it doesnt reduce the uses after adding it into the farmplots. So can someone help me edit this: AddComponentPostInit("crop", function(self) local old = self.Fertilize function self:Fertilize(fertilizer) local pt = self.inst:GetPosition() local ents = GLOBAL.TheSim:FindEntities(pt.x, pt.y, pt.z, 5, {"player", "greenthumb"}, {"playerghost"}) if #ents > 0 then self.growthpercent = self.growthpercent + fertilizer.components.fertilizer.fertilizervalue * self.rate self.inst.AnimState:SetPercent("grow", self.growthpercent) if self.growthpercent >=1 then self.inst.AnimState:PlayAnimation("grow_pst") self:Mature() self.task:Cancel() self.task = nil end if (fertilizer.components.stackable ~= nil) then fertilizer.components.stackable:Get(1):Remove() end return true else return old(self, fertilizer) end end end) So it consumes the uses each time I use my fertilizers. Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/99651-can-plant-crops-in-the-winter/ Share on other sites More sharing options...
rons0n Posted November 28, 2018 Author Share Posted November 28, 2018 (edited) Derp: AddComponentPostInit("crop", function(self) local old = self.Fertilize function self:Fertilize(fertilizer) local pt = self.inst:GetPosition() local ents = GLOBAL.TheSim:FindEntities(pt.x, pt.y, pt.z, 5, {"player", "greenthumb"}, {"playerghost"}) if #ents > 0 then self.growthpercent = self.growthpercent + fertilizer.components.fertilizer.fertilizervalue * self.rate self.inst.AnimState:SetPercent("grow", self.growthpercent) if self.growthpercent >=1 then self.inst.AnimState:PlayAnimation("grow_pst") self:Mature() self.task:Cancel() self.task = nil end if (fertilizer.components.stackable ~= nil) then fertilizer.components.stackable:Get(1):Remove() end if (fertilizer.components.finiteuses ~=nil) then fertilizer.components.finiteuses:Use(1) end return true else return old(self, fertilizer) end end end) It was obvious but im a dumb boi, for anyone else who needs it here you go Edited November 28, 2018 by rons0n Link to comment https://forums.kleientertainment.com/forums/topic/99651-can-plant-crops-in-the-winter/#findComment-1123269 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now