1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | Deliantra - Deliantra suppport module to read/write archetypes, maps etc. |
3 | Deliantra - Deliantra suppport module to read/write archetypes, maps etc. |
4 | |
4 | |
|
|
5 | =over 4 |
|
|
6 | |
5 | =cut |
7 | =cut |
6 | |
8 | |
7 | package Deliantra; |
9 | package Deliantra; |
8 | |
10 | |
9 | our $VERSION = '1.24'; |
11 | our $VERSION = '1.25'; |
10 | |
12 | |
11 | use common::sense; |
13 | use common::sense; |
12 | |
14 | |
13 | use base 'Exporter'; |
15 | use base 'Exporter'; |
14 | |
16 | |
… | |
… | |
151 | boat => MOVE_BOAT, |
153 | boat => MOVE_BOAT, |
152 | ship => MOVE_SHIP, |
154 | ship => MOVE_SHIP, |
153 | all => MOVE_ALL, |
155 | all => MOVE_ALL, |
154 | ); |
156 | ); |
155 | |
157 | |
156 | our @MOVE_TYPE = qw(all ship boat swim flying fly_high fly_low walk); |
158 | our @MOVE_TYPE = qw(all walk flying fly_low fly_high swim boat ship); |
157 | |
159 | |
158 | { |
160 | { |
159 | package Deliantra::MoveType; |
161 | package Deliantra::MoveType; |
160 | |
162 | |
161 | use overload |
163 | use overload |
… | |
… | |
337 | |
339 | |
338 | # object as in "Object xxx", i.e. archetypes |
340 | # object as in "Object xxx", i.e. archetypes |
339 | sub normalize_object($) { |
341 | sub normalize_object($) { |
340 | my ($ob) = @_; |
342 | my ($ob) = @_; |
341 | |
343 | |
|
|
344 | delete $ob->{editable}; # deprecated |
|
|
345 | |
342 | # convert material bitset to materialname, if possible |
346 | # convert material bitset to materialname, if possible |
343 | if (exists $ob->{material}) { |
347 | if (exists $ob->{material}) { |
344 | if (!$ob->{material}) { |
348 | if (!$ob->{material}) { |
345 | delete $ob->{material}; |
349 | delete $ob->{material}; |
346 | } elsif (exists $ob->{materialname}) { |
350 | } elsif (exists $ob->{materialname}) { |
… | |
… | |
389 | $ob->{$attr} = new Deliantra::MoveType $ob->{$attr}; |
393 | $ob->{$attr} = new Deliantra::MoveType $ob->{$attr}; |
390 | } |
394 | } |
391 | |
395 | |
392 | # convert outdated movement flags to new movement sets |
396 | # convert outdated movement flags to new movement sets |
393 | if (defined (my $v = delete $ob->{no_pass})) { |
397 | if (defined (my $v = delete $ob->{no_pass})) { |
394 | $ob->{move_block} = new Deliantra::MoveType $v ? "all" : ""; |
398 | $ob->{move_block} = new Deliantra::MoveType $v ? "all" : "0"; |
395 | } |
399 | } |
396 | if (defined (my $v = delete $ob->{slow_move})) { |
400 | if (defined (my $v = delete $ob->{slow_move})) { |
397 | $ob->{move_slow} += "walk"; |
401 | $ob->{move_slow} += "walk"; |
398 | $ob->{move_slow_penalty} = $v; |
402 | $ob->{move_slow_penalty} = $v; |
399 | } |
403 | } |
400 | if (defined (my $v = delete $ob->{walk_on})) { |
404 | if (defined (my $v = delete $ob->{walk_on})) { |
401 | $ob->{move_on} ||= new Deliantra::MoveType; if ($v) { $ob->{move_on} += "walk" } else { $ob->{move_on} -= "walk" } |
405 | $ob->{move_on} ||= new Deliantra::MoveType; if ($v) { $ob->{move_on} += "walk" } else { $ob->{move_on} -= "walk" } |
402 | } |
406 | } |
403 | if (defined (my $v = delete $ob->{walk_off})) { |
407 | if (defined (my $v = delete $ob->{walk_off})) { |
404 | $ob->{move_off} ||= new Deliantra::MoveType; if ($v) { $ob->{move_off} += "walk" } else { $ob->{move_off} -= "walk" } |
408 | $ob->{move_off} ||= new Deliantra::MoveType; if ($v) { $ob->{move_off} += "walk" } else { $ob->{move_off} -= "walk" } |
405 | } |
409 | } |
406 | if (defined (my $v = delete $ob->{fly_on})) { |
410 | if (defined (my $v = delete $ob->{fly_on})) { |
… | |
… | |
987 | |
991 | |
988 | \%cache |
992 | \%cache |
989 | }; |
993 | }; |
990 | } |
994 | } |
991 | |
995 | |
|
|
996 | =back |
|
|
997 | |
992 | =head1 AUTHOR |
998 | =head1 AUTHOR |
993 | |
999 | |
994 | Marc Lehmann <schmorp@schmorp.de> |
1000 | Marc Lehmann <schmorp@schmorp.de> |
995 | http://home.schmorp.de/ |
1001 | http://home.schmorp.de/ |
996 | |
1002 | |