… | |
… | |
92 | # the map was reset in the meantime |
92 | # the map was reset in the meantime |
93 | my $age = $cf::RUNTIME - $time; |
93 | my $age = $cf::RUNTIME - $time; |
94 | |
94 | |
95 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
95 | warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# |
96 | |
96 | |
97 | ($map, $x, $y) = $pl->savebed; |
|
|
98 | |
|
|
99 | if ($age >= $MAX_DISCONNECT_TIME) { |
97 | if ($age >= $MAX_DISCONNECT_TIME) { |
100 | $ob->message ( |
98 | $ob->message ( |
101 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
99 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
102 | . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " |
100 | . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " |
103 | . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " |
101 | . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " |
… | |
… | |
105 | cf::NDI_RED |
103 | cf::NDI_RED |
106 | ); |
104 | ); |
107 | # kill them. |
105 | # kill them. |
108 | # reminds me of the famous badness 10000 syndrome... |
106 | # reminds me of the famous badness 10000 syndrome... |
109 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
107 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
110 | $pl->killer ("a cave-in"); |
108 | my $killer = cf::arch::get "killer_login"; $pl->killer ($killer); $killer->destroy; |
111 | } else { |
109 | } else { |
|
|
110 | ($map, $x, $y) = $pl->savebed; |
|
|
111 | |
112 | $ob->message ( |
112 | $ob->message ( |
113 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
113 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
114 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
114 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
115 | . "Better use a savebed next time, much worse things could have happened... " |
115 | . "Better use a savebed next time, much worse things could have happened... " |
116 | . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>", |
116 | . "H<You disconnected without having used a savebed. When you do that for too long, you might die.>", |
… | |
… | |
377 | } |
377 | } |
378 | } else { |
378 | } else { |
379 | $ob->roll_stats; |
379 | $ob->roll_stats; |
380 | } |
380 | } |
381 | |
381 | |
382 | Coro::Timer::sleep 0.2; |
382 | Coro::Timer::sleep 0.05; |
383 | } |
383 | } |
384 | |
384 | |
385 | $ob->set_animation (2); |
385 | $ob->set_animation (2); |
386 | $ob->add_statbonus; |
386 | $ob->add_statbonus; |
387 | |
387 | |
… | |
… | |
398 | |
398 | |
399 | $pl->chargen_race_next; |
399 | $pl->chargen_race_next; |
400 | Coro::Timer::sleep 0.2; |
400 | Coro::Timer::sleep 0.2; |
401 | } |
401 | } |
402 | |
402 | |
|
|
403 | # create the playerdir, if necessary, as chargen_race_done did it before |
|
|
404 | # presumably because of unique maps |
|
|
405 | aio_mkdir playerdir $pl, 0770; |
403 | $pl->chargen_race_done; |
406 | $pl->chargen_race_done; |
404 | |
407 | |
405 | while () { |
408 | while () { |
406 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
409 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
407 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
410 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
… | |
… | |
465 | |
468 | |
466 | # update respawn position |
469 | # update respawn position |
467 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
470 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
468 | cf::async { $pl->save }; |
471 | cf::async { $pl->save }; |
469 | |
472 | |
470 | $pl->killer ("left"); |
473 | my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; |
471 | $ob->check_score; |
474 | $ob->check_score; |
472 | |
475 | |
473 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
476 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
474 | |
477 | |
475 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
478 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
… | |
… | |
549 | $pl->destroy; # destroys $ob |
552 | $pl->destroy; # destroys $ob |
550 | } else { |
553 | } else { |
551 | my $a_ = $pl->refcnt;#d# |
554 | my $a_ = $pl->refcnt;#d# |
552 | my $b_ = $ob->refcnt;#d# |
555 | my $b_ = $ob->refcnt;#d# |
553 | |
556 | |
554 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
557 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref/3 ob $ob_ref/3 (C pl $a_/1 ob $b_/2)\n";#d# |
555 | } |
558 | } |
556 | } |
559 | } |
557 | } |
560 | } |
558 | }; |
561 | }; |
559 | warn $@ if $@; |
562 | warn $@ if $@; |
560 | Coro::cede; |
563 | cf::cede_to_tick; |
561 | }; |
564 | }; |
562 | } |
565 | } |
563 | }; |
566 | }; |
564 | |
567 | |
565 | $SCHEDULER->prio (1); |
568 | $SCHEDULER->prio (1); |