| 1 | package Game::TileMap::Tile; | ||||||||||
| 2 | 4 | $Game::TileMap::Tile::VERSION = '1.001'; | |||||||||
| 3 | 4 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use Mooish::Base -standard; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | has param ['x', 'y'] => ( | |||||||||
| 11 | isa => PositiveOrZeroInt, | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 4 | has param 'contents' => ( | |||||||||
| 15 | isa => Any, | ||||||||||
| 16 | writer => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 4 | has field 'is_wall' => ( | |||||||||
| 20 | isa => Bool, | ||||||||||
| 21 | writer => -hidden, | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 4 | has field 'is_void' => ( | |||||||||
| 25 | isa => Bool, | ||||||||||
| 26 | writer => -hidden, | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | 4 | has field 'type' => ( | |||||||||
| 30 | isa => Any, | ||||||||||
| 31 | writer => -hidden, | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | sub BUILD | ||||||||||
| 35 | 195 | ▶ | { | ||||||||
|
Subroutine
BUILD: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 36 | 195 | my ($self, $args) = @_; | |||||||||
| 37 | |||||||||||
| 38 | 195 | my $legend = $args->{legend}; | |||||||||
| 39 | 195 | ▶ | croak "argument legend is required for Game::TileMap::Tile" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | unless $legend; | ||||||||||
| 41 | |||||||||||
| 42 | 195 | $self->_set_type($self->contents); | |||||||||
| 43 | 195 | $self->_set_is_void($legend->voids->{$self->type}); | |||||||||
| 44 | 195 | $self->_set_is_wall($legend->walls->{$self->type}); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 4 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||