… | |
… | |
292 | on_apply => sub { |
292 | on_apply => sub { |
293 | my ($bed, $ob) = @_; |
293 | my ($bed, $ob) = @_; |
294 | |
294 | |
295 | return cf::override 0 unless $ob->type == cf::PLAYER; |
295 | return cf::override 0 unless $ob->type == cf::PLAYER; |
296 | |
296 | |
297 | my $pl = $ob->pl; |
297 | my $pl = $ob->contr; |
298 | |
298 | |
299 | # update respawn position |
299 | # update respawn position |
300 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
300 | $pl->savebed ($bed->map->path, $bed->x, $bed->y); |
301 | |
301 | |
302 | $pl->killer ("left"); |
302 | $pl->killer ("left"); |
… | |
… | |
363 | eval { |
363 | eval { |
364 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
364 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
365 | $pl->save; |
365 | $pl->save; |
366 | Coro::Timer::sleep $SAVE_INTERVAL; |
366 | Coro::Timer::sleep $SAVE_INTERVAL; |
367 | } |
367 | } |
|
|
368 | my $ob = $pl->ob; |
|
|
369 | Scalar::Util::weaken $pl; # 2 == from object + from perl |
|
|
370 | Scalar::Util::weaken $ob; # 2 == one from being an object + ??? |
|
|
371 | my $a_ = $pl->refcnt; |
|
|
372 | my $b_ = $ob->refcnt; |
|
|
373 | my $a = $pl->refcnt_cnt; |
|
|
374 | my $b = $ob->refcnt_cnt; |
|
|
375 | warn "rc $a,$a_ $b,$b_\n";#d# |
368 | }; |
376 | }; |
369 | warn $@ if $@; |
377 | warn $@ if $@; |
370 | Coro::cede; |
378 | Coro::cede; |
371 | }; |
379 | }; |
372 | } |
380 | } |