Update ClothingActionsv2
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
------------------------------------------
|
||||
|
||||
CARadialMenu = ISBaseObject:derive("CARadialMenu")
|
||||
activeMenu = nil
|
||||
|
||||
------------------------------------------
|
||||
local CACommand = ISBaseObject:derive("CACommand")
|
||||
@@ -87,13 +88,12 @@ function CARadialMenu:display()
|
||||
self:center()
|
||||
menu:addToUIManager()
|
||||
if JoypadState.players[self.playerNum+1] then
|
||||
menu:setHideWhenButtonReleased(Joypad.RBumper)
|
||||
menu:setHideWhenButtonReleased(Joypad.DPadUp)
|
||||
setJoypadFocus(self.playerNum, menu)
|
||||
self.player:setJoypadIgnoreAimUntilCentered(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function CARadialMenu:new(player)
|
||||
local o = ISBaseObject.new(self)
|
||||
o.player = player
|
||||
@@ -132,6 +132,39 @@ function CARadialMenu.checkKey(key)
|
||||
return true
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
--- For the DPad
|
||||
function CARadialMenu.showRadialMenu(player)
|
||||
if UIManager.getSpeedControls() and (UIManager.getSpeedControls():getCurrentGameSpeed() == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
if not player or player:isDead() then
|
||||
return
|
||||
end
|
||||
local queue = ISTimedActionQueue.queues[player]
|
||||
if queue and #queue.queue > 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
local menu = CARadialMenu:new(player)
|
||||
menu:fillMenu()
|
||||
menu:display()
|
||||
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)
|
||||
end
|
||||
end
|
||||
------------------------------------------
|
||||
|
||||
function CARadialMenu.onKeyPress(key)
|
||||
if not CARadialMenu.checkKey(key) then
|
||||
return
|
||||
@@ -140,6 +173,8 @@ function CARadialMenu.onKeyPress(key)
|
||||
if radialMenu:isReallyVisible() and getCore():getOptionRadialMenuKeyToggle() then
|
||||
wasVisible = true
|
||||
radialMenu:removeFromUIManager()
|
||||
setJoypadFocus(activeMenu.playerNum, nil)
|
||||
activeMenu = nil
|
||||
return
|
||||
end
|
||||
ticks = getTimestampMs()
|
||||
@@ -163,27 +198,12 @@ function CARadialMenu.onKeyHold(key)
|
||||
local menu = CARadialMenu:new(getSpecificPlayer(0))
|
||||
menu:fillMenu()
|
||||
menu:display()
|
||||
activeMenu = menu
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function CARadialMenu.onKeyRelease(key)
|
||||
if not CARadialMenu.checkKey(key) then
|
||||
return
|
||||
end
|
||||
|
||||
local radialMenu = getPlayerRadialMenu(0)
|
||||
if (radialMenu:isReallyVisible() or wasVisible) then
|
||||
if not getCore():getOptionRadialMenuKeyToggle() then
|
||||
radialMenu:removeFromUIManager()
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Events.OnGameStart.Add(function()
|
||||
Events.OnKeyStartPressed.Add(CARadialMenu.onKeyPress)
|
||||
Events.OnKeyKeepPressed.Add(CARadialMenu.onKeyHold)
|
||||
Events.OnKeyPressed.Add(CARadialMenu.onKeyRelease)
|
||||
end)
|
||||
@@ -4,5 +4,5 @@ UI_EN = {
|
||||
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 Press"
|
||||
UI_ModOptions_CARMdelay = "Show Radial Menu Immediately on Key Press"
|
||||
}
|
||||
@@ -16,8 +16,11 @@ description=[url=https://steamcommunity.com/sharedfiles/filedetails/?id=26842855
|
||||
description=
|
||||
description=Should work with any other mods that add ExtraClothingOptions to item definitions too.
|
||||
description=
|
||||
description=I'm not sure if this will work with controllers as this is not how I play Project Zomboid. Also, not sure if this will work for other local players (shared screen co-op)
|
||||
description=UPDATE 04/02/2022: Added support for controllers
|
||||
description=This RadialMenu is now bound to the UP-DPad; this cannot be changed. Select what you want with the right thumbstick and release to perform the action.
|
||||
description=Don't worry, when the player is near a car the Vehicle Menu will appear as expected.
|
||||
description=
|
||||
description=This mod is now compatible with local co-op as well.
|
||||
description=[h2]Configuration[/h2]
|
||||
description=
|
||||
description=Default keybind is to the "Z" key. Configurable in the "Keybinds" menu.
|
||||
@@ -38,12 +41,13 @@ description=[/tr]
|
||||
description=[tr]
|
||||
description=[td]Show Radial Menu Immediately on Press[/td]
|
||||
description=[td]Disabled[/td]
|
||||
description=[td]Shows Radial Menu when key is pressed. By default, a press and hold is required[/td]
|
||||
description=[td]Shows Radial Menu when key is pressed. By default, a press and hold is required.[/td]
|
||||
description=[/tr]
|
||||
description=[/table]
|
||||
description=
|
||||
description=[h2]Translations[/h2]
|
||||
description=
|
||||
description=This mod is currently only in English. If you would like to contribute a translation, please submit a pull request on [url=https://github.com/hlfstr/pz-mods]GitHub![/url] I will happily give credit!
|
||||
description=This mod is currently only in English, but Actions in the Radial Menu will be translated (modded actions must include their own translations).
|
||||
description=If you would like to contribute a translation, please submit a pull request on [url=https://github.com/hlfstr/pz-mods]GitHub![/url] I will happily give credit!
|
||||
tags=Build 41;Interface;Realistic
|
||||
visibility=friendsOnly
|
||||
visibility=public
|
||||
|
||||
Reference in New Issue
Block a user