… | |
… | |
496 | |
496 | |
497 | # the unique path, undef == no special unique path |
497 | # the unique path, undef == no special unique path |
498 | sub uniq_path { |
498 | sub uniq_path { |
499 | my ($self) = @_; |
499 | my ($self) = @_; |
500 | |
500 | |
|
|
501 | $self->{user_rel} || $self->{ext} |
|
|
502 | ? undef |
501 | sprintf "%s/%s/%s", cf::localdir, cf::uniquedir, $self->_escaped_path |
503 | : sprintf "%s/%s/%s", cf::localdir, cf::uniquedir, $self->_escaped_path |
|
|
504 | } |
|
|
505 | |
|
|
506 | sub customise_for { |
|
|
507 | my ($self, $map, $ob) = @_; |
|
|
508 | |
|
|
509 | if ($map->per_player) { |
|
|
510 | return cf::map::find ("~" . $ob->name . "/" . $map->{path}{path}); |
|
|
511 | } |
|
|
512 | |
|
|
513 | $map |
502 | } |
514 | } |
503 | |
515 | |
504 | # this is somewhat ugly, but style maps do need special treatment |
516 | # this is somewhat ugly, but style maps do need special treatment |
505 | sub is_style_map { |
517 | sub is_style_map { |
506 | $_[0]{path} =~ m{^/styles/} |
518 | $_[0]{path} =~ m{^/styles/} |
… | |
… | |
1598 | $self->reset_timeout (1); |
1610 | $self->reset_timeout (1); |
1599 | $self->rename ("{nuke}/" . ($nuke_counter++)); |
1611 | $self->rename ("{nuke}/" . ($nuke_counter++)); |
1600 | $self->reset; # polite request, might not happen |
1612 | $self->reset; # polite request, might not happen |
1601 | } |
1613 | } |
1602 | |
1614 | |
1603 | sub customise_for { |
|
|
1604 | my ($map, $ob) = @_; |
|
|
1605 | |
|
|
1606 | if ($map->per_player) { |
|
|
1607 | return cf::map::find "~" . $ob->name . "/" . $map->{path}{path}; |
|
|
1608 | } |
|
|
1609 | |
|
|
1610 | $map |
|
|
1611 | } |
|
|
1612 | |
|
|
1613 | =item cf::map::unique_maps |
1615 | =item cf::map::unique_maps |
1614 | |
1616 | |
1615 | Returns an arrayref of cf::path's of all shared maps that have |
1617 | Returns an arrayref of cf::path's of all shared maps that have |
1616 | instantiated unique items. May block. |
1618 | instantiated unique items. May block. |
1617 | |
1619 | |
… | |
… | |
1815 | |
1817 | |
1816 | $self->enter_link; |
1818 | $self->enter_link; |
1817 | |
1819 | |
1818 | (async { |
1820 | (async { |
1819 | my $map = cf::map::find $path->as_string; |
1821 | my $map = cf::map::find $path->as_string; |
1820 | $map = $map->customise_for ($self) if $map; |
1822 | $map = $map->{path}->customise_for ($map, $self) if $map; |
1821 | |
1823 | |
1822 | # warn "entering ", $map->path, " at ($x, $y)\n" |
1824 | # warn "entering ", $map->path, " at ($x, $y)\n" |
1823 | # if $map; |
1825 | # if $map; |
1824 | |
1826 | |
1825 | $map or $self->message ("The exit to '" . ($path->visible_name) . "' is closed", cf::NDI_UNIQUE | cf::NDI_RED); |
1827 | $map or $self->message ("The exit to '" . ($path->visible_name) . "' is closed", cf::NDI_UNIQUE | cf::NDI_RED); |