// Argh's Invisible Turret Script

// This script is copyright (C) Wolfe Games, 2008
// All contents were created by Wolfe Games.

#ifndef INVISIBLE_TURRET_H_
#define INVISIBLE_TURRET_H_

#include "STANDARD_COMMANDS_WORLDBUILDER.h"
piece body, turret, barrel;

static-var turretspeed, xMove, yMove;

Create()
{
	hide body;
	hide barrel;
	turretspeed = rand(100,300);
	xMove = rand(-24,24);	
	yMove = rand(-4,4);
	move turret to x-axis [1]*xMove now;
	move turret to y-axis [1]*yMove now;
	SET ARMORED to TRUE;
}

AimFromWeapon1(piecenum)
{
	piecenum = barrel;
}

AimWeapon1(heading,pitch)
{
	signal SIG_AIM1;
	set-signal-mask SIG_AIM1;

	turn turret to y-axis heading speed <1>*turretspeed;
	turn barrel to x-axis 0-pitch speed <1>*turretspeed;
	wait-for-turn turret around y-axis;
	wait-for-turn barrel around x-axis;
	return (1);
}

QueryWeapon1(piecenum)
{
	piecenum = barrel;	
}

FireWeapon1()
{
	return(0);
}

Killed()
{
	return 0;
}

#endif // INVISIBLE_TURRET_H_