… | |
… | |
43 | |
43 | |
44 | cf::object::attachment town_portal => |
44 | cf::object::attachment town_portal => |
45 | on_apply => sub { |
45 | on_apply => sub { |
46 | my ($self, $who) = @_; |
46 | my ($self, $who) = @_; |
47 | |
47 | |
48 | $who->{town_portal} = ["$who->map", $who->x, $who->y, $self->uuid]; |
48 | $who->{town_portal} = [$who->map->as_string, $who->x, $who->y, $self->uuid]; |
49 | }, |
49 | }, |
50 | ; |
50 | ; |
51 | |
51 | |
52 | cf::object::attachment town_portal_return => |
52 | cf::object::attachment town_portal_return => |
53 | on_apply => sub { |
53 | on_apply => sub { |
… | |
… | |
56 | if ($who->{town_portal}) { |
56 | if ($who->{town_portal}) { |
57 | my ($map, $x, $y, $uuid) = @{ $who->{town_portal} }; |
57 | my ($map, $x, $y, $uuid) = @{ $who->{town_portal} }; |
58 | |
58 | |
59 | $who->goto ($map, $x, $y, sub { |
59 | $who->goto ($map, $x, $y, sub { |
60 | my ($map) = @_; |
60 | my ($map) = @_; |
|
|
61 | |
|
|
62 | $map->load; # make sure the map is loaded |
61 | |
63 | |
62 | if (grep $_->uuid eq $uuid, $map->at ($x, $y)) { |
64 | if (grep $_->uuid eq $uuid, $map->at ($x, $y)) { |
63 | $who->reply (undef, "The town portal weaves its magic... and after a short moment, you return to the magic portal.", cf::NDI_NAVY); |
65 | $who->reply (undef, "The town portal weaves its magic... and after a short moment, you return to the magic portal.", cf::NDI_NAVY); |
64 | |
66 | |
65 | delete $who->{town_portal}; |
67 | delete $who->{town_portal}; |