--- deliantra/server/ext/item-worldmap.ext 2007/07/21 19:04:44 1.2 +++ deliantra/server/ext/item-worldmap.ext 2007/07/22 17:10:06 1.4 @@ -1,5 +1,17 @@ #! perl # depends=widget -#! perl + +# this module implements a rather fancy worldmap + +our $WORLDMAP_UPDATE_INTERVAL = $cfg::CFG{worldmap_update_interval} || 10; + +cf::async_ext { + my $schedule_interval = Coro::Event->timer (after => 1); + + while () { + $schedule_interval->interval ($WORLDMAP_UPDATE_INTERVAL); + $schedule_interval->next; + } +}; sub create_widgets { my ($ns) = @_; @@ -21,6 +33,7 @@ my $face = cf::face::find "res/worldmap.jpg"; $ns->send_face ($face); + $ns->flush_fx; $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1)); $sw->add (my $canvas = $ws->new (Canvas => expand => 1)); @@ -30,7 +43,11 @@ $info } -# this module implements a rather fancy worldmap +sub update_worldmap { + my ($ns) = @_; + + my $ws = $ns->{ws_worldmap} or return; +} cf::object::attachment item_worldmap => on_apply => sub { @@ -40,7 +57,10 @@ if ($ns->{can_widget}) { my $ws = $ns->{ws_worldmap} ||= create_widgets $ns; - $ws->{toplevel}->show; + $ws->{toplevel}->toggle_visibility; + $ws->{toplevel}->get (visible => sub { + update_worldmap $ns; + }); } else { $ns->send_msg ("log", "Your client doesn't support the (required) widget extension. Try CFPlus at http://crossfire.schmorp.de/.", cf::NDI_RED); }