… | |
… | |
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; |
|
|
2094 | |
|
|
2095 | bless $self, "cf::map"; |
2096 | bless $self, "cf::map"; |
2096 | delete $self->{deny_reset}; |
2097 | delete $self->{deny_reset}; |
2097 | $self->{deny_save} = 1; |
2098 | $self->{deny_save} = 1; |
2098 | $self->reset_timeout (1); |
2099 | $self->reset_timeout (1); |
2099 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2100 | $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); |
2100 | |
2101 | |
|
|
2102 | $self->unlink_save; |
|
|
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 |
… | |
… | |
2836 | # the server's init and main functions |
2840 | # the server's init and main functions |
2837 | |
2841 | |
2838 | sub load_facedata($) { |
2842 | sub load_facedata($) { |
2839 | my ($path) = @_; |
2843 | my ($path) = @_; |
2840 | |
2844 | |
|
|
2845 | # HACK to clear player env face cache, we need some signal framework |
|
|
2846 | # for this (global event?) |
|
|
2847 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2848 | |
2841 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2849 | my $enc = JSON::XS->new->utf8->canonical->relaxed; |
2842 | |
2850 | |
2843 | warn "loading facedata from $path\n"; |
2851 | warn "loading facedata from $path\n"; |
2844 | |
2852 | |
2845 | my $facedata; |
2853 | my $facedata; |
… | |
… | |
2956 | $ns->fx_want ($k, $v); |
2964 | $ns->fx_want ($k, $v); |
2957 | } |
2965 | } |
2958 | }; |
2966 | }; |
2959 | |
2967 | |
2960 | sub reload_regions { |
2968 | sub reload_regions { |
|
|
2969 | # HACK to clear player env face cache, we need some signal framework |
|
|
2970 | # for this (global event?) |
|
|
2971 | %ext::player_env::MUSIC_FACE_CACHE = (); |
|
|
2972 | |
2961 | load_resource_file "$MAPDIR/regions" |
2973 | load_resource_file "$MAPDIR/regions" |
2962 | or die "unable to load regions file\n"; |
2974 | or die "unable to load regions file\n"; |
2963 | |
2975 | |
2964 | for (cf::region::list) { |
2976 | for (cf::region::list) { |
2965 | $_->{match} = qr/$_->{match}/ |
2977 | $_->{match} = qr/$_->{match}/ |