local propsrv = lgs.PropertySrv
local linksrv = lgs.LinkSrv

local function Active()
	if propsrv.possessed(script.objid,'StTweqRotate') then
		propsrv.Set(script.objid,'StTweqRotate','AnimS',0x1)	
	end
	if linksrv.AnyExist('ControlDevice',script.objid) then
		linksrv.BroadcastOnAllLinks(script.objid,'TurnOn','ControlDevice')
	end
end

local function Disactive()
	if linksrv.AnyExist('ControlDevice',script.objid) then
		linksrv.BroadcastOnAllLinks(script.objid,'TurnOff','ControlDevice')
	end
	if propsrv.possessed(script.objid,'StTweqRotate') then
		propsrv.Set(script.objid,'StTweqRotate','AnimS',0x3)	
	end
end

function FrobWorldEnd(msg)
	Disactive()
	return true
end

function FrobWorldBegin(msg)
	Active()
	if msg.Abort then
		Disactive()
	end
	return true
end

function TurnOff(msg)
	Disactive()
	return true
end

function TurnOn(msg)
	Active()
	return true
end