Skip to content

Commit a19cab0

Browse files
thefallentreeclaude
andcommitted
Fix "can't do command after register" report + 2 more bugs in hymud
Root-caused the live player report from earlier this session ("Hymud after register can't do command", the ?. symptom): AGENTS.md §7.10 -- adm/single/master.lpc's log_error() gated "is this just a compile warning" on strsrch(message, "Warning") (capital W), but this driver's own diagnostics always emit lowercase "warning: ". Every routine compile warning (chiefly harmless unused-local-variable warnings, common here) got broadcast to whichever player was online as a raw "?." -- clustering around registration/first-login because that's when the most newbie-zone files get lazily compiled for the first time. Same class already found on lineage siblings shenzhou/beimeixiakexing2001; simply never ported here. Verified live: zero "?." across half a dozen subsequent connect/reconnect cycles. Also fixed, surfaced once the warning-suppression bug stopped masking them: - §7.35: 6 NPC files passed an object where is_killing() takes a string, a silent no-op via -> that meant these NPCs' "revealed" ambush logic never worked. - §7.36: feature/clean_up.lpc's interactive()-only occupancy check could destroy a room a net-dead player was still standing in; added userp() plus defense-in-depth environment() guards in clone/user/ user.lpc's net-dead/idle handlers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VyQCUoTo1Z93Py9aVFHQi1
1 parent 5c22182 commit a19cab0

10 files changed

Lines changed: 350 additions & 14 deletions

File tree

libs/hymud/NOTES.md

Lines changed: 309 additions & 0 deletions
Large diffs are not rendered by default.

libs/hymud/work/adm/single/master.lpc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,22 @@ void log_error(string file, string message)
171171
if (name) home = user_path(name);
172172
else home = LOG_DIR;
173173

174-
if (strsrch(message, "Warning") < 0)
174+
// AGENTS.md §7.10: the driver's own compile diagnostics use a
175+
// LOWERCASE "warning: " prefix (see fluffos compiler.cc), not the
176+
// "Warning" this check was originally written against (an old
177+
// MudOS-era convention). The case mismatch meant this branch never
178+
// recognized a warning as a warning, so every routine compile
179+
// warning (e.g. "unused local variable", extremely common in this
180+
// lib) was broadcast to whichever player happened to be online at
181+
// the time a file got lazily compiled -- as a raw "?." to ordinary
182+
// players (get_config(__DEFAULT_ERROR_MESSAGE__)) or a scary fake
183+
// "编译时段错误" to wizards. This is what live players were
184+
// reporting as "some commands stop working after registration": a
185+
// burst of newbie-zone files (jing.lpc, hua.lpc, qian.lpc, look.lpc,
186+
// ...) get compiled for the first time right after landing in
187+
// 世界之树, each with its own unused-variable warnings, each firing
188+
// a spurious "?." that looks exactly like a failed command.
189+
if (strsrch(message, "Warning") < 0 && strsrch(message, "warning") < 0)
175190
{
176191
if (this_player(1))
177192
{

libs/hymud/work/clone/demogorgon.lpc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int do_go(string arg)
161161
mapping exit;
162162
if( !mapp(exit = environment()->query("exits")) || undefinedp(exit[arg]) )
163163
return 0;
164-
if (is_killing(this_player()))
164+
if (is_killing(this_player()->query("id")))
165165
if (random(10)<=2) {
166166
message_vision(YEL "$N见势不好,转身要走,被$n"+YEL+"一把拦在面前。想走?没那么容易!\n"NOR, this_player(), this_object());
167167
return 1;
@@ -175,7 +175,7 @@ int do_kill(string arg)
175175
if (id(arg))
176176
{
177177
set("kill_ob",1);
178-
if (!is_killing(this_player()))
178+
if (!is_killing(this_player()->query("id")))
179179
message_vision("$N"+CYN+"恶狠狠地瞪了$n一眼:想和我打?你活腻了?\n" NOR,this_object(),this_player());
180180
set("eff_qi",query("max_qi"));
181181
set("eff_jing",query("max_jing"));

libs/hymud/work/clone/npc/demogorgon.lpc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int do_go(string arg)
161161
mapping exit;
162162
if( !mapp(exit = environment()->query("exits")) || undefinedp(exit[arg]) )
163163
return 0;
164-
if (is_killing(this_player()))
164+
if (is_killing(this_player()->query("id")))
165165
if (random(10)<=2) {
166166
message_vision(YEL "$N见势不好,转身要走,被$n"+YEL+"一把拦在面前。想走?没那么容易!\n"NOR, this_player(), this_object());
167167
return 1;
@@ -175,7 +175,7 @@ int do_kill(string arg)
175175
if (id(arg))
176176
{
177177
set("kill_ob",1);
178-
if (!is_killing(this_player()))
178+
if (!is_killing(this_player()->query("id")))
179179
message_vision("$N"+CYN+"恶狠狠地瞪了$n一眼:想和我打?你活腻了?\n" NOR,this_object(),this_player());
180180
set("eff_qi",query("max_qi"));
181181
set("eff_jing",query("max_jing"));

libs/hymud/work/clone/user/user.lpc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ private void user_dump(int type)
7575
{
7676
switch(type) {
7777
case DUMP_NET_DEAD:
78-
tell_room( environment(), query("name") + "断线超过 "
79-
+ NET_DEAD_TIMEOUT/60 + " 分钟,自动退出这个世界。\n");
78+
// AGENTS.md §7.36 defense in depth: don't let a corrupted
79+
// (destructed-out-from-under-us) environment() block the
80+
// actual save/quit below.
81+
if( objectp(environment()) )
82+
tell_room( environment(), query("name") + "断线超过 "
83+
+ NET_DEAD_TIMEOUT/60 + " 分钟,自动退出这个世界。\n");
8084
"/cmds/usr/quitgame"->main(this_object());
8185
// command("quitgame");
8286
break;
@@ -86,8 +90,10 @@ private void user_dump(int type)
8690
{
8791
tell_object( this_object(), "对不起,您已经发呆超过 "
8892
+ IDLE_TIMEOUT/60 + " 分钟了,请下次再来。\n");
89-
tell_room( environment(), "一阵风吹来,将发呆中的" + query("name")
90-
+ "化为一堆飞灰,消失了。\n", ({this_object()}));
93+
// AGENTS.md §7.36 defense in depth, same as DUMP_NET_DEAD above.
94+
if( objectp(environment()) )
95+
tell_room( environment(), "一阵风吹来,将发呆中的" + query("name")
96+
+ "化为一堆飞灰,消失了。\n", ({this_object()}));
9197
"/cmds/usr/quitgame"->main(this_object());
9298
// command("quitgame");
9399
}
@@ -123,6 +129,8 @@ call_out("user_dump", 1, DUMP_NET_DEAD);
123129
}else call_out("user_dump", NET_DEAD_TIMEOUT, DUMP_NET_DEAD);
124130
if (this_object())
125131
{
132+
// AGENTS.md §7.36 defense in depth, same as user_dump() above.
133+
if( objectp(environment()) )
126134
tell_room(environment(), query("name") + "断线了。", this_object());
127135
CHANNEL_D->do_channel(this_object(), "sys", "断线了。");
128136
}

libs/hymud/work/d/city/npc/guidao.lpc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ string ask_me(object who)
5353
object *ob;
5454

5555
if( query("revealed") ) {
56-
if( is_killing(who) ) return "你既然知道了我的身分,今日休想活命!\n";
56+
if( is_killing(who->query("id")) ) return "你既然知道了我的身分,今日休想活命!\n";
5757
else {
5858
kill_ob(who);
5959
who->fight_ob(this_object());

libs/hymud/work/d/ny/npc/guard.lpc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int ask_me(object who)
5050
object *ob;
5151

5252
if( query("revealed") ) {
53-
if( is_killing(who) ) return notify_fail("你既然知道了我的身分,今日休想活命!\n");
53+
if( is_killing(who->query("id")) ) return notify_fail("你既然知道了我的身分,今日休想活命!\n");
5454
else {
5555
kill_ob(who);
5656
who->fight_ob(this_object());

libs/hymud/work/d/xiangyang/npc/xiaosong.lpc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ string ask_me(object who)
5656
object *ob;
5757

5858
if( query("revealed") ) {
59-
if( is_killing(who) ) return "你既然知道了我的秘密,今日休想活命!\n";
59+
if( is_killing(who->query("id")) ) return "你既然知道了我的秘密,今日休想活命!\n";
6060
else {
6161
kill_ob(who);
6262
who->fight_ob(this_object());

libs/hymud/work/d/xueting/npc/liuanlu.lpc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ string ask_me(object who)
4949
object *ob;
5050

5151
if( query("revealed") ) {
52-
if( is_killing(who) ) return "你既然知道了我的身分,今日休想活命!\n";
52+
if( is_killing(who->query("id")) ) return "你既然知道了我的身分,今日休想活命!\n";
5353
else {
5454
kill_ob(who);
5555
who->fight_ob(this_object());

libs/hymud/work/feature/clean_up.lpc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ if ( this_object()->query("maze") ) return 1;
2020

2121
inv = all_inventory();
2222
for(i=sizeof(inv)-1; i>=0; i--)
23-
if(interactive(inv[i])) return 1;
23+
// AGENTS.md §7.36: interactive() alone is false for a net-dead
24+
// player (socket gone, body/save state still real and
25+
// reconnectable) -- also check userp() so a room holding only a
26+
// net-dead player isn't swept out from under them.
27+
if(interactive(inv[i]) || userp(inv[i])) return 1;
2428

2529
destruct(this_object());
2630
return 0;

0 commit comments

Comments
 (0)