Jump to content

Gestalt and Greater Gestalt transparency issues


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

	local x = (observer ~= nil and observer.replica.sanity ~= nil) and (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
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

In both of these, checking for inst.components.inspectable ~= nil will never be true for clients, as the component is only created on the server.

Something like this could be done instead:

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

I'm not sure if inst:HasActionComponent is cheap or not though for something like this, but if I find a cheaper method I'll edit the post.

EDIT: at the time I made this report I wasn't sure if entity tags synced or not. That should be much cheaper than HasActionComponent? Said check could be used for all cases instead of just clients, like this:

if inst:HasTag("inspectable") then
	return TUNING.GESTALT_COMBAT_TRANSPERENCY
end

But maybe only clients should be checking for it, I'm not sure what'd be best.

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

Gestalt protection (from wearing the Enlightened Crown or Brightshade Helm) isn't accounted for transparency either, and can result in a Greater Gestalt using combat transparency when wearing the Crown + shadow gear, like a Dark Sword, despite not being aggressive towards anyone:

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:GetPercentWithPenalty() or 0
			local level = sanity > 0.33 and 1
					or 2
			return level, sanity
		end

		for i = 1, #shadow_tags do
			if target:HasTag(shadow_tags[i]) then
				return 3, 0
			end
		end
	end

	return 1, 1
end

Could be 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:GetPercentWithPenalty() or 1 -- sanity still defines transparency
		end

		if target:HasTag("gestalt_possessable") or 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:GetPercentWithPenalty() or 0
			local level = sanity > 0.33 and 1
					or 2
			return level, sanity
		end

		for i = 1, #shadow_tags do
			if target:HasTag(shadow_tags[i]) then
				return 3, 0
			end
		end
	end

	return 1, 1
end

Also, is it intended for sanity to basically check backwards here? Greater Gestalts only stare at players with 33% sanity/enlightenment or less, which doesn't align with what Gestalts do.

Also, the Retarget function should also probably be changed if the function above is changed, to not check for Gestalt protection there as well, by removing these lines from it:

        if target.components.inventory ~= nil and target.components.inventory:EquipHasTag("gestaltprotection") then
            return false
        end

Both of these changes would also result in more consistent behavior, as currently the following function:

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 based on not checking for Gestalt protection, while the Retarget function does, so there's some conflicting conditions there.


Steps to Reproduce

Regarding the first issue:

  1. Create a world without caves enabled.
  2. 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.
  3. Get close to them so that they become inspectable.
  4. 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).
  5. 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 when they have targets that aren't the player.

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

Regarding the second issue:

  1. Get near a Greater Gestalt while at high enlightenment, they should be pretty transparent.
  2. Equip the Enlightened Crown, then a Dark Sword.
  3. Notice how they'll become less transparent, as if aggro'd (you can compare this by removing the crown, just make sure to keep your distance).



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