-- LUA Script - precede every function and global member with lowercase name of script + '_main' local U = require "scriptbank\\utillib" local rotatablesList = {} function rotatable_entity_init( e ) local Ent = g_Entity[ e ] rotatablesList[ e ] = { obj = Ent.obj, pos = { x = Ent.x, y = Ent.y, z = Ent.z }, ang = Ent.angley } end local lookingAt = nil local rotateSpeed = 1 local function incAng( re ) re.ang = re.ang + 1 if re.ang > 360 then re.ang = re.ang - 360 end end local function decAng( re ) re.ang = re.ang - 1 if re.ang < 0 then re.ang = re.ang + 360 end end function rotatable_entity_main( e ) local re = rotatablesList[ e ] if re == nil then return end CollisionOff( e ) PositionObject( re.obj, re.pos.x, re.pos.y, re.pos.z ) RotateObject( re.obj, 0, re.ang, 0 ) CollisionOn( e ) if lookingAt ~= nil and lookingAt ~= e then return end if U.PlayerLookingAtObj( re.obj, 300 ) then lookingAt = e if g_KeyPressE == 1 then incAng( re ) elseif g_KeyPressR == 1 then decAng( re ) end else lookingAt = nil end end