Skip to content

feat(world): expose empty_grace_ms global + log Lua callback errors#14

Merged
Taure merged 1 commit intomainfrom
feat/empty-grace-and-error-visibility
Apr 26, 2026
Merged

feat(world): expose empty_grace_ms global + log Lua callback errors#14
Taure merged 1 commit intomainfrom
feat/empty-grace-and-error-visibility

Conversation

@Taure
Copy link
Copy Markdown
Contributor

@Taure Taure commented Apr 26, 2026

Summary

Pairs with widgrensit/asobi#86 (lobby lifecycle + empty_grace_ms feature).

  • config: read empty_grace_ms Lua global and forward it as empty_grace_ms in mode config so games can configure how long an empty world stays alive before reaping.
  • world: leave / spawn_position / zone_tick / handle_input now log when the Lua callback errors instead of silently swallowing the error. This was hiding bugs in user-supplied scripts.
  • world: generate_world surfaces lua_loader:new failures via logger:error instead of returning an empty world that looks fine.
  • world: decode_phases logs a warning when the Lua phases() table isn't a list. Hides nothing now.

Test plan

  • rebar3 fmt --check clean
  • rebar3 xref clean
  • rebar3 dialyzer clean
  • ~/bin/elp eqwalize-all — only pre-existing errors (verified via stash)
  • rebar3 eunit 62 tests, 0 failures (incl. new empty_grace_ms_forwarded test)
  • Wire up to barrow's world.lua (empty_grace_ms = 900000) in follow-up commit

Pairs with widgrensit/asobi#86 (lobby lifecycle + empty_grace_ms feature).

- feat(config): read `empty_grace_ms` Lua global and forward it as
  empty_grace_ms in mode config. asobi_world_server reads it and keeps
  worlds alive briefly after the last player leaves; barrow uses this
  for hub worlds so brief disconnects don't tear them down.

- fix(world): leave / spawn_position / zone_tick / handle_input now
  log when the Lua callback errors instead of silently swallowing.
  Pre-fix, only post_tick logged; broken user scripts could degrade
  gameplay invisibly. Single log_lua_error/3 helper, severity=error
  for genuine errors, severity=timeout for timeouts.

- fix(world): generate_world surfaces lua_loader:new failures via
  logger:error before falling back to empty zones. Previously silent.

- fix(world): decode_phases logs a warning when the Lua phases() table
  isn't a list. Hides nothing now.
@Taure Taure merged commit 442a225 into main Apr 26, 2026
15 checks passed
@Taure Taure deleted the feat/empty-grace-and-error-visibility branch April 26, 2026 09:24
Taure added a commit that referenced this pull request Apr 26, 2026
Brings in widgrensit/asobi#86: world-server lifecycle fixes plus the
empty_grace_ms feature consumed by asobi_lua_config (#14).

- world.create now reflects the creator in the join reply
- already_in_world rejection on join when player is in another world
- empty world stays alive for empty_grace_ms after last leave
- ETS player->world tracking with cleanup on terminate
- loading state postpones join until init completes
- empty phases() no longer auto-finishes the world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant