z_mirror/FluidMustFlow
git clone https://git.raiguard.me/z_mirror/FluidMustFlow
33db450
trunk
1game . simulation . camera_position ={ 0 , 0.5 } 2 3storage . player =game . simulation . create_test_player ( { name ="foo" } ) 4storage . character =storage . player . character 5storage . character . teleport ( { 0 , 3 } ) 6 7game . simulation . camera_player =storage . player 8 9step_0 =function () 10game . simulation . camera_player_cursor_position ={ 0 , 3 } 11game . simulation . camera_player_cursor_direction =defines . direction . east 12target_cursor_position ={ - 5 , - 1 } 13script . on_nth_tick ( 1 , function () 14local finished =game . simulation . move_cursor ( { position =target_cursor_position } ) 15if finished then 16step_1 () 17end 18end ) 19end 20 21step_1 =function () 22storage . character . cursor_stack . set_stack ( { name ="duct-small" , count =10 } ) 23target_cursor_position ={ 5 , - 1 } 24script . on_nth_tick ( 1 , function () 25local finished =game . simulation . move_cursor ( { position =target_cursor_position , speed =0.1 } ) 26 27if storage . player . can_build_from_cursor ( { position =game . simulation . camera_player_cursor_position } ) then 28storage . player . build_from_cursor ( { 29position =game . simulation . camera_player_cursor_position , 30direction =defines . direction . east , 31} ) 32end 33 34if finished then 35step_2 () 36end 37end ) 38end 39 40step_2 =function () 41target_cursor_position ={ 0 , 3 } 42script . on_nth_tick ( 1 , function () 43local finished =game . simulation . move_cursor ( { position =target_cursor_position } ) 44if finished then 45finish () 46end 47end ) 48end 49 50finish =function () 51storage . finished_tick =game . tick 52 53script . on_nth_tick ( 1 , function () 54if game . tick == storage . finished_tick + 90 then 55for _ , entity in pairs ( game . surfaces [ 1 ]. find_entities_filtered ( { name ={ "duct" , "duct-long" } } )) do 56entity . destroy () 57end 58step_0 () 59end 60end ) 61end 62 63step_0 ()