This commit is contained in:
2025-03-31 15:49:12 +02:00
parent e9672bc9d2
commit c4aa4814ca
3 changed files with 13 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
-- luacheck: globals Character
-- luacheck: globals Character MyModGlobal
---@return Barotrauma.Item|nil, Barotrauma.Items.Components.Repairable|nil
local function getRepairableObjectInFocus()
-- Make sure we have a controlled character
@@ -17,7 +17,7 @@ local function getRepairableObjectInFocus()
-- Check if the selected item is in fact the repairable object itself
for _, component in pairs(selectedItem.Components) do
if component.name == "Repairable" then
if component.Name == "Repairable" then
-- Check if repair interface should be shown
if component:ShouldDrawHUD(controlledCharacter) then
return selectedItem, component
@@ -29,6 +29,7 @@ local function getRepairableObjectInFocus()
return nil, nil
end
-- TODO: Character.HeldItems seems interesting
---@return boolean
local function clickRepairButton()
local item, repairableComponent = getRepairableObjectInFocus()
@@ -46,7 +47,12 @@ local function clickRepairButton()
-- Call the StartRepairing method directly
-- The second parameter (FixActions.Repair = 1) indicates a repair action
local result = repairableComponent:StartRepairing(controlledCharacter, 1)
local result = repairableComponent.StartRepairing(controlledCharacter, 1)
local button = repairableComponent.RepairButton
if button then
MyModGlobal.debugPrint("Clicking repair button")
button.OnClicked(button, repairableComponent)
end
-- MyModGlobal.debugPrint("StartRepairing result: " .. tostring(result))
return result

View File

@@ -13,6 +13,8 @@ local LOAD_MAP = {
handheldsonar = { batterycell = 1 },
underwaterscooter = { batterycell = 1 },
divingsuit = { oxygentank = 1, },
flashlight = { batterycell = 1 },
divingmask = { oxygentank = 1, },
}
return LOAD_MAP

View File

@@ -1,4 +1,5 @@
-- luacheck: globals Character Timer Hook
-- luacheck: globals Character Timer Hook SERVER
if not SERVER then return end
local amountExperience = 6000
local passiveExperienceDelay = 60
local passiveExperienceTimer = 0