#! perl # mandatory # this is the map type for the {link} map, a singleton # this is the only map in the server that is guaranteed to exit # at all times without blocking, and this is ensured by not relying # on any external files. cf::map->register (qr{^\{link\}}); sub load_header { my ($self) = @_; # singleton :/ $self->width (7); $self->height (7); $self->enter_x (1); $self->enter_y (1); $self->no_drop (1); $self->no_reset (1); $self->name ("interdimensional nothingness"); $self->alloc; $self->in_memory (cf::MAP_INACTIVE); # provide a floor my $floor = cf::object::new "dirtfloor"; Guard::scope_guard { $floor->destroy }; $floor->name ("{link}"); for my $x (0..6) { for my $y (0 .. 6) { $self->insert ($floor->clone, $x, $y); } } # provide some exits "home" my $exit = cf::object::new "exit"; Guard::scope_guard { $exit->destroy }; # these teleporters exist in case a player gets stuck $exit->slaying ($cf::EMERGENCY_POSITION->[0]); $exit->stats->hp ($cf::EMERGENCY_POSITION->[1]); $exit->stats->sp ($cf::EMERGENCY_POSITION->[2]); $self->insert ($exit->clone, 2, 2); $self->insert ($exit->clone, 2, 3); $self->insert ($exit->clone, 2, 4); $self->insert ($exit->clone, 3, 2); $self->insert ($exit->clone, 3, 4); $self->insert ($exit->clone, 4, 2); $self->insert ($exit->clone, 4, 3); $self->insert ($exit->clone, 4, 4); $self->{deny_save} = 1; $self->{deny_reset} = 1; $self->activate; 1 }