ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.528 by root, Fri Apr 23 04:42:12 2010 UTC vs.
Revision 1.530 by root, Wed Apr 28 21:05:33 2010 UTC

106our $RANDOMDIR = "$LOCALDIR/random"; 106our $RANDOMDIR = "$LOCALDIR/random";
107our $BDBDIR = "$LOCALDIR/db"; 107our $BDBDIR = "$LOCALDIR/db";
108our $PIDFILE = "$LOCALDIR/pid"; 108our $PIDFILE = "$LOCALDIR/pid";
109our $RUNTIMEFILE = "$LOCALDIR/runtime"; 109our $RUNTIMEFILE = "$LOCALDIR/runtime";
110 110
111our %RESOURCE; 111our %RESOURCE; # unused
112 112
113our $OUTPUT_RATE_MIN = 3000; 113our $OUTPUT_RATE_MIN = 3000;
114our $OUTPUT_RATE_MAX = 1000000; 114our $OUTPUT_RATE_MAX = 1000000;
115 115
116our $MAX_LINKS = 32; # how many chained exits to follow 116our $MAX_LINKS = 32; # how many chained exits to follow
1635 $pl->password ("*"); # this should lock out the player until we have nuked the dir 1635 $pl->password ("*"); # this should lock out the player until we have nuked the dir
1636 1636
1637 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1) if $pl->active; 1637 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1) if $pl->active;
1638 $pl->deactivate; 1638 $pl->deactivate;
1639 my $killer = cf::arch::get "killer_quit"; $pl->killer ($killer); $killer->destroy; 1639 my $killer = cf::arch::get "killer_quit"; $pl->killer ($killer); $killer->destroy;
1640 $pl->ob->check_score;
1641 $pl->invoke (cf::EVENT_PLAYER_QUIT); 1640 $pl->invoke (cf::EVENT_PLAYER_QUIT);
1642 $pl->ns->destroy if $pl->ns; 1641 $pl->ns->destroy if $pl->ns;
1643 1642
1644 my $path = playerdir $pl; 1643 my $path = playerdir $pl;
1645 my $temp = "$path~$cf::RUNTIME~deleting~"; 1644 my $temp = "$path~$cf::RUNTIME~deleting~";
3429 my $idx = (cf::face::find $name) || cf::face::alloc $name; 3428 my $idx = (cf::face::find $name) || cf::face::alloc $name;
3430 3429
3431 cf::face::set_data $idx, 0, $info->{data}, $info->{hash}; 3430 cf::face::set_data $idx, 0, $info->{data}, $info->{hash};
3432 cf::face::set_type $idx, $info->{type}; 3431 cf::face::set_type $idx, $info->{type};
3433 } else { 3432 } else {
3434 $RESOURCE{$name} = $info; 3433 $RESOURCE{$name} = $info; # unused
3435 } 3434 }
3436 3435
3437 cf::cede_to_tick; 3436 cf::cede_to_tick;
3438 } 3437 }
3439 } 3438 }
3440 3439
3441 cf::global->invoke (EVENT_GLOBAL_RESOURCE_UPDATE); 3440 cf::global->invoke (EVENT_GLOBAL_RESOURCE_UPDATE);
3442 3441
3443 1 3442 1
3444} 3443}
3445
3446cf::global->attach (on_resource_update => sub {
3447 if (my $soundconf = $RESOURCE{"res/sound.conf"}) {
3448 $soundconf = JSON::XS->new->utf8->relaxed->decode ($soundconf->{data});
3449
3450 for (0 .. SOUND_CAST_SPELL_0 - 1) {
3451 my $sound = $soundconf->{compat}[$_]
3452 or next;
3453
3454 my $face = cf::face::find "sound/$sound->[1]";
3455 cf::sound::set $sound->[0] => $face;
3456 cf::sound::old_sound_index $_, $face; # gcfclient-compat
3457 }
3458
3459 while (my ($k, $v) = each %{$soundconf->{event}}) {
3460 my $face = cf::face::find "sound/$v";
3461 cf::sound::set $k => $face;
3462 }
3463 }
3464});
3465 3444
3466register_exticmd fx_want => sub { 3445register_exticmd fx_want => sub {
3467 my ($ns, $want) = @_; 3446 my ($ns, $want) = @_;
3468 3447
3469 while (my ($k, $v) = each %$want) { 3448 while (my ($k, $v) = each %$want) {
3508sub reload_treasures { 3487sub reload_treasures {
3509 load_resource_file "$DATADIR/treasures" 3488 load_resource_file "$DATADIR/treasures"
3510 or die "unable to load treasurelists\n"; 3489 or die "unable to load treasurelists\n";
3511} 3490}
3512 3491
3492sub reload_sound {
3493 0 < Coro::AIO::aio_load "$DATADIR/sound", my $data
3494 or die "$DATADIR/sound $!";
3495
3496 my $soundconf = JSON::XS->new->utf8->relaxed->decode ($data);
3497
3498 for (0 .. SOUND_CAST_SPELL_0 - 1) {
3499 my $sound = $soundconf->{compat}[$_]
3500 or next;
3501
3502 my $face = cf::face::find "sound/$sound->[1]";
3503 cf::sound::set $sound->[0] => $face;
3504 cf::sound::old_sound_index $_, $face; # gcfclient-compat
3505 }
3506
3507 while (my ($k, $v) = each %{$soundconf->{event}}) {
3508 my $face = cf::face::find "sound/$v";
3509 cf::sound::set $k => $face;
3510 }
3511}
3512
3513sub reload_resources { 3513sub reload_resources {
3514 warn "reloading resource files...\n"; 3514 warn "reloading resource files...\n";
3515 3515
3516 reload_facedata; 3516 reload_facedata;
3517 reload_sound;
3517 reload_archetypes; 3518 reload_archetypes;
3518 reload_regions; 3519 reload_regions;
3519 reload_treasures; 3520 reload_treasures;
3520 3521
3521 warn "finished reloading resource files\n"; 3522 warn "finished reloading resource files\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines