All pastes #496434 Raw Edit

Something

public text v1 · immutable
·published 2007-05-19 07:19 UTC
rendered paste body
var shootsSemi		=1;
var shootsBursts	=0;
var shootsAutomatic	=1;

enum fireMode {Safe, Semi, Burst, Auto }
var fireSelector : fireMode;
var triggerDown;


function initializeVariables() {
	slideRestPosition = gunslide.localPosition;
	
	burstShotsToGo = shootsBursts;
	
	// If the designer sets gun to a mode it doesnt have - find another
	if (
		(shootsSemi	< 1 && fireSelector = fireMode.Semi)	|| 
		(shootsBurst	< 1 && fireSelector = fireMode.Burst)	|| 
		(shootsAuto	< 1 && fireSelector = fireMode.Auto)
	   )
	{
		fireSelector.Value = fireMode.Safe;
		if (shootsSemi	< 1) fireSelector = fireMode.Semi;
		if (shootsBurst	< 1) fireSelector = fireMode.Burst;
		if (shootsAuto	< 1) fireSelector = fireMode.Auto;
	}
}