#description: A room

=comment

A room style. Currently the only example.

=cut

# Use room1.txs as the default texture scheme.
# Use 'torch' as the default light type.
configure({
 'Texture Scheme'=>'room1',
 'Light archetype'=>['torch','gaslight','NiceTorch'],
});

# Override with brush textures if available
$tx->{ 'wall'    } = $textures[0] if defined($textures[0]);
$tx->{ 'floor'   } = $textures[6] if defined($textures[6]);
$tx->{ 'ceiling' } = $textures[5] if defined($textures[5]);

# trim in middle of room
$br = $bunch->addBrush(air, cube(), 0,0,(0-($h/2))+4.5, $w,$l,1, $tl->texture($tx->{'wood'}));
$bunch->setFaceRot( $br, north(), 90.00 );
$bunch->setFaceRot( $br, south(), 90.00 );
$bunch->setFaceRot( $br, east(), 90.00 );
$bunch->setFaceRot( $br, west(), 90.00 );

# trim on top of room and ceiling
$br = $bunch->addBrush(air, cube(), 0,0,($h/2)-.5, $w,$l,1, $tl->texture($tx->{'trim'}));
$bunch->setTexture($br, top(), $tl->texture($tx->{'ceiling'}));

# top of room
$br = $bunch->addBrush(air, cube(), 0,0,2, $w+.5,$l+.5,$h-6, $tl->texture($tx->{'wall'}));
$bunch->setTexture($br, top(), $tl->texture($tx->{'wood'}));
$bunch->setTexture($br, bottom(), $tl->texture($tx->{'wood'}));

# bottom of room and floor
$br = $bunch->addBrush(air, cube(), 0,0,(0-($h/2))+2, $w+.5,$l+.5,4, $tl->texture($tx->{'panel'}));
$bunch->setTexture($br, top(), $tl->texture($tx->{'wood'}));
$bunch->setTexture($br, bottom(), $tl->texture($tx->{'floor'}));

# testing! objects! requires custom script(thanks GayleSaver) to replace dummy objects with real ones

$p={base=>-36};

$light=$mb_parms->{'Light archetype'};
return if (!defined($light) || $light eq '');
$lightOffset=.48 if $light eq 'torch';
$lightOffset=.78 if $light eq 'gaslight';
$lightOffset=.78 if $light eq 'NiceTorch';

$p->{name}="Wheeeeee";
my $torch1 = $bunch->addObject( 0-($l/2)+$lightOffset,0,0, 0,0,0, $p );
$bunch->setProperty ($torch1, "Editor->DesignNote", "[$light]");

$p->{name}="Blah";
$p->{rz}=90;
my $torch2 = $bunch->addObject( 0,0-($w/2)+$lightOffset,0, 0,0,0, $p );
$bunch->setProperty ($torch2, "Editor->DesignNote", "[$light]");

$p->{name}="Wazaap";
$p->{rz}=180;
my $torch3 = $bunch->addObject( ($l/2)-$lightOffset,0,0, 0,0,0, $p );
$bunch->setProperty ($torch3, "Editor->DesignNote", "[$light]");

$p->{name}="Clyde";
$p->{rz}=270;
my $torch4 = $bunch->addObject( 0,($w/2)-$lightOffset,0, 0,0,0, $p );
$bunch->setProperty ($torch4, "Editor->DesignNote", "[$light]");








