mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 07:41:21 +02:00
e79107c644
A platform-specific launcher wrapper (a native shell embedding this engine, owning its own UI around the game window) needs to pause the simulation while its own UI is on top, live-reload options it wrote outside any Lua UI, and veto main.lua's "closing the window returns to the Lua launcher" behavior when it owns that job itself. Implementing this by hand-patching main.lua's love.update/love.quit directly ties every such integration to editing the one file every other engine change also touches, guaranteeing merge conflicts. No existing hook covers "should the per-frame simulation step run" or "should closing the window return to the Lua launcher." Adds two generic, additive hooks (src/core/PlatformHooks.lua): core.update and core.quit_to_launcher, replacing what would otherwise be inline main.lua special-casing. Also adds Manifest.force_enable_env, letting a mod that cannot function disabled on the one build where its env var is set (a platform-bridge mod bundled only with that build) re-enable itself regardless of a saved disable. RFC 0006 status: Proposed.
19 lines
675 B
Lua
19 lines
675 B
Lua
-- Generic process-lifecycle mod hooks so a platform-specific launcher
|
|
-- integration (a native shell embedding this engine, e.g. wrapping the
|
|
-- window in a platform UI) can live entirely in a mod instead of
|
|
-- hand-patching main.lua, which every other engine change also touches.
|
|
-- See docs/modding.md's "Process-lifecycle hooks" section.
|
|
local ModRuntime = require("src.mods.Runtime")
|
|
|
|
local PlatformHooks = {}
|
|
|
|
function PlatformHooks.update(game, dt)
|
|
return ModRuntime.call("core.update", function(g, d) g:update(d) end, game, dt)
|
|
end
|
|
|
|
function PlatformHooks.quitToLauncher(vanilla)
|
|
return ModRuntime.call("core.quit_to_launcher", vanilla)
|
|
end
|
|
|
|
return PlatformHooks
|