… | |
… | |
11 | $_->contr->MapNewmapCmd |
11 | $_->contr->MapNewmapCmd |
12 | for grep $_->isa (cf::object::player::), @$as; |
12 | for grep $_->isa (cf::object::player::), @$as; |
13 | } |
13 | } |
14 | |
14 | |
15 | sub on_move { |
15 | sub on_move { |
16 | my ($data) = @_; |
16 | my ($event, $who) = @_; |
17 | |
|
|
18 | my $who = $data->{who}; |
|
|
19 | |
17 | |
20 | # on first call (there is no initialiser callback), initialise |
18 | # on first call (there is no initialiser callback), initialise |
21 | my $self = $who->{map_grid_move} ||= { |
19 | my $self = $who->{map_grid_move} ||= { |
22 | x1 => $who->x, |
20 | x1 => $who->x, |
23 | y1 => $who->y, |
21 | y1 => $who->y, |
24 | split /(?:\s+|=)/, $data->{options}, |
22 | split /(?:\s+|=)/, $event->options, |
25 | }; |
23 | }; |
26 | |
24 | |
27 | my ($x1, $y1) = ($self->{x1}, $self->{y1}); |
25 | my ($x1, $y1) = ($self->{x1}, $self->{y1}); |
28 | |
26 | |
29 | # this is horribly ugly code.. why can't there be a simple function to just move objects, |
27 | # this is horribly ugly code.. why can't there be a simple function to just move objects, |