ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/magic_mapping.ext
(Generate patch)

Comparing deliantra/server/ext/magic_mapping.ext (file contents):
Revision 1.1 by root, Wed Nov 4 17:24:00 2009 UTC vs.
Revision 1.4 by root, Tue Oct 12 05:09:54 2010 UTC

7 type => cf::SPELL, 7 type => cf::SPELL,
8 subtype => cf::SP_MAGIC_MAPPING, 8 subtype => cf::SP_MAGIC_MAPPING,
9 on_cast_spell => sub { 9 on_cast_spell => sub {
10 my ($spell, $who, $caster, $dir, $arg) = @_; 10 my ($spell, $who, $caster, $dir, $arg) = @_;
11 11
12 my $pl = $caster->contr
13 or return;
14
12 my ($map, $x, $y) = ($caster->map, $caster->x, $caster->y); 15 my ($map, $x, $y) = ($who->map, $who->x, $who->y);
13 16
14 # dirty check, should maybe allow tiled outdoor maps? 17 # dirty check, should maybe allow tiled outdoor maps?
15 $map->path =~ m%/world/world_% 18 $map->path =~ m%/world/world_%
16 or return; 19 or return;
17 20
18 my $bird = cf::object::new "magic_mapper"; 21 my $bird = cf::object::new "magic_mapper";
19 my $pl = $caster->contr;
20 my $dist = 0; 22 my $dist = 0;
21 $caster->speed_left (-1000); 23 $caster->speed_left (-1); $pl->fire_on (0); $pl->run_on (0);
24
25 my $duration = $caster->casting_level ($spell) * 150 / 100;
22 26
23 $pl->ns->async (sub { 27 $pl->ns->async (sub {
24 while (++$dist < 100) { 28 while (++$dist < $duration && $bird->valid) {
25 my $phi = 2 * $dist ** .5; 29 my $phi = 2 * $dist ** .5;
26 my $dx = (sin $phi) * $phi * 2; 30 my $dx = (sin $phi) * $phi * 2;
27 my $dy = (cos $phi) * $phi * 2; 31 my $dy = (cos $phi) * $phi * 2;
28 32
29 warn "a\n";#d#
30 warn $bird->insert_ob_in_map_at ($map, $caster, cf::INS_ON_TOP, $x + $dx, $y + $dy); 33 $bird->insert_ob_in_map_at ($map, $caster, cf::INS_ON_TOP, $x + $dx, $y + $dy)
31 warn "b\n";#d# 34 or last;
32 last unless $bird->valid;
33 warn "c\n";#d#
34 35
35 $pl->set_viewpoint ($bird); 36 $pl->set_viewpoint ($bird);
36 $caster->speed_left (-1000); 37 $caster->speed_left (-1);
37 cf::wait_for_tick; 38 cf::wait_for_tick;
38 } 39 }
39 40
40 $pl->set_viewpoint (undef); 41 $pl->set_viewpoint (undef);
41 $caster->speed_left (0); 42 $caster->speed_left (0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines