--- deliantra/server/ext/map-per-player.ext 2007/01/13 23:06:13 1.1 +++ deliantra/server/ext/map-per-player.ext 2007/01/29 17:57:22 1.7 @@ -1,28 +1,59 @@ #! perl # MANDATORY -cf::map->register (qr{^~[^/]+/}); +cf::map->register (qr{^~([^/]+)(/.*)}); sub init { my ($self) = @_; - $self->{user} = $1; + $self->{user} = $1; + $self->{orig_path} = $2; + $self->{deny_reset} = 1; #d# for now } -sub as_string { +sub thawer_merge { + # we have to keep some variables in memory intact + local $_[0]{user}; + local $_[0]{orig_path}; + local $_[0]{deny_reset}; + + $_[0]->SUPER::thawer_merge ($_[1]); +} + +sub load_path { my ($self) = @_; - "~$self->{user}$self->{path}" + sprintf "%s/%s/%s.map", cf::datadir, cf::mapdir, $self->{orig_path} } sub save_path { my ($self) = @_; - sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path + (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g; + sprintf "%s/%s/%s/%s.map", cf::localdir, cf::playerdir, $self->{user}, $path } sub uniq_path { undef } +sub load_header { + my ($self) = @_; + + $self->SUPER::load_header + or return; + + # forcefully disable per_player flag + $self->per_player (0); + + 1 +} + +sub decay_objects { + # do nothing on per player maps at the moment + # to protect apartments. + # TODO: apartments should be marked as such + # (no reset, no decay etc.) +} + 1