Tameable Wings of Fire dragon pets for Luanti
  • Lua 79.2%
  • Shell 15.7%
  • Python 5.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Matth 9d79105db6 Add lockbox: a chest that opens only with a 4-digit code
A separate mod, not an extension of wings_of_fire -- neither mod.conf mentions
the other, so it can be installed, tested and dropped on its own. Normal chest
capacity (32 slots), and until the code is typed on its keypad nobody gets a
single item out of it.

The lock is deliberately not the formspec. A client can skip any UI we send, so
the enforcement sits in allow_metadata_inventory_move/put/take, which return 0
unless a per-position, per-player, expiring is_open() entry exists. What the
keypad produces is therefore only ever a request to be let in. The code is
stored as sha1(per-chest salt .. code) and never in the clear, so reading the
world's metadata does not hand over the digits, and two chests given the same
code store different hashes. The code stays a string throughout and never goes
through tonumber(), because "0071" is a legal code that would shrink to 71 and
lock its own owner out on the next try.

Four behaviour choices were made deliberately rather than assumed: anyone who
knows the code may open it (a real padlock, so it works to hand a box to a
friend); the owner can always reset a forgotten code, so a lost code costs the
digits and never the contents; five wrong tries bring a 60 s refusal with the
counter cleared on success, which caps a keyboard-less guessing rate; and the
box cannot be broken while it holds things.

That last one is enforced differently than it was asked, on purpose. The engine
destroys a removed node's contents, so letting a code-holder punch a full box
would mean the code buys you the right to lose everything inside. Punching is
allowed on an empty box only, and a loaded box comes up with the code plus an
explicit "Pack it all up": contents into the player, overflow dropped rather
than vanished, and the code plus owner riding on the dropped item so
after_place_node restores the same locked box wherever it lands. Same security
intent, no path that destroys contents. A box punched empty starts fresh, with
no code left behind.

Tested headless against the dev world: 74 checks in one boot plus 9 persistence
checks across a real restart, zero FAIL and zero lockbox Lua errors, on both
boots. Capacity parity is asserted by placing a real default:chest alongside
and comparing list sizes, not by comparing against a number typed into the
test, so if the game's chest ever changes the check notices. The persistence run
proves code, owner and cool-down counters survive a restart, that no unlock
grant leaks across one, and that the box is usable afterwards. Every scenario
also asserts it actually reached the state it means to test -- an early version
of a fixture never opened the box it was setting up, so a dozen checks were
confidently reporting on a world state that did not exist.

One finding worth keeping: the mod's own load line used minetest.log("info",
...), which produces nothing at this build's default debug_log_level. The mod
was loading fine -- 74 of its checks were passing in the same boot -- while a
grep of the whole server log for the mod name returned zero hits, which looked
exactly like a failed deploy. wings_of_fire logs its load line at "action",
which is why its line was visible and ours was not. Status lines here need to
be "action"; "info" is unreachable without raising the level on the live
server.

Deploy paths are wired for both worlds: tools/deploy.sh takes with_lockbox as
arg 3 and install-live.sh as arg 4, the latter skipping quietly on a tree that
has no mods/lockbox so an older checkout still installs. Nothing was pushed to
the live machine -- that stays the user's step.

Deliberately not in this commit: STARTUP_WARNINGS.md (the user's in-progress
startup-warning write-up, untouched here) and _luanti_logs.txt, the live log
dump, which stays untracked as before.
2026-09-28 16:08:04 +08:00
mods Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
test Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
tools Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
.gitignore Wings of Fire dragon pet mod for Luanti (Phase 1, all tests green) 2026-09-20 13:44:51 +08:00
AGENTS.md Add wild biome spawner, tribe traits, size variation, formation flying 2026-09-20 22:39:21 +08:00
DECISIONS.md Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
DEVELOPMENT_BRIEF.md Add wild biome spawner, tribe traits, size variation, formation flying 2026-09-20 22:39:21 +08:00
ENVIRONMENT.md Wings of Fire dragon pet mod for Luanti (Phase 1, all tests green) 2026-09-20 13:44:51 +08:00
GITHUB_UPLOAD.md Wings of Fire dragon pet mod for Luanti (Phase 1, all tests green) 2026-09-20 13:44:51 +08:00
install-live.sh Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
INSTALL_LIVE.md Wings of Fire dragon pet mod for Luanti (Phase 1, all tests green) 2026-09-20 13:44:51 +08:00
LICENSE Initial commit 2026-09-20 13:40:42 +08:00
PLAYER_GUIDE.md Stop /wof_stay killing the server and fix half-deploys in the deploy scripts 2026-09-23 11:36:14 +08:00
STARTUP_WARNINGS.md Document the asuna startup warnings and script the 4 safe fixes 2026-09-23 16:09:28 +08:00
STATUS.md Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00
TEST_REPORT.md Add lockbox: a chest that opens only with a 4-digit code 2026-09-28 16:08:04 +08:00