All pastes #792561 Raw Edit

Something

public text v1 · immutable
·published 2007-11-21 15:00 UTC
rendered paste body
//This is a The Plot of War Script

piece	base, fw1, fw2, mw1, mw2, bw1, bw2, lfoot, rfoot, bfoot, gun, cap, b1, b2, fp1, fp2;

#define FIRING_THING	2
#define MAX_SPEED	75

static-var whichbarrel, siegemode, x;

Create()
{
	siegemode = 0;
}

StartMoving()
{ 
 	spin fw1 around x-axis speed <140> accelerate <35>;
 	spin fw2 around x-axis speed <140> accelerate <35>;
 	spin mw1 around x-axis speed <140> accelerate <35>;
 	spin mw2 around x-axis speed <140> accelerate <35>;
 	spin bw1 around x-axis speed <140> accelerate <35>;
 	spin bw2 around x-axis speed <140> accelerate <35>;
}

StopMoving()
{ 
	stop-spin fw1 around x-axis;
 	stop-spin fw2 around x-axis;
 	stop-spin mw1 around x-axis;
 	stop-spin mw2 around x-axis;
 	stop-spin bw1 around x-axis;
 	stop-spin bw2 around x-axis;
}

RAD(sleeptime)
{
	set-signal-mask FIRING_THING; //can't remember if child threads are killed by the signal in aimprimary, may as well be safe
	sleep sleeptime;
	turn gun to y-axis 0 speed <180>;
	turn cap to x-axis 0 speed <60>;
}

Activate()
{
	set MAX_SPEED to 1;
	turn lfoot to z-axis <-90> speed [15];
	move lfoot to y-axis [-3] speed [15];
	move lfoot to x-axis [6] speed [15];
	turn rfoot to z-axis <90> speed [15];
	move rfoot to y-axis [-3] speed [15];
	move rfoot to x-axis [-6] speed [15];
	turn bfoot to x-axis <-90> speed [15];
	move bfoot to y-axis [-3] speed [15];
	move bfoot to z-axis [-6] speed [15];
	wait-for-move bfoot along z-axis;

	siegemode = 1; //enables firing *after* the deploy animation is done :P
}

Deactivate()
{
	siegemode = 0;
	signal FIRING_THING;
	start-script RAD(0);//resets the turret position after 0 seconds of inactivity
	turn lfoot to z-axis <0> speed [15];
	move lfoot to y-axis [0] speed [15];
	move lfoot to x-axis [0] speed [15];
	turn rfoot to z-axis <0> speed [15];
	move rfoot to y-axis [0] speed [15];
	move rfoot to x-axis [0] speed [15];
	turn bfoot to x-axis <0> speed [15];
	move bfoot to y-axis [0] speed [15];
	move bfoot to z-axis [0] speed [15];
	wait-for-move bfoot along z-axis;
	set MAX_SPEED to [3]; //enables movement *after* animation is complete
}

AimPrimary(heading, pitch)
{
	if (siegemode == 1)
	{
		signal FIRING_THING;
		set-signal-mask FIRING_THING;
		turn gun to y-axis heading speed <350>;
		turn cap to x-axis <0> - pitch speed <350>;
		wait-for-turn gun around y-axis;
		wait-for-turn cap around x-axis;
		return (1);
	}
}

FirePrimary()
{
	if (whichbarrel == 0)
	{
		move b1 to z-axis [-2] now;
		move b1 to z-axis [0] speed [15];
	}
	if (whichbarrel == 1)
	{
		move b2 to z-axis [-2] now;
		move b2 to z-axis [0] speed [15];
	}
	whichbarrel = !whichbarrel;
}

AimFromPrimary(piecenum)
{
	piecenum = gun;
}

QueryPrimary(piecenum)
{
	if ( whichbarrel == 0 ) //if the barrel that is moving isn't the one the projectile is coming from, swap the 0 and 1 in here
	{
		piecenum = fp1;
	}
	if ( whichbarrel == 1 )
	{
		piecenum = fp2;
	}

}

Killed(severity, corpsetype)
{		
}