Skip to content

Instantly share code, notes, and snippets.

@choro3
Last active June 17, 2024 03:00
Show Gist options
  • Save choro3/3330d6800c6f86d1cb7f0c83b0586507 to your computer and use it in GitHub Desktop.
Save choro3/3330d6800c6f86d1cb7f0c83b0586507 to your computer and use it in GitHub Desktop.
factorio mod sample
mod_moving_state = {direction = nil, tick = 0}
commands.add_command("keep_going", nil, function(command)
mod_moving_state = {direction = defines.direction.north, tick = 30}
end)
script.on_event(defines.events.on_tick,
function(event)
if mod_moving_state.tick > 0 then
game.get_player(1).walking_state = {walking = true, direction = mod_moving_state.direction }
mod_moving_state = { direction = mod_moving_state.direction, tick = mod_moving_state.tick - 1 }
end
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment