… | |
… | |
61 | $pl->send_msg ($cf::SAY_CHANNEL); |
61 | $pl->send_msg ($cf::SAY_CHANNEL); |
62 | $pl->send_msg ($cf::CHAT_CHANNEL); |
62 | $pl->send_msg ($cf::CHAT_CHANNEL); |
63 | }, |
63 | }, |
64 | ); |
64 | ); |
65 | |
65 | |
|
|
66 | # TODO: remove once safe |
66 | cf::register_command listen => sub { |
67 | cf::register_command listen => sub { |
67 | my ($pl, $msg) = @_; |
|
|
68 | my $player = cf::player::find_active $pl->name; |
|
|
69 | |
|
|
70 | if ($msg ne "") { |
|
|
71 | $msg = 10 if $msg > 10; |
|
|
72 | |
|
|
73 | my $prev_listen = $player->listening; |
|
|
74 | $player->listening ($msg); |
|
|
75 | if ($prev_listen == $player->listening) { |
|
|
76 | $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_REPLY); |
|
|
77 | } else { |
|
|
78 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_REPLY); |
|
|
79 | } |
|
|
80 | } else { |
|
|
81 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_REPLY); |
|
|
82 | } |
|
|
83 | }; |
68 | }; |
84 | |
69 | |
85 | cf::register_command cointoss => sub { |
70 | cf::register_command cointoss => sub { |
86 | my ($ob, $msg) = @_; |
71 | my ($ob, $msg) = @_; |
87 | |
72 | |
… | |
… | |
795 | # within a 5x5 square that have something resembling |
780 | # within a 5x5 square that have something resembling |
796 | # dialogue or support on_say. |
781 | # dialogue or support on_say. |
797 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
782 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
798 | |
783 | |
799 | for my $npc ( |
784 | for my $npc ( |
800 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, |
785 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || $_->has_dialogue, |
801 | map +($_, $_->inv), |
786 | map +($_, $_->inv), |
802 | grep $_, |
787 | grep $_, |
803 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
788 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
804 | 0..24 |
789 | 0..24 |
805 | ) { |
790 | ) { |