1 | #! perl # MANDATORY |
1 | #! perl # mandatory |
2 | |
2 | |
3 | # this extension swaps out maps and resets them, in essence managing |
3 | # this extension swaps out maps and resets them, in essence managing |
4 | # the reset/swap policy of the server. |
4 | # the reset/swap policy of the server. |
5 | # it also contains the map prefetching logic |
5 | # it also contains the map prefetching logic |
6 | |
6 | |
… | |
… | |
17 | # load the header of swapped-out maps. |
17 | # load the header of swapped-out maps. |
18 | # this is not a correctness issue, it simply saves diskspace |
18 | # this is not a correctness issue, it simply saves diskspace |
19 | # because old files will get cleaned up on reset time |
19 | # because old files will get cleaned up on reset time |
20 | Coro::Timer::sleep 0.25; |
20 | Coro::Timer::sleep 0.25; |
21 | |
21 | |
22 | for my $map (@{ cf::map::tmp_maps or [] }) { |
22 | for my $path (@{ cf::map::tmp_maps or [] }, @{ cf::map::random_maps or [] }) { |
23 | cf::map::find $map; |
23 | cf::map::find $path; |
24 | cf::wait_for_tick; Coro::cede; |
24 | cf::wait_for_tick; Coro::cede; |
25 | } |
25 | } |
26 | |
|
|
27 | #TODO: should also preload random maps... |
|
|
28 | |
26 | |
29 | # now hunt for resettable per-player maps |
27 | # now hunt for resettable per-player maps |
30 | for my $login (@{ cf::player::list_logins or [] }) { |
28 | for my $login (@{ cf::player::list_logins or [] }) { |
31 | for my $path (@{ cf::player::maps $login or [] }) { |
29 | for my $path (@{ cf::player::maps $login or [] }) { |
32 | Coro::cede; |
30 | Coro::cede; |