Objects created during "normal" command (ie commands.add_command, not /c) are not "owned" by that mod
Posted: Fri Jun 12, 2020 3:10 pm
I noticed it with LuaRendering objects, but there are probably others. If you try and remove objects owned by a given mod, eg rendering.clear(modname), it will not remove ones added by commands that mod owns. It will remove ones spawned by the same code, but with the root caller being some event or something rather than running the command.
Rseding briefly commented on this on the discord:
This has a really nasty gotcha in it, too: It means that any command designed to "refresh" these objects will work perfectly...once. Upon which time it is never going to work again, as the new ones created are not owned by the mod. I nearly fell for that trap creating exactly that sort of command in my Bioluminescence mod.
Rseding briefly commented on this on the discord:
And while that makes sense for "loose" /c commands, it does not for ones added by - and therefore completely owned by - a mod.Console commands run in the scenario lua context.
Why would they be associated with some other mod?
This has a really nasty gotcha in it, too: It means that any command designed to "refresh" these objects will work perfectly...once. Upon which time it is never going to work again, as the new ones created are not owned by the mod. I nearly fell for that trap creating exactly that sort of command in my Bioluminescence mod.