@@ -98,11 +98,13 @@ hook.Add("FinishChat","SF_StartChat",function() isChatOpen=false end)
9898
9999local function CheckButtonPerms (instance , ply , button )
100100 if not IsFirstTimePredicted () and not game .SinglePlayer () then return false end
101- if not haspermission (instance , nil , " input" ) then return false end
102- if isChatOpen and not haspermission (instance , nil , " input.chat" ) then
103- local notMouseButton = button < MOUSE_FIRST and button > MOUSE_LAST
104- local notJoystick = button < JOYSTICK_FIRST and button > JOYSTICK_LAST
105- if notMouseButton and notJoystick then return false end -- Mouse and joystick are allowed, they don't put text into the chat
101+ if instance .player ~= SF .Superuser then
102+ if not haspermission (instance , nil , " input" ) then return false end
103+ if isChatOpen and not haspermission (instance , nil , " input.chat" ) then
104+ local notMouseButton = button < MOUSE_FIRST and button > MOUSE_LAST
105+ local notJoystick = button < JOYSTICK_FIRST and button > JOYSTICK_LAST
106+ if notMouseButton and notJoystick then return false end -- Mouse and joystick are allowed, they don't put text into the chat
107+ end
106108 end
107109
108110 return true , { button }
@@ -129,7 +131,7 @@ SF.hookAdd(PlayerButtonUp, "inputreleased", CheckButtonPerms)
129131-- @param string bind Name of keybind pressed
130132-- @return boolean Returning true will block the binding from being pressed for the chip owner
131133SF .hookAdd (" PlayerBindPress" , " inputbindpressed" , function (instance , ply , bind )
132- if haspermission (instance , nil , " input" ) then
134+ if instance . player == SF . Superuser or haspermission (instance , nil , " input" ) then
133135 return true , {bind }
134136 end
135137 return false
145147-- @param number x X coordinate moved
146148-- @param number y Y coordinate moved
147149SF .hookAdd (" InputMouseApply" , " mousemoved" , function (instance , _ , x , y )
148- if haspermission (instance , nil , " input" ) then
150+ if instance . player == SF . Superuser or haspermission (instance , nil , " input" ) then
149151 if x ~= 0 or y ~= 0 then
150152 return true , { x , y }
151153 end
160162-- @class hook
161163-- @param number delta Rotate delta
162164SF .hookAdd (" StartCommand" , " mousewheeled" , function (instance , ply , cmd )
163- if haspermission (instance , nil , " input" ) then
165+ if instance . player == SF . Superuser or haspermission (instance , nil , " input" ) then
164166 local delta = cmd :GetMouseWheel ()
165167 if delta ~= 0 then
166168 return true , {delta }
@@ -175,7 +177,7 @@ local oldOnMouseWheeled = wpanel.OnMouseWheeled or function() end
175177function wpanel :OnMouseWheeled (delta )
176178 oldOnMouseWheeled (self , delta )
177179 for inst , _ in pairs (SF .allInstances ) do
178- if haspermission (inst , nil , " input" ) then
180+ if inst . player == SF . Superuser or haspermission (inst , nil , " input" ) then
179181 inst :runScriptHook (" mousewheeled" , delta )
180182 end
181183 end
@@ -257,7 +259,7 @@ function input_library.isKeyDown(key)
257259 checkluatype (key , TYPE_NUMBER )
258260
259261 checkpermission (instance , nil , " input" )
260- if isChatOpen and not haspermission (instance , nil , " input.chat" ) then return false end
262+ if isChatOpen and not ( instance . player == SF . Superuser or haspermission (instance , nil , " input.chat" ) ) then return false end
261263
262264 return input .IsKeyDown (key )
263265end
385387-- @client
386388-- @return boolean Whether the player's control can be locked
387389function input_library .canLockControls ()
388- return haspermission (instance , nil , " input.lockcontrols" ) and lockedControlCooldown + inputLockCooldown :GetFloat () <= CurTime ()
390+ return instance . player == SF . Superuser or ( haspermission (instance , nil , " input.lockcontrols" ) and lockedControlCooldown + inputLockCooldown :GetFloat () <= CurTime () )
389391end
390392
391393--- Returns whether the game menu overlay ( main menu ) is open or not.
0 commit comments