… | |
… | |
969 | } |
969 | } |
970 | |
970 | |
971 | 0 |
971 | 0 |
972 | } |
972 | } |
973 | |
973 | |
974 | =item $bool = cf::global::invoke (EVENT_CLASS_XXX, ...) |
974 | =item $bool = cf::global->invoke (EVENT_CLASS_XXX, ...) |
975 | |
975 | |
976 | =item $bool = $attachable->invoke (EVENT_CLASS_XXX, ...) |
976 | =item $bool = $attachable->invoke (EVENT_CLASS_XXX, ...) |
977 | |
977 | |
978 | Generate an object-specific event with the given arguments. |
978 | Generate an object-specific event with the given arguments. |
979 | |
979 | |
… | |
… | |
3218 | $RESOURCE{$name} = $info; |
3218 | $RESOURCE{$name} = $info; |
3219 | } |
3219 | } |
3220 | |
3220 | |
3221 | cf::cede_to_tick; |
3221 | cf::cede_to_tick; |
3222 | } |
3222 | } |
3223 | |
|
|
3224 | if (my $soundconf = delete $res->{"res/sound.conf"}) { |
|
|
3225 | $soundconf = $enc->decode (delete $soundconf->{data}); |
|
|
3226 | |
|
|
3227 | for (0 .. SOUND_CAST_SPELL_0 - 1) { |
|
|
3228 | my $sound = $soundconf->{compat}[$_] |
|
|
3229 | or next; |
|
|
3230 | |
|
|
3231 | my $face = cf::face::find "sound/$sound->[1]"; |
|
|
3232 | cf::sound::set $sound->[0] => $face; |
|
|
3233 | cf::sound::old_sound_index $_, $face; # gcfclient-compat |
|
|
3234 | } |
|
|
3235 | |
|
|
3236 | while (my ($k, $v) = each %{$soundconf->{event}}) { |
|
|
3237 | my $face = cf::face::find "sound/$v"; |
|
|
3238 | cf::sound::set $k => $face; |
|
|
3239 | } |
|
|
3240 | } |
|
|
3241 | } |
3223 | } |
|
|
3224 | |
|
|
3225 | cf::global->invoke (EVENT_GLOBAL_RESOURCE_UPDATE); |
3242 | |
3226 | |
3243 | 1 |
3227 | 1 |
3244 | } |
3228 | } |
|
|
3229 | |
|
|
3230 | cf::global->attach (on_resource_update => sub { |
|
|
3231 | if (my $soundconf = $RESOURCE{"res/sound.conf"}) { |
|
|
3232 | $soundconf = JSON::XS->new->utf8->relaxed->decode ($soundconf->{data}); |
|
|
3233 | |
|
|
3234 | for (0 .. SOUND_CAST_SPELL_0 - 1) { |
|
|
3235 | my $sound = $soundconf->{compat}[$_] |
|
|
3236 | or next; |
|
|
3237 | |
|
|
3238 | my $face = cf::face::find "sound/$sound->[1]"; |
|
|
3239 | cf::sound::set $sound->[0] => $face; |
|
|
3240 | cf::sound::old_sound_index $_, $face; # gcfclient-compat |
|
|
3241 | } |
|
|
3242 | |
|
|
3243 | while (my ($k, $v) = each %{$soundconf->{event}}) { |
|
|
3244 | my $face = cf::face::find "sound/$v"; |
|
|
3245 | cf::sound::set $k => $face; |
|
|
3246 | } |
|
|
3247 | } |
|
|
3248 | }); |
3245 | |
3249 | |
3246 | register_exticmd fx_want => sub { |
3250 | register_exticmd fx_want => sub { |
3247 | my ($ns, $want) = @_; |
3251 | my ($ns, $want) = @_; |
3248 | |
3252 | |
3249 | while (my ($k, $v) = each %$want) { |
3253 | while (my ($k, $v) = each %$want) { |