… | |
… | |
162 | |
162 | |
163 | use overload |
163 | use overload |
164 | '=' => sub { bless [@{$_[0]}], ref $_[0] }, |
164 | '=' => sub { bless [@{$_[0]}], ref $_[0] }, |
165 | '""' => \&as_string, |
165 | '""' => \&as_string, |
166 | '>=' => sub { $_[0][0] & $MOVE_TYPE{$_[1]} ? $_[0][1] & $MOVE_TYPE{$_[1]} : undef }, |
166 | '>=' => sub { $_[0][0] & $MOVE_TYPE{$_[1]} ? $_[0][1] & $MOVE_TYPE{$_[1]} : undef }, |
|
|
167 | '<=' => sub { |
|
|
168 | ($_[0][0] & $MOVE_TYPE{$_[1]}) == $MOVE_TYPE{$_[1]} |
|
|
169 | ? $_[0][1] & $MOVE_TYPE{$_[1]} |
|
|
170 | : undef |
|
|
171 | }, |
167 | '+=' => sub { $_[0][0] |= $MOVE_TYPE{$_[1]}; $_[0][1] |= $MOVE_TYPE{$_[1]}; &normalise }, |
172 | '+=' => sub { $_[0][0] |= $MOVE_TYPE{$_[1]}; $_[0][1] |= $MOVE_TYPE{$_[1]}; &normalise }, |
168 | '-=' => sub { $_[0][0] |= $MOVE_TYPE{$_[1]}; $_[0][1] &= ~$MOVE_TYPE{$_[1]}; &normalise }, |
173 | '-=' => sub { $_[0][0] |= $MOVE_TYPE{$_[1]}; $_[0][1] &= ~$MOVE_TYPE{$_[1]}; &normalise }, |
169 | '/=' => sub { $_[0][0] &= ~$MOVE_TYPE{$_[1]}; &normalise }, |
174 | '/=' => sub { $_[0][0] &= ~$MOVE_TYPE{$_[1]}; &normalise }, |
170 | 'x=' => sub { |
175 | 'x=' => sub { # toggle between off, + and - |
171 | my $cur = $_[0] >= $_[1]; |
176 | my $cur = $_[0] >= $_[1]; |
172 | if (!defined $cur) { |
177 | if (!defined $cur) { |
173 | if ($_[0] >= "all") { |
178 | if ($_[0] >= "all") { |
174 | $_[0] -= $_[1]; |
179 | $_[0] -= $_[1]; |
175 | } else { |
180 | } else { |
… | |
… | |
339 | |
344 | |
340 | # object as in "Object xxx", i.e. archetypes |
345 | # object as in "Object xxx", i.e. archetypes |
341 | sub normalize_object($) { |
346 | sub normalize_object($) { |
342 | my ($ob) = @_; |
347 | my ($ob) = @_; |
343 | |
348 | |
|
|
349 | delete $ob->{editable}; # deprecated |
|
|
350 | |
344 | # convert material bitset to materialname, if possible |
351 | # convert material bitset to materialname, if possible |
345 | if (exists $ob->{material}) { |
352 | if (exists $ob->{material}) { |
346 | if (!$ob->{material}) { |
353 | if (!$ob->{material}) { |
347 | delete $ob->{material}; |
354 | delete $ob->{material}; |
348 | } elsif (exists $ob->{materialname}) { |
355 | } elsif (exists $ob->{materialname}) { |