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 exist |
5 |
# at all times without blocking, and this is ensured by not relying |
6 |
# on any external files. |
7 |
|
8 |
cf::map->register (qr{^\{link\}}); |
9 |
|
10 |
sub load_header { |
11 |
my ($self) = @_; |
12 |
|
13 |
# singleton :/ |
14 |
$self->width (7); |
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 |
|
23 |
$self->alloc; |
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 |
} |
36 |
|
37 |
# provide some exits "home" |
38 |
my $exit = cf::object::new "exit"; |
39 |
Guard::scope_guard { $exit->destroy }; |
40 |
|
41 |
# these teleporters exist in case a player gets stuck |
42 |
$exit->slaying ($cf::EMERGENCY_POSITION->[0]); |
43 |
$exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); |
44 |
$exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); |
45 |
|
46 |
$self->insert ($exit->clone, 2, 2); |
47 |
$self->insert ($exit->clone, 2, 3); |
48 |
$self->insert ($exit->clone, 2, 4); |
49 |
$self->insert ($exit->clone, 3, 2); |
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); |
54 |
|
55 |
$self->{deny_save} = 1; |
56 |
$self->{deny_reset} = 1; |
57 |
|
58 |
$self->activate; |
59 |
|
60 |
1 |
61 |
} |
62 |
|