Scriptname _00E_RotateAroundOwnAxis extends ObjectReference  
{Put this script onto any object to have it rotate around it's own axis}

Import Utility

;=====================================================================================
;              							STATES                  					 
;=====================================================================================


Event OnLoad()

RotationMarker = Self.PlaceAtMe(XMarkerHeading, 1)
Self.Activate(Self)

EndEvent

Event OnActivate(ObjectReference akActionRef)

If Self.Is3DLoaded() && (akActionRef == Self)
	Wait(Delay)
	RotationMarker.SetAngle((Self.GetAngleX() + 180), (Self.GetAngleY() + 180), (Self.GetAngleZ() + 180))
	Self.TranslateToREF(RotationMarker, RotationSpeedBase,RotationSpeedBase)
EndIf

EndEvent

Event OnTranslationAlmostComplete()
	Self.Activate(Self)
EndEvent


;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

ObjectReference RotationMarker

Float Property ActualSpeed Auto Hidden

Static Property XMarkerHeading Auto

Float Property MinimumDistance = 1000.0 Auto
{How far does the player need to be away for the object(s) to start rotating?}
Float Property RotationSpeedBase = 15.0 Auto
{The base speed the objects will rotate around with. Defaut: 25}
Float Property Delay = 0.0 Auto
{Set a delay when to start the rotation. Very handy if multiple objects levitate at once!}


Actor Property PlayerREF Auto