ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.76 by root, Fri Dec 28 19:40:22 2007 UTC vs.
Revision 1.78 by root, Mon Jan 7 01:55:19 2008 UTC

55} 55}
56 56
57sub safe_spot($$$) { 57sub safe_spot($$$) {
58 my ($m, $x, $y) = @_; 58 my ($m, $x, $y) = @_;
59 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
60 scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) 65 scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y)
61} 66}
62 67
63sub enter_map { 68sub enter_map {
64 my ($pl) = @_; 69 my ($pl) = @_;
70 ? @{delete $ob->{_link_pos}} 75 ? @{delete $ob->{_link_pos}}
71 : ($pl->maplevel, $ob->x, $ob->y); 76 : ($pl->maplevel, $ob->x, $ob->y);
72 77
73 $ob->enter_link; 78 $ob->enter_link;
74 79
80 my $m = cf::map::find $map;
75 if (my $time = delete $pl->{unclean_save}) { 81 my $time = delete $pl->{unclean_save};
76 if (my $m = cf::map::find $map) { 82
83 if ($time && $m && !safe_spot $m, $x, $y) {
77 if ($time < $m->{instantiate_time}) { 84 if ($time < $m->{instantiate_time}) {
78 # the map was reset in the meantime 85 # the map was reset in the meantime
79 my $age = $cf::RUNTIME - $time; 86 my $age = $cf::RUNTIME - $time;
80 87
81 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#
82 89
83 ($map, $x, $y) = $pl->savebed; 90 ($map, $x, $y) = $pl->savebed;
84 91
85 if (safe_spot $m, $x, $y) {
86 # do nothing, this is simply ok without a special scary message
87 } elsif ($age >= $MAX_DISCONNECT_TIME) { 92 if ($age >= $MAX_DISCONNECT_TIME) {
88 $ob->message ( 93 $ob->message (
89 "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. "
90 . "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. "
91 . "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... "
92 . "H<You disconnected too long without having used a savebed.>", 97 . "H<You disconnected too long without having used a savebed.>",
93 cf::NDI_RED 98 cf::NDI_RED
94 ); 99 );
95 # kill them. 100 # kill them.
96 # reminds me of the famous badness 10000 syndrome... 101 # reminds me of the famous badness 10000 syndrome...
97 $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
98 $pl->killer ("a cave-in"); 103 $pl->killer ("a cave-in");
99 } else {
100 $ob->message (
101 "You didn't use a bed to reality to leave this realm, leaving your body in great danger. "
102 . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. "
103 . "Better use a savebed next time, much worse things could have happened... "
104 . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>",
105 cf::NDI_RED
106 );
107 }
108 } elsif (safe_spot $m, $x, $y) {
109 # do nothing, this is simply ok without a special scary message
110 } else { 104 } else {
111 $ob->message ( 105 $ob->message (
112 "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. "
113 . "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. "
114 . "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... "
115 . "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.>",
116 cf::NDI_RED 110 cf::NDI_RED
117 ); 111 );
118 } 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 );
119 } 121 }
120 } 122 }
121 123
122 $ob->goto ($map, $x, $y); 124 $ob->goto ($map, $x, $y);
123} 125}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines