1 | #! perl # MANDATORY |
1 | #! perl # MANDATORY |
2 | |
2 | |
3 | cf::map->register (qr{^~[^/]+/}); |
3 | cf::map->register (qr{^~([^/]+)(/.*)}); |
|
|
4 | |
|
|
5 | sub decay_objects { |
|
|
6 | # do nothing on per player maps at the moment |
|
|
7 | # as the lone town apartment is broooken |
|
|
8 | } |
4 | |
9 | |
5 | sub init { |
10 | sub init { |
6 | my ($self) = @_; |
11 | my ($self) = @_; |
7 | |
12 | |
8 | $self->{user} = $1; |
13 | $self->{user} = $1; |
|
|
14 | $self->{orig_path} = $2; |
|
|
15 | $self->{deny_reset} = 1; #d# for now |
9 | } |
16 | } |
10 | |
17 | |
11 | sub as_string { |
18 | sub thawer_merge { |
|
|
19 | # we have to keep some variables in memory intact |
|
|
20 | local $_[0]{user}; |
|
|
21 | local $_[0]{orig_path}; |
|
|
22 | local $_[0]{deny_reset}; |
|
|
23 | |
|
|
24 | $_[0]->SUPER::thawer_merge ($_[1]); |
|
|
25 | } |
|
|
26 | |
|
|
27 | sub load_path { |
12 | my ($self) = @_; |
28 | my ($self) = @_; |
13 | |
29 | |
14 | "~$self->{user}$self->{path}" |
30 | sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path} |
15 | } |
31 | } |
16 | |
32 | |
17 | sub save_path { |
33 | sub save_path { |
18 | my ($self) = @_; |
34 | my ($self) = @_; |
19 | |
35 | |
|
|
36 | (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g; |
20 | sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path |
37 | sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path |
21 | } |
38 | } |
22 | |
39 | |
23 | sub uniq_path { |
40 | sub uniq_path { |
24 | undef |
41 | undef |
25 | } |
42 | } |
26 | |
43 | |
|
|
44 | sub load_header { |
|
|
45 | my ($self) = @_; |
|
|
46 | |
|
|
47 | $self->SUPER::load_header |
|
|
48 | or return; |
|
|
49 | |
|
|
50 | # forcefully disable per_player flag |
|
|
51 | $self->per_player (0); |
|
|
52 | |
|
|
53 | 1 |
|
|
54 | } |
|
|
55 | |
27 | 1 |
56 | 1 |
28 | |
57 | |