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

Comparing deliantra/server/ext/map-link.ext (file contents):
Revision 1.1 by root, Sat Jan 13 23:06:13 2007 UTC vs.
Revision 1.13 by root, Wed May 4 07:41:13 2011 UTC

1#! perl # MANDATORY 1#! perl # mandatory
2
3# this is the map type for the {link} map, a singleton
4# this is the only map in the server that is guaranteed to exit
5# at all times without blocking, and this is ensured by not relying
6# on any external files.
2 7
3cf::map->register (qr{^\{link\}}); 8cf::map->register (qr{^\{link\}});
4 9
5sub load_header { 10sub load_header {
6 my ($self) = @_; 11 my ($self) = @_;
7 12
8 # singleton :/ 13 # singleton :/
9 $self->width (41); 14 $self->width (7);
10 $self->height (41); 15 $self->height (7);
16 $self->enter_x (1);
17 $self->enter_y (1);
18 $self->no_drop (1);
19 $self->no_reset (1);
20
21 $self->name ("interdimensional nothingness");
22
11 $self->alloc; 23 $self->alloc;
12 $self->in_memory (cf::MAP_IN_MEMORY); 24 $self->state (cf::MAP_INACTIVE);
25
26 # provide a floor
27 my $floor = cf::object::new "dirtfloor";
28 Guard::scope_guard { $floor->destroy };
29
30 $floor->name ("{link}");
31 for my $x (0..6) {
32 for my $y (0 .. 6) {
33 $self->insert ($floor->clone, $x, $y);
34 }
35 }
13 36
14 # provide some exits "home" 37 # provide some exits "home"
15 my $exit = cf::object::new "exit"; 38 my $exit = cf::object::new "exit";
16 my $guard = Coro::guard { $exit->destroy }; 39 Guard::scope_guard { $exit->destroy };
17 40
41 # these teleporters exist in case a player gets stuck
18 $exit->slaying ($cf::EMERGENCY_POSITION->[0]); 42 $exit->slaying ($cf::EMERGENCY_POSITION->[0]);
19 $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); 43 $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]);
20 $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); 44 $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]);
21 45
22 $self->insert ($exit->clone, 19, 19);
23 $self->insert ($exit->clone, 19, 20);
24 $self->insert ($exit->clone, 19, 21);
25 $self->insert ($exit->clone, 20, 19);
26 $self->insert ($exit->clone, 20, 21); 46 $self->insert ($exit->clone, 2, 2);
27 $self->insert ($exit->clone, 21, 19); 47 $self->insert ($exit->clone, 2, 3);
28 $self->insert ($exit->clone, 21, 20); 48 $self->insert ($exit->clone, 2, 4);
49 $self->insert ($exit->clone, 3, 2);
29 $self->insert ($exit->clone, 21, 21); 50 $self->insert ($exit->clone, 3, 4);
51 $self->insert ($exit->clone, 4, 2);
52 $self->insert ($exit->clone, 4, 3);
53 $self->insert ($exit->clone, 4, 4);
30 54
31 $self->{deny_save} = 1; 55 $self->{deny_save} = 1;
32 $self->{deny_reset} = 1; 56 $self->{deny_reset} = 1;
33 57
58 $self->activate;
59
34 1 60 1
35} 61}
36 62
371
38

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines