[Suggestion] Wildbores should help hack bamboo / vines


Recommended Posts

Hacking bamboo gets really tedious in the mid and late game. It would be really nice if you could hire Wildbores to help hack bamboo (and vines I guess, mainly just because they use the same system and there doesn't seem like a good reason to prevent them from being able to get hacked).

Edit: I wrote a small mod to enable this. But I want it to actually get added, so I'm not going to publish it. Here's the code, if it helps it get implemented at all:

AddStategraphActionHandler("wildbore", GLOBAL.ActionHandler(GLOBAL.ACTIONS.HACK, "chop"))

local SEE_HACKABLE_DIST = 15
local KEEP_HACKING_DIST = 10

local function StartHackingCondition(inst)
    return inst.components.follower.leader
		and inst.components.follower.leader.sg
		and inst.components.follower.leader.sg:HasStateTag("hacking")    
end

local function KeepHackingAction(inst)
    return inst.components.follower.leader
		and inst.components.follower.leader:GetDistanceSqToInst(inst) <= KEEP_HACKING_DIST*KEEP_HACKING_DIST
end

local function FindThingToHackAction(inst)
    local target = GLOBAL.FindEntity(inst, SEE_HACKABLE_DIST, function(item) return item.components.hackable and item.components.hackable:CanBeHacked() end)
    if target then
        return GLOBAL.BufferedAction(inst, target, GLOBAL.ACTIONS.HACK)
    end
end

AddBrainPostInit("wildborebrain", function(self)
	local hacknode =
			GLOBAL.IfNode(function() return StartHackingCondition(self.inst) end, "chop", 
                GLOBAL.WhileNode(function() return KeepHackingAction(self.inst) end, "keep chopping",
                    GLOBAL.LoopNode{ 
                        GLOBAL.ChattyNode(self.inst, {"KILL PLANT!", "SMASH MEAN PLANT!", "I PUNCH PLANT!"},
                            GLOBAL.DoAction(self.inst, FindThingToHackAction ))}))

	table.insert(self.bt.root.children[6].children[2].children, 3, hacknode)
end)

 

Link to comment
Share on other sites

The machete has a BIG advantage of being in SW besides for hacking stuff...Replacement for spear...I mean the spear has become useless except for making a sick stick or gem sticks...However aside from that I first want the soo called House blowing down thing to stop cause its really hard getting pig skins SW...

 

Forget all that...SMASH  MEAN PLANT!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.