… | |
… | |
86 | cf::NDI_RED |
86 | cf::NDI_RED |
87 | ); |
87 | ); |
88 | # kill them. |
88 | # kill them. |
89 | # reminds me of the famous badness 10000 syndrome... |
89 | # reminds me of the famous badness 10000 syndrome... |
90 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
90 | $ob->stats->hp (-10000); #] if they survive this they deserved to live |
|
|
91 | $pl->killer ("a cave-in"); |
91 | } else { |
92 | } else { |
92 | $ob->message ( |
93 | $ob->message ( |
93 | "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. " |
94 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
95 | . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " |
95 | . "Better use a savebed next time, much worse things could have happened... " |
96 | . "Better use a savebed next time, much worse things could have happened... " |
… | |
… | |
115 | # delete a player directory, be non-blocking AND synchronous... |
116 | # delete a player directory, be non-blocking AND synchronous... |
116 | # (thats hard, so we crap out and fork). |
117 | # (thats hard, so we crap out and fork). |
117 | sub nuke_playerdir { |
118 | sub nuke_playerdir { |
118 | my ($user) = @_; |
119 | my ($user) = @_; |
119 | |
120 | |
120 | aio_stat "$PLAYERDIR/$user"; |
121 | aio_rename "$PLAYERDIR/$user", "$PLAYERDIR/~$Coro::current~deleting~"; |
121 | system "cd \Q$PLAYERDIR\E " |
122 | system "rm -rf \Q$PLAYERDIR/~$Coro::current~deleting~\E &"; |
122 | . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " |
|
|
123 | . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; |
|
|
124 | } |
123 | } |
125 | |
124 | |
126 | cf::client->attach (on_addme => sub { |
125 | cf::client->attach (on_addme => sub { |
127 | my ($ns) = @_; |
126 | my ($ns) = @_; |
128 | |
127 | |
… | |
… | |
141 | *** |
140 | *** |
142 | *** CFPlus: all known versions automatically enable the facecache. |
141 | *** CFPlus: all known versions automatically enable the facecache. |
143 | *** cfclient: use the -cache commandline option. |
142 | *** cfclient: use the -cache commandline option. |
144 | *** cfclient: map will not redraw automatically (bug). |
143 | *** cfclient: map will not redraw automatically (bug). |
145 | *** gcfclient: use -cache commandline option, or enable |
144 | *** gcfclient: use -cache commandline option, or enable |
146 | *** gcfclient: Client=>Configure=>Map & Image=>Cache Images. |
145 | *** gcfclient: Client => Configure => Map & Image => Cache Images. |
147 | *** jcrossclient: your client is broken, use CFPlus or gcfclient. |
146 | *** jcrossclient: your client is broken, use CFPlus or gcfclient. |
148 | *** |
147 | *** |
149 | *** |
148 | *** |
150 | EOF |
149 | EOF |
151 | if ($ns->version =~ /jcrossclient/) { |
150 | if ($ns->version =~ /jcrossclient/) { |
… | |
… | |
356 | |
355 | |
357 | $ob->set_animation (2); |
356 | $ob->set_animation (2); |
358 | $ob->add_statbonus; |
357 | $ob->add_statbonus; |
359 | |
358 | |
360 | while () { |
359 | while () { |
361 | $ns->send_msg (-1, "chargen-race-title", ucfirst $pl->title); |
360 | $ns->send_msg ("chargen-race-title", ucfirst $pl->title, -1); |
362 | my $msg = $ob->msg; |
361 | my $msg = $ob->msg; |
363 | $msg =~ s/(?<=\S)\n(?=\S)/ /g; |
362 | $msg =~ s/(?<=\S)\n(?=\S)/ /g; |
364 | $ns->send_msg (cf::NDI_BLUE, "chargen-race-description", $msg); |
363 | $ns->send_msg ("chargen-race-description", $msg, cf::NDI_BLUE); |
365 | |
364 | |
366 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
365 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
367 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
366 | "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; |
368 | |
367 | |
369 | last if $res =~ /[dD]/; |
368 | last if $res =~ /[dD]/; |
… | |
… | |
476 | }, |
475 | }, |
477 | ); |
476 | ); |
478 | |
477 | |
479 | ############################################################################# |
478 | ############################################################################# |
480 | |
479 | |
481 | our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs |
480 | our $SCHEDULE_INTERVAL = $cf::CFG{player_schedule_interval} || 10; # time the player scheduler sleeps between runs |
482 | our $SAVE_TIMEOUT = 20; # save players every n seconds |
481 | our $SAVE_TIMEOUT = $cf::CFG{player_save_interval} || 20; # save players every n seconds |
483 | |
482 | |
484 | our $SCHEDULER = cf::async_ext { |
483 | our $SCHEDULER = cf::async_ext { |
485 | my $schedule_interval = Coro::Event->timer (after => 1, interval => $SCHEDULE_INTERVAL); |
484 | my $schedule_interval = Coro::Event->timer (after => 1); |
486 | while () { |
485 | while () { |
|
|
486 | $schedule_interval->interval ($SCHEDULE_INTERVAL); |
487 | $schedule_interval->next; |
487 | $schedule_interval->next; |
488 | |
488 | |
489 | # this weird form of iteration over values is used because |
489 | # this weird form of iteration over values is used because |
490 | # the hash changes underneath us frequently, and for |
490 | # the hash changes underneath us frequently, and for |
491 | # keeps a direct reference to the value without (in 5.8 perls) |
491 | # keeps a direct reference to the value without (in 5.8 perls) |
… | |
… | |
496 | or next; |
496 | or next; |
497 | $pl->valid or next; |
497 | $pl->valid or next; |
498 | |
498 | |
499 | eval { |
499 | eval { |
500 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
500 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
501 | cf::wait_for_tick_begin; |
|
|
502 | $pl->save; |
501 | $pl->save; |
503 | |
502 | |
504 | unless ($pl->active || $pl->ns) { |
503 | unless ($pl->active || $pl->ns) { |
505 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
504 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
506 | my $ob = $pl->ob; |
505 | my $ob = $pl->ob; |