#description: Simple door

=comment

Simple door frame, top piece extends over side pieces like this:
__________
|________|
| |    | |
| |    | |
| |    | |
| |    | |
| |    | |
| |    | |

=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,0, $postw,$l+($overhang*2),$h, $tl->texture('core_1/wdplnk2g'));
$br = $bunch->addBrush(solid(), cube(), 0,0-(($w+$postw)/2),0, $postw,$l+($overhang*2),$h, $tl->texture('core_1/wdplnk2g'));

# Lintel
$br = $bunch->addBrush(solid(), cube(), 0,0,($h+$lintelh)/2, $w+($postw*2),$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
