Jump to content

Transparency issues with Gestalts (plus small targeting inconsistency)


hoxi
  • Pending

In gestalt.lua:

local function Client_CalcSanityForTransparency(inst, observer)
	if inst.components.inspectable ~= nil then
		return TUNING.GESTALT_COMBAT_TRANSPERENCY
	end

	local sanity = observer and observer.replica.sanity
	local x = sanity and sanity:IsLunacyMode() and math.max(0, observer.replica.sanity:GetPercentWithPenalty() - TUNING.GESTALT_MIN_SANITY_TO_SPAWN) / (1 - TUNING.GESTALT_MIN_SANITY_TO_SPAWN) or 0
	return math.min(0.5, 0.4*x*x*x + 0.3)
end

And gestalt_guard.lua and gestalt_guard_evolved.lua:

local function Client_CalcTransparencyRating(inst, observer)
	if inst.components.inspectable ~= nil then
		return TUNING.GESTALT_COMBAT_TRANSPERENCY -- 0.85
	end

	local level, sanity = GetLevelForTarget(observer)
	if level >= 3 then
		return TUNING.GESTALT_COMBAT_TRANSPERENCY -- 0.85
	end

	local x = (.7*sanity - .7)
	return math.min(x*x + .2, TUNING.GESTALT_COMBAT_TRANSPERENCY)
end

Checking for inst.components.inspectable ~= nil will never be true for clients (except for client hosts in non-dedicated servers), as the component is only created on the server.

 

Something like this would be needed for this to work:

if TheWorld.ismastersim then
	if inst.components.inspectable ~= nil then
		return TUNING.GESTALT_COMBAT_TRANSPERENCY
	end
elseif inst:HasTag("inspectable") then
	return TUNING.GESTALT_COMBAT_TRANSPERENCY
end

Could also just simply check for the "inspectable" tag for both server and clients.

 

---------------------------------------------------------------------------------------------------------------------

 

For gestalt_guard.lua and gestalt_guard_evolved.lua, having gear that protects against Gestalts (from wearing the Enlightened Crown or Brightshade Helm) isn't accounted for transparency either, and will result in combat transparency being used when combining said gear with shadow gear, despite not aggroing them:

local function GetLevelForTarget(target)
	-- L1: 0.5 to 1.0 is ignore
	-- L2: 0.0 to 0.5 is look at behaviour
	-- L3: shadow target, attack it!

	if target ~= nil then
		if target:HasTag("gestalt_possessable") then
			return 3, 0
		end

		local inventory = target.replica.inventory
		if inventory ~= nil and inventory:EquipHasTag("shadow_item") then
			return 3, 0
		end

		local sanity_rep = target.replica.sanity
		if sanity_rep ~= nil then
			local sanity = sanity_rep:IsLunacyMode() and sanity_rep:GetPercentWithPenalty() or 0
			local level = sanity > 0.33 and 1
					or 2
			return level, sanity
		end

		-- please update this to use HasAnyTag
		for i = 1, #shadow_tags do
			if target:HasTag(shadow_tags[i]) then
				return 3, 0
			end
		end

	return 1, 1
end

And:

local function GetLevelForTarget(target)
	-- L1: 0.5 to 1.0 is ignore
	-- L2: 0.0 to 0.5 is look at behaviour
	-- L3: shadow target, attack it!

	if target ~= nil then
		if target:HasTag("gestalt_possessable") then
			return 3, 0
		end

		local inventory = target.replica.inventory
		if inventory ~= nil and inventory:EquipHasTag("shadow_item") then
			return 3, 0
		end

		local sanity_rep = target.replica.sanity
		if sanity_rep ~= nil then
			local sanity = sanity_rep:IsLunacyMode() and sanity_rep:GetPercentWithPenalty() or 0
			local level = (sanity < 0.33 and 1) or 3
			return level, sanity
		end

        if target:HasAnyTag(shadow_tags) then
            return 3, 0
        end
	end

	return 1, 1
end

 

Could have something like this:

local function GetLevelForTarget(target)
	-- L1: 0.5 to 1.0 is ignore
	-- L2: 0.0 to 0.5 is look at behaviour
	-- L3: shadow target, attack it!

	if target ~= nil then
		local inventory = target.replica.inventory

		-- we ignore targets with gestalt protection
		if inventory ~= nil and inventory:EquipHasTag("gestaltprotection") then
			local sanity_rep = target.replica.sanity
			return 1, sanity_rep ~= nil and sanity_rep:IsLunacyMode() and sanity_rep:GetPercentWithPenalty() or 0
		end

		-- rest of the function

 

The Retarget functions would need to be changed accordingly too to remove the gestalt protection check (as it'd be already checked in GetLevelForTarget), except for when gestalt_guard_evolved.lua checks for inst.tracking_target, as shown below:

EDIT: disregard the strikethrough bit, there's so many issues with targeting explained in another report that things need be set in a consistent way in the first place. The KeepTarget function needs to be looked at too. All of these should probably use GetLevelForTarget in some way (the version above with the gestalt protection check).

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

		-- If our potential target has a gestalt item, don't target them.
		local target_inventory = inst.tracking_target.components.inventory
		if target_inventory ~= nil and target_inventory:EquipHasTag("gestaltprotection") then
			return nil
		end

		return inst.tracking_target
	else

 

Doing so will result in more consistent behavior, as currently, the following function in both files:

local function OnNewCombatTarget(inst, data)
	inst.behaviour_level = GetLevelForTarget(data.target)

	if inst.components.inspectable == nil then
		inst:AddComponent("inspectable")
		inst:AddTag("scarytoprey")
	end
end

Sets a behavior level without checking for protection gear, while the Retarget functions do check for gear, so there's some conflicting conditions between GetLevelForTarget and Retarget.


Steps to Reproduce

Regarding the first issue:

  • Create a world without caves enabled.
  • Go to the lunar island or lunar grotto, with enlightenment above 25% but below 50%. So that Gestalts don't follow you or attack you, and are very transparent.
  • Get close to them so that they become inspectable.
  • Notice how they become less transparent when inspectable (note, they won't become more transparent on moving away due to another bug, this doesn't happen above 50% sanity).
  • Try to reproduce these steps again on a world with caves enabled, or by joining the previous world as another player. Notice how the transparency won't change when they become inspectable.

These steps also apply to Greater Gestalts (and the new Greaterer Gestalts), when they have targets that aren't the player.

  • Go to the Lunar Grotto with the archives powered on, and observe Greater Gestalts fighting shadow creatures. Repeat the last step above.

---------------------------------------------------------------------------------------------------------------------

Regarding the second issue:

  • Get near a Greater Gestalt, while at high sanity/enlightenment, they should be pretty transparent.
  • Equip the Enlightened Crown, then a Dark Sword.
  • Notice how they'll become less transparent, as if aggro'd (you can compare this to using the sword without the crown, you'll get attacked).

 

Note: in both cases, when you as the local player are being targeted, they will be even less transparent, as intended, due to the transparenttosanity component handling it as so. This is mainly an issue when they target other things (or when they observe targets without necessarily being aggressive) and are supposed to become very visible to everyone.




User Feedback


There are no comments to display.



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