z_mirror/EvenDistributionLite
git clone https://git.raiguard.me/z_mirror/EvenDistributionLite
1009eca
simulation
1--- @type LuaPlayer 2local player =game . create_test_player ( { name ="big k" } ) --- @diagnostic disable-line 3player . teleport ( { 0 , 4 } ) 4 5game . camera_player =player 6game . camera_player_cursor_position =player . position 7game . camera_alt_info =true 8 9local path ={ 10{ 11on_started =function () 12game . camera_player_cursor_position ={ 0 , 4 } 13player . clear_cursor () 14end , 15wait_time =30 , 16} , 17{ 18on_started =function () 19player . character . cursor_stack . set_stack ( { name ="copper-plate" , count =100 } ) 20end , 21wait_time =30 , 22} , 23{ 24target ={ - 7 , - 1 } , 25wait_time =30 , 26} , 27{ 28target ={ 7 , - 1 } , 29wait_time =120 , 30} , 31{ 32target ={ 0 , 4 } , 33} , 34} 35 36local step =1 37local started =false 38local wait_until_tick =0 39 40script . on_event ( defines . events . on_tick , function () 41if wait_until_tick > game . tick then 42return 43end 44local data =path [ step ] 45if not data then 46step =1 47started =false 48return 49end 50if not started and data . on_started then 51started =true 52data . on_started () 53end 54local finished =true 55if data . target then 56finished =game . move_cursor ( { position =data . target , speed =data . speed } ) --- @diagnostic disable-line 57if data . on_moved then 58data . on_moved () 59end 60end 61if not finished then 62return 63end 64step =step + 1 65started =false 66if data . on_finished then 67data . on_finished () 68end 69if data . wait_time then 70wait_until_tick =game . tick + data . wait_time 71end 72end )