Adding a component to an entity checks all assigned mod component actions and adds them to modactioncomponents field, which is later used to fill actionreplica.modactioncomponents (net_smallbytearray).
Removing a component from an entity does not remove said actions from modactioncomponents field.
Adding the same component to the entity again adds duplicate component reference to modactioncomponents.
Repeating the removal and addition increases the field's size without limit, which net_smallbytearray can't hold and issues error Net array has 32 elements; exceeds maximum size of 31.
Thanks to @DejaVuZXY for noticing it and cooperation during investigation.
Steps to reproduce:
Enable (server) mod with this modmain.lua:
AddComponentAction("SCENE", "inspectable", function(inst, doer, actions, right) end) AddComponentAction("SCENE", "workable", function(inst, doer, actions, right) end) AddComponentAction("SCENE", "lootdropper", function(inst, doer, actions, right) end)
Join the world. Enter the following into the debug console:
e=c_find('evergreen'); dumptable(e.modactioncomponents) e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents) e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents) e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents) e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents)
Which produces:
K: Test3 V table: 5B2B8868 K: 1 V: 1 K: 2 V: 2 K: 3 V: 3 K: 4 V: 1 K: Test3 V table: 5B2B8868 K: 1 V: 1 K: 2 V: 2 K: 3 V: 3 K: 4 V: 1 K: 5 V: 1 K: Test3 V table: 5B2B8868 K: 1 V: 1 K: 2 V: 2 K: 3 V: 3 K: 4 V: 1 K: 5 V: 1 K: 6 V: 1 K: Test3 V table: 5B2B8868 K: 1 V: 1 K: 2 V: 2 K: 3 V: 3 K: 4 V: 1 K: 5 V: 1 K: 6 V: 1 K: 7 V: 1 K: Test3 V table: 5B2B8868 K: 1 V: 1 K: 2 V: 2 K: 3 V: 3 K: 4 V: 1 K: 5 V: 1 K: 6 V: 1 K: 7 V: 1 K: 8 V: 1
Moved above, because this can't handle [code] tags [/code].
-
2
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 accountSign in
Already have an account? Sign in here.
Sign In Now