#description: Wooden platform

=comment

A wooden platform with four legs

=cut

configure({},{'wood'=>'core_1/wdplnk2g'});

#$tx->{'wood'} = $textures[0] if defined($textures[0]);
#$tx->{'wood'} = 'core_1/wdplnk2g' if !defined($tx->{'wood'});

$tmp1=$h/2;
$tmp2=$w-2;
$tmp3=$l-2;

# top boards
$br=$bunch->addBrush(solid(), cube(), 0,0,$tmp1-.2, $w,$l,0.4, $tl->texture($tx->{'wood'}));
  $bunch->setFaceRot($br, north(), 90);
  $bunch->setFaceRot($br, south(), 90);

# support beams
$br=$bunch->addBrush(solid(), cube(), 0,0,$tmp1-.9, $w,$l,1, $tl->texture($tx->{'wood'}));
  $bunch->setFaceRot($br, north(), 90);
  $bunch->setFaceRot($br, west(), 90);
  $bunch->setFaceRot($br, south(), 90);
  $bunch->setFaceRot($br, east(), 90);
  $bunch->setFaceRot($br, bottom(), 90);
$br=$bunch->addBrush(solid(), cube(), 0,0,$tmp1-.9, $tmp2,$l,1, $tl->texture($tx->{'wood'}));
  $bunch->setFaceRot($br, north(), 90);
  $bunch->setFaceRot($br, west(), 90);
  $bunch->setFaceRot($br, south(), 90);
  $bunch->setFaceRot($br, east(), 90);
$br=$bunch->addBrush(air(), cube(), 0,0,$tmp1-.9, $tmp2,$tmp3,1, $tl->texture($tx->{'wood'}));
  $bunch->setFaceRot($br, north(), 90);
  $bunch->setFaceRot($br, west(), 90);
  $bunch->setFaceRot($br, south(), 90);
  $bunch->setFaceRot($br, east(), 90);

# legs
$br=$bunch->addBrush(solid(), cube(), 0-($l/2)+.5,0-($w/2)+.5,0-.7, 1,1,$h-1.4, $tl->texture($tx->{'wood'}));
$br=$bunch->addBrush(solid(), cube(), ($l/2)-.5,0-($w/2)+.5,0-.7, 1,1,$h-1.4, $tl->texture($tx->{'wood'}));
$br=$bunch->addBrush(solid(), cube(), ($l/2)-.5,($w/2)-.5,0-.7, 1,1,$h-1.4, $tl->texture($tx->{'wood'}));
$br=$bunch->addBrush(solid(), cube(), 0-($l/2)+.5,($w/2)-.5,0-.7, 1,1,$h-1.4, $tl->texture($tx->{'wood'}));
