Jump to content

Gestalt projectiles fired by a Possessed Chassis wearing the Enlightened Crown can hit allies


hoxi
  • Fixed

This includes players and other Possessed Chassis.

 

This happens due to this bit here:

local HATGUARD_COMBAT_MUSHAVE_TAGS = { "_combat", "_health" }
local HATGUARD_COMBAT_CANTHAVE_TAGS = { "INLIMBO", "structure", "wall", "companion" }

local function hatguard_find_attack_victim(inst)
    local hitrange = 0.75
    if inst._focustarget then
		return inst._focustarget:IsValid() and inst:IsNear(inst._focustarget, hitrange) and inst._focustarget or nil
    end

    local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, hitrange, HATGUARD_COMBAT_MUSHAVE_TAGS, HATGUARD_COMBAT_CANTHAVE_TAGS)
	for _, target in ipairs(ents) do
		if not target.components.health:IsDead() and
			not inst.components.combat:IsAlly(target) and
			inst.components.combat:CanTarget(target)
		then
			return target
		end
	end
end

The inst.components.combat:IsAlly(target) bit is checking if the target is an ally to the projectile itself, which does check for the projectile leader, which in this case is who's wearing the crown. This normally works when the player is the one wearing the crown, as there's a player leader check in the IsAlly function, but otherwise it won't.

Maybe getting the leader inst (in this case, the Possessed Chassis), and doing an extra IsAlly check from the leader's combat component would be the way to go? This would make it so the Possessed Chassis checks with its leader in the IsAlly function, which would be the WX-78 player.

That is, if not outright replacing the usual check (unless the leader doesn't exist), as this could ensure the projectile never hits something the user wouldn't hit/target (unless force-attacking, as an example).


Steps to Reproduce
  • Equip a Possessed Chassis with an Enlightened Crown.
  • Have them attack something.
  • Get in the way of the Gestalt projectile.
  • Notice how you'll be hit, despite the Possessed Chassis being a follower.
  • Repeat the steps with other player followers (including more Possessed Chassis) getting in the way of the Gestalt projectile.
  • Big Ups 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...