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 (21); |
10 | $self->height (21); |
15 | $self->height (21); |
11 | $self->nodrop (1); |
16 | $self->no_drop (1); |
12 | |
17 | |
13 | $self->name ("special built-in map"); |
18 | $self->name ("interdimensional nothingness"); |
14 | |
19 | |
15 | $self->alloc; |
20 | $self->alloc; |
16 | $self->in_memory (cf::MAP_IN_MEMORY); |
21 | $self->in_memory (cf::MAP_ACTIVE); |
17 | |
22 | |
18 | # provide some exits "home" |
23 | # provide some exits "home" |
19 | my $exit = cf::object::new "exit"; |
24 | my $exit = cf::object::new "exit"; |
20 | my $guard = Coro::guard { $exit->destroy }; |
25 | Guard::scope_guard { $exit->destroy }; |
21 | |
26 | |
|
|
27 | # these teleporters exist in case a player gets stuck |
22 | $exit->slaying ($cf::EMERGENCY_POSITION->[0]); |
28 | $exit->slaying ($cf::EMERGENCY_POSITION->[0]); |
23 | $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); |
29 | $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); |
24 | $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); |
30 | $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); |
25 | |
31 | |
26 | $self->insert ($exit->clone, 9, 9); |
32 | $self->insert ($exit->clone, 9, 9); |
… | |
… | |
33 | $self->insert ($exit->clone, 11, 11); |
39 | $self->insert ($exit->clone, 11, 11); |
34 | |
40 | |
35 | $self->{deny_save} = 1; |
41 | $self->{deny_save} = 1; |
36 | $self->{deny_reset} = 1; |
42 | $self->{deny_reset} = 1; |
37 | |
43 | |
|
|
44 | $self->activate; |
|
|
45 | |
38 | 1 |
46 | 1 |
39 | } |
47 | } |
40 | |
48 | |
41 | 1 |
49 | 1 |
42 | |
50 | |