LuaRendering get ids of current scenario ("level")
Posted: Thu Aug 06, 2020 8:49 am
Split off suggestion from unrelated post
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.