Jump to content

Recommended Posts

Hello, I am trying to port the bucket-o-poop from RoG to the base game of don't starve, I have gotten everything working except the fact that it takes the entire bu cket-o-poop instead of 10% of it's durability. I know what the issue is, I just don't know how to fix it. 

 

It is inside the actions.lua but I have no idea how to edit that within a mod as it is in the base game. 

 

Can anyone help me out? 

 

here is the code:

 

Modmain.lua http://pastebin.com/1QSeDDC4

 

scripts/prefabs/fertilizer.lua http://pastebin.com/VHamjAuD

 

if you take a look at actions.lua in the original game and actions.lua in dlc0001 aka RoG, they are different and I do not know what part of it is actually giving the bucket back, can someone give me some info and help me out? I would be really appreciative, I am pretty new to modding so I don't know a lot of things yet. Thank you :-)

Edited by bigpak

@bigpak

 

Hmm. For some reason, I think the problem may related to the finiteuses component instead. Couldn't find exactly where that might be, though.

This is the portion in actions.lua relevant to fertilizer (line 339 - 356).

ACTIONS.FERTILIZE.fn = function(act)    if act.target and act.target.components.crop and not act.target.components.crop:IsReadyForHarvest() and not act.target.components.crop:IsWithered() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        if act.target.components.crop:Fertilize(obj) then			return true		else			return false		end    elseif act.target.components.grower and act.target.components.grower:IsEmpty() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        act.target.components.grower:Fertilize(obj)	elseif act.target.components.pickable and act.target.components.pickable:CanBeFertilized() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        act.target.components.pickable:Fertilize(obj)		return true			endend

I think you can implement it through the GLOBAL.ACTIONS variable in your modmain.

ACTIONS = GLOBAL.ACTIONS-- See note below..ACTIONS.FERTILIZE = Action()-- Copied from actions.luaACTIONS.FERTILIZE.fn = function(act)    if act.target and act.target.components.crop and not act.target.components.crop:IsReadyForHarvest() and not act.target.components.crop:IsWithered() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        if act.target.components.crop:Fertilize(obj) then			return true		else			return false		end    elseif act.target.components.grower and act.target.components.grower:IsEmpty() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        act.target.components.grower:Fertilize(obj)	elseif act.target.components.pickable and act.target.components.pickable:CanBeFertilized() and act.invobject and act.invobject.components.fertilizer then        local obj = act.invobject        act.target.components.pickable:Fertilize(obj)		return true			endend

You may need to define the Action class locally. I'm not sure if there's any better way to access it.

require "class"-- ...Action = Class(function(self, priority, instant, rmb, distance)     self.priority = priority or 0    self.fn = function() return false end    self.strfn = nil    self.testfn = nil    self.instant = instant or false    self.rmb = rmb or nil    self.distance = distance or nilend)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...