Easier than expected, now prost won't show up when equipped

This commit is contained in:
Pao
2023-01-15 12:50:58 +01:00
parent f35c8ca9ca
commit 754478db03
6 changed files with 80 additions and 63 deletions

View File

@@ -28,7 +28,7 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
for i,name in ipairs(protPartNames) do
if modData.TOC[name].is_cut then
if modData.TOC[name].is_prosthesis_equipped then
maxTime = maxTime * modData.TOC[name].prothesis_factor --TODO this is dumb
maxTime = maxTime * modData.TOC[name].prosthesis_factor --TODO this is dumb
else
maxTime = maxTime * 2;
end

View File

@@ -140,16 +140,16 @@ function ISInstallProsthesis:perform()
if self.cloth ~= nil then
if self.bodyPart:getType() == BodyPartType.Hand_R then
modData.TOC.RightHand.is_prosthesis_equipped = true;
modData.TOC.RightHand.prothesis_factor = find_protheseFact_TOC(self.cloth);
modData.TOC.RightHand.prosthesis_factor = find_protheseFact_TOC(self.cloth);
elseif self.bodyPart:getType() == BodyPartType.ForeArm_R then
modData.TOC.RightForearm.is_prosthesis_equipped = true;
modData.TOC.RightForearm.prothesis_factor = find_protheseFact_TOC(self.cloth);
modData.TOC.RightForearm.prosthesis_factor = find_protheseFact_TOC(self.cloth);
elseif self.bodyPart:getType() == BodyPartType.Hand_L then
modData.TOC.LeftHand.is_prosthesis_equipped = true;
modData.TOC.LeftHand.prothesis_factor = find_protheseFact_TOC(self.cloth);
modData.TOC.LeftHand.prosthesis_factor = find_protheseFact_TOC(self.cloth);
elseif self.bodyPart:getType() == BodyPartType.ForeArm_L then
modData.TOC.LeftForearm.is_prosthesis_equipped = true;
modData.TOC.LeftForearm.prothesis_factor = find_protheseFact_TOC(self.cloth);
modData.TOC.LeftForearm.prosthesis_factor = find_protheseFact_TOC(self.cloth);
end
self.character:getInventory():Remove(self.item);

View File

@@ -55,42 +55,47 @@ function ISUninstallProsthesis:perform()
for _, v in ipairs(GetAcceptingProsthesisBodyParts()) do
if self.bodyPart:getType() == v then
local part_name = FindTocBodyPartNameFromBodyPartType(v)
if self.bodyPart:getType() == BodyPartType.Hand_R then
toc_data.RightHand.is_prosthesis_equipped = false
toc_data.RightHand.prothesis_factor = 1
elseif self.bodyPart:getType() == BodyPartType.ForeArm_R then
toc_data.RightForearm.is_prosthesis_equipped = false
toc_data.RightForearm.prothesis_factor = 1
elseif self.bodyPart:getType() == BodyPartType.Hand_L then
toc_data.LeftHand.is_prosthesis_equipped = false
toc_data.LeftHand.prothesis_factor = 1
elseif self.bodyPart:getType() == BodyPartType.ForeArm_L then
toc_data.LeftForearm.is_prosthesis_equipped = false
toc_data.LeftForearm.prothesis_factor = 1
if part_name then
toc_data[part_name].is_prosthesis_equipped = false
toc_data[part_name].prosthesis_factor = 1
local side = string.gsub(part_name, "Hand" or "Forearm", "")
local prosthesis_list = {"TOC.WoodenHook", "TOC.MetalHook", "TOC.MetalHand"}
for _, prost_v in ipairs(prosthesis_list) do
local prosthesis_name = string.match(self.item:getName(), prost_v)
if prosthesis_name then
self.character:getInventory():AddItem(prosthesis_name)
self.character:setWornItem(self.item:getBodyLocation(), nil)
self.character:getInventory():Remove(self.item)
self.character:transmitModData()
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self)
end
end
end
end
end
local weight = math.floor(self.item:getWeight() * 10 + 0.5)
if weight == 10 then
self.character:getInventory():AddItem("TOC.WoodenHook")
elseif weight == 5 then
self.character:getInventory():AddItem("TOC.MetalHook")
elseif weight == 3 then
self.character:getInventory():AddItem("TOC.MetalHand")
elseif weight == 20 then
self.character:getInventory():AddItem("TOC.WoodenHook")
elseif weight == 15 then
self.character:getInventory():AddItem("TOC.MetalHook")
elseif weight == 12 then
self.character:getInventory():AddItem("TOC.MetalHand")
end
self.character:setWornItem(self.item:getBodyLocation(), nil)
self.character:getInventory():Remove(self.item)
self.character:transmitModData()
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self);
end
function ISUninstallProsthesis:new(character, item, bodyPart)