… | |
… | |
52 | ); |
52 | ); |
53 | |
53 | |
54 | 1 |
54 | 1 |
55 | } |
55 | } |
56 | |
56 | |
|
|
57 | sub safe_spot($$$) { |
|
|
58 | my ($m, $x, $y) = @_; |
|
|
59 | |
|
|
60 | scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) |
|
|
61 | } |
|
|
62 | |
57 | sub enter_map { |
63 | sub enter_map { |
58 | my ($pl) = @_; |
64 | my ($pl) = @_; |
59 | |
65 | |
60 | my $ob = $pl->ob; |
66 | my $ob = $pl->ob; |
61 | |
67 | |
… | |
… | |
72 | # the map was reset in the meantime |
78 | # the map was reset in the meantime |
73 | my $age = $cf::RUNTIME - $time; |
79 | my $age = $cf::RUNTIME - $time; |
74 | |
80 | |
75 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
81 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
76 | |
82 | |
77 | # for now, just go back to savebed |
|
|
78 | ($map, $x, $y) = $pl->savebed; |
83 | ($map, $x, $y) = $pl->savebed; |
79 | |
84 | |
|
|
85 | if (safe_spot $m, $x, $y) { |
|
|
86 | # do nothing, this is simply ok without a special scary message |
80 | if ($age >= $MAX_DISCONNECT_TIME) { |
87 | } elsif ($age >= $MAX_DISCONNECT_TIME) { |
81 | $ob->message ( |
88 | $ob->message ( |
82 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
89 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
83 | . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " |
90 | . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " |
84 | . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " |
91 | . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " |
85 | . "H<You disconnected too long without having used a savebed.>", |
92 | . "H<You disconnected too long without having used a savebed.>", |
… | |
… | |
96 | . "Better use a savebed next time, much worse things could have happened... " |
103 | . "Better use a savebed next time, much worse things could have happened... " |
97 | . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>", |
104 | . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>", |
98 | cf::NDI_RED |
105 | cf::NDI_RED |
99 | ); |
106 | ); |
100 | } |
107 | } |
|
|
108 | } elsif (safe_spot $m, $x, $y) { |
|
|
109 | # do nothing, this is simply ok without a special scary message |
101 | } else { |
110 | } else { |
102 | $ob->message ( |
111 | $ob->message ( |
103 | "You didn't use a bed to reality to leave this realm. This is very dangerous, " |
112 | "You didn't use a bed to reality to leave this realm. This is very dangerous, " |
104 | . "as lots of things could happen when you leave by other means, such as cave-ins, " |
113 | . "as lots of things could happen when you leave by other means, such as cave-ins, " |
105 | . "or monsters suddenly snapping your body. Better use a savebed next time. " |
114 | . "or monsters suddenly snapping your body. Better use a savebed next time. " |
… | |
… | |
396 | last; |
405 | last; |
397 | } |
406 | } |
398 | Coro::Timer::sleep 0.2; |
407 | Coro::Timer::sleep 0.2; |
399 | } |
408 | } |
400 | |
409 | |
401 | $ob->reply (undef, "Welcome to Crossfire!"); |
410 | $ob->reply (undef, "Welcome to Deliantra!"); |
402 | |
411 | |
403 | delete $pl->{deny_save}; |
412 | delete $pl->{deny_save}; |
404 | |
413 | |
405 | last; |
414 | last; |
406 | } |
415 | } |