… | |
… | |
1310 | } |
1310 | } |
1311 | |
1311 | |
1312 | use File::Glob (); |
1312 | use File::Glob (); |
1313 | |
1313 | |
1314 | cf::player->attach ( |
1314 | cf::player->attach ( |
1315 | on_command => sub { |
1315 | on_unknown_command => sub { |
1316 | my ($pl, $name, $params) = @_; |
1316 | my ($pl, $name, $params) = @_; |
1317 | |
1317 | |
1318 | my $cb = $COMMAND{$name} |
1318 | my $cb = $COMMAND{$name} |
1319 | or return; |
1319 | or return; |
1320 | |
1320 | |
… | |
… | |
1769 | my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM |
1769 | my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM |
1770 | |
1770 | |
1771 | # mit "rum" bekleckern, nicht |
1771 | # mit "rum" bekleckern, nicht |
1772 | $self->_create_random_map ( |
1772 | $self->_create_random_map ( |
1773 | $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, |
1773 | $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, |
1774 | $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, |
1774 | $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, $rmp->{miningstyle}, |
1775 | $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, |
1775 | $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, |
1776 | $rmp->{exit_on_final_map}, |
1776 | $rmp->{exit_on_final_map}, |
1777 | $rmp->{xsize}, $rmp->{ysize}, |
1777 | $rmp->{xsize}, $rmp->{ysize}, |
1778 | $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3}, |
1778 | $rmp->{expand2x}, $rmp->{layoutoptions1}, $rmp->{layoutoptions2}, $rmp->{layoutoptions3}, |
1779 | $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase}, |
1779 | $rmp->{symmetry}, $rmp->{difficulty}, $rmp->{difficulty_given}, $rmp->{difficulty_increase}, |
… | |
… | |
2093 | } |
2093 | } |
2094 | |
2094 | |
2095 | $self->post_load; |
2095 | $self->post_load; |
2096 | } |
2096 | } |
2097 | |
2097 | |
|
|
2098 | # customize the map for a given player, i.e. |
|
|
2099 | # return the _real_ map. used by e.g. per-player |
|
|
2100 | # maps to change the path to ~playername/mappath |
2098 | sub customise_for { |
2101 | sub customise_for { |
2099 | my ($self, $ob) = @_; |
2102 | my ($self, $ob) = @_; |
2100 | |
2103 | |
2101 | return find "~" . $ob->name . "/" . $self->{path} |
2104 | return find "~" . $ob->name . "/" . $self->{path} |
2102 | if $self->per_player; |
2105 | if $self->per_player; |
… | |
… | |
3131 | |
3134 | |
3132 | $coro |
3135 | $coro |
3133 | } |
3136 | } |
3134 | |
3137 | |
3135 | cf::client->attach ( |
3138 | cf::client->attach ( |
3136 | on_destroy => sub { |
3139 | on_client_destroy => sub { |
3137 | my ($ns) = @_; |
3140 | my ($ns) = @_; |
3138 | |
3141 | |
3139 | $_->cancel for values %{ (delete $ns->{_coro}) || {} }; |
3142 | $_->cancel for values %{ (delete $ns->{_coro}) || {} }; |
3140 | }, |
3143 | }, |
3141 | ); |
3144 | ); |