File Coverage

blib/lib/Games/AssaultCube/Log/Line/GameStart.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::GameStart;
3              
4             # import the Moose stuff
5 1     1   2202 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 'players' => (
25             isa => 'Int',
26             is => 'ro',
27             required => 1,
28             );
29              
30             has 'minutes' => (
31             isa => 'Int',
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 "GameStart: map " . $self->map . " with " . $self->players . " players, " . $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::GameStart - Describes the GameStart event in a log line
62              
63             =head1 ABSTRACT
64              
65             Describes the GameStart event in a log line
66              
67             =head1 DESCRIPTION
68              
69             This module holds the "GameStart" 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 when the AC server starts a new 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
96              
97             =head3 players
98              
99             The number of connected players
100              
101             =head3 minutes
102              
103             The number of minutes remaining in the game
104              
105             =head3 mastermode
106              
107             The numeric AssaultCube mastermode of the server
108              
109             0 = OPEN
110             1 = PRIVATE ( passworded )
111             2 = NUM ( full )
112              
113             =head3 mastermode_name
114              
115             The name of the mastermode on the server ( OPEN, PRIVATE, NUM )
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