Jump to content

StateGraphInstance:HasAnyStateTag doesn't handle tables properly


hoxi
  • Fixed

This is only an issue for a few cases thankfully.

In gestalt.lua:

local SLEEPING_TAGS = {"bedroll", "knockout", "sleeping", "tent", "waking"}
local function Retarget(inst)
    -- If we don't have a tracking target, are in combat cooldown, or are too far away, no target.
    if not inst.tracking_target
            or inst.components.combat:InCooldown()
            or not inst:IsNear(inst.tracking_target, TUNING.GESTALT_AGGRESSIVE_RANGE) then
        return nil
    end

    -- If our potential target is sleeping, don't target them.
    if inst.tracking_target.sg:HasAnyStateTag(SLEEPING_TAGS) then
        return nil
    end

In gestalt_guard_evolved.lua:

local SLEEPING_TAGS = {"bedroll", "knockout", "sleeping", "tent", "waking"}
local function Retarget(inst)
	if inst.tracking_target then
		if inst.components.combat:InCooldown()
				or not inst:IsNear(inst.tracking_target, TUNING.GESTALTGUARD_AGGRESSIVE_RANGE)
				or inst.tracking_target.sg:HasAnyStateTag(SLEEPING_TAGS) then
			return nil
		end

In SGgestalt_guard_evolved.lua:

In SGgestalt_guard_evolved.lua:

local INVALID_ATTACK_STATE_TAGS = {"bedroll", "knockout", "sleeping", "tent", "waking"}
local function TargetTestFn(target, inst)
    return not IsEntityDeadOrGhost(target)
        and (target.sg == nil or not target.sg:HasAnyStateTag(INVALID_ATTACK_STATE_TAGS))
		and inst.components.combat:CanTarget(target)
end

 


Steps to Reproduce
  • Test sending a table with tags that should absolutely be returning true, and see that it doesn't.

 

For the specific cases mentioned:

  • Test that Gestalts don't ignore sleeping players (don't test it with Inimical Gestalts, they have plenty of other issues I also reported).



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