[PR #149] SMP: emergency switches to turn features off (/smp off|on|status) #150

Open
opened 2026-11-03 04:03:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-mods/pull/149
Author: @rdbtCVS
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: smp/emergency-off


📝 Commits (1)

  • badb56c SMP: emergency switches for operators (/smp off|on|status)

📊 Changes

8 files changed (+804 additions, -14 deletions)

View changed files

📝 native/smp/README.md (+17 -1)
📝 native/smp/mixins/smp/glue.rs (+213 -11)
📝 native/smp/mixins/smp/horizon-mixin.toml (+6 -0)
📝 native/smp/mixins/smp/invsee_glue.rs (+12 -1)
📝 native/smp/mixins/smp/smp_board.rs (+8 -0)
➕ native/smp/mixins/smp/smp_switch.rs (+507 -0)
📝 native/smp/proof.py (+39 -1)
📝 native/smp/src/lib.rs (+2 -0)

📄 Description

🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally.

Why

The staff wanted a way to turn off almost all of the SMP's custom features from in game during an emergency, such as a dupe, an exploit or a feature misbehaving, without rebuilding or restarting the server.

What

New operator command (level 3), in a new pure module smp_switch.rs with unit tests, wired in through the glue:

Command Does
/smp off [reason] or /smp off all [reason] turns off every part except land protection (land would be open to grief otherwise)
/smp off <part> [reason] turns off one part; /smp off claims is the only way to turn claims off
/smp on [part|all] turns parts back on
/smp, /smp status lists what is off, by whom, when (UTC) and why

Parts: economy, market, auction, trades, gambling, futures, places, claims, board, presence, nicks, invsee.

A part that is off:

  • refuses its commands with "… is turned off for now by the server's staff." (/smp itself is never off);
  • closes its menus at the next click (shop, market, auction, futures, casino, trade, invsee);
  • pauses its timed work: the lottery draw, auctions ending, futures marking and funding, contracts, bank interest, weekly taxes and the daily reward. Nothing held is lost: untaken coinflips still return their stakes, and a casino round already running still ends and pays out;
  • claims off: block break and use guards, fluid, fire and piston spread, explosions and entity hits all allow everything.

Turning a part off also cleans up what it had running: open trades end with nothing moved, open menus close, waiting teleports are cancelled, sidebars and Tab headers are cleared, and nicknames go back to real names. Turning it back on restores them on the next second.

Safety:

  • The state is kept in world/horizon-smp/switches.json, so a crash-and-restart keeps things off.
  • If the file is damaged, every part stays on and the error is logged; the switch never takes the SMP down.
  • Each change goes to the server log ([smp] <op> turned off: …), to audit.log (switch_off / switch_on, with the parts and reason), and to every other online operator.

Size: about 800 lines, but half of that is the new module's tests, the proof step and the README. The glue changes are gates at the existing entry points.

There is no version bump: this is one of several SMP PRs opened together, and the maintainer bumps the version at release.

Proof

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked: 164 passed (5 new: every SMP command belongs to a part, /smp off leaves claims on and survives a restart, claims go off only by name, non-operators change nothing, a damaged or unknown-part file).
  • native.py check smp at the pinned Horizon (975c07d): ok.
  • native.py proof smp (a dedicated server with two real clients, new switches step): "ok": true.
    • /smp off market proof → /worth is refused, /balance still works.
    • /smp status → - market, by Alex at 2026-11-02 09:41 UTC: proof.
    • /smp off → "Turned off: economy, auction, trades, gambling, futures, places, board, presence, nicks, invsee", and "Land protection stays on". /balance is refused and the sidebar is gone from the client.
    • /smp on → everything back, /balance works and the sidebar returns.
    • audit.log has switch_off, switch_off, switch_on, and switches.json ends empty.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon-mods/pull/149 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `smp/emergency-off` --- ### 📝 Commits (1) - [`badb56c`](https://github.com/horizon-rust/horizon-mods/commit/badb56cf6639257805e8bd0ad82850c97522342e) SMP: emergency switches for operators (/smp off|on|status) ### 📊 Changes **8 files changed** (+804 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `native/smp/README.md` (+17 -1) 📝 `native/smp/mixins/smp/glue.rs` (+213 -11) 📝 `native/smp/mixins/smp/horizon-mixin.toml` (+6 -0) 📝 `native/smp/mixins/smp/invsee_glue.rs` (+12 -1) 📝 `native/smp/mixins/smp/smp_board.rs` (+8 -0) ➕ `native/smp/mixins/smp/smp_switch.rs` (+507 -0) 📝 `native/smp/proof.py` (+39 -1) 📝 `native/smp/src/lib.rs` (+2 -0) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally. ## Why The staff wanted a way to turn off almost all of the SMP's custom features from in game during an emergency, such as a dupe, an exploit or a feature misbehaving, without rebuilding or restarting the server. ## What New operator command (level 3), in a new pure module `smp_switch.rs` with unit tests, wired in through the glue: | Command | Does | |---|---| | `/smp off [reason]` or `/smp off all [reason]` | turns off every part **except land protection** (land would be open to grief otherwise) | | `/smp off <part> [reason]` | turns off one part; `/smp off claims` is the only way to turn claims off | | `/smp on [part\|all]` | turns parts back on | | `/smp`, `/smp status` | lists what is off, by whom, when (UTC) and why | Parts: `economy`, `market`, `auction`, `trades`, `gambling`, `futures`, `places`, `claims`, `board`, `presence`, `nicks`, `invsee`. A part that is off: - refuses its commands with "… is turned off for now by the server's staff." (`/smp` itself is never off); - closes its menus at the next click (shop, market, auction, futures, casino, trade, invsee); - pauses its timed work: the lottery draw, auctions ending, futures marking and funding, contracts, bank interest, weekly taxes and the daily reward. Nothing held is lost: untaken coinflips still return their stakes, and a casino round already running still ends and pays out; - `claims` off: block break and use guards, fluid, fire and piston spread, explosions and entity hits all allow everything. Turning a part off also cleans up what it had running: open trades end with nothing moved, open menus close, waiting teleports are cancelled, sidebars and Tab headers are cleared, and nicknames go back to real names. Turning it back on restores them on the next second. Safety: - The state is kept in `world/horizon-smp/switches.json`, so a crash-and-restart keeps things off. - If the file is damaged, every part stays on and the error is logged; the switch never takes the SMP down. - Each change goes to the server log (`[smp] <op> turned off: …`), to `audit.log` (`switch_off` / `switch_on`, with the parts and reason), and to every other online operator. Size: about 800 lines, but half of that is the new module's tests, the proof step and the README. The glue changes are gates at the existing entry points. There is no version bump: this is one of several SMP PRs opened together, and the maintainer bumps the version at release. ## Proof - `cargo fmt --check`, `cargo clippy --all-targets --locked -- -D warnings`, `cargo test --locked`: 164 passed (5 new: every SMP command belongs to a part, `/smp off` leaves claims on and survives a restart, claims go off only by name, non-operators change nothing, a damaged or unknown-part file). - `native.py check smp` at the pinned Horizon (975c07d): ok. - `native.py proof smp` (a dedicated server with two real clients, new `switches` step): `"ok": true`. - `/smp off market proof` → `/worth` is refused, `/balance` still works. - `/smp status` → `- market, by Alex at 2026-11-02 09:41 UTC: proof`. - `/smp off` → "Turned off: economy, auction, trades, gambling, futures, places, board, presence, nicks, invsee", and "Land protection stays on". `/balance` is refused and the sidebar is gone from the client. - `/smp on` → everything back, `/balance` works and the sidebar returns. - `audit.log` has `switch_off, switch_off, switch_on`, and `switches.json` ends empty. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon-mods#150
No description provided.