--- deliantra/server/ext/map_lib.ext 2006/12/21 22:41:34 1.3 +++ deliantra/server/ext/map_lib.ext 2007/02/05 11:48:43 1.4 @@ -69,6 +69,46 @@ } }; + +=item object attachment: 'trigger_on_dialog_flag' + +This attachment checks whether the player has a specific +dialog flag set (the ones you can set with @setflag, see also +L, and triggers a connection depending on that. + +The attachment has following configuration: + +=over 4 + +=item flag + +This field should contain the name of the flag that you want to check +for. + +=item connection + +The connection ID of the connection you want to trigger. + +=item state + +The state of the connection: 0 for release, 1 for push. + +=back + +=cut + +cf::object::attachment trigger_on_dialog_flag => + on_move_trigger => sub { + my ($self, $who, $orig) = @_; + my $cfg = $self->{trigger_on_dialog_flag}; + if (exists $who->{ob}{dialog_flag}{$cfg->{flag}}) { + if ($who->{ob}{dialog_flag}{$cfg->{flag}}) { + $self->map->trigger ($cfg->{connection}, $cfg->{state}); + } + cf::override; + } + }; + =back =cut