Finished renaming files
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
---Equip a prosthesis transforming a normal item into a clothing item
|
---Equip a prosthesis transforming a normal item into a clothing item
|
||||||
---@param partName string
|
---@param partName string
|
||||||
---@param prosthesisItem any the prosthesis item
|
---@param prosthesisItem any the prosthesis item
|
||||||
---@param prosthesisBaseName string
|
---@param prosthesisBaseName string I don't really remember
|
||||||
function JCIO.EquipProsthesis(partName, prosthesisItem, prosthesisBaseName)
|
function JCIO.EquipProsthesis(partName, prosthesisItem, prosthesisBaseName)
|
||||||
|
|
||||||
-- TODO probably will have to move this from the TOC menu to classic equip to have dynamic durability
|
-- TODO probably will have to move this from the TOC menu to classic equip to have dynamic durability
|
||||||
|
|||||||
@@ -251,3 +251,27 @@ function JCIO_Common.CheckIfProsthesisAlreadyInstalled(limbsData, partName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function JCIO_Common.GetCanBeHeldTable(limbs_data)
|
||||||
|
|
||||||
|
local canBeHeld = {}
|
||||||
|
|
||||||
|
for _, side in pairs(JCIO.sideNames) do
|
||||||
|
canBeHeld[side] = true
|
||||||
|
|
||||||
|
if limbs_data[side .. "_Hand"].isCut then
|
||||||
|
if limbs_data[side .. "_LowerArm"].isCut then
|
||||||
|
if not limbs_data[side .. "_LowerArm"].isProsthesisEquipped then
|
||||||
|
canBeHeld[side] = false
|
||||||
|
end
|
||||||
|
elseif not limbs_data[side .. "_Hand"].isProsthesisEquipped then
|
||||||
|
canBeHeld[side] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return canBeHeld
|
||||||
|
|
||||||
|
end
|
||||||
|
-------------------------------
|
||||||
@@ -67,29 +67,3 @@ function TocFindAmputationOrProsthesisName(part_name, player, choice)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------
|
|
||||||
-- Override and mod compat helper
|
|
||||||
function TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
|
||||||
|
|
||||||
for _, side in pairs(JCIO.sideNames) do
|
|
||||||
can_be_held[side] = true
|
|
||||||
|
|
||||||
if limbs_data[side .. "_Hand"].isCut then
|
|
||||||
if limbs_data[side .. "_LowerArm"].isCut then
|
|
||||||
if not limbs_data[side .. "_LowerArm"].isProsthesisEquipped then
|
|
||||||
can_be_held[side] = false
|
|
||||||
end
|
|
||||||
elseif not limbs_data[side .. "_Hand"].isProsthesisEquipped then
|
|
||||||
can_be_held[side] = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
---------------------------------
|
------------------------------------------
|
||||||
-- Compatibility for various mods
|
------------- JUST CUT IT OFF ------------
|
||||||
---------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
-- Compatibility for various mods
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
local function SetCompatibilityFancyHandwork()
|
local function SetCompatibilityFancyHandwork()
|
||||||
@@ -12,13 +16,10 @@ local function SetCompatibilityFancyHandwork()
|
|||||||
local secondary = self.chr:getSecondaryHandItem()
|
local secondary = self.chr:getSecondaryHandItem()
|
||||||
local equip = true
|
local equip = true
|
||||||
|
|
||||||
local limbs_data = getPlayer():getModData().TOC.Limbs
|
local limbsData = getPlayer():getModData().JCIO.limbs
|
||||||
local can_be_held = {}
|
local canBeHeld = JCIO_Common.GetCanBeHeldTable(limbsData)
|
||||||
|
|
||||||
-- TODO not totally realiable
|
|
||||||
TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- If we already have the item equipped
|
-- If we already have the item equipped
|
||||||
if (primary and primary == item) or (secondary and secondary == item) then
|
if (primary and primary == item) or (secondary and secondary == item) then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, item, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, item, 20))
|
||||||
@@ -36,25 +37,25 @@ local function SetCompatibilityFancyHandwork()
|
|||||||
if mod then
|
if mod then
|
||||||
--print("JCIO: Fancy Handwork modifier")
|
--print("JCIO: Fancy Handwork modifier")
|
||||||
-- If we still have something equipped in secondary, unequip
|
-- If we still have something equipped in secondary, unequip
|
||||||
if secondary and equip and can_be_held["Left"] then
|
if secondary and equip and canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_be_held["Left"] then
|
if canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
||||||
elseif can_be_held["Right"] then
|
elseif canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- If we still have something equipped in primary, unequip
|
-- If we still have something equipped in primary, unequip
|
||||||
if primary and equip and can_be_held["Right"] then
|
if primary and equip and canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 20))
|
||||||
end
|
end
|
||||||
-- Equip Primary
|
-- Equip Primary
|
||||||
if can_be_held["Right"] then
|
if canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
||||||
elseif can_be_held["Left"] then
|
elseif canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -69,10 +70,10 @@ local function SetCompatibilityFancyHandwork()
|
|||||||
|
|
||||||
|
|
||||||
function FHSwapHandsAction:isValid()
|
function FHSwapHandsAction:isValid()
|
||||||
local limbs_data = getPlayer():getModData().TOC.Limbs
|
local limbsData = getPlayer():getModData().JCIO.limbs
|
||||||
local can_be_held = {}
|
local canBeHeld = JCIO_Common.GetCanBeHeldTable(limbsData)
|
||||||
TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
|
||||||
return (can_be_held["Right"] and can_be_held["Left"]) and(((self.character:getPrimaryHandItem() or self.character:getSecondaryHandItem()) ~= nil))
|
return (canBeHeld["Right"] and canBeHeld["Left"]) and(((self.character:getPrimaryHandItem() or self.character:getSecondaryHandItem()) ~= nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -88,12 +89,8 @@ local function SetCompatibilityFancyHandWorkAndSwapIt()
|
|||||||
local secondary = self.chr:getSecondaryHandItem()
|
local secondary = self.chr:getSecondaryHandItem()
|
||||||
local equip = true
|
local equip = true
|
||||||
|
|
||||||
local limbs_data = getPlayer():getModData().TOC.Limbs
|
local limbsData = getPlayer():getModData().JCIO.limbs
|
||||||
local can_be_held = {}
|
local canBeHeld = JCIO_Common.GetCanBeHeldTable(limbsData)
|
||||||
|
|
||||||
-- TODO not totally realiable
|
|
||||||
TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
|
||||||
|
|
||||||
|
|
||||||
-- If we already have the item equipped
|
-- If we already have the item equipped
|
||||||
if (primary and primary == item) or (secondary and secondary == item) then
|
if (primary and primary == item) or (secondary and secondary == item) then
|
||||||
@@ -112,25 +109,25 @@ local function SetCompatibilityFancyHandWorkAndSwapIt()
|
|||||||
if mod then
|
if mod then
|
||||||
--print("JCIO: Fancy Handwork modifier")
|
--print("JCIO: Fancy Handwork modifier")
|
||||||
-- If we still have something equipped in secondary, unequip
|
-- If we still have something equipped in secondary, unequip
|
||||||
if secondary and equip and can_be_held["Left"] then
|
if secondary and equip and canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_be_held["Left"] then
|
if canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
||||||
elseif can_be_held["Right"] then
|
elseif canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- If we still have something equipped in primary, unequip
|
-- If we still have something equipped in primary, unequip
|
||||||
if primary and equip and can_be_held["Right"] then
|
if primary and equip and canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, primary, 20))
|
||||||
end
|
end
|
||||||
-- Equip Primary
|
-- Equip Primary
|
||||||
if can_be_held["Right"] then
|
if canBeHeld["Right"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, true, item:isTwoHandWeapon()))
|
||||||
elseif can_be_held["Left"] then
|
elseif canBeHeld["Left"] then
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(self.chr, item, 20, false, item:isTwoHandWeapon()))
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -159,13 +156,12 @@ end
|
|||||||
--------------------------------------------------------
|
--------------------------------------------------------
|
||||||
|
|
||||||
local function CheckModCompatibility()
|
local function CheckModCompatibility()
|
||||||
local activated_mods = getActivatedMods()
|
local activatedMods = getActivatedMods()
|
||||||
print("JCIO: Checking mods")
|
print("JCIO: Checking mods")
|
||||||
|
|
||||||
|
if activatedMods:contains("FancyHandwork") then
|
||||||
|
|
||||||
if activated_mods:contains("FancyHandwork") then
|
if activatedMods:contains("SwapIt") then
|
||||||
|
|
||||||
if activated_mods:contains("SwapIt") then
|
|
||||||
require "SwapIt Main"
|
require "SwapIt Main"
|
||||||
print("JCIO: Overriding FancyHandwork and SwapIt methods")
|
print("JCIO: Overriding FancyHandwork and SwapIt methods")
|
||||||
SetCompatibilityFancyHandWorkAndSwapIt()
|
SetCompatibilityFancyHandWorkAndSwapIt()
|
||||||
@@ -125,7 +125,7 @@ function ISEquipWeaponAction:perform()
|
|||||||
og_ISEquipWeaponActionPerform(self)
|
og_ISEquipWeaponActionPerform(self)
|
||||||
local limbs_data = self.character:getModData().TOC.Limbs
|
local limbs_data = self.character:getModData().TOC.Limbs
|
||||||
local can_be_held = {}
|
local can_be_held = {}
|
||||||
TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
JCIO_Common.GetCanBeHeldTable(can_be_held, limbs_data)
|
||||||
|
|
||||||
if not self.item:isRequiresEquippedBothHands() then
|
if not self.item:isRequiresEquippedBothHands() then
|
||||||
if can_be_held["Right"] and not can_be_held["Left"] then
|
if can_be_held["Right"] and not can_be_held["Left"] then
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
------------------------------------------
|
------------------------------------------
|
||||||
-------- JUST CUT IT OFF --------
|
------------- JUST CUT IT OFF ------------
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
------------ CLIENT COMMANDS -------------
|
------------- SERVER COMMANDS ------------
|
||||||
|
|
||||||
local ServerCommands = {}
|
local ServerCommands = {}
|
||||||
|
|
||||||
@@ -30,7 +30,6 @@ ServerCommands.CanCutLimb = function(arg)
|
|||||||
arg["toSend"] = { part_name, "Cut", JCIO_Common.CheckIfCanBeCut(part_name) }
|
arg["toSend"] = { part_name, "Cut", JCIO_Common.CheckIfCanBeCut(part_name) }
|
||||||
sendClientCommand("JCIO", "SendServer", arg)
|
sendClientCommand("JCIO", "SendServer", arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
ServerCommands.CutLimb = function(arg)
|
ServerCommands.CutLimb = function(arg)
|
||||||
local data = arg["toSend"]
|
local data = arg["toSend"]
|
||||||
|
|
||||||
@@ -44,7 +43,6 @@ ServerCommands.CutLimb = function(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ServerCommands.CanOperateLimb = function(arg)
|
ServerCommands.CanOperateLimb = function(arg)
|
||||||
local part_name = arg["toSend"]
|
local part_name = arg["toSend"]
|
||||||
|
|
||||||
@@ -57,7 +55,12 @@ end
|
|||||||
ServerCommands.OperateLimb = function(arg)
|
ServerCommands.OperateLimb = function(arg)
|
||||||
|
|
||||||
local data = arg["toSend"]
|
local data = arg["toSend"]
|
||||||
JCIO.OperateLimb(data[1], data[2], data[3])
|
|
||||||
|
local partName = data[1]
|
||||||
|
local surgeonFactor = data[2]
|
||||||
|
local useOven = data[3]
|
||||||
|
|
||||||
|
JCIO.OperateLimb(partName, surgeonFactor, useOven)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +82,11 @@ ServerCommands.EquipProsthesis = function(arg)
|
|||||||
-- prosthesis_name = arg[3]
|
-- prosthesis_name = arg[3]
|
||||||
|
|
||||||
local data = arg["toSend"]
|
local data = arg["toSend"]
|
||||||
JCIO.EquipProsthesis(data[1], data[2], data[3])
|
|
||||||
|
local partName = data[1]
|
||||||
|
local prosthesisItem = data[2]
|
||||||
|
|
||||||
|
JCIO.EquipProsthesis(partName, prosthesisItem, _) -- TODO Add the third param
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -93,16 +100,17 @@ ServerCommands.CanUnequipProsthesis = function(arg)
|
|||||||
sendClientCommand("JCIO", "SendServer", arg)
|
sendClientCommand("JCIO", "SendServer", arg)
|
||||||
end
|
end
|
||||||
ServerCommands.UnequipProsthesis = function(arg)
|
ServerCommands.UnequipProsthesis = function(arg)
|
||||||
|
|
||||||
-- part_name = arg[1]
|
|
||||||
|
|
||||||
local data = arg["toSend"]
|
local data = arg["toSend"]
|
||||||
TheOnlyCure.TocUnequipProsthesis(data[1], data[2])
|
|
||||||
|
local patient = data[1]
|
||||||
|
local partName = data[2]
|
||||||
|
local equippedProsthesis = data[3]
|
||||||
|
|
||||||
|
JCIO.UnequipProsthesis(patient, partName, equippedProsthesis)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ServerCommands.CanResetEverything = function(arg)
|
ServerCommands.CanResetEverything = function(arg)
|
||||||
local part_name = "RightHand" --useless
|
local part_name = "RightHand" --useless
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
------------------------------------------
|
||||||
|
------------- JUST CUT IT OFF ------------
|
||||||
|
------------------------------------------
|
||||||
|
------------- UPDATE EVENTS --------------
|
||||||
|
|
||||||
|
|
||||||
require "TOC_Init"
|
require "TOC_Init"
|
||||||
|
|
||||||
local function CheckIfPlayerIsInfected(player, limbsData)
|
local function CheckIfPlayerIsInfected(player, limbsData)
|
||||||
@@ -48,7 +54,6 @@ local function ManagePhantomPain(player, limbsData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function SetHealthStatusForBodyPart(partData, partName, player)
|
local function SetHealthStatusForBodyPart(partData, partName, player)
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +142,6 @@ local function SetHealthStatusForBodyPart(partData, partName, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function UpdatePlayerHealth(player, partData)
|
local function UpdatePlayerHealth(player, partData)
|
||||||
local bodyDamage = player:getBodyDamage()
|
local bodyDamage = player:getBodyDamage()
|
||||||
|
|
||||||
@@ -235,7 +239,7 @@ JCIO.UpdateEveryOneMinute = function()
|
|||||||
if jcioModData ~= nil then
|
if jcioModData ~= nil then
|
||||||
-- FIXME Send little packets instead of the whole thing?
|
-- FIXME Send little packets instead of the whole thing?
|
||||||
-- TODO we shouldn't run this if we're in SP I guess?
|
-- TODO we shouldn't run this if we're in SP I guess?
|
||||||
sendClientCommand(player, 'TOC', 'ChangePlayerState', { jcioModData.limbs } )
|
sendClientCommand(player, 'JCIO', 'ChangePlayerState', { jcioModData.limbs } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ function JCIO_UninstallProsthesisAction:perform()
|
|||||||
|
|
||||||
SendUnequipProsthesis(self.patient, self.partName, self.item)
|
SendUnequipProsthesis(self.patient, self.partName, self.item)
|
||||||
else
|
else
|
||||||
TheOnlyCure.TocUnequipProsthesis(self.patient, self.partName, self.item)
|
JCIO.OperateLimb(self.patient, self.partName, self.item)
|
||||||
end
|
end
|
||||||
|
|
||||||
ISBaseTimedAction.perform(self)
|
ISBaseTimedAction.perform(self)
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
------------------------------------------
|
||||||
|
------------- JUST CUT IT OFF ------------
|
||||||
|
------------------------------------------
|
||||||
|
------------- CLIENT COMMANDS ------------
|
||||||
|
|
||||||
local ClientCommands = {}
|
local ClientCommands = {}
|
||||||
|
|
||||||
@@ -31,7 +34,7 @@ ClientCommands.AskStopAmputationSound = function(_, args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Animations
|
-- Animations
|
||||||
ClientCommands.NotifyNewCrawlAnimation = function(player, args)
|
ClientCommands.NotifyNewCrawlAnimation = function(_, args)
|
||||||
|
|
||||||
sendServerCommand("JCIO", "SetCrawlAnimation", {id = args.id, check = args.check})
|
sendServerCommand("JCIO", "SetCrawlAnimation", {id = args.id, check = args.check})
|
||||||
|
|
||||||
@@ -42,8 +45,8 @@ end
|
|||||||
|
|
||||||
-- Cheats
|
-- Cheats
|
||||||
ClientCommands.AskToResetEverything = function(_, arg)
|
ClientCommands.AskToResetEverything = function(_, arg)
|
||||||
local clicked_player = getPlayerByOnlineID(arg[1])
|
local clickedPlayer = getPlayerByOnlineID(arg[1])
|
||||||
sendServerCommand(clicked_player, "JCIO", "ResetEverything", {})
|
sendServerCommand(clickedPlayer, "JCIO", "ResetEverything", {})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -56,17 +59,17 @@ end
|
|||||||
|
|
||||||
------ Global Mod Data -----------
|
------ Global Mod Data -----------
|
||||||
|
|
||||||
function TOC_OnInitGlobalModData()
|
local function OnInitGlobalModData()
|
||||||
ModData.getOrCreate("JCIO_PLAYER_DATA")
|
ModData.getOrCreate("JCIO_PLAYER_DATA")
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.OnInitGlobalModData.Add(TOC_OnInitGlobalModData)
|
Events.OnInitGlobalModData.Add(OnInitGlobalModData)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
|
||||||
local function OnClientCommand(module, command, playerObj, args)
|
local function OnClientCommand(module, command, playerObj, args)
|
||||||
if module == 'TOC' and ClientCommands[command] then
|
if module == 'JCIO' and ClientCommands[command] then
|
||||||
ClientCommands[command](playerObj, args)
|
ClientCommands[command](playerObj, args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user