--- deliantra/server/ext/login.ext 2007/06/24 04:09:29 1.56 +++ deliantra/server/ext/login.ext 2012/11/15 07:08:15 1.122 @@ -1,26 +1,18 @@ -#! perl # mandatory +#! perl # mandatory depends=highscore # login handling use Fcntl; use Coro::AIO; -use List::Util qw(min max); +use Deliantra::Util (); -our %EXT_SETUP; - -# paranoia function to overwrite a string-in-place -sub nuke_str { - substr $_[0], 0, (length $_[0]), "x" x length $_[0] -} +CONF MAX_DISCONNECT_TIME = 3600; sub query { my ($ns, $flags, $text) = @_; - my $current = $Coro::current; - $ns->query ($flags, $text, sub { $current->ready; $current = $_[0] }); - Coro::schedule while ref $current; - - $current + $ns->query ($flags, $text, Coro::rouse_cb); + Coro::rouse_wait } sub can_cleanup { @@ -43,8 +35,8 @@ $ns->send_drawinfo ( "That player is already logged in on this server. " . "If you want to create a new player, choose another name. " - . "If you are already a registered player, make sure nobody " - . "else is using your account at this time. If you lost your conenction " + . "If you have already a registered, make sure nobody " + . "else is using your account at this time. If you lost your connection " . "then the server will likely timeout within a minute. If you still " . "cannot log-in after a minute, you are still logged in. Make sure " . "you do not have another client running. If you use windows, reboot, " @@ -55,236 +47,209 @@ 1 } +sub safe_spot($) { + my ($pl) = @_; + + my $ob = $pl->ob; + + my $m = $ob->map + or return; + my $x = $ob->x; + my $y = $ob->y; + + # never happens normally, but helps when shell users make mistakes + $m->linkable + or return 1; + + scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) +} + sub enter_map { my ($pl) = @_; + my $ob = $pl->ob; + my ($map, $x, $y) - = $pl->ob->{_link_pos} - ? @{delete $pl->ob->{_link_pos}} - : ($pl->maplevel, $pl->ob->x, $pl->ob->y); - - $pl->ob->enter_link; - - if (my $time = delete $pl->{unclean_save}) { - if (my $m = cf::map::find $map) { - if ($time < $m->{instantiate_time}) { - # the map was reset in the meantime - my $age = $cf::RUNTIME - $time; - warn $pl->ob->name, " map reset after logout, logout age $age\n";#d# + = $ob->{_link_pos} + ? @{delete $ob->{_link_pos}} + : ($pl->maplevel, $ob->x, $ob->y); - # for now, just go back to savebed - ($map, $x, $y) = $pl->savebed; + $ob->enter_link; + + my $m = cf::map::find $map; + my $time = delete $pl->{unclean_save}; + + if ($time && $m) { + if ($time < $m->{instantiate_time}) { + # the map was reset in the meantime + my $age = $cf::RUNTIME - $time; - $pl->ns->send_drawinfo ( + cf::info $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# + + if ($age >= $MAX_DISCONNECT_TIME) { + $ob->message ( "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " - . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " - . "Better use a savebed next time, much worse things could have happened...", + . "Unfortunately, nobody was near to help you when the monsters arrived to eat you. " + . "Maybe you can find comfort in the thought that your body was quite satisfying in taste... " + . "H", cf::NDI_RED ); + # kill them. + # reminds me of the famous badness 10000 syndrome... + $ob->stats->hp (-10000); #] if they survive this they deserved to live + my $killer = cf::arch::get "killer_login"; $pl->killer ($killer); $killer->destroy; } else { - $pl->ns->send_drawinfo ( - "You didn't use a bed to reality to leave this realm. This is very dangerous, " - . "as lots of things could happen when you leave by other means, such as cave-ins, " - . "or monsters suddenly snapping your body. Better use a savebed next time.", + ($map, $x, $y) = $pl->savebed; + + $ob->message ( + "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " + . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " + . "Better use a savebed next time, much worse things could have happened... " + . "H", cf::NDI_RED ); } + } else { + $ob->message ( + "You didn't use a bed to reality to leave this realm. This is very dangerous, " + . "as lots of things could happen when you leave by other means, such as cave-ins, " + . "or monsters suddenly snapping your body. Better use a savebed next time. " + . "H", + cf::NDI_RED + ); } } - $pl->ob->goto ($map, $x, $y); + $ob->goto ($map, $x, $y); } -# delete a player directory, be non-blocking AND synchronous... -# (thats hard, so we crap out and fork). -sub nuke_playerdir { - my ($user) = @_; - - aio_stat "$PLAYERDIR/$user"; - system "cd \Q$PLAYERDIR\E " - . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " - . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; +sub encode_password($) { + "!" . unpack "H*", $_[0] } -sub send_capabilities { - my ($ns) = @_; - - return unless $ns->extcmd; +sub compare_password($$) { + my ($pass, $token) = @_; - $ns->ext_event (capabilities => - # id, name, flags (1 == 2d), edge length - tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], - ); + if ($token =~ /!!(.*)/) { + return +(substr $pass, 0, 8) eq pack "H*", $1; + } elsif ($token =~ /!(.*)/) { + return $pass eq pack "H*", $1; + } else { + return $token eq crypt $pass, $token; + } } -sub setup { - my ($ns, $args) = @_; +# delete a player directory +sub nuke_playerdir { + my ($user) = @_; - # run through the cmds of setup - # syntax is setup ... - # - # we send the status of the cmd back, or a FALSE is the cmd is the server unknown - # The client then must sort this out - - my %setup = split / +/, $args; - while (my ($k, $v) = each %setup) { - if ($k eq "sound") { - $ns->sound ($v); - - } elsif ($k eq "exp64") { - $setup{$k} = 1; - - } elsif ($k eq "spellmon") { - $ns->monitor_spells ($v); - - } elsif ($k eq "darkness") { - $ns->darkness ($v); - - } elsif ($k eq "map1cmd") { - $ns->mapmode (cf::Map1Cmd) if $v > 0; - - } elsif ($k eq "map1acmd") { - $ns->mapmode (cf::Map1aCmd) if $v > 0; - - } elsif ($k eq "map2cmd") { - # gcfclient bug, map1acmd is sent too late - $ns->mapmode (cf::Map1aCmd); - $setup{$k} = "FALSE"; - - } elsif ($k eq "newmapcmd") { - $ns->newmapcmd ($v); - - } elsif ($k eq "mapinfocmd") { - $ns->mapinfocmd ($v); - - } elsif ($k eq "extcmd") { - $ns->extcmd ($v > 0); - send_capabilities $ns; - - } elsif ($k eq "extmap") { - $ns->extmap ($v); - - } elsif ($k eq "facecache") { - if (!$v) { - $v = 1; - $setup{$k} = $v; - $ns->send_drawinfo ("(trying to forcefully enable facecaching)", cf::NDI_RED); - } + my $lock = cf::lock_acquire "ext::login::nuke_playerdir"; - $ns->facecache ($v); + my $temp = "$PLAYERDIR/~$Coro::current~deleting~"; + aio_rename "$PLAYERDIR/$user", $temp; + IO::AIO::aio_rmtree $temp; +} - } elsif ($k eq "faceset") { - $ns->faceset (0); - $setup{$k} = 0; - # $ns->image2 (1) +sub login_done { + my ($pl) = @_; - } elsif ($k eq "tileset") { - $setup{$k} = $ns->faceset ($v & 1); + if (0 < Coro::AIO::aio_load "$cf::CONFDIR/motd", my $motd) { + $pl->ns->send_msg ("c/motd" => $motd, cf::NDI_CLEAR); + } +} - } elsif ($k eq "itemcmd") { - # Version of the item protocol command to use. Currently, - # only supported versions are 1 and 2. Using a numeric - # value will make it very easy to extend this in the future. - $ns->itemcmd ($v) if $v >= 1 && $v <= 2; +sub chargen { + my ($ns, $user, $pass) = @_; - $setup{$k} = $ns->itemcmd; + # the rest of this function is character creation + $Coro::current->{desc} = "addme($user) chargen"; - } elsif ($k eq "mapsize") { - my ($x, $y) = split /x/, $v; + # just to make sure nothing is left over + # normally, nothing is there. + nuke_playerdir $user; + + my $pl = cf::player::new $user; + $pl->password (encode_password $pass); + $pl->connect ($ns); + my $ob = $pl->ob; - $ns->mapx ($x = max 9, min cf::MAP_CLIENT_X, ($x - 1) | 1); - $ns->mapy ($y = max 9, min cf::MAP_CLIENT_Y, ($y - 1) | 1); + $ob->goto ($pl->maplevel, $ob->x, $ob->y); - $setup{$k} = "${x}x${y}"; + while () { + $ob->update_stats; + $pl->save_stats; - } elsif ($k eq "extendedMapInfos") { - $ns->ext_mapinfos ($v); + my $res = query $ns, cf::CS_QUERY_SINGLECHAR, + "[y] to roll new stats [n] to use stats\n[1-7] [1-7] to swap stats.\nRoll again (y/n/1-7)?"; - } elsif ($k eq "extendedTextInfos") { - $ns->has_readable_type ($v); + if ($res =~ /^[Nn]/) { + last; + } elsif ($res > 0 && $res <= 7) { + my $swap = query $ns, cf::CS_QUERY_SINGLECHAR, "Swap stat with (will not roll new stats) [1-7]?"; - } elsif ($k eq "smoothing") { # cfplus-style smoothing - $ns->smoothing ($v); + if ($swap > 0 && $swap <= 7) { + $ob->swap_stats ($res - 1, $swap - 1); + } + } else { + $ob->roll_stats; + } - } elsif ($k eq "fxix") { - $ns->fxix ($v); + Coro::Timer::sleep 0.05; + } - } elsif ($k eq "msg") { - $ns->can_msg ($v >= 2); - $setup{$k} = $ns->can_msg; + $ob->set_animation (2); + $ob->add_statbonus; - } elsif ($k eq "excmd") { - # we support it + while () { + $ns->send_msg ("chargen-race-title", ucfirst $pl->title, -1); + my $msg = $ob->msg; + $msg =~ s/(?<=\S)\n(?=\S)/ /g; + $ns->send_msg ("chargen-race-description", $msg, cf::NDI_BLUE); - } else { - # other commands: - # sexp: no idea, probably for oudated servers - # tick: more stupidity, server should send a tick per tick + my $res = query $ns, cf::CS_QUERY_SINGLECHAR, + "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; - $setup{$k} = "FALSE"; - } - } + last if $res =~ /[dD]/; - $ns->send_packet (join " ", setup => %setup); + $pl->chargen_race_next; + Coro::Timer::sleep 0.05; + } - cf::datalog setup => - request => $args, - reply => \%setup, - client => $ns->version, - ; -} + # create the playerdir, if necessary, as chargen_race_done did it before + # presumably because of unique maps + aio_mkdir playerdir $pl, 0770; + $pl->chargen_race_done; -sub addme { - my ($ns) = @_; + while () { + my $res = query $ns, cf::CS_QUERY_SINGLECHAR, + "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; - if (!$ns->facecache) - { - $ns->send_drawinfo (<Configure=>Map & Image=>Cache Images. -*** jcrossclient: your client is broken, use CFPlus or gcfclient. -*** -*** -EOF - if ($ns->version =~ /jcrossclient/) { - # let them, for now - } else { - $ns->flush; - return $ns->destroy; + if ($res =~ /^[fF]/) { + $pl->gender (1); + last; + } elsif ($res =~ /^[mM]/) { + $pl->gender (0); + last; } - - # $ns->facecache = true; + Coro::Timer::sleep 0.05; } - if ($ns->mapmode < cf::Map1aCmd) { - $ns->send_drawinfo (<reply (undef, "Welcome to Deliantra!"); + # XXX: Workaround for delayed client ext protocol handshake + $pl->esrv_new_player; -*** -*** WARNING: -*** Your client is too old. Please upgrade to a newer version. -EOF + delete $pl->{deny_save}; +} - $ns->flush; - return $ns->destroy; - } +cf::client->attach (on_addme => sub { + my ($ns) = @_; $ns->pl and return $ns->destroy; $ns->async (sub { + $Coro::current->{desc} = "addme init"; + my ($user, $pass); $ns->send_packet ("addme_success"); @@ -299,7 +264,7 @@ # read username while () { - $user = query $ns, 0, "What is your name?\n:"; + $user = query $ns, 0, "What is your name? (login names are case-sensitive)\n:"; if ($cf::LOGIN_LOCK{$user}) { $ns->send_drawinfo ( @@ -307,20 +272,23 @@ . "Chose another, or wait till the other session has ended.", cf::NDI_RED ); - } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,17}\z/) { + } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,19}\z/) { last; } else { $ns->send_drawinfo ( "Your username contains illegal characters " . "(only a-z, A-Z and 0-9 are allowed), " - . "or is not between 3 and 18 characters in length.", + . "or is not between 3 and 20 characters in length.", cf::NDI_RED ); } + Coro::Timer::sleep 0.4; } check_playing $ns, $user and next; + $Coro::current->{desc} = "addme($user) pass"; + $ns->send_drawinfo ( "Welcome $user, please enter your password now. " . "New users should now choose a password. " @@ -337,6 +305,7 @@ . "that cannot be too much to ask for :)", cf::NDI_RED ); + Coro::Timer::sleep 0.4; } # lock this username for the remainder of this login session @@ -352,19 +321,23 @@ check_playing $ns, $user and next; + $Coro::current->{desc} = "addme($user) check"; + # try to read the user file and check the password if (my $pl = cf::player::find $user) { aio_stat $pl->path and next; my $mtime = (stat _)[9]; - my $hash = $pl->password; + my $token = $pl->password; + + if ($cf::CFG{ext_login_nocheck} or compare_password $pass, $token) { + # player exists and passwords match - we can proceed - if ($cf::CFG{ext_login_nocheck} or $hash eq crypt $pass, $hash) { - nuke_str $pass; # password matches, wonderful my $pl = cf::player::find $user or next; $pl->connect ($ns); enter_map $pl; - last; + login_done $pl; + return; } elsif (can_cleanup $pl, $mtime) { Coro::Timer::sleep 1; @@ -375,7 +348,6 @@ cf::NDI_RED ); - #TODO: nuke_str (query $ns, cf::CS_QUERY_SINGLECHAR, "Delete existing account and create a new one (Y/N)?") =~ /^[yY]/ or next; @@ -387,8 +359,6 @@ # fall through to creation } else { - nuke_str $pass; - Coro::Timer::sleep 1; $ns->send_drawinfo ( @@ -400,7 +370,7 @@ } } else { # unable to load the playerfile: - # check wether the player dir exists, which means the file is corrupted or + # check whether the player dir exists, which means the file is corrupted or # something very similar. if (!aio_stat cf::player::playerdir $user) { $ns->send_drawinfo ( @@ -413,101 +383,98 @@ } } - # the rest of this function is character creation - - # just to make sure nothing is left over - nuke_playerdir $user; - my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again."; if ($pass2 ne $pass) { - nuke_str $pass; - nuke_str $pass2; $ns->send_drawinfo ( "The passwords do not match, please try again.", cf::NDI_RED ); + Coro::Timer::sleep 0.5; next; } - nuke_str $pass2; - - my $pl = cf::player::new $user; - $pl->password (crypt $pass, join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]); - nuke_str $pass; - $pl->connect ($ns); - my $ob = $pl->ob; - - $ob->goto ($pl->maplevel, $ob->x, $ob->y); - - while () { - $ob->update_stats; - $pl->save_stats; - - my $res = query $ns, cf::CS_QUERY_SINGLECHAR, - "[y] to roll new stats [n] to use stats\n[1-7] [1-7] to swap stats.\nRoll again (y/n/1-7)?"; + last; + } - if ($res =~ /^[Nn]/) { - last; - } elsif ($res > 0 && $res <= 7) { - my $swap = query $ns, cf::CS_QUERY_SINGLECHAR, "Swap stat with (will not roll new stats) [1-7]?"; + # lock again, too layz to make this nicer + local $cf::LOGIN_LOCK{$user} = 1; - if ($swap > 0 && $swap <= 7) { - $ob->swap_stats ($res - 1, $swap - 1); - } - } else { - $ob->roll_stats; - } - } + chargen $ns, $user, $pass; + login_done $ns->pl; + }); +}); - $ob->set_animation (2); - $ob->add_statbonus; +cf::client->attach ( + on_version => sub { + my ($ns, $arg) = @_; - while () { - $ns->send_msg (-1, "chargen-race-title", ucfirst $pl->title); - my $msg = $ob->msg; - $msg =~ s/(?<=\S)\n(?=\S)/ /g; - $ns->send_msg (cf::NDI_BLUE, "chargen-race-description", $msg); + $ns->ext_msg (nonces => map { join "", map { chr rand 256 } 0..63 } 1..2); + }, +); - my $res = query $ns, cf::CS_QUERY_SINGLECHAR, - "Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"; +#cf::register_async_exticmd create_login => sub { +# my ($ns, $reply, $user, $pass) = @_; +# +# $ns->pl and return $ns->destroy; +#}; - last if $res =~ /[dD]/; +cf::register_async_exticmd login => sub { + my ($ns, $reply, $user, $hash) = @_; - $pl->chargen_race_next; - } + $ns->pl and return $ns->destroy; +}; - $pl->chargen_race_done; +cf::register_command password => sub { + my ($pl, $arg) = @_; - while () { - my $res = query $ns, cf::CS_QUERY_SINGLECHAR, - "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; + unless ($pl->flag (cf::FLAG_WIZ)) { + $pl->message ( + "The password can currently only changed by a DM.", + cf::NDI_UNIQUE | cf::NDI_REPLY); + return; + } - if ($res =~ /^[fF]/) { - $pl->gender (1); - last; - } elsif ($res =~ /^[mM]/) { - $pl->gender (0); - last; - } - } + my (@args) = split /\s+/, $arg; + my ($player, $new_pw) = @args; - $ob->reply (undef, "Welcome to Crossfire!"); + if ($pl->flag (cf::FLAG_WIZ) && $player eq '') { + $pl->message ( + "Usage: password []", + cf::NDI_UNIQUE | cf::NDI_REPLY); + return; + } - delete $pl->{deny_save}; + if ($new_pw eq '') { + $new_pw = + join '', + map { ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[(cf::rndm 64)] } + 1..9; + } - last; + cf::async { + my $plc = cf::player::find $player; + if ($plc) { + $plc->password (encode_password $new_pw); + $pl->message ( + "Ok, changed password of '$player' to '$new_pw'!", + cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); + } else { + $pl->message ( + "Fail! Couldn't set password for '$player', " + . "he doesn't seem to exist!", + cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); } - }); -} + }; +}; cf::register_command quit => sub { my ($ob, $arg) = @_; - $ob->reply (undef, - "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. " - . "If you are sure you want to do this, then use the quit_character command instead of quit.", - cf::NDI_UNIQUE | cf::NDI_RED); + $ob->send_msg (undef, + "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. " + . "If you are sure you want to do this, then use the quit_character command instead of quit.", + cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); }; cf::register_command quit_character => sub { @@ -517,15 +484,12 @@ $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to PERMANENTLY delete your character and all associated data (y/n)?", sub { if ($_[0] !~ /^[yY]/) { - $ob->reply (undef, - "Ok, not not quitting then.", - cf::NDI_UNIQUE | cf::NDI_RED); + $ob->send_msg (undef, "Ok, not not quitting then.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); } else { - $ob->reply (undef, - "Ok, quitting, hope to see you again.", - cf::NDI_UNIQUE | cf::NDI_RED); - $pl->ns->flush; - cf::async { $pl->quit_character }; + $ob->send_msg (undef, "Ok, quitting, hope to see you again.", cf::NDI_UNIQUE | cf::NDI_RED | cf::NDI_REPLY); + cf::async { + $pl->quit_character; + }; } }); }; @@ -541,22 +505,26 @@ # update respawn position $pl->savebed ($bed->map->path, $bed->x, $bed->y); - cf::async { $pl->save }; - - $pl->killer ("left"); - $ob->check_score; - $ob->reply (undef, "In the future, you will wake up here when you die."); - - $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { - if ($_[0] !~ /^[yY]/) { - $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); - $pl->deactivate; - $pl->ns->destroy; - } else { - cf::async { $pl->save }; - } - }); + cf::async { + my $killer = cf::arch::get "killer_logout"; $pl->killer ($killer); $killer->destroy; + ext::highscore::check $ob; + + $pl->save; + + $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY); + + my $ns = $pl->ns + or return; + + $ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { + if ($_[0] !~ /^[yY]/) { + $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); + $pl->deactivate; + $pl->ns->destroy; + } + }); + }; }, ); @@ -575,72 +543,9 @@ $_->ob->message ("$name left the game.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; } else { $_->ob->message ("$name uncerimoniously disconnected.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; - $pl->{unclean_save} = $cf::RUNTIME; + $pl->{unclean_save} = $cf::RUNTIME + unless safe_spot $pl; } }, ); -cf::client->attach ( - on_addme => \&addme, - on_setup => \&setup, -); - -############################################################################# - -our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs -our $SAVE_TIMEOUT = 20; # save players every n seconds - -our $SCHEDULER = cf::async_ext { - my $schedule_interval = Coro::Event->timer (after => 1, interval => $SCHEDULE_INTERVAL); - while () { - $schedule_interval->next; - - # this weird form of iteration over values is used because - # the hash changes underneath us frequently, and for - # keeps a direct reference to the value without (in 5.8 perls) - # keeping a reference, so this is prone to crashes or worse. - my @players = keys %cf::PLAYER; - for (@players) { - my $pl = $cf::PLAYER{$_} - or next; - $pl->valid or next; - - eval { - if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { - cf::wait_for_tick_begin; - $pl->save; - - unless ($pl->active || $pl->ns) { - # check refcounts, this is tricky and needs to be adjusted to fit server internals - my $ob = $pl->ob; - - my $pl_ref = $pl->refcnt_cnt; - my $ob_ref = $ob->refcnt_cnt; - - ## pl_ref == $pl + ob->contr + %cf::PLAYER - ## ob_ref == $ob + pl->observe + simply being an object - if ($pl_ref == 3 && $ob_ref == 3) { - warn "player-scheduler destroy ", $ob->name;#d# - - # remove from sight and get fresh "copies" - $pl = delete $cf::PLAYER{$ob->name}; - $ob = $pl->ob; - - $pl->destroy; # destroys $ob - } else { - my $a_ = $pl->refcnt;#d# - my $b_ = $ob->refcnt;#d# - - warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# - } - } - } - }; - warn $@ if $@; - Coro::cede; - }; - } -}; - -$SCHEDULER->prio (1); -