… | |
… | |
201 | cf::register_command reset => sub { |
201 | cf::register_command reset => sub { |
202 | my ($ob, $arg) = @_; |
202 | my ($ob, $arg) = @_; |
203 | |
203 | |
204 | return unless $ob->may ("command_reset"); |
204 | return unless $ob->may ("command_reset"); |
205 | |
205 | |
|
|
206 | my $unique = $arg =~ s/^\s*--unique\s*//; |
|
|
207 | |
206 | my $map = $ob->map; |
208 | my $map = $ob->map; |
207 | |
209 | |
208 | my @pl = $map->players; |
210 | my @pl = $map->players; |
209 | $_->enter_link for @pl; |
211 | $_->enter_link for @pl; |
210 | cf::async { |
212 | cf::async { |
211 | my $name = $map->visible_name; |
213 | my $name = $map->visible_name; |
212 | $Coro::current->{desc} = "reset $name"; |
214 | $Coro::current->{desc} = "reset $name"; |
213 | |
215 | |
|
|
216 | $map->clear_unique_items if $unique; |
214 | $map->reset; |
217 | $map->reset; |
|
|
218 | |
215 | $_->leave_link for @pl; |
219 | $_->leave_link for @pl; |
216 | |
220 | |
217 | $ob->reply (undef, "$name was reset."); |
221 | $ob->reply (undef, "$name was reset."); |
218 | }; |
222 | }; |
219 | |
223 | |