blib/lib/Games/TF2/Demo/GameState.pm

filter: Statementstmt 56.7% 46 / 81 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 10 / 20 Podpod 100% 10 / 10 totaltotal 59.4% 66 / 111 CC 1 SCAR 2.1
CC
1
Cov
57%
from_fields
2.0
players
1.5
buildings
1.5
CRAP 1.2
« blib/lib/Games/TF2/Demo/GameState/Building.pm ↑ Summary blib/lib/Games/TF2/Demo/GameState/Projectile.pm »
1 package Games::TF2::Demo::GameState;
2  
3 11 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 our $VERSION = '0.01';
9  
10 11 ▶use Object::Pad 0.800;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 class Games::TF2::Demo::GameState :strict(params) {
13 11 ▶ use Games::TF2::Demo::GameState::Building;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 11 ▶ use Games::TF2::Demo::GameState::Cart;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 11 ▶ use Games::TF2::Demo::GameState::ControlPoint;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 11 ▶ use Games::TF2::Demo::GameState::Player;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 11 ▶ use Games::TF2::Demo::GameState::Projectile;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 0 ▶ field $demo_tick :param :reader;
Subroutine demo_tick: not called CC=1 SCAR=2.6
Pod documented
20 0 ▶ field $server_tick :param :reader;
Subroutine server_tick: not called CC=1 SCAR=2.6
Pod documented
21 0 ▶ field $world_min :param :reader;
Subroutine world_min: not called CC=1 SCAR=2.6
Pod documented
22 0 ▶ field $world_max :param :reader;
Subroutine world_max: not called CC=1 SCAR=2.6
Pod documented
23 11 field $players :param;
24 11 field $buildings :param;
25 11 field $projectiles :param;
26 11 field $control_points :param;
27 11 field $carts :param;
28  
29 0 ▶ method players () { return $players->@* }
Subroutine players: not called CC=1 SCAR=4.1
Pod documented
30 0 ▶ method buildings () { return $buildings->@* }
Subroutine buildings: not called CC=1 SCAR=4.1
Pod documented
31 0 ▶ method projectiles () { return $projectiles->@* }
Subroutine projectiles: not called CC=1 SCAR=4.1
Pod documented
32 0 ▶ method control_points () { return $control_points->@* }
Subroutine control_points: not called CC=1 SCAR=4.1
Pod documented
33 0 ▶ method carts () { return $carts->@* }
Subroutine carts: not called CC=1 SCAR=4.1
Pod documented
34  
35 # The game state of the plain values the XS reads.
36 0 ▶ sub from_fields ( $class, $fields ) {
Subroutine from_fields: not called CC=1 SCAR=6.9
Pod documented
37 0 my %lists = (
38 players => 'Player',
39 buildings => 'Building',
40 projectiles => 'Projectile',
41 control_points => 'ControlPoint',
42 carts => 'Cart',
43 );
44 my %objects = map {
45 0 my $element_class = "Games::TF2::Demo::GameState::$lists{$_}";
46 0 ( $_ => [ map { $element_class->new( $_->%* ) } $fields->{$_}->@* ] )
47 } keys %lists;
48 0 return $class->new( ( map { $_ => $fields->{$_} } qw(demo_tick server_tick world_min world_max) ), %objects );
49 }
50 }
51  
52 11 1;
53  
54 __END__
« blib/lib/Games/TF2/Demo/GameState/Building.pm ↑ Summary blib/lib/Games/TF2/Demo/GameState/Projectile.pm »