Scriptname DCF_ObjectMoveToScript extends ObjectReference

;properties
ObjectReference Property XMarker Auto Const
ObjectReference Property workshopnewloc Auto Const
Sound Property xSoundFX01 Auto Const
Sound Property xSoundFX02 Auto Const
ObjectReference Property xButtonLightOn01 Auto Const
ObjectReference Property xButtonLightOn02 Auto Const
ObjectReference Property xButtonLightOn03 Auto Const
ObjectReference Property xButtonLightOn04 Auto Const
ObjectReference Property xButtonLightOn05 Auto Const
ObjectReference Property xButtonLightOn06 Auto Const
ObjectReference Property xButtonLightOn07 Auto Const
ObjectReference Property xButtonLightOn08 Auto Const
ObjectReference Property xButtonLightOn09 Auto Const
ObjectReference Property xButtonLightOn10 Auto Const

;events
Event OnActivate(ObjectReference akActionRef)
	if workshopnewloc.GetDistance(XMarker) < 16
	   debug.notification("It's already there")
	int instanceID = xSoundFX02.play(self)
	Sound.SetInstanceVolume(instanceID, 0.5)
	ClearDestruction()
	else
		akActionRef == Game.GetPlayer()
		xButtonLightOn01.DamageObject(10.0)
		xButtonLightOn02.ClearDestruction()
		xButtonLightOn03.ClearDestruction()
		xButtonLightOn04.ClearDestruction()
		xButtonLightOn05.ClearDestruction()
		xButtonLightOn06.ClearDestruction()
		xButtonLightOn07.ClearDestruction()
		xButtonLightOn08.ClearDestruction()
		xButtonLightOn09.ClearDestruction()
		xButtonLightOn10.ClearDestruction()

	  workshopnewloc .MoveTo(XMarker)
	  debug.notification("It's moved")
	int instanceID = xSoundFX01.play(self)
	Sound.SetInstanceVolume(instanceID, 0.5)
   EndIf
EndEvent


