1 | #! perl # MANDATORY |
1 | #! perl # mandatory |
2 | |
2 | |
3 | # wizard commands |
3 | # wizard commands |
4 | |
4 | |
5 | cf::register_command shutdown => sub { |
5 | cf::register_command shutdown => sub { |
6 | my ($ob, $arg) = @_; |
6 | my ($ob, $arg) = @_; |
… | |
… | |
41 | my ($ob, $arg) = @_; |
41 | my ($ob, $arg) = @_; |
42 | |
42 | |
43 | return unless $ob->may ("command_teleport"); |
43 | return unless $ob->may ("command_teleport"); |
44 | |
44 | |
45 | cf::async { |
45 | cf::async { |
|
|
46 | $Coro::current->{desc} = "teleport $arg"; |
|
|
47 | |
46 | my $other = cf::player::find $arg |
48 | my $other = cf::player::find $arg |
47 | or return $ob->reply (undef, "$arg: no such player."); |
49 | or return $ob->reply (undef, "$arg: no such player."); |
48 | |
50 | |
49 | $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); |
51 | $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); |
50 | }; |
52 | }; |
… | |
… | |
91 | cf::register_command wizlook => sub { |
93 | cf::register_command wizlook => sub { |
92 | my ($ob, $arg) = @_; |
94 | my ($ob, $arg) = @_; |
93 | |
95 | |
94 | return unless $ob->may ("command_wizlook"); |
96 | return unless $ob->may ("command_wizlook"); |
95 | |
97 | |
96 | $ob->clear_los; |
98 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZLOOK); |
97 | |
99 | |
98 | $ob->reply (undef, "You can temporarily see through walls."); |
100 | $ob->flag (cf::FLAG_WIZLOOK, $new_val); |
|
|
101 | |
|
|
102 | $ob->contr->do_los (1); |
|
|
103 | |
|
|
104 | $ob->reply (undef, |
|
|
105 | $new_val |
|
|
106 | ? "You can now look through walls." |
|
|
107 | : "You will now see the same thing as you would normally.", |
|
|
108 | ); |
99 | |
109 | |
100 | 1 |
110 | 1 |
101 | }; |
111 | }; |
102 | |
112 | |
103 | cf::register_command reset => sub { |
113 | cf::register_command reset => sub { |
… | |
… | |
109 | |
119 | |
110 | my @pl = $map->players; |
120 | my @pl = $map->players; |
111 | $_->enter_link for @pl; |
121 | $_->enter_link for @pl; |
112 | cf::async { |
122 | cf::async { |
113 | my $name = $map->visible_name; |
123 | my $name = $map->visible_name; |
|
|
124 | $Coro::current->{desc} = "reset $name"; |
114 | |
125 | |
115 | $map->reset; |
126 | $map->reset; |
116 | $_->leave_link for @pl; |
127 | $_->leave_link for @pl; |
117 | |
128 | |
118 | $ob->reply (undef, "$name was reset."); |
129 | $ob->reply (undef, "$name was reset."); |
119 | }; |
130 | }; |
|
|
131 | |
|
|
132 | 1 |
|
|
133 | }; |
|
|
134 | |
|
|
135 | cf::register_command observe => sub { |
|
|
136 | my ($ob, $arg) = @_; |
|
|
137 | |
|
|
138 | return unless $ob->may ("command_observe"); |
|
|
139 | |
|
|
140 | my $other = cf::player::find_active $arg; |
|
|
141 | $ob->contr->set_observe ($other ? $other->ob : undef); |
120 | |
142 | |
121 | 1 |
143 | 1 |
122 | }; |
144 | }; |
123 | |
145 | |
124 | for my $command (qw(summon arrest banish)) { |
146 | for my $command (qw(summon arrest banish)) { |