Changeset View
Changeset View
Standalone View
Standalone View
source/tools/entity/creationgraph.pl
use strict; | use strict; | ||||
use warnings; | use warnings; | ||||
use lib "."; | |||||
use Entity; | use Entity; | ||||
elexis: Fair enough "public" abstraction for now, but ideally no mod name would exist here at all. But… | |||||
Done Inline ActionsWell since I break that script in that patch and I'm not exactly sure what it does or where it's used I'd rather include it there. Could be made in separate commits though. Stan: Well since I break that script in that patch and I'm not exactly sure what it does or where… | |||||
my @files = Entity::find_entities(); | my @files = Entity::find_entities("public"); | ||||
my %files = map +($_ => 1), @files; | my %files = map +($_ => 1), @files; | ||||
open my $g, '>', 'creation.dot' or die $!; | open my $g, '>', 'creation.dot' or die $!; | ||||
print $g "digraph G {\n"; | print $g "digraph G {\n"; | ||||
for my $f (sort @files) { | for my $f (sort @files) { | ||||
next if $f =~ /^template_/; | next if $f =~ /^template_/; | ||||
print "# $f...\n"; | print "# $f...\n"; | ||||
my $ent = Entity::load_inherited($f); | my $ent = Entity::load_inherited($f, "public"); | ||||
if ($ent->{Entity}{Builder}) { | if ($ent->{Entity}{Builder}) { | ||||
my $ents = $ent->{Entity}{Builder}{Entities}{' content'}; | my $ents = $ent->{Entity}{Builder}{Entities}{' content'}; | ||||
$ents =~ s/\{civ\}/$ent->{Entity}{Identity}{Civ}{' content'}/eg; | $ents =~ s/\{civ\}/$ent->{Entity}{Identity}{Civ}{' content'}/eg; | ||||
for my $b (split /\s+/, $ents) { | for my $b (split /\s+/, $ents) { | ||||
warn "Invalid Builder reference: $f -> $b\n" unless $files{$b}; | warn "Invalid Builder reference: $f -> $b\n" unless $files{$b}; | ||||
print $g qq{"$f" -> "$b" [color=green];\n}; | print $g qq{"$f" -> "$b" [color=green];\n}; | ||||
} | } | ||||
Show All 17 Lines |
Wildfire Games · Phabricator
Fair enough "public" abstraction for now, but ideally no mod name would exist here at all. But it's probably better to implement that in a separate diff to prevent this patch from becoming too big.