Changeset View
Changeset View
Standalone View
Standalone View
source/tools/entity/Entity.pm
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | for my $k (grep $_ ne ' content', keys %$new) { | ||||
} | } | ||||
$base->{$k} ||= {}; | $base->{$k} ||= {}; | ||||
apply_layer($base->{$k}, $new->{$k}); | apply_layer($base->{$k}, $new->{$k}); | ||||
delete $base->{$k}{'@replace'}; | delete $base->{$k}{'@replace'}; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
sub load_inherited | sub load_inherited | ||||
elexis: (I didn't read the code, but should one mod stand out as the 'main' mod, or should it just… | |||||
Done Inline ActionsWell actually it's the main mod by default for example terra_magna|public|mod would return terra_magna, but only if the file we are looking for exist in that mod. So it's the highest mod of the stack to be precise. Stan: Well actually it's the main mod by default for example
terra_magna|public|mod would return… | |||||
{ | { | ||||
my ($vfspath) = @_; | my ($vfspath) = @_; | ||||
my $layer = load_xml($vfspath, get_file($vfspath)); | my $layer = load_xml($vfspath, get_file($vfspath)); | ||||
if ($layer->{Entity}{'@parent'}) { | if ($layer->{Entity}{'@parent'}) { | ||||
my $parent = load_inherited($layer->{Entity}{'@parent'}{' content'}); | my $parent = load_inherited($layer->{Entity}{'@parent'}{' content'}); | ||||
apply_layer($parent->{Entity}, $layer->{Entity}); | apply_layer($parent->{Entity}, $layer->{Entity}); | ||||
return $parent; | return $parent; | ||||
} else { | } else { | ||||
return $layer; | return $layer; | ||||
} | } | ||||
} | } | ||||
sub find_entities | sub find_entities | ||||
{ | { | ||||
my ($modName) = @_; | |||||
my @files; | my @files; | ||||
my $find_process = sub { | my $find_process = sub { | ||||
return $File::Find::prune = 1 if $_ eq '.svn'; | return $File::Find::prune = 1 if $_ eq '.svn'; | ||||
my $n = $File::Find::name; | my $n = $File::Find::name; | ||||
return if /~$/; | return if /~$/; | ||||
return unless -f $_; | return unless -f $_; | ||||
$n =~ s~\Q$vfsroot\E/public/simulation/templates/~~; | $n =~ s~\Q$vfsroot\E/$modName/simulation/templates/~~; | ||||
$n =~ s/\.xml$//; | $n =~ s/\.xml$//; | ||||
push @files, $n; | push @files, $n; | ||||
}; | }; | ||||
find({ wanted => $find_process }, "$vfsroot/public/simulation/templates"); | find({ wanted => $find_process }, "$vfsroot/$modName/simulation/templates"); | ||||
return @files; | return @files; | ||||
} | } |
Wildfire Games · Phabricator
(I didn't read the code, but should one mod stand out as the 'main' mod, or should it just iterate through all mods and treat each mod equally?
Or is main_mod the only mod considered and it could become get_mod? (As I recall it checked the XML files of the modmod, no?))