#description: Simple door 2

=comment

Simple door frame, sides extend to top of frame like this:

__________
| |____| |
| |    | |
| |    | |
| |    | |
| |    | |
| |    | |
| |    | |

=cut

=comment
my $br;

$br = $bunch->addBrush(solid(), cube(), 0,0,0, $w+1,$l,$h, $tl->texture('vicm07/woodbeam'));

$br = $bunch->addBrush(solid(), cube(), 0,0,($h/2)+.25, $w+1,$l,.5, $tl->texture('vicm07/woodbeam'));
$bunch->setFaceRot( $br, north(), 90.00 );
$bunch->setFaceRot( $br, south(), 90.00 );

$br = $bunch->addBrush(air(), cube(), 0,0,0, $w,$l,$h, $tl->texture('vicm07/woodbeam'));

$bunch->setTexture($br, bottom(), $tl->texture($textures[0]));
=cut

configure({
 'Overhang'=>.125,
 'Post width'=>.5,
 'Lintel height'=>.5,
 #'Door archetype'=>'Wood4x8',
});

$overhang=$mb_parms->{'Overhang'}+0;        $overhang=.25 if $overhang<0;
$postw=$mb_parms->{'Post width'}+0;         $postw=1 if $postw<0;
$lintelh=$mb_parms->{'Lintel height'}+0;    $lintelh=1 if $lintelh<0;
$doortype=$mb_parms->{'Door archetype'}.'';

my $br;

# Door opening, presumably as thick as the wall it is in
$br = $bunch->addBrush(air, cube(), 0,0,0, $w,$l,$h);
$bunch->setTexture($br, bottom(), $tl->texture($textures[0]));

# Posts
$br = $bunch->addBrush(solid(), cube(), 0,($w+$postw)/2,$lintelh/2, $postw,$l+($overhang*2),$h+$lintelh, $tl->texture('core_1/wdplnk2g'));
$br = $bunch->addBrush(solid(), cube(), 0,0-(($w+$postw)/2),$lintelh/2, $postw,$l+($overhang*2),$h+$lintelh, $tl->texture('core_1/wdplnk2g'));

# Lintel
$br = $bunch->addBrush(solid(), cube(), 0,0,($h+$lintelh)/2, $w,$l+($overhang*2),$lintelh, $tl->texture('core_1/wdplnk2g'));
$bunch->setFaceRot( $br, north(), 90.00 );
$bunch->setFaceRot( $br, east(), 90.00 );
$bunch->setFaceRot( $br, south(), 90.00 );
$bunch->setFaceRot( $br, west(), 90.00 );

# Objects still buggy, leave out for now
# Door
=comment
if($doortype ne ''){
 $p={base=>-36};
 my $door = $bunch->addObject( 0,0,0, 0,0,90, $p );
 $bunch->setProperty ($door, "Editor->DesignNote", "[$doortype]");
}
=cut
