1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # this module implements the town portal spell: |
3 | # this module implements the town portal spell: |
4 | # casting it creates a magic portal to the nearest town portal (regions) |
4 | # casting it creates a magic portal to the nearest town portal (regions) |
5 | # using the magic portal brings you to the town portal and remembers your magic portal |
5 | # using the magic portal brings you to the town portal and remembers your magic portal |
6 | # using the town portal brings you back to the magic portla if it still exists |
6 | # using the town portal brings you back to the magic portal if it still exists |
7 | |
7 | |
8 | cf::object->attach ( |
8 | cf::object->attach ( |
9 | type => cf::SPELL, |
9 | type => cf::SPELL, |
10 | subtype => cf::SP_TOWN_PORTAL, |
10 | subtype => cf::SP_TOWN_PORTAL, |
11 | on_cast_spell => sub { |
11 | on_cast_spell => sub { |
… | |
… | |
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 { |
… | |
… | |
78 | } |
78 | } |
79 | |
79 | |
80 | cf::override 1; |
80 | cf::override 1; |
81 | }, |
81 | }, |
82 | ; |
82 | ; |
|
|
83 | |