Update All of the mods to the latest versions

This commit is contained in:
hlfstr
2022-12-23 01:26:54 -06:00
parent 15c7f6d92b
commit 5d5972ec3b
164 changed files with 185630 additions and 445 deletions

0
ClothingActions/Contents/mods/ClothingActions/mod.info Normal file → Executable file
View File

View File

Before

Width:  |  Height:  |  Size: 717 KiB

After

Width:  |  Height:  |  Size: 717 KiB

0
ClothingActions/README.md Normal file → Executable file
View File

0
ClothingActions/preview.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

0
ClothingActions/workshop.txt Normal file → Executable file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>AttachItem_BackL</m_Name>
<m_AnimName>Bob_Equip_Rifle_BackL</m_AnimName>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_Looped>false</m_Looped>
<m_SpeedScale>AttachItemSpeed</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>PerformingAction</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>AttachItem</m_StringValue>
</m_Conditions>
<m_Conditions>
<m_Name>AttachAnim</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>back</m_StringValue>
</m_Conditions>
<m_Conditions>
<m_Name>FHAnimHand</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>left</m_StringValue>
</m_Conditions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.00</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Prop2</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger1Nub</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger1</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger0Nub</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger0</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Hand</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Forearm</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_UpperArm</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Clavicle</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_R_Clavicle</boneName>
<weight>0.50</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_R_UpperArm</boneName>
<weight>0.50</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_R_Forearm</boneName>
<weight>0.50</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_R_Hand</boneName>
<weight>0.50</weight>
</m_SubStateBoneWeights>
<m_Events>
<m_EventName>attachConnect</m_EventName>
<m_TimePc>0.5</m_TimePc>
<m_ParameterValue></m_ParameterValue>
</m_Events>
</animNode>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BackL.xml">
<m_Name>AttachItem_BeltLeftL</m_Name>
<m_AnimName>Bob_Equip_HolsterLeft_1HandL</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_StringValue>belt left</m_StringValue>
</m_Conditions>
<m_Conditions />
</animNode>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BackL.xml">
<m_Name>AttachItem_BeltRightL</m_Name>
<m_AnimName>Bob_Equip_HolsterRight_1HandL</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_StringValue>belt right</m_StringValue>
</m_Conditions>
<m_Conditions />
</animNode>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BackL.xml">
<m_Name>AttachItem_HolsterLeftL</m_Name>
<m_AnimName>Bob_Equip_HolsterLeftL</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_StringValue>holster left</m_StringValue>
</m_Conditions>
<m_Conditions />
</animNode>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BackL.xml">
<m_Name>AttachItem_HolsterRightL</m_Name>
<m_AnimName>Bob_Equip_HolsterRightL</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_StringValue>holster right</m_StringValue>
</m_Conditions>
<m_Conditions />
</animNode>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BackL.xml">
<m_Name>DetachItem_BackL</m_Name>
<m_AnimName>Bob_Equip_Rifle_Back_OutL</m_AnimName>
<m_Conditions>
<m_StringValue>DetachItem</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Events>
<m_EventName>detachConnect</m_EventName>
</m_Events>
</animNode>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BeltLeftL.xml">
<m_Name>DetachItem_BeltLeftL</m_Name>
<m_AnimName>Bob_Equip_HolsterLeft_1Hand_OutL</m_AnimName>
<m_Conditions>
<m_StringValue>DetachItem</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Events>
<m_EventName>detachConnect</m_EventName>
</m_Events>
</animNode>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_BeltRightL.xml">
<m_Name>DetachItem_BeltRightL</m_Name>
<m_AnimName>Bob_Equip_HolsterRight_1Hand_OutL</m_AnimName>
<m_Conditions>
<m_StringValue>DetachItem</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Events>
<m_EventName>detachConnect</m_EventName>
</m_Events>
</animNode>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_HolsterLeftL.xml">
<m_Name>DetachItem_HolsterLeftL</m_Name>
<m_AnimName>Bob_Equip_HolsterLeft_OutL</m_AnimName>
<m_Conditions>
<m_StringValue>DetachItem</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Events>
<m_EventName>detachConnect</m_EventName>
</m_Events>
</animNode>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="AttachItem_HolsterRightL.xml">
<m_Name>DetachItem_HolsterRightL</m_Name>
<m_AnimName>Bob_Equip_HolsterRight_OutL</m_AnimName>
<m_Conditions>
<m_StringValue>DetachItem</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Events>
<m_EventName>detachConnect</m_EventName>
</m_Events>
</animNode>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="FHaimgunleft_item.xml">
<m_Name>FHaimgunleft_hgun</m_Name>
<m_AnimName>Bob_HgunAim_Hgun</m_AnimName>
<m_Conditions>
<m_StringValue>holdinghgunleft</m_StringValue>
</m_Conditions>
<m_Conditions />
<m_Conditions />
<m_Conditions>
<m_Name>hasTimedActions</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>false</m_BoolValue>
</m_Conditions>
<m_Transitions>
<m_Target>FHholdinggunleft</m_Target>
<m_AnimName>Bob_HgunAimToIdle_Hgun</m_AnimName>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.2</m_blendOutTime>
<m_speedScale>1.5</m_speedScale>
</m_Transitions>
</animNode>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="FHholdingitemleft.xml">
<m_Name>FHaimgunleft_item</m_Name>
<m_AnimName>Bob_HgunAim_Item</m_AnimName>
<m_Conditions />
<m_Conditions>
<m_Name>Aim</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>true</m_BoolValue>
</m_Conditions>
<m_Conditions>
<m_Name>Weapon</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>handgun</m_StringValue>
</m_Conditions>
<m_Transitions>
<m_Target>FHholdingitemleft</m_Target>
<m_AnimName>Bob_HgunAimToIdle_Item</m_AnimName>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.2</m_blendOutTime>
<m_speedScale>1.5</m_speedScale>
</m_Transitions>
</animNode>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode x_extends="FHholdingitemleft.xml">
<m_Name>FHholdinggunleft</m_Name>
<m_AnimName>Bob_FH_Hgun</m_AnimName>
<m_Conditions>
<m_StringValue>holdinghgunleft</m_StringValue>
</m_Conditions>
<m_Conditions>
<m_Name>hasTimedActions</m_Name>
<m_Type>BOOL</m_Type>
<m_BoolValue>false</m_BoolValue>
</m_Conditions>
<m_Transitions>
<m_Target>FHaimgunleft_hgun</m_Target>
<m_AnimName>Bob_HgunIdleToAim_Hgun</m_AnimName>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.2</m_blendOutTime>
<m_speedScale>1.5</m_speedScale>
</m_Transitions>
</animNode>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<animNode>
<m_Name>FHholdingitemleft</m_Name>
<m_AnimName>Bob_FH_Item</m_AnimName>
<m_Priority>10</m_Priority>
<m_deferredBoneAxis>Y</m_deferredBoneAxis>
<m_SyncTrackingEnabled>false</m_SyncTrackingEnabled>
<m_SpeedScale>0.48</m_SpeedScale>
<m_BlendTime>0.20</m_BlendTime>
<m_Conditions>
<m_Name>LeftHandMask</m_Name>
<m_Type>STRING</m_Type>
<m_StringValue>holdingitemleft</m_StringValue>
</m_Conditions>
<m_Transitions>
<m_Target>FHaimgunleft_item</m_Target>
<m_AnimName>Bob_HgunIdleToAim_Item</m_AnimName>
<m_blendInTime>0.5</m_blendInTime>
<m_blendOutTime>0.2</m_blendOutTime>
<m_speedScale>1.5</m_speedScale>
</m_Transitions>
<m_SubStateBoneWeights>
<boneName>Bip01</boneName>
<weight>0.00</weight>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Hand</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger0</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_L_Finger1</boneName>
</m_SubStateBoneWeights>
<m_SubStateBoneWeights>
<boneName>Bip01_Prop2</boneName>
</m_SubStateBoneWeights>
</animNode>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
------------------------------------------
-- Fancy Handwork Hotbar
---
------------------------------------------
-- Override on GameStart
local function doOverride()
-- SwapIt is better, I'd rather use their features than mine.
---- Hopefully we can get compatibility. :)
if getActivatedMods():contains('SwapIt') then print("Not overriding because SwapIt is enabled!") return end
local _ISHotbar_equipItem = ISHotbar.equipItem
function ISHotbar:equipItem(item)
-- Get Modifier
local mod = isFHModKeyDown()
local primary = self.chr:getPrimaryHandItem()
local secondary = self.chr:getSecondaryHandItem()
local equip = true
ISInventoryPaneContextMenu.transferIfNeeded(self.chr, item)
-- If we already have the item equipped
if (primary and primary == item) or (secondary and secondary == item) then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, item, 20))
equip = false
end
-- If we didn't just do something
if equip then
-- Handle holding big objects
if primary and isForceDropHeavyItem(primary) then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 50))
----- treat "equip" as if we have something equipped from here down
equip = false
end
if mod then
-- If we still have something equipped in secondary, unequip
if secondary and equip then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
end
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
else
-- If we still have something equipped in primary, unequip
if primary and equip then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 20))
end
-- Equip Primary
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
end
end
self.chr:getInventory():setDrawDirty(true)
getPlayerData(self.chr:getPlayerNum()).playerInventory:refreshBackpacks()
end
end
Events.OnGameStart.Add(doOverride)

View File

@@ -0,0 +1,187 @@
------------------------------------------
-- Fancy Handwork Init
------------------------------------------
FancyHands = FancyHands or {}
------------------------------------------
-- Fancy Handwork Configuration
------------------------------------------
FancyHands.config = {
applyRotationL = true
}
------------------------------------------
-- Fancy Handwork Utilities
------------------------------------------
function isFHModKeyDown()
return isKeyDown(getCore():getKey('FHModifier'))
end
local count = 0
local FH_OnTick = function()
if not FancyHands.config.applyRotationL then return end
-- Control to not get spammed
count = count + 1
if count % 30 ~= 0 then return end
count = 0
-- First figure out the local player's stuff
local player = getSpecificPlayer(0)
if not player:getModData().FancyHandwork then
player:getModData().FancyHandwork = {}
end
for vari, val in pairs(player:getModData().FancyHandwork) do
player:setVariable(vari, val)
end
if isClient() then
ModData.request("animapi")
local md = ModData.getOrCreate("animapi")
for id, obj in pairs(md) do
local p = getPlayerByOnlineID(id)
if p and p ~= player then
for vari, val in pairs(obj) do
if val == "nil" then
p:clearVariable(vari)
else
p:setVariable(vari, val)
end
end
end
end
end
end
local FH_OnCreatePlayer = function(playerNum, playerObj)
if isClient() then
ModData.request("animapi")
if not ModData.getOrCreate("animapi")[playerObj:getOnlineID()] then
ModData.getOrCreate("animapi")[playerObj:getOnlineID()]= {}
end
ModData.transmit("animapi")
end
if not playerObj:getModData().FancyHandwork then
playerObj:getModData().FancyHandwork = {}
end
end
local FHswapItems = function(character)
local primary = character:getPrimaryHandItem()
local secondary = character:getSecondaryHandItem()
if (primary or secondary) and (primary ~= secondary) then
ISTimedActionQueue.add(FHSwapHandsAction:new(character, primary, secondary, 10))
end
end
local FHswapItemsMod = function(character)
if isFHModKeyDown() then
FHswapItems(character)
end
end
local FHDebugKey = function(character)
if isFHModKeyDown() then
character:Say("I'm not sure what to do with my hands.")
--ISTimedActionQueue.add(FHHamboneAction:new(character))
end
end
local FHcreateBindings = function()
local FHbindings = {
{
value = '[FancyHandwork]'
},
{
value = 'FHModifier',
key = Keyboard.KEY_LCONTROL,
},
{
value = 'FHSwapKey',
action = FHswapItems,
key = 0,
},
{
value = 'FHSwapKeyMod',
action = FHswapItemsMod,
key = Keyboard.KEY_E,
},
-- {
-- value = 'FHDebugKey',
-- action = FHDebugKey,
-- key = Keyboard.KEY_Y,
-- }
}
for _, bind in ipairs(FHbindings) do
if bind.key or not bind.action then
table.insert(keyBinding, { value = bind.value, key = bind.key })
end
end
local FHhandleKeybinds = function(key)
local player = getSpecificPlayer(0)
local action
for _,bind in ipairs(FHbindings) do
if key == getCore():getKey(bind.value) then
action = bind.action
break
end
end
if not action or isGamePaused() or not player or player:isDead() then
return
end
action(player)
end
Events.OnGameStart.Add(function()
Events.OnKeyPressed.Add(FHhandleKeybinds)
end)
end
local function FancyHandwork()
FHcreateBindings()
if ModOptions and ModOptions.getInstance then
local function apply(data)
local values = data.settings.options
FancyHands.config.applyRotationL = values.applyRotationL
end
local FHCONFIG = {
options_data = {
applyRotationL = {
default = true,
name = getText("UI_ModOptions_FHfixLHandRotation"),
OnApplyMainMenu = apply,
OnApplyInGame = apply
}
},
mod_id = "FancyHandwork",
mod_shortname = "FH",
mod_fullname = getText("UI_optionscreen_binding_FancyHandwork"),
mod_version = "1.0"
}
local optionsInstance = ModOptions:getInstance(FHCONFIG)
ModOptions:loadFile()
Events.OnGameStart.Add(function()
apply({settings = FHCONFIG})
end)
end
Events.OnCreatePlayer.Add(FH_OnCreatePlayer)
Events.OnTick.Add(FH_OnTick)
print(getText("UI_Init_FancyHandwork"))
end
FancyHandwork()

View File

@@ -0,0 +1,53 @@
------------------------------------------
-- Fancy Handwork Attach Hotbar Action
---
------------------------------------------
local _ISAttachItemHotbar_start = ISAttachItemHotbar.start
function ISAttachItemHotbar:start()
_ISAttachItemHotbar_start(self)
self.mdata = {}
if isClient() then
local md = ModData.getOrCreate("animapi")
if not md[self.character:getOnlineID()] then
md[self.character:getOnlineID()] = {}
end
self.mdata = md[self.character:getOnlineID()]
end
if self.item == self.character:getPrimaryHandItem() then
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = nil
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
elseif self.item == self.character:getSecondaryHandItem() then
self.character:setVariable("FHAnimHand", "left")
self.mdata["FHAnimHand"] = "left"
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
if ZombRand(3) == 1 then
self.character:setVariable("FHAnimHand", "left")
self.mdata["FHAnimHand"] = "left"
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = nil
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
end
if isClient() then
ModData.transmit("animapi")
end
end
local _ISAttachItemHotbar_animEvent = ISAttachItemHotbar.animEvent
function ISAttachItemHotbar:animEvent(event, parameter)
_ISAttachItemHotbar_animEvent(self, event, parameter)
if event == 'attachConnect' then
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = nil
if isClient() then
ModData.transmit("animapi")
end
end
end

View File

@@ -0,0 +1,79 @@
------------------------------------------
-- Fancy Handwork Detach Hotbar Action
---
------------------------------------------
local _ISDetachItemHotbar_start = ISDetachItemHotbar.start
function ISDetachItemHotbar:start()
-- Run the base, then override
_ISDetachItemHotbar_start(self)
self.mdata = {}
if isClient() then
local md = ModData.getOrCreate("animapi")
if not md[self.character:getOnlineID()] then
md[self.character:getOnlineID()] = {}
end
self.mdata = md[self.character:getOnlineID()]
end
if self.item == self.character:getPrimaryHandItem() then
self.character:clearVariable("FHAnimHand")
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
self.mdata["FHAnimHand"] = nil
elseif self.item == self.character:getSecondaryHandItem() then
self.character:setVariable("FHAnimHand", "left")
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
self.mdata["FHAnimHand"] = "left"
else
if ZombRand(3) == 1 then
self.character:setVariable("FHAnimHand", "left")
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
self.mdata["FHAnimHand"] = "left"
else
self.character:clearVariable("FHAnimHand")
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
self.mdata["FHAnimHand"] = nil
end
end
local hotbar = getPlayerHotbar(self.character:getPlayerNum())
hotbar.chr:removeAttachedItem(self.item)
if isClient() then
ModData.transmit("animapi")
end
end
local _ISDetachItemHotbar_animEvent = ISDetachItemHotbar.animEvent
function ISDetachItemHotbar:animEvent(event, parameter)
-- Run the base, then override
_ISDetachItemHotbar_animEvent(self, event, parameter)
-- Fix the models
if event == 'detachConnect' then
-- Fix updating the inventory
self.character:getInventory():setDrawDirty(true)
getPlayerData(self.character:getPlayerNum()).playerInventory:refreshBackpacks()
--self.character:getInventory():refreshBackpacks()
if self.character:getPrimaryHandItem() == self.character:getSecondaryHandItem() then -- special case if 2handed
if self.animHand == "left" then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
else
if self.animHand == "left" then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
end
end
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = nil
if isClient() then
ModData.transmit("animapi")
end
end

View File

@@ -0,0 +1,122 @@
------------------------------------------
-- Fancy Handwork Equip Action
---
------------------------------------------
local _ISEquipWeaponAction_start = ISEquipWeaponAction.start
function ISEquipWeaponAction:start()
-- So, items in your other hand are unequiped if a handgun is equipped
--- i.e. a handgun in primary hand will be unequiped if a secondary item is equipped and vice versa
--- this should restore this feature. First, we cache the weapon if needed
self.hgun = nil
if instanceof(self.item, "HandWeapon") and not self.twoHands then
if self.primary then
self.hgun = self.character:getSecondaryHandItem()
else
self.hgun = self.character:getPrimaryHandItem()
end
end
-- Run the base, then override
_ISEquipWeaponAction_start(self)
self.mdata = {}
if isClient() then
local md = ModData.getOrCreate("animapi")
if not md[self.character:getOnlineID()] then
md[self.character:getOnlineID()] = {}
end
self.mdata = md[self.character:getOnlineID()]
end
-- Check if in second hand or not two handed and use left hand, default is primary hand
if not self.primary and not self.twoHands then
self.character:setVariable("FHAnimHand", "left")
self.mdata["FHAnimHand"] = "left"
self.LHand = true
if instanceof(self.item, "HandWeapon") then
if self.item:isRanged() then
self.character:setVariable("LeftHandMask", "holdinghgunleft")
self.mdata["LeftHandMask"] = "holdinghgunleft"
self.character:getModData().FancyHandwork["LeftHandMask"] = "holdinghgunleft"
else
self.character:setVariable("LeftHandMask", "holdingitemleft")
self.mdata["LeftHandMask"] = "holdingitemleft"
self.character:getModData().FancyHandwork["LeftHandMask"] = "holdingitemleft"
end
else
self.character:clearVariable("LeftHandMask")
self.mdata["LeftHandMask"] = "nil"
self.character:getModData().FancyHandwork["LeftHandMask"] = nil
end
if self.fromHotbar then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
end
else
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = "nil"
self.character:getModData().FancyHandwork["FHAnimHand"] = nil
if self.fromHotbar and not self.twoHands then
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
if self.twoHands or not self.character:getSecondaryHandItem() then
self.character:clearVariable("LeftHandMask")
self.mdata["LeftHandMask"] = "nil"
self.character:getModData().FancyHandwork["LeftHandMask"] = nil
end
end
if self.fromHotbar then
local hotbar = getPlayerHotbar(self.character:getPlayerNum())
hotbar.chr:removeAttachedItem(self.item)
end
if isClient() then
ModData.transmit("animapi")
end
end
local _ISEquipWeaponAction_perform = ISEquipWeaponAction.perform
function ISEquipWeaponAction:perform()
-- Run the base, then override
_ISEquipWeaponAction_perform(self)
-- Lets restore our other weapon now
if self.hgun then
if self.primary then
self.character:setSecondaryHandItem(self.hgun)
else
self.character:setPrimaryHandItem(self.hgun)
end
end
-- Fix the models, idk why they always blank out the secondary item. :(
if self.fromHotbar and not self.twoHands then
if self.LHand then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
end
end
-- Override this to set the correct hand on completion
local _ISEquipWeaponAction_animEvent = ISEquipWeaponAction.animEvent
function ISEquipWeaponAction:animEvent(event, parameter)
-- Run the base, then override
_ISEquipWeaponAction_animEvent(self, event, parameter)
-- Fix the models
if event == 'detachConnect' and not self.twoHands then
if self.LHand then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
else
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
end
end

View File

@@ -0,0 +1,135 @@
------------------------------------------
-- Fancy Handwork Swap Action
---
-- Mostly based on code from:
--- lua\client\TimedActions\ISUnequipAction.lua
--- lua\client\TimedActions\ISEquipWeaponAction.lua
------------------------------------------
require "TimedActions/ISBaseTimedAction"
FHSwapHandsAction = ISBaseTimedAction:derive("FHSwapHandsAction")
function FHSwapHandsAction:isValid()
if self.character:getPrimaryHandItem() or self.character:getSecondaryHandItem() then
return true
else
return false
end
end
function FHSwapHandsAction:update()
if self.itemL then
self.itemL:setJobDelta(self:getJobDelta())
end
if self.itemR then
self.itemR:setJobDelta(self:getJobDelta())
end
end
function FHSwapHandsAction:start()
local sound = nil
if self.itemL then
self.itemL:setJobType(getText("ContextMenu_Equip_Primary") .. " " .. self.itemL:getName())
self.itemL:setJobDelta(0.0)
sound = self.itemL:getUnequipSound()
end
if self.itemR then
self.itemR:setJobType(getText("ContextMenu_Equip_Secondary") .. " " .. self.itemR:getName())
self.itemR:setJobDelta(0.0)
if not sound then
sound = self.itemR:getUnequipSound()
end
end
self:setActionAnim("EquipItem")
self:setOverrideHandModels(self.itemR, self.itemL)
if sound then
self.sound = self.character:getEmitter():playSound(sound)
end
end
function FHSwapHandsAction:stop()
if self.sound then
self.character:getEmitter():stopSound(self.sound)
end
if self.itemL then
self.itemL:setJobDelta(0.0)
end
if self.itemR then
self.itemR:setJobDelta(0.0)
end
ISBaseTimedAction.stop(self);
end
function FHSwapHandsAction:perform()
if self.sound then
self.character:getEmitter():stopSound(self.sound)
end
if self.itemL then
self.itemL:getContainer():setDrawDirty(true)
self.itemL:setJobDelta(0.0)
end
if self.itemR then
self.itemR:getContainer():setDrawDirty(true)
self.itemR:setJobDelta(0.0)
end
self.character:setPrimaryHandItem(nil)
self.character:setSecondaryHandItem(nil)
self.mdata = {}
if isClient() then
local md = ModData.getOrCreate("animapi")
if not md[self.character:getOnlineID()] then
md[self.character:getOnlineID()] = {}
end
self.mdata = md[self.character:getOnlineID()]
end
if self.itemL then
self.character:setPrimaryHandItem(self.itemL)
end
if self.itemR and FancyHands.config.applyRotationL then
self.character:setSecondaryHandItem(self.itemR)
if self.itemR:isRanged() then
self.character:setVariable("LeftHandMask", "holdinghgunleft")
self.mdata["LeftHandMask"] = "holdinghgunleft"
self.character:getModData().FancyHandwork["LeftHandMask"] = "holdinghgunleft"
else
self.character:setVariable("LeftHandMask", "holdingitemleft")
self.mdata["LeftHandMask"] = "holdingitemleft"
self.character:getModData().FancyHandwork["LeftHandMask"] = "holdingitemleft"
end
else
self.mdata["LeftHandMask"] = "nil"
self.character:getModData().FancyHandwork["LeftHandMask"] = nil
end
if isClient() then
ModData.transmit("animapi")
end
getPlayerInventory(self.character:getPlayerNum()):refreshBackpacks()
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self);
end
function FHSwapHandsAction:new(character, itemR, itemL, time)
local o = ISBaseTimedAction.new(self, character)
o.itemR = itemR
o.itemL = itemL
o.stopOnAim = false
o.stopOnWalk = false
o.stopOnRun = false
o.maxTime = time
o.ignoreHandsWounds = FancyHands.config.injuries
o.useProgressBar = false
o.animSpeed = 1.0
return o;
end

View File

@@ -0,0 +1,42 @@
------------------------------------------
-- Fancy Handwork Unequip Action
---
------------------------------------------
local _ISUnequipAction_start = ISUnequipAction.start
function ISUnequipAction:start()
-- Run the base, then override
_ISUnequipAction_start(self)
self.mdata = {}
if isClient() then
local md = ModData.getOrCreate("animapi")
if not md[self.character:getOnlineID()] then
md[self.character:getOnlineID()] = {}
end
self.mdata = md[self.character:getOnlineID()]
end
-- Check for second hand item that's not 2-handed, use left hand
-- else use right
if self.item == self.character:getSecondaryHandItem() and self.character:getPrimaryHandItem() ~= self.character:getSecondaryHandItem() then
self.character:setVariable("FHAnimHand", "left")
self.mdata["FHAnimHand"] = "left"
if self.fromHotbar then
self:setOverrideHandModels(self.character:getPrimaryHandItem(), self.item)
end
self.character:clearVariable("LeftHandMask")
self.mdata["LeftHandMask"] = "nil"
self.character:getModData().FancyHandwork["LeftHandMask"] = nil
else
self.character:clearVariable("FHAnimHand")
self.mdata["FHAnimHand"] = "nil"
if self.fromHotbar and self.character:getPrimaryHandItem() ~= self.character:getSecondaryHandItem() then
self:setOverrideHandModels(self.item, self.character:getSecondaryHandItem())
end
end
if isClient() then
ModData.transmit("animapi")
end
end

View File

@@ -0,0 +1,33 @@
-- Animation Framework for Project Zomboid
---- Code inspired and modifed from "Tsarlib"
if not isClient() and not isServer() then return end
local AF_InitGlobaModData = function(mod, pack)
if not ModData.exists("animapi") then
local t = ModData.create("animapi")
end
end
local AF_ReceiveGlobalModData = function(mod, pack)
if mod ~= "animapi" then return; end;
if not pack then
print("ERROR: OnReceiveGlobalModData in AF_ReceiveGlobalModData " .. (pack or "missing packet."))
else
ModData.add(mod, pack)
end
end
local AF_CleanGlobalModData = function()
local md = ModData.getOrCreate("animapi")
for id, _ in pairs(md) do
local player = getPlayerByOnlineID(id)
if not player then
md[id] = nil
end
end
end
Events.OnInitGlobalModData.Add(AF_InitGlobaModData)
Events.OnReceiveGlobalModData.Add(AF_ReceiveGlobalModData)
Events.EveryHours.Add(AF_CleanGlobalModData)

View File

@@ -0,0 +1,9 @@
UI_EN = {
UI_Init_FancyHandwork = "Hello: Fancy Handwork!",
UI_optionscreen_binding_FancyHandwork = "Fancy Handwork",
UI_optionscreen_binding_FHModifier = "Modifier Key",
UI_optionscreen_binding_FHSwapKey = "Swap Items (just key)",
UI_optionscreen_binding_FHSwapKeyMod = "Swap Items (mod + key)",
UI_optionscreen_binding_FHDebugKey = "Debug Key (Only used in Debug Mode)",
UI_ModOptions_FHfixLHandRotation = "Apply Animations"
}

View File

@@ -0,0 +1,11 @@
name=Fancy Handwork
id=FancyHandwork
authors=dhert
description=Got a left arm that's just dangling there and not doing anything? The Zombies haven't gotten it yet, so put it to use!
pzversion=41
tags=Realistic
poster=poster.png
poster=animfix.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

BIN
FancyHandwork/preview.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

47
FancyHandwork/workshop.txt Executable file
View File

@@ -0,0 +1,47 @@
version=1
id=2904920097
title=Fancy Handwork
description=[h1]Supports B41+. Works in Multiplayer[/h1]
description=[h3]A new save is not required[/h3]
description=
description=[h1]Supports B41+. Works in Multiplayer[/h1]
description=[h3]A new save is not required[/h3]
description=[img]https://i.imgur.com/p7Fv1Z6.gif[/img]
description=
description=Got a left arm that's just dangling there and not doing anything? The Zombies haven't gotten it yet, so put it to use!
description=
description=[h2]Features[/h2]
description=[list]
description=[*] Attaching or Detaching an item to your Hotbar now has a chance to be done with the left arm
description=[*] Equipping and Unequipping your secondary item is now done with the left arm
description=[*] "Hand Swap" action to quickly swap the primary and secondary held items
description=[*] Modifier key to quickly equip items in secondary hand using from your Hotbar
description=[*] Animation mask for the left arm to correct the rotation of the held item
description=[*] Includes a new pose when aiming a pistol and holding a secondary tool (Also lets you do this again)
description=[/list]
description=
description=[h2]Usage[/h2]
description=When Attaching or Detaching an item on your Hotbar, you have a chance for the action to automatically be done with your left hand.
description=
description=A modifier key is added as well, which by default is bound to "Left Control".
description=[b]Note:[/b] By default, "Left Control" is the "Aim" key. I personally do not use the keyboard to aim (its right-click on the mouse anyways) so I disable this keybind. You are free to rebind the key in options.
description=
description=When you press the Modifier Key and a Hotbar slot, the item slotted there will go into your Secondary Hand. Example: (Left Control + 2) equips a Hammer to your left hand.
description=
description=Pressing the Modifier and "E" will swap the items in your hands. (Configurable)
description=
description=[h2]Limitations[/h2]
description=The corrected rotations in the Left Hand will take a brief second to "settle" into place. Additionally, performing another action may reset the Left Hand mask causing the correction to have to be re-applied (it will do so automatically).
description=
description=[h3]Multiplayer[/h3]
description=Animations should sync across multiplayer. However, there are a few limitations that may result in some brief odd behavior.
description=
description=Custom Animation states are not synced like how built-in states are, and the game seems to change animations on the player outside of what you do in Lua as well. I sync the animation states required for this mod, but this is separate from how the game handles its own synced animations. As such, brief de-sync can happen when a player is performing an action. For example, an equip animation may start with the right hand like normal and quickly change to the left once the custom state syncs.
description=
description=[h2]Compatibility[/h3]
description=Should be compatible with almost everything. The only incompatibility I found is with the mod [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2366717227]Swap It[/url]. [b]Note:[/b]"Swap It's" functionality is way better than this mod, so the quick equip to secondary keybinds are not enabled when using both mods due to incompatibilities.
description=
description=Workshop ID: 2904920097
description=Mod ID: FancyHandwork
tags=Build 41;Realistic;Silly/Fun
visibility=public

View File

@@ -618,6 +618,10 @@ end
-- Adapted from: https://www.rosettacode.org/wiki/Word_wrap#Lua
SpiffUI.textwrap = function(text, linewidth)
-- if its already wrapped, do nothing
if text:contains("\n") then
return text
end
local function splittokens(s)
local res = {}
for w in s:gmatch("%S+") do
@@ -646,6 +650,7 @@ SpiffUI.textwrap = function(text, linewidth)
end
table.insert(res, table.concat(line, ' '))
return table.concat(res, '\n')
end

View File

@@ -0,0 +1,22 @@
------------------------------------------
-- SpiffUI Radials
---- ISEmoteRadial SpiffUI
------------------------------------------
SpiffUI = SpiffUI or {}
-- Register our Radials
local spiff = SpiffUI:Register("radials")
local _ISEmoteRadialMenu_fillMenu = ISEmoteRadialMenu.fillMenu
function ISEmoteRadialMenu:fillMenu(submenu)
local menu = getPlayerRadialMenu(self.playerNum)
if not submenu then
menu:setRadialImage(ISEmoteRadialMenu.icons["wavehi"])
menu:setRadialText(getText("UI_SpiffUI_EmoteWheel"))
else
menu:setRadialImage(ISEmoteRadialMenu.icons[submenu])
menu:setRadialText(ISEmoteRadialMenu.menu[submenu].name)
end
_ISEmoteRadialMenu_fillMenu(self, submenu)
end

View File

@@ -1,6 +1,6 @@
------------------------------------------
-- SpiffUI Radials
---- ISFirearmRadialMenu getWeapon hack
---- ISFirearmRadialMenu SpiffUI
------------------------------------------
SpiffUI = SpiffUI or {}
@@ -31,5 +31,11 @@ function ISFirearmRadialMenu:display()
o:fillMenu()
end
local weapon = self:getWeapon()
if not weapon then return end
local menu = getPlayerRadialMenu(self.playerNum)
menu:setRadialImage(weapon:getTexture())
menu:setRadialText(weapon:getName())
_ISFirearmRadialMenu_display(self)
end

View File

@@ -285,10 +285,15 @@ function ISRadialMenu:getSliceTooltipMouse(x, y)
end
function ISRadialMenu:getSliceText(sliceIndex)
if sliceIndex < 1 or sliceIndex > #self.slices then return "" end
if sliceIndex < 1 or sliceIndex > #self.slices then return end
return self.slices[sliceIndex].text
end
function ISRadialMenu:getSliceTexture(sliceIndex)
if sliceIndex < 1 or sliceIndex > #self.slices then return end
return self.slices[sliceIndex].texture
end
function ISRadialMenu:showTooltip(item)
if item and spiff.config.showTooltips then
if self.prev == item and (self.toolRender:getIsVisible()
@@ -403,6 +408,7 @@ end
local _ISRadialMenu_undisplay = ISRadialMenu.undisplay
function ISRadialMenu:undisplay()
_ISRadialMenu_undisplay(self)
if self.toolRender and self.toolRender:getIsVisible() then
self.toolRender:removeFromUIManager()
self.toolRender:setVisible(false)
@@ -419,13 +425,70 @@ function ISRadialMenu:undisplay()
self.activeMenu:undisplay()
self.activeMenu = nil
end
self.clock = nil
end
function ISRadialMenu:RadialTick()
if self:isReallyVisible() then
if JoypadState.players[self.playerNum+1] then
self:showTooltip(self:getSliceTooltipJoyPad())
end
local _ISRadialMenu_addSlice = ISRadialMenu.addSlice
function ISRadialMenu:addSlice(text, texture, command, arg1, arg2, arg3, arg4, arg5, arg6)
local slice = {}
slice.text = text
slice.texture = texture
slice.command = { command, arg1, arg2, arg3, arg4, arg5, arg6 }
table.insert(self.slices, slice)
-- we don't actually wan't to pass the string in here anymore.
if self.javaObject then
self.javaObject:addSlice(nil, texture)
end
end
function ISRadialMenu:setRadialText(text)
self.radText = text
end
function ISRadialMenu:setRadialImage(img)
self.radImg = img
end
function ISRadialMenu:setImgChange(state)
self.radImgChange = state
end
function ISRadialMenu:getClock()
return self.clock
end
function ISRadialMenu:setClock(clock, clockSpiff)
self.clock = clock
end
local SUIRadialMenuOverlay = require("SUI/SUI_RadialMenuOverlay")
local _ISRadialMenu_instantiate = ISRadialMenu.instantiate
function ISRadialMenu:instantiate()
_ISRadialMenu_instantiate(self)
if not self.spiff then
self.spiff = SUIRadialMenuOverlay:new(self)
end
end
-- Apparently, I am unable to add a child to the RadialMenu. I think its something to do with it being part Java object?
---- So, instead here is a little hack to bring that parent/child relationship
function ISRadialMenu:addToUIManager()
ISUIElement.addToUIManager(self)
if self.spiff then
self.spiff:display()
end
end
function ISRadialMenu:removeFromUIManager()
ISUIElement.removeFromUIManager(self)
self.radText = nil
self.radImg = nil
self.radImgChange = true
if self.spiff then
self.spiff:undisplay()
end
end
@@ -433,6 +496,10 @@ local _ISRadialMenu_new = ISRadialMenu.new
function ISRadialMenu:new(...)
local o = _ISRadialMenu_new(self, ...)
o:makeToolTip()
return o
end
o.radText = nil
o.radImg = nil
o.radImgChange = true
return o
end

View File

@@ -50,7 +50,7 @@ end
function SpiffUIRadialCommand:fillMenu()
if self.texture then
self.rmenu:addSlice("", self.texture, self.invoke, self)
self.rmenu:addSlice(self.text, self.texture, self.invoke, self)
else -- add a blank
self.rmenu:addSlice(nil, nil, nil)
end
@@ -159,14 +159,22 @@ function SpiffUIRadialMenu:show()
end
if count > 0 then
if self.btmText[self.page] then
self.rmenu:setRadialText(self.btmText[self.page])
end
if self.centerImg[self.page] then
self.rmenu:setRadialImage(self.centerImg[self.page])
end
if self.cImgChange[self.page] ~= nil then
self.rmenu:setImgChange(self.cImgChange[self.page])
end
self.rmenu:center()
self:center()
self.rmenu:addToUIManager()
self:addToUIManager()
self.rmenu:setVisible(true)
self:setVisible(true)
self:bringToTop()
self.rmenu.activeMenu = self
SpiffUI.action.wasVisible = true
if JoypadState.players[self.playerNum+1] then
self.rmenu:setHideWhenButtonReleased(Joypad.DPadUp)
@@ -179,113 +187,7 @@ function SpiffUIRadialMenu:show()
end
end
function SpiffUIRadialMenu:center()
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
if self.cmdText then
local cH = getTextManager():getFontHeight(UIFont.Medium)
local cW = getTextManager():MeasureStringX(UIFont.Medium, self.cmdText)
self.cTX = (x - cW / 2)
self.cTY = (y - cH / 2)
self.bTY = (y - cH / 2) + (cH * 2)
end
if self.btmText[self.page] then
local bh = getTextManager():getFontHeight(UIFont.Medium)
local bw = getTextManager():MeasureStringX(UIFont.Medium, self.btmText[self.page])
self.bTX = (x - bw / 2)
self.bTY = (y - bh / 2) + (bh * 2)
end
self.imgH = self.rmenu.innerRadius/2
self.imgW = self.imgH
self.imgX = (x - self.imgW / 2)
self.imgY = (y - self.imgH / 2)
self.cenX = x
self.cenY = y
end
function SpiffUIRadialMenu:render()
local index = -1
-- This is a better way to handle this. :D
if self.cIndex then -- force show
index = -1
elseif JoypadState.players[self.playerNum+1] then
index = self.rmenu.javaObject:getSliceIndexFromJoypad(self.rmenu.joyfocus.id)
else
index = self.rmenu.javaObject:getSliceIndexFromMouse(self.rmenu:getMouseX(), self.rmenu:getMouseY())
end
self.cmdText = nil
self.cmdImg = nil
if index > -1 then
if self.rmenu:getSliceCommand(index+1) and self.rmenu:getSliceCommand(index+1)[2] then
self.cmdText = SpiffUI.textwrap(self.rmenu:getSliceCommand(index+1)[2].text,20)
self.cmdImg = self.rmenu:getSliceCommand(index+1)[2].texture
end
end
self:center()
if index == -1 then
if self.centerImg[self.page] then
self:drawTextureScaledAspect(self.centerImg[self.page], self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
if self.btmText[self.page] then
self:drawText(self.btmText[self.page], self.bTX, self.bTY, 1,1,1,1, UIFont.Medium)
end
else
if self.cImgChange[self.page] then
if self.cmdImg then
self:drawTextureScaledAspect(self.cmdImg, self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
else
if self.centerImg[self.page] then
self:drawTextureScaledAspect(self.centerImg[self.page], self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
end
else
if self.centerImg[self.page] then
self:drawTextureScaledAspect(self.centerImg[self.page], self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
end
if self.cmdText then
if self.centerImg[self.page] or self.cImgChange[self.page] then
-- Draw cmdText at bottom
self:drawText(self.cmdText, self.cTX, self.bTY, 1,1,1,1, UIFont.Medium)
else
if self.btmText[self.page] then
-- Draw btmText
self:drawText(self.btmText[self.page], self.bTX, self.bTY, 1,1,1,1, UIFont.Medium)
end
-- Draw cmdText at middle
self:drawText(self.cmdText, self.cTX, self.cTY, 1,1,1,1, UIFont.Medium)
end
else
if self.btmText[self.page] then
self:drawText(self.btmText[self.page], self.bTX, self.bTY, 1,1,1,1, UIFont.Medium)
end
end
if JoypadState.players[self.playerNum+1] then
self.rmenu:showTooltip(self.rmenu:getSliceTooltipJoyPad())
end
end
end
function SpiffUIRadialMenu:undisplay()
self:removeFromUIManager()
end
function SpiffUIRadialMenu:AddCommand(command)
@@ -322,10 +224,10 @@ function SpiffUIRadialMenu:new(player, prev, centerImg, btmText)
o.prevTex = getTexture("media/spifcons/prevpage.png")
o.centerImg = {
[o.page] = centerImg
[1] = centerImg
}
o.btmText = {
[o.page] = btmText
[1] = btmText
}
o.cmdText = nil

View File

@@ -38,16 +38,16 @@ function SpiffUIAlarmRadialCommand:new(menu, mode, alarm)
local tex
local label = ""
if mode == 1 then
tex = menu.icons["silence"]
tex = menu.aicons["silence"]
label = getText("UI_alarm_SpiffUI_Silence")
elseif mode == 2 then
tex = menu.icons["enable"]
tex = menu.aicons["enable"]
label = getText("UI_alarm_SpiffUI_Enable")
elseif mode == 3 then
tex = alarm:getTexture()
label = getText("UI_alarm_SpiffUI_Reset")
elseif mode == 4 then
tex = menu.icons["stop"]
tex = menu.aicons["stop"]
label = getText("ContextMenu_StopAlarm")
end
local o = spiff.radialcommand.new(self, menu, label, tex, nil)
@@ -64,7 +64,7 @@ function SpiffUIAlarmRadialCommandHour:Action()
end
function SpiffUIAlarmRadialCommandHour:new(menu, hour)
local o = spiff.radialcommand.new(self, menu, "", menu.icons[hour], nil)
local o = spiff.radialcommand.new(self, menu, getText("UI_alarm_SpiffUI_SetHourF", string.format("%02d", hour), getText("UI_alarm_SpiffUI_MM")), menu.aicons[hour], nil)
o.hour = hour
return o
end
@@ -81,14 +81,19 @@ function SpiffUIAlarmRadialCommandMinute:Action()
self.menu:start()
end
function SpiffUIAlarmRadialCommandMinute:new(menu, minute)
local o = spiff.radialcommand.new(self, menu, "", menu.icons[minute], nil)
function SpiffUIAlarmRadialCommandMinute:new(menu, minute, hText)
local o = spiff.radialcommand.new(self, menu, getText("UI_alarm_SpiffUI_SetMinuteF", hText, string.format("%02d", minute)), menu.aicons[minute], nil)
o.minute = minute
return o
end
------------------------------------------
function SpiffUIAlarmRadial:show()
spiff.radialmenu.show(self)
self.rmenu:setClock(self.alarm)
end
function SpiffUIAlarmRadial:start()
self:prepareCmds()
@@ -107,7 +112,6 @@ function SpiffUIAlarmRadial:start()
end
self.btmText[self.page] = getText("UI_alarm_SpiffUI_CurrentF", hText, mText)
self.btmText[self.page] = self.btmText[self.page]:gsub('\\n', '\n')
if self.alarm:isRinging() then
self:AddCommand(SpiffUIAlarmRadialCommand:new(self,4,self.alarm))
@@ -123,7 +127,7 @@ function SpiffUIAlarmRadial:hourRadial()
self:prepareCmds()
self.btmText[self.page] = getText("UI_alarm_SpiffUI_SetHourF", getText("UI_alarm_SpiffUI_HH"), getText("UI_alarm_SpiffUI_MM"))
self.btmText[self.page] = self.btmText[self.page]:gsub('\\n', '\n')
self.cImgChange[self.page] = false
for i = 0, 23 do
table.insert(self.commands[self.page], SpiffUIAlarmRadialCommandHour:new(self, i))
@@ -143,26 +147,15 @@ function SpiffUIAlarmRadial:minuteRadial()
end
self.btmText[self.page] = getText("UI_alarm_SpiffUI_SetMinuteF", hText, getText("UI_alarm_SpiffUI_MM"))
self.btmText[self.page] = self.btmText[self.page]:gsub('\\n', '\n')
self.cImgChange[self.page] = false
for i = 0, 5 do
table.insert(self.commands[self.page], SpiffUIAlarmRadialCommandMinute:new(self, i*10))
table.insert(self.commands[self.page], SpiffUIAlarmRadialCommandMinute:new(self, i*10, hText))
end
self:show()
end
function SpiffUIAlarmRadial:initialise()
if self.init then
-- This is called by "onSetAlarm"
-- We'll just override this to show the radial instead
self:display()
else
ISUIElement.initialise(self)
self.init = true
end
end
function SpiffUIAlarmRadial:new(player, alarm, prev)
local o = spiff.radialmenu.new(self, player, prev)
o.alarm = alarm
@@ -170,7 +163,7 @@ function SpiffUIAlarmRadial:new(player, alarm, prev)
o.minute = o.alarm:getMinute()
-- Alarm icons
o.icons = {
o.aicons = {
[30] = getTexture("media/spifcons/alarm/30.png"),
[40] = getTexture("media/spifcons/alarm/40.png"),
[50] = getTexture("media/spifcons/alarm/50.png"),
@@ -180,15 +173,39 @@ function SpiffUIAlarmRadial:new(player, alarm, prev)
}
-- Do the rest
for i=0,23 do
o.icons[i] = getTexture("media/spifcons/alarm/" .. string.format("%02d", i) .. ".png")
o.aicons[i] = getTexture("media/spifcons/alarm/" .. string.format("%02d", i) .. ".png")
end
o.icons = {
["mid"] = getTexture("media/spifcons/clock/mid.png"),
["silence"] = getTexture("media/ui/ClockAssets/ClockAlarmLargeSet.png"),
["enable"] = getTexture("media/ui/ClockAssets/ClockAlarmLargeSound.png"),
}
for i=0,9 do
o.icons[i] = getTexture(string.format("media/spifcons/clock/%d.png", i))
end
return o
end
-- later when i get the inventory to dismiss/reappear for controllers. i've delayed release enough for now
-- local _ISAlarmClockDialog_new = ISAlarmClockDialog.new
-- function ISAlarmClockDialog:new(x, y, width, height, player, alarm)
-- --return _ISAlarmClockDialog_new(self, x, y, width, height, player, alarm)
-- return SpiffUIAlarmRadial:new(getSpecificPlayer(player), alarm)
-- end
local _ISAlarmClockDialog_new = ISAlarmClockDialog.new
function ISAlarmClockDialog:new(x, y, width, height, player, alarm)
if JoypadState.players[player+1] then
return _ISAlarmClockDialog_new(self, x, y, width, height, player, alarm)
else
return SpiffUIAlarmRadial:new(getSpecificPlayer(player), alarm)
end
end
function SpiffUIAlarmRadial:initialise()
if self.init then
-- This is called again by "onSetAlarm"
-- We'll just override this to show the radial instead
self:display()
else
ISUIElement.initialise(self)
self.init = true
end
end

View File

@@ -99,7 +99,7 @@ local function getItems(packs, player)
-- the only real difference between food and drinks is if there is a custom menu option/animation it seems.
return item:isWaterSource()
or (instanceof(item, "Food") and not player:isKnownPoison(item) and not item:getScriptItem():isCantEat())
and (item:getThirstChange() < 0 and item:getCustomMenuOption() == getText("ContextMenu_Drink"))
and (item:getCustomMenuOption() == getText("ContextMenu_Drink"))
end)
if ps and ps:size() > 0 then
for i = 0, ps:size() - 1 do
@@ -167,7 +167,7 @@ function SpiffUIDrinkRadial:start()
hasCmd = true
end
self.centerImg[self.page] = InventoryItemFactory.CreateItem("Base.WaterBottleFull"):getTexture()
self.btmText[self.page] = getText("UI_SpiffUI_Radial_Drink")
self.btmText[self.page] = "<RGB:1,0,0> "..getText("UI_SpiffUI_Radial_Drink")
self.cImgChange[self.page] = true
end

View File

@@ -344,7 +344,7 @@ function SpiffUIEquipmentRadial:itemOptions(item)
if not item then return end
-- Get Hotbar & loot
local hotbar = getPlayerHotbar(self.player:getPlayerNum())
local hotbar = getPlayerHotbar(self.playerNum)
local loot = getPlayerLoot(self.playerNum)
self.btmText[self.page] = SpiffUI.textwrap(item:getName(), 20) -- some names are just too long :/

View File

@@ -29,244 +29,62 @@ function SpiffUIOneRadialCommand:new(menu, name, texture, mode)
return o
end
local tickWatch = ISUIElement:derive("tickWatch")
-- local tickWatch = ISUIElement:derive("tickWatch")
function tickWatch:render()
local hour = getGameTime():getHour()
minutes = getGameTime():getMinutes()
-- function tickWatch:render()
-- local hour = getGameTime():getHour()
-- minutes = getGameTime():getMinutes()
hour = hour + (minutes/60)
-- hour = hour + (minutes/60)
local endX = self.cenX + ( (self.hrLen) * (math.sin(2 * math.pi * hour / 12 ) ) )
local endY = self.cenY + ( (-self.hrLen) * (math.cos(2 * math.pi * hour / 12 ) ) )
-- local endX = self.cenX + ( (self.hrLen) * (math.sin(2 * math.pi * hour / 12 ) ) )
-- local endY = self.cenY + ( (-self.hrLen) * (math.cos(2 * math.pi * hour / 12 ) ) )
self:drawLine2(self.cenX, self.cenY, endX, endY, 1, 1, 1, 1)
-- self:drawLine2(self.cenX, self.cenY, endX, endY, 1, 1, 1, 1)
endX = self.cenX + ( (self.minLen) * (math.sin(2 * math.pi * minutes / 60 ) ) )
endY = self.cenY + ( (-self.minLen) * (math.cos(2 * math.pi * minutes / 60 ) ) )
-- endX = self.cenX + ( (self.minLen) * (math.sin(2 * math.pi * minutes / 60 ) ) )
-- endY = self.cenY + ( (-self.minLen) * (math.cos(2 * math.pi * minutes / 60 ) ) )
self:drawLine2(self.cenX, self.cenY, endX, endY, 1, 1, 1, 1)
end
-- self:drawLine2(self.cenX, self.cenY, endX, endY, 1, 1, 1, 1)
-- end
function tickWatch:center()
local x = getPlayerScreenLeft(self.playerNum)
local y = getPlayerScreenTop(self.playerNum)
local w = getPlayerScreenWidth(self.playerNum)
local h = getPlayerScreenHeight(self.playerNum)
-- function tickWatch:center()
-- 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
-- x = x + w / 2
-- y = y + h / 2
self:setX(x - self.rad / 2)
self:setY(y - self.rad / 2)
-- self:setX(x - self.rad / 2)
-- self:setY(y - self.rad / 2)
self.cenX = x
self.cenY = y
end
-- self.cenX = x
-- self.cenY = y
-- end
function tickWatch:new(playerNum, radius, clock, menu)
local o = ISUIElement.new(self, 0, 0, radius, radius/3)
o:initialise()
-- function tickWatch:new(playerNum, radius, clock, menu)
-- local o = ISUIElement.new(self, 0, 0, radius, radius/3)
-- o:initialise()
o.clock = clock
o.rad = radius
-- o.clock = clock
-- o.rad = radius
o.playerNum = playerNum
-- o.playerNum = playerNum
o.imgW = o.rad
o.imgH= o.rad
-- o.imgW = o.rad
-- o.imgH= o.rad
o.hrLen = o.rad*0.5
o.minLen = o.rad*0.8
-- o.hrLen = o.rad*0.5
-- o.minLen = o.rad*0.8
self.menu = menu
-- self.menu = menu
o:center()
-- o:center()
return o
end
local timeImg = ISUIElement:derive("timeImg")
function timeImg:render()
local time = getGameTime():getHour()
local h1 = 0
local h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[1], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons[h2], self.X[2], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons["mid"], self.X[3], 0, self.midW, self.imgH, 1,1,1,1)
time = getGameTime():getMinutes()
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[4], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons[h2], self.X[5], 0, self.secW, self.imgH, 1,1,1,1)
end
function timeImg:center()
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
self:setX(x - self.imgW / 2)
self:setY(y - self.rad / 2)
self.cenX = x
self.cenY = y
end
function timeImg:new(playerNum, radius, clock, menu)
local o = ISUIElement.new(self, 0, 0, radius, radius/3)
o:initialise()
o.clock = clock
o.rad = radius
o.playerNum = playerNum
o.imgW = o.rad
o.imgH= o.rad/3
o.secW = o.rad/4
o.midW = o.rad/8
o.X = {
[1] = 0,
[2] = o.secW,
[3] = o.secW + o.secW,
[4] = o.secW + o.secW + o.midW,
[5] = o.secW + o.secW + o.midW + o.secW
}
o.imgW = o.X[5] + o.secW
self.menu = menu
o:center()
return o
end
local dateImg = ISUIElement:derive("dateImg")
local function round(num)
return math.floor(num * 10) / 10;
end
function dateImg:render()
local time = getGameTime():getMonth()+1
local h1 = 0
local h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[1], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons[h2], self.X[2], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons["date"], self.X[3], 0, self.secW, self.imgH, 1,1,1,1)
time = getGameTime():getDay()+1
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[4], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons[h2], self.X[5], 0, self.secW, self.imgH, 1,1,1,1)
-------------------------------------
local temp = round(self.climate:getAirTemperatureForCharacter(self.player))
time = math.floor(temp)
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[6], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons[h2], self.X[7], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons["dot"], self.X[8], 5, self.midW, self.imgH, 1,1,1,1)
h1 = math.floor((temp - time) * 10)
self:drawTextureScaledAspect(self.menu.icons[h1], self.X[9], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(self.menu.icons["C"], self.X[10], 0, self.secW, self.imgH, 1,1,1,1)
end
function dateImg:center()
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
self:setX(x - self.imgW / 2)
self:setY((y - self.rad / 2) + (self.rad * 0.4))
end
function dateImg:new(playerNum, player, radius, clock, menu)
local o = ISUIElement.new(self, 0, 0, radius, radius/3)
o:initialise()
o.clock = clock
o.climate = getClimateManager()
o.rad = radius
o.playerNum = playerNum
o.player = player
o.imgW = o.rad
o.imgH= o.rad/6
o.secW = (o.rad/8)
o.midW = (o.rad/10)
o.X ={
[1] = 0,
[2] = o.secW,
[3] = 2*o.secW,
[4] = 3*o.secW,
[5] = 4*o.secW,
[6] = 6*o.secW,
[7] = 7*o.secW,
[8] = 8*o.secW-2,
[9] = 8*o.secW+(o.midW/2)+2,
[10] = 9*o.secW+(o.midW/2)+2,
}
o.imgW = 10*o.secW+(o.midW/2)
self.menu = menu
o:center()
return o
end
-- return o
-- end
local function getBestClock(player)
local watch = nil
@@ -295,25 +113,31 @@ local function getBestClock(player)
return watch
end
function SpiffUIOneRadial:show()
spiff.radialmenu.show(self)
self.rmenu:setClock(getBestClock(self.player))
end
function SpiffUIOneRadial:start()
self.clock = getBestClock(self.player)
if self.clock then
self.cFace = nil
if spiff.config.experimental and (not self.clock:isDigital() or instanceof(self.clock, "AlarmClock")) then
-- hand clock or non-digital watch
self.cFace = tickWatch:new(self.playerNum, self.rmenu.innerRadius, self.clock, self)
else
self.cFace = timeImg:new(self.playerNum, self.rmenu.innerRadius, self.clock, self)
end
--self.clock =
-- if self.clock then
-- self.cFace = nil
-- if spiff.config.experimental and (not self.clock:isDigital() or instanceof(self.clock, "AlarmClock")) then
-- -- hand clock or non-digital watch
-- self.cFace = tickWatch:new(self.playerNum, self.rmenu.innerRadius, self.clock, self)
-- else
-- self.cFace = timeImg:new(self.playerNum, self.rmenu.innerRadius, self.clock, self)
-- end
self:addChild(self.cFace)
-- show date/temp
if self.clock:isDigital() and instanceof(self.clock, "AlarmClockClothing") then
self.dFace = dateImg:new(self.playerNum, self.player, self.rmenu.innerRadius, self.clock, self)
self:addChild(self.dFace)
end
end
-- self:addChild(self.cFace)
-- -- show date/temp
-- if self.clock:isDigital() and instanceof(self.clock, "AlarmClockClothing") then
-- self.dFace = dateImg:new(self.playerNum, self.player, self.rmenu.innerRadius, self.clock, self)
-- self:addChild(self.dFace)
-- end
-- end
-- Crafting
self:AddCommand(SpiffUIOneRadialCommand:new(self, getText("UI_SpiffUI_Radial_Crafting"), getTexture("media/spifcons/crafting.png"), 0))
@@ -345,7 +169,7 @@ function SpiffUIOneRadial:start()
self:AddCommand(SpiffUIOneRadialCommand:new(self, getText("UI_SpiffUI_Radial_SmokeCraft"), icon, 7))
end
if spiff.config.showSmokingRadial then
if spiff.config.showSmokeRadial then
-- Smoke
self:AddCommand(SpiffUIOneRadialCommand:new(self, getText("UI_SpiffUI_Radial_Smoke"), InventoryItemFactory.CreateItem("Base.Cigarettes"):getTexture(), 8))
end
@@ -359,45 +183,6 @@ function SpiffUIOneRadial:start()
end
end
function SpiffUIOneRadial:render()
local index = -1
if self.cIndex then -- force show
index = -1
elseif JoypadState.players[self.playerNum+1] then
index = self.rmenu.javaObject:getSliceIndexFromJoypad(self.rmenu.joyfocus.id)
else
index = self.rmenu.javaObject:getSliceIndexFromMouse(self.rmenu:getMouseX(), self.rmenu:getMouseY())
end
self.cmdText = nil
if index > -1 then
if self.rmenu:getSliceCommand(index+1) and self.rmenu:getSliceCommand(index+1)[2] then
self.cmdText = SpiffUI.textwrap(self.rmenu:getSliceCommand(index+1)[2].text,20)
end
end
self:center()
if index > -1 then
if self.cmdText then
-- Draw cmdText at bottom
self:drawText(self.cmdText, self.cTX, self.bTY, 1,1,1,1, UIFont.Medium)
end
end
if self.clock and self.clock:isAlarmSet() then
local sz = self.rmenu.innerRadius/3
local y = self.cFace:getY() - (sz*1.15)
local x = self.cenX - sz/2
if self.clock:isRinging() then
self:drawTextureScaledAspect(self.icons["enable"], x, y, sz, sz, 1,1,1,1)
else
self:drawTextureScaledAspect(self.icons["silence"], x, y, sz, sz, 1,1,1,1)
end
end
end
function SpiffUIOneRadial:new(player)
local o = spiff.radialmenu.new(self, player)

View File

@@ -0,0 +1,405 @@
SpiffUI = SpiffUI or {}
-- Register our Radials
local spiff = SpiffUI:Register("radials")
-- RadialMenuOverlay
local SUIRadialMenuOverlay = ISUIElement:derive("SUIRadialMenuOverlay")
local timeImg = ISUIElement:derive("timeImg")
function timeImg:center()
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
self:setX(x - self.imgW / 2)
self:setY(y - self.rad / 2)
self.cenX = x
self.cenY = y
end
function timeImg:render(one)
self:center()
local time = getGameTime():getHour()
local h1 = 0
local h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(one.icons[h1], self.X[1], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons[h2], self.X[2], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons["mid"], self.X[3], 0, self.midW, self.imgH, 1,1,1,1)
time = getGameTime():getMinutes()
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(one.icons[h1], self.X[4], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons[h2], self.X[5], 0, self.secW, self.imgH, 1,1,1,1)
end
function timeImg:new(playerNum, menu)
local o = ISUIElement.new(self, 0, 0, menu.innerRadius, menu.innerRadius/3)
o:initialise()
o:instantiate()
o.playerNum = playerNum
o.menu = menu
o.rad = menu.innerRadius
o.imgW = o.rad
o.imgH= o.rad/3
o.secW = o.rad/4
o.midW = o.rad/8
o.X = {
[1] = 0,
[2] = o.secW,
[3] = o.secW + o.secW,
[4] = o.secW + o.secW + o.midW,
[5] = o.secW + o.secW + o.midW + o.secW
}
o.imgW = o.X[5] + o.secW
return o
end
local dateImg = ISUIElement:derive("dateImg")
local function round(num)
return math.floor(num * 10) / 10;
end
function dateImg:center()
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
self:setX(x - self.imgW / 2)
self:setY((y - self.rad / 2) + (self.rad * 0.4))
end
function dateImg:render(one)
self:center()
local time = getGameTime():getMonth()+1
local h1 = 0
local h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(one.icons[h1], self.X[1], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons[h2], self.X[2], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons["date"], self.X[3], 0, self.secW, self.imgH, 1,1,1,1)
time = getGameTime():getDay()+1
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(one.icons[h1], self.X[4], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons[h2], self.X[5], 0, self.secW, self.imgH, 1,1,1,1)
-------------------------------------
local temp = round(self.climate:getAirTemperatureForCharacter(self.player))
time = math.floor(temp)
h1 = 0
h2 = 0
if time > 9 then
h1 = math.floor(time/10)
end
h2 = time - (h1*10)
self:drawTextureScaledAspect(one.icons[h1], self.X[6], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons[h2], self.X[7], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons["dot"], self.X[8], 5, self.midW, self.imgH, 1,1,1,1)
h1 = math.floor((temp - time) * 10)
self:drawTextureScaledAspect(one.icons[h1], self.X[9], 0, self.secW, self.imgH, 1,1,1,1)
self:drawTextureScaledAspect(one.icons["C"], self.X[10], 0, self.secW, self.imgH, 1,1,1,1)
end
function dateImg:new(playerNum, menu)
local o = ISUIElement.new(self, 0, 0, menu.innerRadius, menu.innerRadius/3)
o:initialise()
o:instantiate()
o.menu = menu
o.climate = getClimateManager()
o.rad = menu.innerRadius
o.playerNum = playerNum
o.player = getSpecificPlayer(o.playerNum)
o.imgW = o.rad
o.imgH= o.rad/6
o.secW = (o.rad/8)
o.midW = (o.rad/10)
o.X ={
[1] = 0,
[2] = o.secW,
[3] = 2*o.secW,
[4] = 3*o.secW,
[5] = 4*o.secW,
[6] = 6*o.secW,
[7] = 7*o.secW,
[8] = 8*o.secW-2,
[9] = 8*o.secW+(o.midW/2)+2,
[10] = 9*o.secW+(o.midW/2)+2,
}
o.imgW = 10*o.secW+(o.midW/2)
return o
end
function SUIRadialMenuOverlay:center()
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
self.imgH = self.rmenu.innerRadius*0.6
self.imgW = self.imgH
self.imgX = (x - self.imgW / 2)
self.imgY = (y - self.imgH / 2) - getTextManager():getFontHeight(UIFont.Medium)
if self.text then
self.textPanel:setWidth(self.rmenu.innerRadius*1.5)
self.textPanel:paginate()
self.textPanel:setX(x - self.textPanel:getWidth()/2)
self.tpY = (y - self.textPanel:getHeight() / 2)
self.btpY = self.imgY + self.imgH + getTextManager():getFontHeight(UIFont.Medium)
else
self.textPanel.lines = nil
end
self.cenX = x
self.cenY = y
end
function SUIRadialMenuOverlay:renderClock()
local clock = self.rmenu:getClock()
local one = self.rmenu.activeMenu
self.cFace:render(one)
if clock:isDigital() and instanceof(clock, "AlarmClockClothing") and not one.alarm then
self.dFace:render(one)
end
if clock:isAlarmSet() then
local sz = self.rmenu.innerRadius/3
local y = self.cFace:getY() - (sz*1.15)
local x = self.cenX - sz/2
if clock:isRinging() then
self:drawTextureScaledAspect(one.icons["enable"], x, y, sz, sz, 1,1,1,1)
else
self:drawTextureScaledAspect(one.icons["silence"], x, y, sz, sz, 1,1,1,1)
end
end
end
function SUIRadialMenuOverlay:render()
if not self.rmenu:isReallyVisible() then
self:setVisible(false)
return
end
local hasClock = false
if self.rmenu:getClock() then
hasClock = true
end
local index = -1
if JoypadState.players[self.playerNum+1] then
index = self.rmenu.javaObject:getSliceIndexFromJoypad(self.rmenu.joyfocus.id)
else
index = self.rmenu.javaObject:getSliceIndexFromMouse(self.rmenu:getMouseX(), self.rmenu:getMouseY())
end
self.cmdText = nil
self.cmdImg = nil
if index > -1 then
local obj = self.rmenu:getSliceText(index+1)
if obj then
self.cmdText = obj
end
obj = self.rmenu:getSliceTexture(index+1)
if obj then
self.cmdImg = obj
end
end
if self.btmText then
self.text = "<CENTRE> "..self.btmText
end
if index > -1 then
if self.cmdText then
self.text = "<CENTRE> "..self.cmdText
elseif self.btmText then
self.text = "<CENTRE> "..self.btmText
else
self.text = " "
end
end
if self.text == "" then
self.text = nil
self.textPanel.text = ""
else
self.textPanel.text = self.text
end
self:center()
if hasClock then
self:renderClock()
end
if index == -1 then
if self.centerImg and not hasClock then
self:drawTextureScaledAspect(self.centerImg, self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
if self.btmText then
self.textPanel:setY(self.btpY)
end
else
if self.cImgChange then
if self.cmdImg then
if not hasClock then
self:drawTextureScaledAspect(self.cmdImg, self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
else
if self.centerImg and not hasClock then
self:drawTextureScaledAspect(self.centerImg, self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
end
else
if self.centerImg and not hasClock then
self:drawTextureScaledAspect(self.centerImg, self.imgX, self.imgY, self.imgW, self.imgH, 1, 1, 1, 1)
end
end
if self.cmdText then
if self.centerImg or self.cmdImg or hasClock then
-- Draw cmdText at bottom
self.textPanel:setY(self.btpY)
else
if self.btmText then
-- Draw btmText
self.textPanel:setY(self.btpY)
end
-- Draw cmdText at middle like default
self.textPanel:setY(self.tpY)
end
else
if self.btmText then
self.textPanel:setY(self.btpY)
end
end
if JoypadState.players[self.playerNum+1] then
self.rmenu:showTooltip(self.rmenu:getSliceTooltipJoyPad())
end
end
self.textPanel:prerender()
self.textPanel:render()
self.text = ""
end
function SUIRadialMenuOverlay:undisplay()
self:removeFromUIManager()
self:setVisible(false)
self.btmText = nil
self.centerImg = nil
self.cImgChange = true
end
function SUIRadialMenuOverlay:display()
self:addToUIManager()
self:setVisible(true)
self:bringToTop()
if self.rmenu.radText then
self.btmText = self.rmenu.radText
--print("Bottom Text!")
end
if self.rmenu.radImg then
self.centerImg = self.rmenu.radImg
--print("centerImg!")
end
if self.rmenu.radImgChange ~= nil then
self.cImgChange = self.rmenu.radImgChange
--print("cImgChange!")
end
end
function SUIRadialMenuOverlay:new(menu)
local o = ISUIElement.new(self, 0,0,0,0)
o.rmenu = menu
o.playerNum = menu.playerNum
o.btmText = nil
o.centerImg = nil
o.cImgChange = true
o.textPanel = ISRichTextPanel:new(0, 0, 0, 0)
o.textPanel.marginLeft = 0
o.textPanel.marginRight = 0
o.textPanel:initialise()
o.textPanel:instantiate()
o.textPanel:noBackground()
o.textPanel.backgroundColor = {r=0, g=0, b=0, a=0.3}
o.textPanel.borderColor = {r=1, g=1, b=1, a=0.1}
o.textPanel.defaultFont = UIFont.Medium
o.cFace = timeImg:new(o.playerNum, o.rmenu)
o.dFace = dateImg:new(o.playerNum, o.rmenu)
return o
end
return SUIRadialMenuOverlay

View File

@@ -402,8 +402,8 @@ local function SpiffUIBoot()
OnApplyMainMenu = apply,
OnApplyInGame = apply
},
showSmokingRadial = {
name = "UI_ModOptions_SpiffUI_showSmokingRadial",
showSmokeRadial = {
name = "UI_ModOptions_SpiffUI_showSmokeRadial",
default = true,
OnApplyMainMenu = apply,
OnApplyInGame = apply

View File

@@ -131,15 +131,13 @@ UI_EN = {
-- These next few include formatting so that the text lines up more or less.
---- EX: Current Alarm
---- HH:MM
-- I can't do this with richtext, and there's only one label (for simplicity) so brute force it is
-- Sorry to all translators for any tweaks or weirdness you may have to do
-- Hour:Minutes or HH:MM if no alarm
UI_alarm_SpiffUI_CurrentF = "Current Alarm \n %1:%2",
UI_alarm_SpiffUI_CurrentF = "Current Alarm <br> %1:%2",
-- HH:MM
UI_alarm_SpiffUI_SetHourF = "SET HOUR \n %1:%2",
UI_alarm_SpiffUI_SetHourF = "SET HOUR <br> %1:%2",
-- Hour:MM
UI_alarm_SpiffUI_SetMinuteF = "SET MINUTE \n %1:%2",
UI_alarm_SpiffUI_SetMinuteF = "SET MINUTE <br> %1:%2",
UI_equip_SpiffUI_FirearmRadial = "Firearm Radial",
@@ -170,5 +168,7 @@ UI_EN = {
UI_ModOptions_SpiffUI_equipShowTransfer = "Show Transfer Action (Equipment)",
UI_ModOptions_SpiffUI_showSmokeCraftRadial = "Show Smoke Craft Radial (SpiffUI)",
UI_ModOptions_SpiffUI_showSmokingRadial = "Show Smoking Radial (SpiffUI)"
UI_ModOptions_SpiffUI_showSmokeRadial = "Show Smoking Radial (SpiffUI)",
UI_SpiffUI_EmoteWheel = "Emotes"
}

View File

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1022 B

View File

Before

Width:  |  Height:  |  Size: 829 B

After

Width:  |  Height:  |  Size: 829 B

View File

Before

Width:  |  Height:  |  Size: 1021 B

After

Width:  |  Height:  |  Size: 1021 B

View File

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 953 B

View File

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 998 B

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 890 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 834 B

View File

Before

Width:  |  Height:  |  Size: 561 B

After

Width:  |  Height:  |  Size: 561 B

View File

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 817 B

View File

Before

Width:  |  Height:  |  Size: 809 B

After

Width:  |  Height:  |  Size: 809 B

View File

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 741 B

View File

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

View File

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 872 B

Some files were not shown because too many files have changed in this diff Show More