Jump to content

Giant symbol tables in clothing.lua


Tykvesh
  • Fixed

Skinner and Skinner_Beefalo components use these tables to hide and clear AnimState symbols:

  • CLOTHING_SYMBOLS
  • HIDE_SYMBOLS
  • BEEFALO_CLOTHING_SYMBOLS
  • BEEFALO_HIDE_SYMBOLS

However the tables contain hundreds of duplicates, for example CLOTHING_SYMBOLS has 2097 values:

CLOTHING_SYMBOLS = {}
HIDE_SYMBOLS = {}
for _,v in pairs(CLOTHING) do
	for _,sym in pairs(v.symbol_overrides) do
		table.insert( CLOTHING_SYMBOLS, sym )
	end
	if v.symbol_hides then
		for _,sym in pairs(v.symbol_hides) do
			table.insert( HIDE_SYMBOLS, sym )
		end
	end
end

So this code from Skinner runs 2097 times each time SetSkinsOnAnim is used:

for _,sym in pairs(CLOTHING_SYMBOLS) do
	anim_state:ClearOverrideSymbol(sym)
end

This is really unnecessary, I suggest changing the code to this:

CLOTHING_SYMBOLS = {}
HIDE_SYMBOLS = {}
for _,v in pairs(CLOTHING) do
	for _,sym in ipairs(v.symbol_overrides) do
		CLOTHING_SYMBOLS[sym] = true
	end
	if v.symbol_hides then
		for _,sym in ipairs(v.symbol_hides) do
			HIDE_SYMBOLS[sym] = true
		end
	end
end
for sym in pairs(CLOTHING_SYMBOLS) do
	anim_state:ClearOverrideSymbol(sym)
end

anim_state:ClearSymbolExchanges()
for sym in pairs(HIDE_SYMBOLS) do
	anim_state:ShowSymbol(sym)
end

Same goes for the beefalo part.


Steps to Reproduce

~

  • Like 3
  • Thanks 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...