File Coverage

blib/lib/App/EmpyrionBlueprint.pm
Criterion Covered Total %
statement 9 28 32.1
branch 0 16 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 49 24.4


line stmt bran cond sub pod time code
1             package App::EmpyrionBlueprint;
2             our $AUTHORITY = 'cpan:GETTY';
3             $App::EmpyrionBlueprint::VERSION = '0.003';
4 1     1   1000 use Empyrion::Base;
  1         1  
  1         5  
5 1     1   1467 use MooX::Options;
  1         18519  
  1         6  
6 1     1   36780 use Empyrion::Blueprint;
  1         1  
  1         273  
7              
8             option 'spawn_group' => (
9             is => 'ro',
10             format => 's',
11             predicate => 1,
12             doc => 'set a new spawn group to the blueprint',
13             );
14              
15             option 'no_spawn_group' => (
16             is => 'ro',
17             negativable => 0,
18             doc => 'unset existing spawn group',
19             );
20              
21             option 'z_position' => (
22             is => 'ro',
23             format => 's',
24             predicate => 1,
25             doc => 'set new z position for the blueprint',
26             );
27              
28             option 'remove_terrain' => (
29             is => 'ro',
30             negativable => 1,
31             predicate => 1,
32             doc => 'remove terrain around base on random spawn',
33             );
34              
35             option 'from' => (
36             is => 'ro',
37             format => 's',
38             required => 1,
39             doc => 'filename to open (required)',
40             );
41              
42             option 'to' => (
43             is => 'ro',
44             format => 's',
45             predicate => 1,
46             doc => 'save changed blueprint here',
47             );
48              
49             sub run {
50 0     0 0   my ( $self ) = @_;
51 0           my $bp = Empyrion::Blueprint->new($self->from);
52 0 0         $bp->set_spawn_group($self->spawn_group) if $self->has_spawn_group;
53 0 0         $bp->set_spawn_group(undef) if $self->no_spawn_group;
54 0 0         $bp->set_spawn_group($self->spawn_group) if $self->has_spawn_group;
55 0 0         $bp->set_z_position($self->z_position) if $self->has_z_position;
56 0 0         $bp->set_remove_terrain($self->remove_terrain) if $self->has_remove_terrain;
57 0           print "\n";
58 0 0         if ($self->has_to) {
59 0           my $path = $bp->save($self->to);
60 0           print "Saved new blueprint to: ".$path->absolute->stringify."\n";
61             } else {
62 0           print "Type: ".$bp->type_name."\n";
63 0           print "Dimensions: ".$bp->width."/".$bp->height."/".$bp->depth." (w/h/d)\n";
64 0 0         print "Remove Terrain: ".($bp->remove_terrain ? 'Yes' : 'No')."\n";
65 0 0         if ($bp->spawn_group_length) {
66 0           print "Spawn Group: ".$bp->spawn_group."\n";
67             }
68 0           print "Z-position: ".$bp->z_position."\n";
69             }
70 0           print "\n";
71 0           return 0;
72             }
73              
74             1;
75              
76             __END__