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 | |
3 | cf::map->register (qr{^\{link\}}); |
8 | cf::map->register (qr{^\{link\}}); |
4 | |
9 | |
5 | sub load_header { |
10 | sub load_header { |
6 | my ($self) = @_; |
11 | my ($self) = @_; |
7 | |
12 | |
8 | # singleton :/ |
13 | # singleton :/ |
9 | $self->width (21); |
14 | $self->width (7); |
10 | $self->height (21); |
15 | $self->height (7); |
|
|
16 | $self->enter_x (1); |
|
|
17 | $self->enter_y (1); |
11 | $self->nodrop (1); |
18 | $self->no_drop (1); |
|
|
19 | $self->no_reset (1); |
12 | |
20 | |
13 | $self->name ("interdimensional nothingness"); |
21 | $self->name ("interdimensional nothingness"); |
14 | |
22 | |
15 | $self->alloc; |
23 | $self->alloc; |
16 | $self->in_memory (cf::MAP_ACTIVE); |
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 | } |
17 | |
36 | |
18 | # provide some exits "home" |
37 | # provide some exits "home" |
19 | my $exit = cf::object::new "exit"; |
38 | my $exit = cf::object::new "exit"; |
20 | my $guard = Coro::guard { $exit->destroy }; |
39 | Guard::scope_guard { $exit->destroy }; |
21 | |
40 | |
|
|
41 | # these teleporters exist in case a player gets stuck |
22 | $exit->slaying ($cf::EMERGENCY_POSITION->[0]); |
42 | $exit->slaying ($cf::EMERGENCY_POSITION->[0]); |
23 | $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); |
43 | $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); |
24 | $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); |
44 | $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); |
25 | |
45 | |
26 | $self->insert ($exit->clone, 9, 9); |
46 | $self->insert ($exit->clone, 2, 2); |
27 | $self->insert ($exit->clone, 9, 10); |
47 | $self->insert ($exit->clone, 2, 3); |
28 | $self->insert ($exit->clone, 9, 11); |
48 | $self->insert ($exit->clone, 2, 4); |
29 | $self->insert ($exit->clone, 10, 9); |
49 | $self->insert ($exit->clone, 3, 2); |
30 | $self->insert ($exit->clone, 10, 11); |
50 | $self->insert ($exit->clone, 3, 4); |
31 | $self->insert ($exit->clone, 11, 9); |
51 | $self->insert ($exit->clone, 4, 2); |
32 | $self->insert ($exit->clone, 11, 10); |
52 | $self->insert ($exit->clone, 4, 3); |
33 | $self->insert ($exit->clone, 11, 11); |
53 | $self->insert ($exit->clone, 4, 4); |
34 | |
54 | |
35 | $self->{deny_save} = 1; |
55 | $self->{deny_save} = 1; |
36 | $self->{deny_reset} = 1; |
56 | $self->{deny_reset} = 1; |
37 | |
57 | |
38 | $self->activate; |
58 | $self->activate; |
39 | |
59 | |
40 | 1 |
60 | 1 |
41 | } |
61 | } |
42 | |
62 | |
43 | 1 |
|
|
44 | |
|
|