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