z_mirror/CursorEnhancements
git clone https://git.raiguard.me/z_mirror/CursorEnhancements
b4ff864
smart-quickbar
1local util =require ( "__CursorEnhancements__/scripts/util" ) 2 3--- @param e EventData.CustomInputEvent 4local function on_recall_last_item ( e ) 5local player =game . get_player ( e . player_index ) 6if not player then 7return 8end 9 10local last_item =global . last_item [ e . player_index ] 11if not last_item then 12return 13end 14 15util . set_cursor ( player , last_item ) 16end 17 18--- @param e EventData.on_player_cursor_stack_changed 19local function on_player_cursor_stack_changed ( e ) 20local player =game . get_player ( e . player_index ) 21if not player then 22return 23end 24 25local item =util . get_cursor_item ( player ) 26if not item then 27return 28end 29 30global . last_item [ e . player_index ] =item 31end 32 33local recall_last_item ={} 34 35recall_last_item . on_init =function () 36--- @type table<uint, string?> 37global . last_item ={} 38end 39 40recall_last_item . events ={ 41[ "cen-recall-last-item" ] =on_recall_last_item , 42[ defines . events . on_player_cursor_stack_changed ] =on_player_cursor_stack_changed , 43} 44 45return recall_last_item