File Coverage

blib/lib/Games/AssaultCube/Log/Line/GameStatus.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             # Declare our package
2             package Games::AssaultCube::Log::Line::GameStatus;
3              
4             # import the Moose stuff
5 1     1   3372 use Moose;
  0            
  0            
6              
7             # Initialize our version
8             use vars qw( $VERSION );
9             $VERSION = '0.04';
10              
11             extends 'Games::AssaultCube::Log::Line::Base';
12              
13             with 'Games::AssaultCube::Log::Line::Base::MasterMode',
14             'Games::AssaultCube::Log::Line::Base::GameMode';
15              
16             # TODO improve validation for everything here, ha!
17              
18             has 'map' => (
19             isa => 'Str',
20             is => 'ro',
21             required => 1,
22             );
23              
24             has 'minutes' => (
25             isa => 'Int',
26             is => 'ro',
27             required => 1,
28             );
29              
30             has 'finished' => (
31             isa => 'Bool',
32             is => 'ro',
33             required => 1,
34             );
35              
36             has 'tostr' => (
37             isa => 'Str',
38             is => 'ro',
39             lazy => 1,
40             default => sub {
41             my $self = shift;
42             return "GameStatus: map " . $self->map . " with " . $self->minutes . " minutes left in gamemode " . $self->gamemode_fullname;
43             },
44             );
45              
46             # TODO Moose can't export multiple roles into this class unless it defines BUILD...
47             # Error: 'Games::AssaultCube::Log::Line::Base::Mastermode|Games::AssaultCube::Log::Line::Base::Gamemode' requires the method 'BUILD' to be implemented by 'Games::AssaultCube::Log::Line::GameStatus' at /usr/local/share/perl/5.10.0/Moose/Meta/Role/Application.pm line 59
48             sub BUILD {
49             return;
50             }
51              
52             no Moose;
53             __PACKAGE__->meta->make_immutable;
54              
55             1;
56             __END__
57              
58             =for stopwords CTF NUM TDM gamemode mastermode
59             =head1 NAME
60              
61             Games::AssaultCube::Log::Line::GameStatus - Describes the GameStatus event in a log line
62              
63             =head1 ABSTRACT
64              
65             Describes the GameStatus event in a log line
66              
67             =head1 DESCRIPTION
68              
69             This module holds the "GameStatus" event data from a log line. Normally, you would not use this class directly
70             but via the L<Games::AssaultCube::Log::Line> class.
71              
72             This line is emitted once in a while as the AC server goes through the game.
73              
74             =head2 Attributes
75              
76             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
77             class, you can also use it's attributes too.
78              
79             =head3 gamemode
80              
81             The numeric AssaultCube gamemode ( look at L<Games::AssaultCube::Utils> for more info )
82              
83             P.S. It's better to use the gamemode_fullname or gamemode_name accessors
84              
85             =head3 gamemode_name
86              
87             The gamemode name ( CTF, TDM, etc )
88              
89             =head3 gamemode_fullname
90              
91             The full gamemode name ( "capture the flag", "team one shot one kill", etc )
92              
93             =head3 map
94              
95             The map name ( sometimes it's a zero-length string... )
96              
97             =head3 minutes
98              
99             The number of minutes remaining in the game
100              
101             =head3 mastermode
102              
103             The numeric AssaultCube mastermode of the server
104              
105             0 = OPEN
106             1 = PRIVATE ( passworded )
107             2 = NUM ( full )
108              
109             =head3 mastermode_name
110              
111             The name of the mastermode on the server ( OPEN, PRIVATE, NUM )
112              
113             =head3 finished
114              
115             A boolean indicating if the game is finished or not
116              
117             =head1 AUTHOR
118              
119             Apocalypse E<lt>apocal@cpan.orgE<gt>
120              
121             Props goes to the BS clan for the support!
122              
123             This project is sponsored by L<http://cubestats.net>
124              
125             =head1 COPYRIGHT AND LICENSE
126              
127             Copyright 2009 by Apocalypse
128              
129             This library is free software; you can redistribute it and/or modify
130             it under the same terms as Perl itself.
131              
132             =cut