… | |
… | |
2086 | my $nuke_counter = "aaaa"; |
2086 | my $nuke_counter = "aaaa"; |
2087 | |
2087 | |
2088 | sub nuke { |
2088 | sub nuke { |
2089 | my ($self) = @_; |
2089 | my ($self) = @_; |
2090 | |
2090 | |
|
|
2091 | { |
|
|
2092 | my $lock = cf::lock_acquire "map_data:$self->{path}"; |
|
|
2093 | |
2091 | delete $cf::MAP{$self->path}; |
2094 | delete $cf::MAP{$self->path}; |
2092 | |
2095 | |
2093 | $self->unlink_save; |
2096 | $self->unlink_save; |
2094 | |
2097 | |
2095 | bless $self, "cf::map"; |
2098 | bless $self, "cf::map"; |
2096 | delete $self->{deny_reset}; |
2099 | delete $self->{deny_reset}; |
2097 | $self->{deny_save} = 1; |
2100 | $self->{deny_save} = 1; |
2098 | $self->reset_timeout (1); |
2101 | $self->reset_timeout (1); |
2099 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2102 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2100 | |
2103 | |
2101 | $cf::MAP{$self->path} = $self; |
2104 | $cf::MAP{$self->path} = $self; |
|
|
2105 | } |
2102 | |
2106 | |
2103 | $self->reset; # polite request, might not happen |
2107 | $self->reset; # polite request, might not happen |
2104 | } |
2108 | } |
2105 | |
2109 | |
2106 | =item $maps = cf::map::tmp_maps |
2110 | =item $maps = cf::map::tmp_maps |
… | |
… | |
2500 | the message, with C<log> being the default. If C<$color> is negative, suppress |
2504 | the message, with C<log> being the default. If C<$color> is negative, suppress |
2501 | the message unless the client supports the msg packet. |
2505 | the message unless the client supports the msg packet. |
2502 | |
2506 | |
2503 | =cut |
2507 | =cut |
2504 | |
2508 | |
|
|
2509 | our %CHANNEL = ( |
|
|
2510 | "c/identify" => { |
|
|
2511 | id => "identify", |
|
|
2512 | title => "Identify", |
|
|
2513 | reply => undef, |
|
|
2514 | tooltip => "Items recently identified", |
|
|
2515 | }, |
|
|
2516 | ); |
|
|
2517 | |
2505 | sub cf::client::send_msg { |
2518 | sub cf::client::send_msg { |
2506 | my ($self, $channel, $msg, $color, @extra) = @_; |
2519 | my ($self, $channel, $msg, $color, @extra) = @_; |
2507 | |
2520 | |
2508 | $msg = $self->pl->expand_cfpod ($msg); |
2521 | $msg = $self->pl->expand_cfpod ($msg); |
2509 | |
2522 | |
2510 | $color &= cf::NDI_CLIENT_MASK; # just in case... |
2523 | $color &= cf::NDI_CLIENT_MASK; # just in case... |
|
|
2524 | |
|
|
2525 | # check predefined channels, for the benefit of C |
|
|
2526 | $channel = $CHANNEL{$channel} if $CHANNEL{$channel}; |
2511 | |
2527 | |
2512 | if (ref $channel) { |
2528 | if (ref $channel) { |
2513 | # send meta info to client, if not yet sent |
2529 | # send meta info to client, if not yet sent |
2514 | unless (exists $self->{channel}{$channel->{id}}) { |
2530 | unless (exists $self->{channel}{$channel->{id}}) { |
2515 | $self->{channel}{$channel->{id}} = $channel; |
2531 | $self->{channel}{$channel->{id}} = $channel; |
… | |
… | |
2836 | # the server's init and main functions |
2852 | # the server's init and main functions |
2837 | |
2853 | |
2838 | sub load_facedata($) { |
2854 | sub load_facedata($) { |
2839 | my ($path) = @_; |
2855 | my ($path) = @_; |
2840 | |
2856 | |
|
|
2857 | # HACK to clear player env face cache, we need some signal framework |
|
|
2858 | # for this (global event?) |
|
|
2859 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2860 | |
2841 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2861 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2842 | |
2862 | |
2843 | warn "loading facedata from $path\n"; |
2863 | warn "loading facedata from $path\n"; |
2844 | |
2864 | |
2845 | my $facedata; |
2865 | my $facedata; |
… | |
… | |
2956 | $ns->fx_want ($k, $v); |
2976 | $ns->fx_want ($k, $v); |
2957 | } |
2977 | } |
2958 | }; |
2978 | }; |
2959 | |
2979 | |
2960 | sub reload_regions { |
2980 | sub reload_regions { |
|
|
2981 | # HACK to clear player env face cache, we need some signal framework |
|
|
2982 | # for this (global event?) |
|
|
2983 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2984 | |
2961 | load_resource_file "$MAPDIR/regions" |
2985 | load_resource_file "$MAPDIR/regions" |
2962 | or die "unable to load regions file\n"; |
2986 | or die "unable to load regions file\n"; |
2963 | |
2987 | |
2964 | for (cf::region::list) { |
2988 | for (cf::region::list) { |
2965 | $_->{match} = qr/$_->{match}/ |
2989 | $_->{match} = qr/$_->{match}/ |