z_mirror/CursorEnhancements
git clone https://git.raiguard.me/z_mirror/CursorEnhancements
848a4d4
proxies
1local util ={} 2 3function util . apply_overrides ( data , overrides , item_prototypes ) 4for item , next_item in pairs ( overrides ) do 5if item_prototypes [ item ] and ( next_item and item_prototypes [ next_item ] or true ) then 6local old_next_item 7-- this entity 8local item_data =data [ item ] 9if item_data then 10old_next_item =item_data . next 11if next_item then 12item_data . next =next_item 13else 14item_data . next =nil 15if not item_data . previous then 16data [ item ] =nil 17end 18end 19elseif next_item then 20data [ item ] ={ next =next_item } 21end 22-- old next's previous 23if old_next_item then 24local old_next_data =data [ old_next_item ] 25if old_next_data then 26old_next_data . previous =nil 27if not old_next_data . next then 28data [ old_next_item ] =nil 29end 30end 31end 32-- new next's previous 33if next_item then 34local next_item_data =data [ next_item ] 35if next_item_data then 36next_item_data . previous =item 37elseif next_item then 38data [ next_item ] ={ previous =item } 39end 40end 41end 42end 43 44return data 45end 46 47return util