Compare commits
2 Commits
42ba29dc9d
...
28486c00ff
Author | SHA1 | Date | |
---|---|---|---|
28486c00ff | |||
9ba782b8e9 |
@@ -1,181 +1,183 @@
|
|||||||
-- luacheck: globals MyModGlobal
|
-- luacheck: globals MyModGlobal
|
||||||
-- luacheck: read_globals Character SERVER Keys LuaUserData Hook Descriptors PlayerInput Timer
|
-- luacheck: read_globals Character SERVER Keys LuaUserData Hook Descriptors PlayerInput Timer
|
||||||
-- luacheck: max line length 420
|
-- luacheck: max line length 420
|
||||||
if SERVER then return end
|
|
||||||
-- Docs: https://evilfactory.github.io/LuaCsForBarotrauma/lua-docs/manual/common-questions/
|
-- Docs: https://evilfactory.github.io/LuaCsForBarotrauma/lua-docs/manual/common-questions/
|
||||||
|
|
||||||
---@class MyModGlobal
|
if SERVER then
|
||||||
---@field CONFIG {QUICKSTACK_KEYS: Keys, FABRICATOR_KEY: Keys, MAX_BUY: Keys, NESTED_CONTAINERS: boolean, DEBUG_MODE: boolean}
|
require("Cyka.xpticker")
|
||||||
---@field MOD_NAME string
|
else
|
||||||
---@field MOD_VERSION string
|
---@class MyModGlobal
|
||||||
---@field DumpTable fun(table: table, depth?: number)
|
---@field CONFIG {QUICKSTACK_KEYS: Keys, FABRICATOR_KEY: Keys, MAX_BUY: Keys, NESTED_CONTAINERS: boolean, DEBUG_MODE: boolean}
|
||||||
---@field debugPrint fun(message: string)
|
---@field MOD_NAME string
|
||||||
MyModGlobal = {
|
---@field MOD_VERSION string
|
||||||
CONFIG = {
|
---@field DumpTable fun(table: table, depth?: number)
|
||||||
QUICKSTACK_KEYS = Keys.F,
|
---@field debugPrint fun(message: string)
|
||||||
FABRICATOR_KEY = Keys.V,
|
MyModGlobal = {
|
||||||
MAX_BUY = Keys.B,
|
CONFIG = {
|
||||||
FIX = Keys.R,
|
QUICKSTACK_KEYS = Keys.F,
|
||||||
UNLOAD = Keys.E,
|
FABRICATOR_KEY = Keys.V,
|
||||||
RELOAD = Keys.R,
|
MAX_BUY = Keys.B,
|
||||||
STACK_TO_CURSOR = Keys.G,
|
FIX = Keys.R,
|
||||||
LOOT = Keys.L,
|
UNLOAD = Keys.E,
|
||||||
SONAR = Keys.X,
|
RELOAD = Keys.R,
|
||||||
AOEPICKUP = Keys.Y,
|
STACK_TO_CURSOR = Keys.G,
|
||||||
QICK_FABRICATOR = Keys.K,
|
LOOT = Keys.L,
|
||||||
QICK_DECONSTRUCTOR = Keys.J,
|
SONAR = Keys.X,
|
||||||
QICK_MEDICAL_FABRICATOR = Keys.M,
|
AOEPICKUP = Keys.Y,
|
||||||
NESTED_CONTAINERS = true,
|
QICK_FABRICATOR = Keys.K,
|
||||||
DEBUG_MODE = true,
|
QICK_DECONSTRUCTOR = Keys.J,
|
||||||
},
|
QICK_MEDICAL_FABRICATOR = Keys.M,
|
||||||
MOD_NAME = "Cyka Quick",
|
NESTED_CONTAINERS = true,
|
||||||
MOD_VERSION = "1.1.0",
|
DEBUG_MODE = true,
|
||||||
BAG_SLOT = 8,
|
},
|
||||||
}
|
MOD_NAME = "Cyka Quick",
|
||||||
|
MOD_VERSION = "1.1.0",
|
||||||
|
BAG_SLOT = 8,
|
||||||
|
}
|
||||||
|
|
||||||
---@param table table
|
---@param table table
|
||||||
---@param depth number?
|
---@param depth number?
|
||||||
MyModGlobal.DumpTable = function(table, depth)
|
MyModGlobal.DumpTable = function(table, depth)
|
||||||
if depth == nil then
|
if depth == nil then
|
||||||
depth = 0
|
depth = 0
|
||||||
end
|
end
|
||||||
if (depth > 200) then
|
if (depth > 200) then
|
||||||
print("Error: Depth > 200 in dumpTable()")
|
print("Error: Depth > 200 in dumpTable()")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for k, v in pairs(table) do
|
for k, v in pairs(table) do
|
||||||
if (type(v) == "table") then
|
if (type(v) == "table") then
|
||||||
print(string.rep(" ", depth) .. k .. ":")
|
print(string.rep(" ", depth) .. k .. ":")
|
||||||
MyModGlobal.DumpTable(v, depth + 1)
|
MyModGlobal.DumpTable(v, depth + 1)
|
||||||
else
|
else
|
||||||
print(string.rep(" ", depth) .. k .. ": ", v)
|
print(string.rep(" ", depth) .. k .. ": ", v)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Debugging helper function
|
||||||
|
MyModGlobal.debugPrint = function(message)
|
||||||
|
if MyModGlobal.CONFIG.DEBUG_MODE then
|
||||||
|
print("[" .. MyModGlobal.MOD_NAME .. "] " .. message)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local quickstack = require("Cyka.quickstack")
|
||||||
|
local fabricatorstack = require("Cyka.fabricatorstack")
|
||||||
|
local quickbuy = require("Cyka.quickbuy")
|
||||||
|
local hotkeyrepair = require("Cyka.hotkeyrepair")
|
||||||
|
local cursormacroer = require("Cyka.cursormacroer")
|
||||||
|
local quickunload = require("Cyka.quickunload")
|
||||||
|
local quickreload = require("Cyka.quickreload")
|
||||||
|
local quickloot = require("Cyka.quickloot")
|
||||||
|
local sonarpinger = require("Cyka.sonarpinger")
|
||||||
|
local aoepickup = require("Cyka.aoepickup")
|
||||||
|
local quickaccess = require("Cyka.quickaccess")
|
||||||
|
require("Cyka.zoom")
|
||||||
|
|
||||||
|
-- TODO: Keybind fabricator / medical fabricator / deconstructor on the sub
|
||||||
|
|
||||||
|
print(MyModGlobal.MOD_NAME .. " v" .. MyModGlobal.MOD_VERSION .. " loaded!")
|
||||||
|
|
||||||
|
-- Register necessary types and make fields accessible
|
||||||
|
LuaUserData.RegisterType("Barotrauma.Items.Components.ItemContainer+SlotRestrictions")
|
||||||
|
LuaUserData.RegisterType(
|
||||||
|
'System.Collections.Immutable.ImmutableArray`1[[Barotrauma.Items.Components.ItemContainer+SlotRestrictions, Barotrauma]]')
|
||||||
|
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.Items.Components.ItemContainer'], 'slotRestrictions')
|
||||||
|
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.ItemInventory'], 'slots')
|
||||||
|
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.ItemInventory'], 'slotsPerRow')
|
||||||
|
LuaUserData.MakeFieldAccessible(Descriptors["Barotrauma.CharacterInventory"], "slots")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.Store")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.GUIComponent")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.PurchasedItem")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.ItemPrefab")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.Location+StoreInfo")
|
||||||
|
LuaUserData.MakeMethodAccessible(Descriptors["Barotrauma.CargoManager"], "GetConfirmedSoldEntities")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.Items.Components.Repairable")
|
||||||
|
LuaUserData.RegisterType("Barotrauma.VisualSlot")
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QUICKSTACK_KEYS) then return end
|
||||||
|
quickstack.quickStackItems(instance)
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.STACK_TO_CURSOR) then return end
|
||||||
|
if not PlayerInput.IsShiftDown() then
|
||||||
|
quickstack.stackToCursor()
|
||||||
|
else
|
||||||
|
quickstack.stackAllToCursor()
|
||||||
|
end
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.FABRICATOR_KEY) then return end
|
||||||
|
fabricatorstack.tryStackFabricator(instance)
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.FIX) then return end
|
||||||
|
hotkeyrepair.tryRepair()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.MAX_BUY) then return end
|
||||||
|
quickbuy.tryBuy()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
local throttle = 0.1
|
||||||
|
local throttleTimer = 0
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if PlayerInput.Mouse4ButtonClicked() then
|
||||||
|
cursormacroer.setTargetInventory()
|
||||||
|
end
|
||||||
|
if not PlayerInput.IsAltDown() then return end
|
||||||
|
if Timer.GetTime() < throttleTimer then return end
|
||||||
|
throttleTimer = Timer.GetTime() + throttle
|
||||||
|
-- We can not use shift because holding shift means we're moving half a stack
|
||||||
|
-- Fuck me sideways
|
||||||
|
-- if not PlayerInput.IsShiftDown() then return end
|
||||||
|
-- if not PlayerInput.PrimaryMouseButtonClicked() then return end
|
||||||
|
cursormacroer.tryStackCursorItem()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.UNLOAD) then return end
|
||||||
|
quickunload.tryUnloadCursorItem()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.RELOAD) then return end
|
||||||
|
quickreload.tryReloadCursorItem(PlayerInput.IsShiftDown())
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
-- Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
-- if not PlayerInput.KeyHit(MyModGlobal.CONFIG.LOOT) then return end
|
||||||
|
-- quickloot.tryLoot()
|
||||||
|
-- end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.SONAR) then return end
|
||||||
|
sonarpinger.tryPing()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.AOEPICKUP) then return end
|
||||||
|
aoepickup.tryAoePickup()
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_FABRICATOR) then return end
|
||||||
|
quickaccess.tryAccessFabricator(PlayerInput.IsShiftDown())
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_DECONSTRUCTOR) then return end
|
||||||
|
quickaccess.tryAccessDeconstructor(PlayerInput.IsShiftDown())
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
|
|
||||||
|
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
||||||
|
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_MEDICAL_FABRICATOR) then return end
|
||||||
|
quickaccess.tryAccessMedicalFabricator(PlayerInput.IsShiftDown())
|
||||||
|
end, Hook.HookMethodType.After)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debugging helper function
|
|
||||||
MyModGlobal.debugPrint = function(message)
|
|
||||||
if MyModGlobal.CONFIG.DEBUG_MODE then
|
|
||||||
print("[" .. MyModGlobal.MOD_NAME .. "] " .. message)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local quickstack = require("Cyka.quickstack")
|
|
||||||
local fabricatorstack = require("Cyka.fabricatorstack")
|
|
||||||
local quickbuy = require("Cyka.quickbuy")
|
|
||||||
local hotkeyrepair = require("Cyka.hotkeyrepair")
|
|
||||||
local cursormacroer = require("Cyka.cursormacroer")
|
|
||||||
local quickunload = require("Cyka.quickunload")
|
|
||||||
local quickreload = require("Cyka.quickreload")
|
|
||||||
local quickloot = require("Cyka.quickloot")
|
|
||||||
local sonarpinger = require("Cyka.sonarpinger")
|
|
||||||
local aoepickup = require("Cyka.aoepickup")
|
|
||||||
local quickaccess = require("Cyka.quickaccess")
|
|
||||||
require("Cyka.xpticker")
|
|
||||||
require("Cyka.zoom")
|
|
||||||
|
|
||||||
-- TODO: Keybind fabricator / medical fabricator / deconstructor on the sub
|
|
||||||
|
|
||||||
print(MyModGlobal.MOD_NAME .. " v" .. MyModGlobal.MOD_VERSION .. " loaded!")
|
|
||||||
|
|
||||||
-- Register necessary types and make fields accessible
|
|
||||||
LuaUserData.RegisterType("Barotrauma.Items.Components.ItemContainer+SlotRestrictions")
|
|
||||||
LuaUserData.RegisterType(
|
|
||||||
'System.Collections.Immutable.ImmutableArray`1[[Barotrauma.Items.Components.ItemContainer+SlotRestrictions, Barotrauma]]')
|
|
||||||
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.Items.Components.ItemContainer'], 'slotRestrictions')
|
|
||||||
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.ItemInventory'], 'slots')
|
|
||||||
LuaUserData.MakeFieldAccessible(Descriptors['Barotrauma.ItemInventory'], 'slotsPerRow')
|
|
||||||
LuaUserData.MakeFieldAccessible(Descriptors["Barotrauma.CharacterInventory"], "slots")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.Store")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.GUIComponent")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.PurchasedItem")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.ItemPrefab")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.Location+StoreInfo")
|
|
||||||
LuaUserData.MakeMethodAccessible(Descriptors["Barotrauma.CargoManager"], "GetConfirmedSoldEntities")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.Items.Components.Repairable")
|
|
||||||
LuaUserData.RegisterType("Barotrauma.VisualSlot")
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QUICKSTACK_KEYS) then return end
|
|
||||||
quickstack.quickStackItems(instance)
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.STACK_TO_CURSOR) then return end
|
|
||||||
if not PlayerInput.IsShiftDown() then
|
|
||||||
quickstack.stackToCursor()
|
|
||||||
else
|
|
||||||
quickstack.stackAllToCursor()
|
|
||||||
end
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.FABRICATOR_KEY) then return end
|
|
||||||
fabricatorstack.tryStackFabricator(instance)
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.FIX) then return end
|
|
||||||
hotkeyrepair.tryRepair()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.MAX_BUY) then return end
|
|
||||||
quickbuy.tryBuy()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
local throttle = 0.1
|
|
||||||
local throttleTimer = 0
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if PlayerInput.Mouse4ButtonClicked() then
|
|
||||||
cursormacroer.setTargetInventory()
|
|
||||||
end
|
|
||||||
if not PlayerInput.IsAltDown() then return end
|
|
||||||
if Timer.GetTime() < throttleTimer then return end
|
|
||||||
throttleTimer = Timer.GetTime() + throttle
|
|
||||||
-- We can not use shift because holding shift means we're moving half a stack
|
|
||||||
-- Fuck me sideways
|
|
||||||
-- if not PlayerInput.IsShiftDown() then return end
|
|
||||||
-- if not PlayerInput.PrimaryMouseButtonClicked() then return end
|
|
||||||
cursormacroer.tryStackCursorItem()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.UNLOAD) then return end
|
|
||||||
quickunload.tryUnloadCursorItem()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.RELOAD) then return end
|
|
||||||
quickreload.tryReloadCursorItem(PlayerInput.IsShiftDown())
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
-- Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
-- if not PlayerInput.KeyHit(MyModGlobal.CONFIG.LOOT) then return end
|
|
||||||
-- quickloot.tryLoot()
|
|
||||||
-- end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.SONAR) then return end
|
|
||||||
sonarpinger.tryPing()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.AOEPICKUP) then return end
|
|
||||||
aoepickup.tryAoePickup()
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_FABRICATOR) then return end
|
|
||||||
quickaccess.tryAccessFabricator(PlayerInput.IsShiftDown())
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_DECONSTRUCTOR) then return end
|
|
||||||
quickaccess.tryAccessDeconstructor(PlayerInput.IsShiftDown())
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
|
||||||
Hook.Patch("Barotrauma.Character", "ControlLocalPlayer", function(instance, ptable)
|
|
||||||
if not PlayerInput.KeyHit(MyModGlobal.CONFIG.QICK_MEDICAL_FABRICATOR) then return end
|
|
||||||
quickaccess.tryAccessMedicalFabricator(PlayerInput.IsShiftDown())
|
|
||||||
end, Hook.HookMethodType.After)
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
-- luacheck: globals Item Vector2 Character MyModGlobal
|
-- luacheck: globals Item Vector2 Character MyModGlobal CLIENT
|
||||||
-- luacheck: max line length 420
|
-- luacheck: max line length 420
|
||||||
|
if not CLIENT then return end
|
||||||
local dump = require("Cyka.dump")
|
local dump = require("Cyka.dump")
|
||||||
local quickstack = require("Cyka.quickstack")
|
local quickstack = require("Cyka.quickstack")
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
-- luacheck: globals Character MyModGlobal Timer
|
-- luacheck: globals Character MyModGlobal Timer CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
local quickstack = require("Cyka.quickstack")
|
local quickstack = require("Cyka.quickstack")
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
-- luacheck: globals Character Game MyModGlobal
|
-- luacheck: globals Character Game MyModGlobal CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
local dump = require("Cyka.dump")
|
local dump = require("Cyka.dump")
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
-- luacheck: globals Character MyModGlobal
|
-- luacheck: globals Character MyModGlobal CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
---@return Barotrauma.Item|nil, Barotrauma.Items.Components.Repairable|nil
|
---@return Barotrauma.Item|nil, Barotrauma.Items.Components.Repairable|nil
|
||||||
local function getRepairableObjectInFocus()
|
local function getRepairableObjectInFocus()
|
||||||
-- Make sure we have a controlled character
|
-- Make sure we have a controlled character
|
||||||
@@ -51,8 +53,8 @@ local function clickRepairButton()
|
|||||||
local button = repairableComponent.RepairButton
|
local button = repairableComponent.RepairButton
|
||||||
if button then
|
if button then
|
||||||
MyModGlobal.debugPrint("Clicking repair button")
|
MyModGlobal.debugPrint("Clicking repair button")
|
||||||
-- button.OnClicked(button, repairableComponent)
|
-- Try to access repair functionality directly
|
||||||
button.OnButtonDown()
|
repairableComponent.requestStartFixAction = 1 -- FixActions.Repair = 1
|
||||||
end
|
end
|
||||||
-- MyModGlobal.debugPrint("StartRepairing result: " .. tostring(result))
|
-- MyModGlobal.debugPrint("StartRepairing result: " .. tostring(result))
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
-- luacheck: globals MyModGlobal Character Hook EnsurePatch
|
-- luacheck: globals MyModGlobal Character Hook EnsurePatch CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
local utils = require "Cyka.utils"
|
local utils = require "Cyka.utils"
|
||||||
local dump = require "Cyka.dump"
|
local dump = require "Cyka.dump"
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
-- luacheck: globals Game MyModGlobal
|
-- luacheck: globals Game MyModGlobal CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
---@return Barotrauma.Location.StoreInfo[], string?
|
---@return Barotrauma.Location.StoreInfo[], string?
|
||||||
local function getCurrentStore()
|
local function getCurrentStore()
|
||||||
if not Game or not Game.GameSession or not Game.GameSession.Campaign then
|
if not Game or not Game.GameSession or not Game.GameSession.Campaign then
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
-- luacheck: globals Character MyModGlobal
|
-- luacheck: globals Character MyModGlobal CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
local dump = require("Cyka.dump")
|
local dump = require("Cyka.dump")
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
local quickstack = require("Cyka.quickstack")
|
local quickstack = require("Cyka.quickstack")
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
-- luacheck: globals Character MyModGlobal Timer
|
-- luacheck: globals Character MyModGlobal Timer CLIENT
|
||||||
-- luacheck: max line length 420
|
-- luacheck: max line length 420
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
local dump = require("Cyka.dump")
|
local dump = require("Cyka.dump")
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
-- luacheck: globals MyModGlobal Character
|
-- luacheck: globals MyModGlobal Character CLIENT
|
||||||
-- luacheck: max line length 420
|
-- luacheck: max line length 420
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
|
|
||||||
---@class ItemLocation
|
---@class ItemLocation
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
-- luacheck: globals Character MyModGlobal Timer
|
-- luacheck: globals Character MyModGlobal Timer CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
local utils = require("Cyka.utils")
|
local utils = require("Cyka.utils")
|
||||||
|
|
||||||
---@param inventory Barotrauma.ItemInventory
|
---@param inventory Barotrauma.ItemInventory
|
||||||
@@ -96,7 +98,8 @@ local function tryUnloadSlot(slot)
|
|||||||
for _, nearbySlot in ipairs(nearbySlots) do
|
for _, nearbySlot in ipairs(nearbySlots) do
|
||||||
local canAccept = nearbySlot.inventory.CanBePutInSlot(iitem.Prefab, nearbySlot.slotIndex)
|
local canAccept = nearbySlot.inventory.CanBePutInSlot(iitem.Prefab, nearbySlot.slotIndex)
|
||||||
if canAccept then
|
if canAccept then
|
||||||
local moved = nearbySlot.inventory.TryPutItem(iitem, nearbySlot.slotIndex, true, false, Character.Controlled, true)
|
local moved = nearbySlot.inventory.TryPutItem(iitem, nearbySlot.slotIndex, true, false,
|
||||||
|
Character.Controlled, true)
|
||||||
-- print(string.format("Moved item %s to slot %d", iitem.Name, nearbySlot.slotIndex))
|
-- print(string.format("Moved item %s to slot %d", iitem.Name, nearbySlot.slotIndex))
|
||||||
if moved then break end
|
if moved then break end
|
||||||
end
|
end
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
-- luacheck: globals Character MyModGlobal LuaUserData Descriptors Timer
|
-- luacheck: globals Character MyModGlobal LuaUserData Descriptors Timer CLIENT
|
||||||
|
if not CLIENT then return end
|
||||||
|
|
||||||
local dump = require("Cyka.dump")
|
local dump = require("Cyka.dump")
|
||||||
|
|
||||||
-- LuaUserData.MakeMethodAccessible(Descriptors["Barotrauma.Sonar"], "UpdateGUIElements")
|
-- LuaUserData.MakeMethodAccessible(Descriptors["Barotrauma.Sonar"], "UpdateGUIElements")
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
-- luacheck: globals Character Timer Hook SERVER
|
-- luacheck: globals Character Timer Hook SERVER CLIENT
|
||||||
if not SERVER then return end
|
if not SERVER then return end
|
||||||
local amountExperience = 6000
|
local amountExperience = 6000
|
||||||
local passiveExperienceDelay = 60
|
local passiveExperienceDelay = 2
|
||||||
local passiveExperienceTimer = 0
|
local passiveExperienceTimer = 0
|
||||||
|
|
||||||
Hook.Add("think", "examples.passiveExperience", function()
|
Hook.Add("think", "examples.passiveExperience", function()
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
-- luacheck: globals SERVER Hook Keys LuaUserData PlayerInput Character Descriptors
|
-- luacheck: globals Hook Keys LuaUserData PlayerInput Character Descriptors CLIENT
|
||||||
-- luacheck: max line length 420
|
-- luacheck: max line length 420
|
||||||
if SERVER then return end
|
if not CLIENT then return end
|
||||||
|
|
||||||
local isToggle = true -- toggle or hold behaviour
|
local isToggle = true -- toggle or hold behaviour
|
||||||
local smoothZoom = false -- smooth or step
|
local smoothZoom = false -- smooth or step
|
||||||
|
Reference in New Issue
Block a user