Skip to content

Commit ee4131d

Browse files
committed
Refactor logging and adjust shift key input handling
Replaces grapple gun's custom logger with a reference to a common logger module, streamlining logging across scripts. Removes a specific update mechanism for the `KEYBOARD_SHIFT` state within the C++ controller logic. Applies whitespace reformatting (spaces to tabs) across several Lua files for consistency.
1 parent 81a918a commit ee4131d

File tree

12 files changed

+2823
-2817
lines changed

12 files changed

+2823
-2817
lines changed

Data/Base.rte/Devices/Tools/GrappleGun/Grapple.lua

Lines changed: 911 additions & 911 deletions
Large diffs are not rendered by default.

Data/Base.rte/Devices/Tools/GrappleGun/GrappleGun.lua

Lines changed: 176 additions & 176 deletions
Large diffs are not rendered by default.

Data/Base.rte/Devices/Tools/GrappleGun/Pie.lua

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,50 @@
44

55
-- Utility function to safely check if an object has a specific property (key) in its Lua script table.
66
-- This is useful for checking if a script-defined variable exists on an MO.
7-
function HasScriptProperty(obj, propName)
8-
if type(obj) ~= "table" or type(propName) ~= "string" then
9-
return false
10-
end
11-
-- pcall to safely access potentially non-existent script members.
12-
-- This is more about checking Lua script-defined members rather than engine properties.
13-
local status, result = pcall(function() return rawget(obj, propName) ~= nil end)
14-
return status and result
7+
local function HasScriptProperty(obj, propName)
8+
if type(obj) ~= "table" or type(propName) ~= "string" then
9+
return false
10+
end
11+
-- pcall to safely access potentially non-existent script members.
12+
-- This is more about checking Lua script-defined members rather than engine properties.
13+
local status, result = pcall(function() return rawget(obj, propName) ~= nil end)
14+
return status and result
1515
end
1616

1717
-- Helper function to validate grapple gun
1818
local function ValidateGrappleGun(pieMenuOwner)
19-
if not pieMenuOwner or not pieMenuOwner.EquippedItem then
20-
return nil
21-
end
22-
23-
local gun = ToMOSRotating(pieMenuOwner.EquippedItem)
24-
if gun and gun.PresetName == "Grapple Gun" then
25-
return gun
26-
end
27-
28-
return nil
19+
if not pieMenuOwner or not pieMenuOwner.EquippedItem then
20+
return nil
21+
end
22+
23+
local gun = ToMOSRotating(pieMenuOwner.EquippedItem)
24+
if gun and gun.PresetName == "Grapple Gun" then
25+
return gun
26+
end
27+
28+
return nil
2929
end
3030

3131
-- Action for Retract slice in the pie menu.
3232
function GrapplePieRetract(pieMenuOwner, pieMenu, pieSlice)
33-
local gun = ValidateGrappleGun(pieMenuOwner)
34-
if gun then
35-
gun:SetNumberValue("GrappleMode", 1) -- 1 signifies Retract
36-
end
33+
local gun = ValidateGrappleGun(pieMenuOwner)
34+
if gun then
35+
gun:SetNumberValue("GrappleMode", 1) -- 1 signifies Retract
36+
end
3737
end
3838

3939
-- Action for Extend slice in the pie menu.
4040
function GrapplePieExtend(pieMenuOwner, pieMenu, pieSlice)
41-
local gun = ValidateGrappleGun(pieMenuOwner)
42-
if gun then
43-
gun:SetNumberValue("GrappleMode", 2) -- 2 signifies Extend
44-
end
41+
local gun = ValidateGrappleGun(pieMenuOwner)
42+
if gun then
43+
gun:SetNumberValue("GrappleMode", 2) -- 2 signifies Extend
44+
end
4545
end
4646

4747
-- Action for Unhook slice in the pie menu.
4848
function GrapplePieUnhook(pieMenuOwner, pieMenu, pieSlice)
49-
local gun = ValidateGrappleGun(pieMenuOwner)
50-
if gun then
51-
gun:SetNumberValue("GrappleMode", 3) -- 3 signifies Unhook
52-
end
49+
local gun = ValidateGrappleGun(pieMenuOwner)
50+
if gun then
51+
gun:SetNumberValue("GrappleMode", 3) -- 3 signifies Unhook
52+
end
5353
end

Data/Base.rte/Devices/Tools/GrappleGun/Scripts/Logger.lua

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)