ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-per-player.ext
Revision: 1.5
Committed: Thu Jan 18 15:12:43 2007 UTC (17 years, 4 months ago) by elmex
Branch: MAIN
Changes since 1.4: +5 -0 lines
Log Message:
overwrote decay_objects

File Contents

# User Rev Content
1 root 1.1 #! perl # MANDATORY
2    
3 root 1.2 cf::map->register (qr{^~([^/]+)(/.*)});
4 root 1.1
5 elmex 1.5 sub decay_objects {
6     # do nothing on per player maps at the moment
7     # as the lone town apartment is broooken
8     }
9    
10 root 1.1 sub init {
11     my ($self) = @_;
12    
13 root 1.3 $self->{user} = $1;
14     $self->{orig_path} = $2;
15     $self->{deny_reset} = 1; #d# for now
16 root 1.1 }
17    
18 root 1.4 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 root 1.2 sub load_path {
28 root 1.1 my ($self) = @_;
29    
30 root 1.2 sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path}
31 root 1.1 }
32    
33     sub save_path {
34     my ($self) = @_;
35    
36 root 1.2 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
37     sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path
38 root 1.1 }
39    
40     sub uniq_path {
41     undef
42     }
43    
44 root 1.2 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    
56 root 1.1 1
57