-- The gate's driver mod (docs/lua-modding.md, "The gate's driver mod"). Ships disabled: a run enables a copy of it. -- It needs LEONIDA_GAME_ACTIONS=1 for the player's position. An optional gate.txt beside this file sets -- `mode = idle` or `mode = roam` and any number of driver.lua's defaults (`give_up = 600`, ...), one a line. local driver = require("driver") local config = {} local text = leonida.read_file("gate.txt") if text then for line in text:gmatch("[^\r\n]+") do local key, value = line:match("^%s*([%w_]+)%s*=%s*(.-)%s*$") if key == "mode" and (value == "idle" or value == "roam") then config.mode = value elseif key and type(driver.defaults[key]) == "number" and tonumber(value) then config[key] = tonumber(value) end end end local d = driver.new({ time = leonida.time, frame = leonida.frame, position = leonida.player_position, hold = leonida.hold_keys, release = leonida.release_keys, shot = leonida.screenshot, log = leonida.log, }, config) leonida.log("GATE", "loaded", "mode=" .. d.cfg.mode) leonida.on("frame", function() d:step() end)