Jump to content

Webber befriending pigs


CarlZalph
  • Fixed

Webber can make pigmen friends if timed properly and/or has luck with the brain logic ticks.

By having multiple meats at the ready to feed the pig, the Webber needs to feed multiple meats (2+) to be able to befriend it.

The second+ meats must be given right as the pig finishes the first and before its brain does a tick such that it isn't an enemy of the Webber while it's eating the second.

This makes the pig like the Webber and considers Webber a friend, since it wasn't hostile at the time of consumption.

 

See scripts/prefabs/pigman.lua:61-73::

        if item.components.edible.foodtype == FOODTYPE.MEAT or item.components.edible.foodtype == FOODTYPE.HORRIBLE then
            if inst.components.combat:TargetIs(giver) then
                inst.components.combat:SetTarget(nil)
            elseif giver.components.leader ~= nil and not inst:HasTag("guard") then
                giver:PushEvent("makefriend")
                giver.components.leader:AddFollower(inst)
                inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER)
                inst.components.follower.maxfollowtime =
                    giver:HasTag("polite")
                    and TUNING.PIG_LOYALTY_MAXTIME + TUNING.PIG_LOYALTY_POLITENESS_MAXTIME_BONUS
                    or TUNING.PIG_LOYALTY_MAXTIME
            end
        end

There should be a check in there to ensure that Webber/monsters can't befriend the pig just because the pig isn't hostile at that moment.

 

Fix:

        if item.components.edible.foodtype == FOODTYPE.MEAT or item.components.edible.foodtype == FOODTYPE.HORRIBLE then
            if inst.components.combat:TargetIs(giver) then
                inst.components.combat:SetTarget(nil)
            elseif giver.components.leader ~= nil and not inst:HasTag("guard") and not giver:HasTag("monster") then
                giver:PushEvent("makefriend")
                giver.components.leader:AddFollower(inst)
                inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER)
                inst.components.follower.maxfollowtime =
                    giver:HasTag("polite")
                    and TUNING.PIG_LOYALTY_MAXTIME + TUNING.PIG_LOYALTY_POLITENESS_MAXTIME_BONUS
                    or TUNING.PIG_LOYALTY_MAXTIME
            end
        end

 


Steps to Reproduce
Have a few meat and give the pigman a meat right after it is done eating the first, and if luck is on your side then it'll play the befriend tone and the pig likes you.
  • Like 1



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


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...