z_mirror/CursorEnhancements
git clone https://git.raiguard.me/z_mirror/CursorEnhancements
b9cfe41
proxies
1local global_data ={} 2 3local constants =require ( "constants" ) 4 5local util =require ( "scripts.util" ) 6 7function global_data . init () 8global . players ={} 9global . proxies ={ 10-- proxy unit_number -> target unit_number 11by_proxy ={} , 12-- target unit_number -> proxy entity 13by_target ={} 14} 15 16global_data . build_global_registry () 17end 18 19-- build the default upgrade/downgrade registry 20function global_data . build_global_registry () 21local entity_prototypes =game . entity_prototypes 22local item_prototypes =game . item_prototypes 23local data ={} 24 25-- auto-generated 26for name , prototype in pairs ( entity_prototypes ) do 27if prototype . next_upgrade and prototype . items_to_place_this then 28local next_item =prototype . next_upgrade . name 29for _ , item in ipairs ( prototype . items_to_place_this ) do 30if not data [ item . name ] then data [ item . name ] ={} end 31data [ item . name ]. next =next_item 32end 33for _ , item in ipairs ( entity_prototypes [ next_item ]. items_to_place_this ) do 34if not data [ item . name ] then data [ item . name ] ={} end 35data [ item . name ]. previous =name 36end 37end 38end 39 40-- default overrides 41for mod_name , overrides in pairs ( constants . default_overrides ) do 42if script . active_mods [ mod_name ] then 43util . apply_overrides ( data , overrides , item_prototypes ) 44end 45end 46 47global . registry =data 48end 49 50return global_data