1 | #! perl # depends=widget mandatory |
1 | #! perl # depends=widget mandatory |
2 | |
2 | |
3 | # this module implements a rather fancy worldmap |
3 | # this module implements a rather fancy worldmap |
4 | |
4 | |
5 | our $WORLDMAP_UPDATE_INTERVAL = $cf::CFG{worldmap_update_interval} || 2; |
5 | CONF WORLDMAP_UPDATE_INTERVAL = 2; |
6 | |
6 | |
7 | our $GENCOUNT = 0; |
7 | our $GENCOUNT = 0; |
8 | our %PLAYERINFO; |
8 | our %PLAYERINFO; |
9 | |
9 | |
10 | our ($MAPW, $MAPH) = (1024, 1024); # it's useful to know the map width/height in pixels |
10 | our ($MAPW, $MAPH) = (1024, 1024); # it's useful to know the map width/height in pixels |
… | |
… | |
105 | cf::override 1; |
105 | cf::override 1; |
106 | }, |
106 | }, |
107 | ; |
107 | ; |
108 | |
108 | |
109 | cf::post_init { |
109 | cf::post_init { |
110 | cf::async_ext { |
110 | our $UPDATER = cf::async_ext { |
111 | $Coro::current->{desc} = "worldmap updater"; |
111 | $Coro::current->{desc} = "worldmap updater"; |
112 | |
112 | |
113 | while () { |
113 | while () { |
114 | Coro::EV::timer_once $WORLDMAP_UPDATE_INTERVAL; |
114 | Coro::AnyEvent::sleep $WORLDMAP_UPDATE_INTERVAL; |
115 | |
115 | |
116 | cf::get_slot 0.01, -50, "worldmap update"; |
116 | cf::get_slot 0.01, -50, "worldmap update"; |
117 | |
117 | |
118 | ++$GENCOUNT; |
118 | ++$GENCOUNT; |
119 | |
119 | |