… | |
… | |
73 | } |
73 | } |
74 | |
74 | |
75 | sub enter_map { |
75 | sub enter_map { |
76 | my ($pl) = @_; |
76 | my ($pl) = @_; |
77 | |
77 | |
|
|
78 | warn $pl->ob->name, ": enter map 1\n";#d# |
78 | my $ob = $pl->ob; |
79 | my $ob = $pl->ob; |
79 | |
80 | |
80 | my ($map, $x, $y) |
81 | my ($map, $x, $y) |
81 | = $ob->{_link_pos} |
82 | = $ob->{_link_pos} |
82 | ? @{delete $ob->{_link_pos}} |
83 | ? @{delete $ob->{_link_pos}} |
83 | : ($pl->maplevel, $ob->x, $ob->y); |
84 | : ($pl->maplevel, $ob->x, $ob->y); |
84 | |
85 | |
|
|
86 | warn $pl->ob->name, ": enter map 2\n";#d# |
85 | $ob->enter_link; |
87 | $ob->enter_link; |
|
|
88 | warn $pl->ob->name, ": enter map 3\n";#d# |
86 | |
89 | |
87 | my $m = cf::map::find $map; |
90 | my $m = cf::map::find $map; |
88 | my $time = delete $pl->{unclean_save}; |
91 | my $time = delete $pl->{unclean_save}; |
|
|
92 | warn $pl->ob->name, ": enter map 4\n";#d# |
89 | |
93 | |
90 | if ($time && $m) { |
94 | if ($time && $m) { |
91 | if ($time < $m->{instantiate_time}) { |
95 | if ($time < $m->{instantiate_time}) { |
92 | # the map was reset in the meantime |
96 | # the map was reset in the meantime |
93 | my $age = $cf::RUNTIME - $time; |
97 | my $age = $cf::RUNTIME - $time; |
… | |
… | |
103 | cf::NDI_RED |
107 | cf::NDI_RED |
104 | ); |
108 | ); |
105 | # kill them. |
109 | # kill them. |
106 | # reminds me of the famous badness 10000 syndrome... |
110 | # reminds me of the famous badness 10000 syndrome... |
107 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
111 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
108 | my $killer = cf::arch::get "killer_login"; |
112 | my $killer = cf::arch::get "killer_login"; $pl->killer ($killer); $killer->destroy; |
109 | $pl->killer ($killer); |
|
|
110 | $killer->destroy; |
|
|
111 | } else { |
113 | } else { |
112 | ($map, $x, $y) = $pl->savebed; |
114 | ($map, $x, $y) = $pl->savebed; |
113 | |
115 | |
114 | $ob->message ( |
116 | $ob->message ( |
115 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
117 | "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " |
… | |
… | |
128 | cf::NDI_RED |
130 | cf::NDI_RED |
129 | ); |
131 | ); |
130 | } |
132 | } |
131 | } |
133 | } |
132 | |
134 | |
|
|
135 | warn $pl->ob->name, ": enter map 5\n";#d# |
133 | $ob->goto ($map, $x, $y); |
136 | #$ob->goto ($map, $x, $y); |
|
|
137 | $ob->goto ($map, $x, $y, sub { |
|
|
138 | warn $pl->ob->name, ": enter map check\n";#d# |
|
|
139 | $_[0] |
|
|
140 | }, sub { |
|
|
141 | warn $pl->ob->name, ": enter map done\n";#d# |
|
|
142 | }); |
|
|
143 | warn $pl->ob->name, ": enter map 6\n";#d# |
|
|
144 | |
134 | } |
145 | } |
135 | |
146 | |
136 | # delete a player directory, be non-blocking AND synchronous... |
147 | # delete a player directory, be non-blocking AND synchronous... |
137 | # (thats hard, so we crap out and fork). |
148 | # (thats hard, so we crap out and fork). |
138 | sub nuke_playerdir { |
149 | sub nuke_playerdir { |
… | |
… | |
379 | } |
390 | } |
380 | } else { |
391 | } else { |
381 | $ob->roll_stats; |
392 | $ob->roll_stats; |
382 | } |
393 | } |
383 | |
394 | |
384 | Coro::Timer::sleep 0.2; |
395 | Coro::Timer::sleep 0.05; |
385 | } |
396 | } |
386 | |
397 | |
387 | $ob->set_animation (2); |
398 | $ob->set_animation (2); |
388 | $ob->add_statbonus; |
399 | $ob->add_statbonus; |
389 | |
400 | |
… | |
… | |
400 | |
411 | |
401 | $pl->chargen_race_next; |
412 | $pl->chargen_race_next; |
402 | Coro::Timer::sleep 0.2; |
413 | Coro::Timer::sleep 0.2; |
403 | } |
414 | } |
404 | |
415 | |
|
|
416 | # create the playerdir, if necessary, as chargen_race_done did it before |
|
|
417 | # presumably because of unique maps |
|
|
418 | aio_mkdir playerdir $pl, 0770; |
405 | $pl->chargen_race_done; |
419 | $pl->chargen_race_done; |
406 | |
420 | |
407 | while () { |
421 | while () { |
408 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
422 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
409 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
423 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
… | |
… | |
467 | |
481 | |
468 | # update respawn position |
482 | # update respawn position |
469 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
483 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
470 | cf::async { $pl->save }; |
484 | cf::async { $pl->save }; |
471 | |
485 | |
472 | my $killer = cf::arch::get "killer_logout"; |
486 | my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; |
473 | $pl->killer ($killer); |
|
|
474 | $killer->destroy; |
|
|
475 | $ob->check_score; |
487 | $ob->check_score; |
476 | |
488 | |
477 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
489 | $ob->reply (undef, "In the future, you will wake up here when you die."); |
478 | |
490 | |
479 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |
491 | $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { |