--- deliantra/server/ext/map_lib.ext 2007/02/05 11:48:43 1.4 +++ deliantra/server/ext/map_lib.ext 2008/02/02 17:38:36 1.5 @@ -109,6 +109,47 @@ } }; +=item object attachment: 'display_info_window' + +If you attach this attachment to a sign a window containing the +message will open in the client when the player applies it. + +Use this feature with care, as popups usually are very noisy. +This is mostly thought for tutorial or other instructions. + +=cut + +cf::object::attachment display_info_window => + on_apply => sub { + my ($self, $pl) = @_; + + return unless $pl->contr->ns->{can_widget}; + + my $cfg = $self->{display_info_window}; + + if ($pl->contr->ns->{info_wins}->{$self->uuid}) { + $pl->contr->ns->{info_wins}->{$self->uuid}->destroy; + } + + my $ws = $pl->contr->ns->new_widgetset; + + my $w = $ws->{my_main} = $ws->new (Toplevel => + force_w => 600, + force_h => 400, + x => 'center', + y => 'center', + title => 'Information Sign', + has_close_button => 1, + on_delete => sub { $ws->destroy }, + ); + $w->add ($ws->{txt_area} = $ws->new ('TextScroller')); + $ws->{txt_area}->add_paragraph ($self->msg); + $w->show; + $pl->contr->ns->{info_wins}->{$self->uuid} = $ws; + + cf::override 1; + }; + =back =cut