Added explicit support to LIR
This commit is contained in:
@@ -2,7 +2,14 @@
|
|||||||
-- Compatibility for various mods
|
-- Compatibility for various mods
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
local function OverrideFancyHandwork()
|
TOC_ModTable = {
|
||||||
|
FancyHandwork = false,
|
||||||
|
LeftIsRight = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function SetCompatibilityFancyHandwork()
|
||||||
if getActivatedMods():contains('FancyHandwork') == false then return end
|
if getActivatedMods():contains('FancyHandwork') == false then return end
|
||||||
require "TimedActions/FHSwapHandsAction"
|
require "TimedActions/FHSwapHandsAction"
|
||||||
|
|
||||||
@@ -43,7 +50,7 @@ local function OverrideFancyHandwork()
|
|||||||
equip = false
|
equip = false
|
||||||
end
|
end
|
||||||
if mod then
|
if mod then
|
||||||
print("TOC: Fancy Handwork modifier")
|
--print("TOC: 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 can_be_held["Left"] then
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
|
||||||
@@ -86,4 +93,14 @@ local function OverrideFancyHandwork()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.OnGameStart.Add(OverrideFancyHandwork)
|
local function SetCompatibilityLeftIsRight()
|
||||||
|
if getActivatedMods():contains('LeftIsRight') == false then return end
|
||||||
|
|
||||||
|
-- This check is needed since we're gonna add a little check in adjustMaxTime
|
||||||
|
-- to prevent problems with maxTime scaling
|
||||||
|
TOC_ModTable.LeftIsRight = true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Events.OnGameStart.Add(SetCompatibilityFancyHandwork)
|
||||||
|
Events.OnGameStart.Add(SetCompatibilityLeftIsRight)
|
||||||
|
|||||||
@@ -3,52 +3,53 @@ require "TimedActions/ISEquipWeaponAction"
|
|||||||
require "TimedActions/ISUnequipAction"
|
require "TimedActions/ISUnequipAction"
|
||||||
require "ISUI/ISInventoryPaneContextMenu"
|
require "ISUI/ISInventoryPaneContextMenu"
|
||||||
|
|
||||||
local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
|
local og_ISBaseTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
|
||||||
|
|
||||||
|
|
||||||
function ISBaseTimedAction:adjustMaxTime(maxTime)
|
function ISBaseTimedAction:adjustMaxTime(maxTime)
|
||||||
|
|
||||||
-- TODO Make the malus for time a little less awful and add some other malus, like fitness and stuff
|
local original_max_time = og_ISBaseTimedActionAdjustMaxTime(self, maxTime)
|
||||||
|
|
||||||
--print("TOC: Input max time " .. tostring(maxTime))
|
|
||||||
local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime)
|
|
||||||
|
|
||||||
--print("TOC: Return original max time: " .. tostring(original_max_time))
|
|
||||||
|
|
||||||
if original_max_time ~= -1 then
|
if original_max_time ~= -1 then
|
||||||
|
local mod_data = getPlayer():getModData()
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
-- MOD SUPPORT ACTIONS
|
||||||
|
----------------------
|
||||||
|
-- LIR
|
||||||
|
|
||||||
|
if TOC_ModTable.LeftIsRight then
|
||||||
|
|
||||||
|
if mod_data.LIR.is_attacking then
|
||||||
|
-- TODO we need to check if we're doing that specific action
|
||||||
|
return original_max_time
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
local limbs_data = mod_data.TOC.Limbs
|
||||||
local modified_max_time = original_max_time
|
local modified_max_time = original_max_time
|
||||||
|
local burn_factor = 1.3 -- TODO Move this crap
|
||||||
|
|
||||||
local part_data = getPlayer():getModData().TOC.Limbs
|
for _, part_name in pairs(GetBodyParts()) do
|
||||||
local burn_factor = 1.3
|
if limbs_data[part_name].is_cut then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- if it's -1, it should be instant.
|
|
||||||
|
|
||||||
|
|
||||||
-- To make it faster, let's have everything already written in another func
|
|
||||||
local all_body_parts = GetBodyParts()
|
|
||||||
|
|
||||||
|
|
||||||
-- TODO this gets awfully slow really quick, doesn't even make much sense.
|
|
||||||
for _, part_name in ipairs(all_body_parts) do
|
|
||||||
|
|
||||||
if part_data[part_name].is_cut then
|
|
||||||
|
|
||||||
if part_data[part_name].is_prosthesis_equipped then
|
|
||||||
modified_max_time = modified_max_time * part_data[part_name].equipped_prosthesis.prosthesis_factor
|
|
||||||
|
|
||||||
|
|
||||||
|
--Equipped prosthesis or not
|
||||||
|
if limbs_data[part_name].is_prosthesis_equipped then
|
||||||
|
modified_max_time = modified_max_time * limbs_data[part_name].equipped_prosthesis.prosthesis_factor
|
||||||
else
|
else
|
||||||
modified_max_time = modified_max_time * 1.5 -- TODO make this lower
|
-- TODO this should depend on the limb?
|
||||||
|
modified_max_time = modified_max_time * 1.5
|
||||||
end
|
end
|
||||||
if part_data[part_name].is_cauterized then
|
|
||||||
|
-- Cauterization check
|
||||||
|
if limbs_data[part_name].is_cauterized then
|
||||||
modified_max_time = modified_max_time * burn_factor
|
modified_max_time = modified_max_time * burn_factor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Perk scaling
|
-- Perk scaling
|
||||||
if part_name == "Right_Hand" or part_name == "Left_Hand" then
|
if part_name == "Right_Hand" or part_name == "Left_Hand" then
|
||||||
modified_max_time = modified_max_time *
|
modified_max_time = modified_max_time *
|
||||||
@@ -57,20 +58,17 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end
|
if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end
|
||||||
|
|
||||||
|
|
||||||
--print("TOC: Modified Max Time " .. modified_max_time)
|
|
||||||
|
|
||||||
return modified_max_time
|
return modified_max_time
|
||||||
else
|
|
||||||
return original_max_time
|
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return original_max_time
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
-- Block access to drag, picking, inspecting, etc to amputated limbs
|
-- Block access to drag, picking, inspecting, etc to amputated limbs
|
||||||
local og_ISInventoryPaneOnMouseDoubleClick = ISInventoryPane.onMouseDoubleClick
|
local og_ISInventoryPaneOnMouseDoubleClick = ISInventoryPane.onMouseDoubleClick
|
||||||
@@ -81,7 +79,7 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
|
|||||||
if instanceof(item_to_check, "InventoryItem") then
|
if instanceof(item_to_check, "InventoryItem") then
|
||||||
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
||||||
elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then
|
elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then
|
||||||
print("TOC: Can't double click this item")
|
--print("TOC: Can't double click this item")
|
||||||
else
|
else
|
||||||
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ ISInventoryPaneContextMenu.onInspectClothing = function(playerObj, cloth
|
|||||||
-- Inspect menu bypasses getActualItems, so we need to add that workaround here too
|
-- Inspect menu bypasses getActualItems, so we need to add that workaround here too
|
||||||
local clothing_full_type = clothing:getFullType()
|
local clothing_full_type = clothing:getFullType()
|
||||||
if CheckIfItemIsAmputatedLimb(clothing) or CheckIfItemIsInstalledProsthesis(clothing) then
|
if CheckIfItemIsAmputatedLimb(clothing) or CheckIfItemIsInstalledProsthesis(clothing) then
|
||||||
print("TOC: Can't inspect this!")
|
--print("TOC: Can't inspect this!")
|
||||||
else
|
else
|
||||||
og_ISInventoryPaneContextMenuOnInspectClothing(playerObj, clothing)
|
og_ISInventoryPaneContextMenuOnInspectClothing(playerObj, clothing)
|
||||||
|
|
||||||
|
|||||||
@@ -220,9 +220,9 @@ local function TocUpdateEveryTenMinutes()
|
|||||||
|
|
||||||
local modifier = SandboxVars.TOC.CicatrizationSpeedMultiplier - item_bloodyness - item_dirtyness
|
local modifier = SandboxVars.TOC.CicatrizationSpeedMultiplier - item_bloodyness - item_dirtyness
|
||||||
|
|
||||||
print("TOC: Type " .. amputated_limb_item:getFullType())
|
--print("TOC: Type " .. amputated_limb_item:getFullType())
|
||||||
print("TOC: Dirtyness " .. item_dirtyness)
|
--print("TOC: Dirtyness " .. item_dirtyness)
|
||||||
print("TOC: Bloodyness " .. item_bloodyness)
|
--print("TOC: Bloodyness " .. item_bloodyness)
|
||||||
|
|
||||||
|
|
||||||
part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - modifier
|
part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - modifier
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function TocSetCorrectTextureForAmputation(item, player, cicatrized)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print("TOC: Setting texture " .. matched_index)
|
--print("TOC: Setting texture " .. matched_index)
|
||||||
item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- it counts from 0, so we have to subtract 1
|
item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- it counts from 0, so we have to subtract 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ function TocSetBloodOnAmputation(player, body_part)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
print("TOC: Adding blood based on " .. tostring(body_part_type))
|
--print("TOC: Adding blood based on " .. tostring(body_part_type))
|
||||||
|
|
||||||
player:addBlood(blood_body_part_type, false, true, false)
|
player:addBlood(blood_body_part_type, false, true, false)
|
||||||
player:addBlood(BloodBodyPartType.Torso_Lower, false, true, false)
|
player:addBlood(BloodBodyPartType.Torso_Lower, false, true, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user