--- deliantra/server/ext/login.ext 2008/01/07 01:55:19 1.78 +++ deliantra/server/ext/login.ext 2008/04/30 06:40:28 1.84 @@ -54,13 +54,20 @@ 1 } -sub safe_spot($$$) { - my ($m, $x, $y) = @_; +sub safe_spot($) { + my ($pl) = @_; + + my $ob = $pl->ob; - return 0; - warn join ":", $m->at ($x, $y);#d# - warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; - return 0; + my $m = $ob->map + or return; + my $x = $ob->x; + my $y = $ob->y; + +# return 0;#d# +# warn join ":", $m->at ($x, $y);#d# +# warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; +# return 0; scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) } @@ -80,15 +87,13 @@ my $m = cf::map::find $map; my $time = delete $pl->{unclean_save}; - if ($time && $m && !safe_spot $m, $x, $y) { + if ($time && $m) { if ($time < $m->{instantiate_time}) { # the map was reset in the meantime my $age = $cf::RUNTIME - $time; warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# - ($map, $x, $y) = $pl->savebed; - if ($age >= $MAX_DISCONNECT_TIME) { $ob->message ( "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " @@ -100,8 +105,12 @@ # kill them. # reminds me of the famous badness 10000 syndrome... $ob->stats->hp (-10000); #] if they survive this they deserved to live - $pl->killer ("a cave-in"); + my $killer = cf::arch::get "killer_login"; + $pl->killer ($killer); + $killer->destroy; } else { + ($map, $x, $y) = $pl->savebed; + $ob->message ( "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " @@ -153,12 +162,12 @@ *** *** Look at your client preferences: *** -*** CFPlus: all known versions automatically enable the facecache. +*** deliantra: all known versions automatically enable the facecache. *** cfclient: use the -cache commandline option. *** cfclient: map will not redraw automatically (bug). *** gcfclient: use -cache commandline option, or enable *** gcfclient: Client => Configure => Map & Image => Cache Images. -*** jcrossclient: your client is broken, use CFPlus or gcfclient. +*** jcrossclient: your client is broken, use deliantra or gcfclient. *** *** EOF @@ -460,7 +469,9 @@ $pl->savebed ($bed->map->path, $bed->x, $bed->y); cf::async { $pl->save }; - $pl->killer ("left"); + my $killer = cf::arch::get "killer_logout"; + $pl->killer ($killer); + $killer->destroy; $ob->check_score; $ob->reply (undef, "In the future, you will wake up here when you die."); @@ -492,7 +503,8 @@ $_->ob->message ("$name left the game.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; } else { $_->ob->message ("$name uncerimoniously disconnected.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; - $pl->{unclean_save} = $cf::RUNTIME; + $pl->{unclean_save} = $cf::RUNTIME + unless safe_spot $pl; } }, ); @@ -543,13 +555,13 @@ my $a_ = $pl->refcnt;#d# my $b_ = $ob->refcnt;#d# - warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# + warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref/3 ob $ob_ref/3 (C pl $a_/1 ob $b_/2)\n";#d# } } } }; warn $@ if $@; - Coro::cede; + cf::cede_to_tick; }; } };