--- deliantra/server/ext/login.ext 2007/12/28 19:40:22 1.76 +++ deliantra/server/ext/login.ext 2008/01/07 01:55:19 1.78 @@ -57,6 +57,11 @@ sub safe_spot($$$) { my ($m, $x, $y) = @_; + return 0; + 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) } @@ -72,50 +77,47 @@ $ob->enter_link; - if (my $time = delete $pl->{unclean_save}) { - if (my $m = cf::map::find $map) { - 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 (safe_spot $m, $x, $y) { - # do nothing, this is simply ok without a special scary message - } elsif ($age >= $MAX_DISCONNECT_TIME) { - $ob->message ( - "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " - . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " - . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " - . "H", - cf::NDI_RED - ); - # 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"); - } else { - $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. " - . "Better use a savebed next time, much worse things could have happened... " - . "H", - cf::NDI_RED - ); - } - } elsif (safe_spot $m, $x, $y) { - # do nothing, this is simply ok without a special scary message + my $m = cf::map::find $map; + my $time = delete $pl->{unclean_save}; + + if ($time && $m && !safe_spot $m, $x, $y) { + 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. " + . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " + . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " + . "H", + cf::NDI_RED + ); + # 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"); } else { $ob->message ( - "You didn't use a bed to reality to leave this realm. This is very dangerous, " - . "as lots of things could happen when you leave by other means, such as cave-ins, " - . "or monsters suddenly snapping your body. Better use a savebed next time. " - . "H", + "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. " + . "Better use a savebed next time, much worse things could have happened... " + . "H", cf::NDI_RED ); } + } else { + $ob->message ( + "You didn't use a bed to reality to leave this realm. This is very dangerous, " + . "as lots of things could happen when you leave by other means, such as cave-ins, " + . "or monsters suddenly snapping your body. Better use a savebed next time. " + . "H", + cf::NDI_RED + ); } }