Update CARM SUI-Inv and add SUI-Rads

This commit is contained in:
davidh
2022-05-11 03:16:11 -05:00
parent d742e5fad1
commit d9f4c8bd13
48 changed files with 5225 additions and 95 deletions

View File

@@ -2,9 +2,19 @@
-- Clothing Actions
------------------------------------------
local CARM = require("ClothingActionsRadialMenu")
local spiff
if getActivatedMods():contains('SpiffUI-Rads') then
-- Register our Radials
spiff = SpiffUI:Register("radials")
if not spiff.radials then spiff.radials = {} end
end
CARMconfig = {
filter = false,
delay = false
delay = false,
spiff = true
}
local function ClothingActions()
@@ -25,14 +35,6 @@ local function ClothingActions()
end
end
if ModKey then
local CARMMODbindings = {
name = 'CARMMK',
key = 0
}
ModKey:AddBinding(CARMMODbindings)
end
if ModOptions and ModOptions.getInstance then
local function apply(data)
local player = getSpecificPlayer(0)
@@ -40,6 +42,16 @@ local function ClothingActions()
CARMconfig.filter = values.filter
CARMconfig.delay = values.delay
CARMconfig.spiff = values.spiff
-- Register our Radial to SpiffUI
if spiff then
if CARMconfig.spiff then
spiff.radials[9] = CARM
else
spiff.radials[9] = nil
end
end
end
local CARMCONFIG = {
@@ -62,6 +74,15 @@ local function ClothingActions()
mod_fullname = getText("UI_optionscreen_binding_ClothingActionsRM")
}
if spiff then
CARMCONFIG.options_data.spiff = {
default = true,
name = getText("UI_ModOptions_CARMtoSpiff"),
OnApplyMainMenu = apply,
OnApplyInGame = apply
}
end
local optionsInstance = ModOptions:getInstance(CARMCONFIG)
ModOptions:loadFile()
@@ -69,8 +90,14 @@ local function ClothingActions()
apply({settings = CARMCONFIG})
end)
end
Events.OnGameBoot.Add(function()
print("Clothing Actions Boot!")
end)
print(getText("UI_Init_ClothingActionsRM"))
end
ClothingActions()

View File

@@ -1,8 +1,8 @@
------------------------------------------
-- Clothing Actions Radial Menu
------------------------------------------
local CARadialMenu = ISBaseObject:derive("CARadialMenu")
CARadialMenu = ISBaseObject:derive("CARadialMenu")
activeMenu = nil
------------------------------------------
@@ -31,21 +31,6 @@ end
------------------------------------------
function CARadialMenu:center()
local menu = getPlayerRadialMenu(self.playerNum)
local x = getPlayerScreenLeft(self.playerNum)
local y = getPlayerScreenTop(self.playerNum)
local w = getPlayerScreenWidth(self.playerNum)
local h = getPlayerScreenHeight(self.playerNum)
x = x + w / 2
y = y + h / 2
menu:setX(x - menu:getWidth() / 2)
menu:setY(y - menu:getHeight() / 2)
end
local function checkClothes(item)
-- If there's extra options
if item and item:getClothingItemExtraOption() then
@@ -70,6 +55,7 @@ function CARadialMenu:fillMenu()
local action = item:getClothingItemExtraOption():get(i)
local itemType = moduleDotType(item:getModule(), item:getClothingItemExtra():get(i))
table.insert(commands, CACommand:new(self, item, getText("ContextMenu_" .. action), itemType, action))
self.hasCommands = true
end
end
end
@@ -84,8 +70,12 @@ function CARadialMenu:fillMenu()
end
function CARadialMenu:display()
self:fillMenu()
if not self.hasCommands then return end
local menu = getPlayerRadialMenu(self.playerNum)
self:center()
menu:center()
menu:addToUIManager()
if JoypadState.players[self.playerNum+1] then
menu:setHideWhenButtonReleased(Joypad.DPadUp)
@@ -109,6 +99,10 @@ function CARadialMenu.checkKey(key)
return false
end
if ModKey and ModKey.isKeyDown() then
return false
end
if UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0) then
return false
end
@@ -148,19 +142,22 @@ function CARadialMenu.showRadialMenu(player)
end
local menu = CARadialMenu:new(player)
menu:fillMenu()
--menu:fillMenu()
menu:display()
activeMenu = menu
--activeMenu = menu
end
---- Show the Radial Menu on the Up DPad when there's not a car around
local _ISDPadWheels_onDisplayUp = ISDPadWheels.onDisplayUp
function ISDPadWheels.onDisplayUp(joypadData)
local player = getSpecificPlayer(joypadData.player)
if not player:getVehicle() and not ISVehicleMenu.getVehicleToInteractWith(player) then
CARadialMenu.showRadialMenu(player)
else
_ISDPadWheels_onDisplayUp(joypadData)
-- Only do this if SpiffUI doesn't
if not SpiffUI then
---- Show the Radial Menu on the Up DPad when there's not a car around
local _ISDPadWheels_onDisplayUp = ISDPadWheels.onDisplayUp
function ISDPadWheels.onDisplayUp(joypadData)
local player = getSpecificPlayer(joypadData.player)
if not player:getVehicle() and not ISVehicleMenu.getVehicleToInteractWith(player) then
CARadialMenu.showRadialMenu(player)
else
_ISDPadWheels_onDisplayUp(joypadData)
end
end
end
------------------------------------------
@@ -196,7 +193,7 @@ function CARadialMenu.onKeyHold(key)
end
if (getTimestampMs() - ticks >= delay) and not radialMenu:isReallyVisible() then
local menu = CARadialMenu:new(getSpecificPlayer(0))
menu:fillMenu()
--menu:fillMenu()
menu:display()
activeMenu = menu
end
@@ -206,4 +203,6 @@ end
Events.OnGameStart.Add(function()
Events.OnKeyStartPressed.Add(CARadialMenu.onKeyPress)
Events.OnKeyKeepPressed.Add(CARadialMenu.onKeyHold)
end)
end)
return CARadialMenu

View File

@@ -6,7 +6,9 @@
local _ISClothingExtraAction_new = ISClothingExtraAction.new
function ISClothingExtraAction:new(...)
local o = _ISClothingExtraAction_new(self, ...)
o.stopOnWalk = false
o.stopOnAim = false
o.stopOnWalk = false
o.stopOnRun = true
o.maxTime = 25
o.useProgressBar = false
if o.character:isTimedActionInstant() then

View File

@@ -1,8 +1,9 @@
UI_EN = {
UI_Init_ClothingActionsRM = "Hello from Clothing Actions - Radial Menu!",
UI_Init_ClothingActionsRM = "Hello: Clothing Actions - Radial Menu!",
UI_optionscreen_binding_ClothingActionsRM = "Clothing Actions - Radial Menu",
UI_optionscreen_binding_CARM = "Show Clothing Actions Radial Menu",
UI_optionscreen_binding_CARMMK = "Show Clothing Actions Radial Menu",
UI_ModOptions_CARMfilter = "Disable Clothing Filter (Shows bags, watches, etc)",
UI_ModOptions_CARMdelay = "Show Radial Menu Immediately on Key Press"
UI_ModOptions_CARMdelay = "Show Radial Menu Immediately on Key Press",
UI_ModOptions_CARMtoSpiff = "Add Clothing Actions Radial to SpiffUI Radial"
}

View File

@@ -5,6 +5,6 @@ authors=dhert
description=A Radial Menu for quick access to equipped clothing actions
pzversion=41
tags=Immersion;Realistic
tags=Interface;Realistic
poster=poster.png