Re: Tutorials: wallsets and custom monsters, objects, etc
Posted: Tue Mar 04, 2025 7:26 pm
The reason just setting the definition to nil doesn't work is that obj has a metatable that appends every newly created archetype's key to a hidden array as soon as it is created. Iterating over a Lua table has no particular order, so doing it this way ensures that you can iterate over archetypes in the order they're listed in objects.lua, which is usually what people are expecting to happen, and (since I was also expecting it to work this way!) got rid of a bunch of insidious bugs in early versions of DSB that didn't do it this way. When you nil the entry in obj the hidden entry still exists and DSB gets confused. I could probably fix this, if it's actually something people care about.