… | |
… | |
52 | ); |
52 | ); |
53 | |
53 | |
54 | 1 |
54 | 1 |
55 | } |
55 | } |
56 | |
56 | |
|
|
57 | sub safe_spot($$$) { |
|
|
58 | my ($m, $x, $y) = @_; |
|
|
59 | |
|
|
60 | return 0; |
|
|
61 | warn join ":", $m->at ($x, $y);#d# |
|
|
62 | warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; |
|
|
63 | return 0; |
|
|
64 | |
|
|
65 | scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) |
|
|
66 | } |
|
|
67 | |
57 | sub enter_map { |
68 | sub enter_map { |
58 | my ($pl) = @_; |
69 | my ($pl) = @_; |
59 | |
70 | |
60 | my $ob = $pl->ob; |
71 | my $ob = $pl->ob; |
61 | |
72 | |
… | |
… | |
64 | ? @{delete $ob->{_link_pos}} |
75 | ? @{delete $ob->{_link_pos}} |
65 | : ($pl->maplevel, $ob->x, $ob->y); |
76 | : ($pl->maplevel, $ob->x, $ob->y); |
66 | |
77 | |
67 | $ob->enter_link; |
78 | $ob->enter_link; |
68 | |
79 | |
|
|
80 | my $m = cf::map::find $map; |
69 | if (my $time = delete $pl->{unclean_save}) { |
81 | my $time = delete $pl->{unclean_save}; |
70 | if (my $m = cf::map::find $map) { |
82 | |
|
|
83 | if ($time && $m && !safe_spot $m, $x, $y) { |
71 | if ($time < $m->{instantiate_time}) { |
84 | if ($time < $m->{instantiate_time}) { |
72 | # the map was reset in the meantime |
85 | # the map was reset in the meantime |
73 | my $age = $cf::RUNTIME - $time; |
86 | my $age = $cf::RUNTIME - $time; |
74 | |
87 | |
75 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
88 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
76 | |
89 | |
77 | # for now, just go back to savebed |
|
|
78 | ($map, $x, $y) = $pl->savebed; |
90 | ($map, $x, $y) = $pl->savebed; |
79 | |
91 | |
80 | if ($age >= $MAX_DISCONNECT_TIME) { |
92 | if ($age >= $MAX_DISCONNECT_TIME) { |
81 | $ob->message ( |
93 | $ob->message ( |
82 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
94 | "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. " |
95 | . "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... " |
96 | . "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.>", |
97 | . "H<You disconnected too long without having used a savebed.>", |
86 | cf::NDI_RED |
98 | cf::NDI_RED |
87 | ); |
99 | ); |
88 | # kill them. |
100 | # kill them. |
89 | # reminds me of the famous badness 10000 syndrome... |
101 | # reminds me of the famous badness 10000 syndrome... |
90 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
102 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
91 | $pl->killer ("a cave-in"); |
103 | $pl->killer ("a cave-in"); |
92 | } else { |
|
|
93 | $ob->message ( |
|
|
94 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
|
|
95 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
|
|
96 | . "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.>", |
|
|
98 | cf::NDI_RED |
|
|
99 | ); |
|
|
100 | } |
|
|
101 | } else { |
104 | } else { |
102 | $ob->message ( |
105 | $ob->message ( |
103 | "You didn't use a bed to reality to leave this realm. This is very dangerous, " |
106 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
104 | . "as lots of things could happen when you leave by other means, such as cave-ins, " |
107 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
105 | . "or monsters suddenly snapping your body. Better use a savebed next time. " |
108 | . "Better use a savebed next time, much worse things could have happened... " |
106 | . "H<Always apply a bed of reality to disconnect from the server.>", |
109 | . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>", |
107 | cf::NDI_RED |
110 | cf::NDI_RED |
108 | ); |
111 | ); |
109 | } |
112 | } |
|
|
113 | } else { |
|
|
114 | $ob->message ( |
|
|
115 | "You didn't use a bed to reality to leave this realm. This is very dangerous, " |
|
|
116 | . "as lots of things could happen when you leave by other means, such as cave-ins, " |
|
|
117 | . "or monsters suddenly snapping your body. Better use a savebed next time. " |
|
|
118 | . "H<Always apply a bed of reality to disconnect from the server.>", |
|
|
119 | cf::NDI_RED |
|
|
120 | ); |
110 | } |
121 | } |
111 | } |
122 | } |
112 | |
123 | |
113 | $ob->goto ($map, $x, $y); |
124 | $ob->goto ($map, $x, $y); |
114 | } |
125 | } |
… | |
… | |
396 | last; |
407 | last; |
397 | } |
408 | } |
398 | Coro::Timer::sleep 0.2; |
409 | Coro::Timer::sleep 0.2; |
399 | } |
410 | } |
400 | |
411 | |
401 | $ob->reply (undef, "Welcome to Crossfire!"); |
412 | $ob->reply (undef, "Welcome to Deliantra!"); |
402 | |
413 | |
403 | delete $pl->{deny_save}; |
414 | delete $pl->{deny_save}; |
404 | |
415 | |
405 | last; |
416 | last; |
406 | } |
417 | } |