Sign in to follow this  

Gingerbread Pigs - Stale Component Reference


KoreanWaffles
  • Pending

Sometimes the console spams a Stale Component Reference error that refers to line 1065 of entityscript.lua which is the following function

function EntityScript:GetPosition()
    return Point(self.Transform:GetWorldPosition())
end

Calling GetPosition on an invalid entity will cause a Stale Component Reference. The entity in question has been traced back to Gingerbread Pigs, more specifically line 22 of brains/gingerbreadpigbrain.lua which is the following function

local function GetLeashTargetPosition(inst)
	return inst.leash_target and inst.leash_target:GetPosition()
end

leash_target is defined in behaviours/leash.lua. If a Gingerbread Pig calls GetLeashTargetPosition on an invalid player (e.g. the player has logged off), it will cause a Stale Component Reference since leash_target is referencing an entity that no longer exists.

I'm guessing changing the function to something like this would solve the issue?

local function GetLeashTargetPosition(inst)
	return inst.leash_target and inst.leash_target:IsValid() and inst.leash_target:GetPosition() or inst:GetPosition()
end

 

Here's a snippet of how the server log might look. The Stale Component References go on for much longer, spamming the console for several minutes at a time.

Spoiler

[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065
[02:29:25]: Stale Component Reference: GUID 133116, scripts/entityscript.lua:1065

 


Steps to Reproduce

Start a Gingerbread Pig hunt?

  • Thanks 1
Sign in to follow this  


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