… | |
… | |
205 | $ns->send_drawinfo ($ob->msg, cf::NDI_BLUE); |
205 | $ns->send_drawinfo ($ob->msg, cf::NDI_BLUE); |
206 | $ns->send_packet (sprintf "query %d %s", cf::CS_QUERY_SINGLECHAR, |
206 | $ns->send_packet (sprintf "query %d %s", cf::CS_QUERY_SINGLECHAR, |
207 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"); |
207 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"); |
208 | |
208 | |
209 | $ns->state (cf::ST_CHANGE_CLASS); |
209 | $ns->state (cf::ST_CHANGE_CLASS); |
|
|
210 | $pl->enable_save (1);#d# too early |
210 | |
211 | |
211 | last; |
212 | last; |
212 | } |
213 | } |
213 | }); |
214 | }); |
214 | } |
215 | } |
… | |
… | |
218 | on_apply => sub { |
219 | on_apply => sub { |
219 | my ($bed, $ob) = @_; |
220 | my ($bed, $ob) = @_; |
220 | |
221 | |
221 | return cf::override 0 unless $ob->type == cf::PLAYER; |
222 | return cf::override 0 unless $ob->type == cf::PLAYER; |
222 | |
223 | |
223 | my $ns = $ob->contr->ns; |
|
|
224 | |
|
|
225 | # update respawn position |
224 | # update respawn position |
226 | $ob->contr->savebed ($bed->map->path, $bed->x, $bed->y); |
225 | $ob->contr->savebed ($bed->map->path, $bed->x, $bed->y); |
227 | |
226 | |
228 | #TODO? |
227 | #TODO? |
229 | #strcpy (pl->contr->killer, "left"); |
228 | #strcpy (pl->contr->killer, "left"); |
230 | #check_score (pl); /* Always check score */ |
229 | #check_score (pl); /* Always check score */ |
231 | |
230 | |
232 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
231 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
233 | $ob->contr->save (); |
232 | $ob->contr->save (); |
234 | |
233 | |
235 | $ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
234 | $ob->contr->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
236 | if ($_[0] !~ /^[yY]/) { |
235 | if ($_[0] !~ /^[yY]/) { |
237 | $ob->contr->save (1); |
236 | $ob->contr->save (1); |
238 | $ns->destroy (); |
237 | $ob->contr->ns->destroy (); |
239 | } |
238 | } |
240 | }); |
239 | }); |
241 | }, |
240 | }, |
242 | ); |
241 | ); |
243 | |
242 | |