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

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