credomane wrote: Thu Aug 06, 2020 2:15 am It would be nice if there was a magic variable like __SCENARIO__ that would always refer to the scenario (be it freeplay, sandbox, campaign, or some other custom scenario). That way sound.get_all_ids(__SCENARIO__) would return only ids made by the scenario and not any created by a mod. If there is one what is it and where is it documented? Only way I've considered on how to do it with LuaRendering is the hardway:
Code: Select all
--Pseudo code local allids=rendering.get_all_ids(); local allmodids={}; local scenarioids={}; for name, _ in pairs(game.active_mods) do local modids=rendering.get_all_ids(name); for _,v in pairs(modids) do allmodids[v]=true; end end for _,v in pairs(allids) do if type(allmodids[v]) == nil do table.insert(scenarioids,v); end end --scenarioids now only has ids that don't belong to mods. Assuming my psuedo code is correct.
LuaRendering get ids of current scenario ("level")
LuaRendering get ids of current scenario ("level")
Split off suggestion from unrelated post
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: LuaRendering get ids of current scenario ("level")
I made the get-all-ids and clear() function accept an empty string to mean "level".
If you want to get ahold of me I'm almost always on Discord.