Fixed some errors from the last refactor
This commit is contained in:
@@ -44,12 +44,12 @@ function SendEquipProsthesis(player, part_name, prosthesis_base_name)
|
|||||||
sendClientCommand("TOC", "SendServer", arg)
|
sendClientCommand("TOC", "SendServer", arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SendUnequipProsthesis(player, part_name)
|
function SendUnequipProsthesis(player, part_name, item)
|
||||||
local arg = {}
|
local arg = {}
|
||||||
arg["From"] = getPlayer():getOnlineID()
|
arg["From"] = getPlayer():getOnlineID()
|
||||||
arg["To"] = player:getOnlineID()
|
arg["To"] = player:getOnlineID()
|
||||||
arg["command"] = "UnequipProsthesis"
|
arg["command"] = "UnequipProsthesis"
|
||||||
arg["toSend"] = { player, part_name}
|
arg["toSend"] = { player, part_name, item}
|
||||||
sendClientCommand("TOC", "SendServer", arg)
|
sendClientCommand("TOC", "SendServer", arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ function TocFindCorrectClothingProsthesis(item_name, part_name)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function TocGetAmputationItemInInventory(player, part_name)
|
function TocGetAmputationItemInInventory(player, part_name)
|
||||||
|
|
||||||
local player_inventory = player:getInventory()
|
local player_inventory = player:getInventory()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function TocResetEverything()
|
|||||||
|
|
||||||
-- Destroy the amputation or prosthesis item
|
-- Destroy the amputation or prosthesis item
|
||||||
for _, v in ipairs(GetBodyParts()) do
|
for _, v in ipairs(GetBodyParts()) do
|
||||||
-- TODO This is incredibly shitty
|
-- TODO This is incredibly shitty, but we can't use worn items since we need to consider the case that the item wasn't applied
|
||||||
local amputation_item_name = TocFindAmputationOrProsthesisName(v, player, "Amputation")
|
local amputation_item_name = TocFindAmputationOrProsthesisName(v, player, "Amputation")
|
||||||
local prosthesis_item_name = TocFindAmputationOrProsthesisName(v, player, "Prosthesis")
|
local prosthesis_item_name = TocFindAmputationOrProsthesisName(v, player, "Prosthesis")
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
|
-- TODO this needs to be moved away
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TocGetKitInInventory(surgeon)
|
function TocGetKitInInventory(surgeon)
|
||||||
local playerInv = surgeon:getInventory();
|
local playerInv = surgeon:getInventory();
|
||||||
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or
|
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or
|
||||||
@@ -17,7 +9,7 @@ end
|
|||||||
|
|
||||||
-- Unequip Prosthesis
|
-- Unequip Prosthesis
|
||||||
|
|
||||||
local function PartNameToBodyLocationProsthesis(name)
|
function PartNameToBodyLocationProsthesis(name)
|
||||||
if name == "Right_Hand" then return "TOC_ArmRightProsthesis" end
|
if name == "Right_Hand" then return "TOC_ArmRightProsthesis" end
|
||||||
if name == "Right_LowerArm" then return "TOC_ArmRightProsthesis" end
|
if name == "Right_LowerArm" then return "TOC_ArmRightProsthesis" end
|
||||||
if name == "Right_UpperArm" then return "TOC_ArmRightProsthesis" end
|
if name == "Right_UpperArm" then return "TOC_ArmRightProsthesis" end
|
||||||
@@ -26,7 +18,7 @@ local function PartNameToBodyLocationProsthesis(name)
|
|||||||
if name == "Left_UpperArm" then return "TOC_ArmLeftProsthesis" end
|
if name == "Left_UpperArm" then return "TOC_ArmLeftProsthesis" end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function PartNameToBodyLocationAmputation(name)
|
function PartNameToBodyLocationAmputation(name)
|
||||||
if name == "Right_Hand" then return "TOC_ArmRight" end
|
if name == "Right_Hand" then return "TOC_ArmRight" end
|
||||||
if name == "Right_LowerArm" then return "TOC_ArmRight" end
|
if name == "Right_LowerArm" then return "TOC_ArmRight" end
|
||||||
if name == "Right_UpperArm" then return "TOC_ArmRight" end
|
if name == "Right_UpperArm" then return "TOC_ArmRight" end
|
||||||
@@ -48,12 +40,6 @@ function TocFindItemInProstBodyLocation(part_name, patient)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Debug cheat and update every minute for cicatrization
|
-- Debug cheat and update every minute for cicatrization
|
||||||
function TocFindAmputationOrProsthesisName(part_name, player, choice)
|
function TocFindAmputationOrProsthesisName(part_name, player, choice)
|
||||||
local worn_items = player:getWornItems()
|
local worn_items = player:getWornItems()
|
||||||
@@ -77,8 +63,12 @@ function TocFindAmputationOrProsthesisName(part_name, player, choice)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
-- Override helper
|
-- Override and mod compat helper
|
||||||
function TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
function TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
||||||
|
|
||||||
for _, side in ipairs(TOC_sides) do
|
for _, side in ipairs(TOC_sides) do
|
||||||
|
|||||||
@@ -42,14 +42,13 @@ end
|
|||||||
|
|
||||||
---Unequip a prosthesis clothing item and returns it to the inventory as a normal item
|
---Unequip a prosthesis clothing item and returns it to the inventory as a normal item
|
||||||
---@param part_name string
|
---@param part_name string
|
||||||
function TheOnlyCure.UnequipProsthesis(patient, part_name)
|
function TheOnlyCure.UnequipProsthesis(patient, part_name, equipped_prosthesis)
|
||||||
|
|
||||||
|
|
||||||
local toc_data = patient:getModData().TOC
|
local toc_data = patient:getModData().TOC
|
||||||
toc_data.Limbs[part_name].is_prosthesis_equipped = false
|
toc_data.Limbs[part_name].is_prosthesis_equipped = false
|
||||||
|
|
||||||
|
|
||||||
local equipped_prosthesis = toc_data.Limbs[part_name].equipped_prosthesis -- TODO Test this
|
|
||||||
local equipped_prosthesis_full_type = equipped_prosthesis:getFullType()
|
local equipped_prosthesis_full_type = equipped_prosthesis:getFullType()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,59 @@ local function TocCutLimbForTrait(player, limbs_data, part_name)
|
|||||||
limbs_data[v].is_amputation_shown = false
|
limbs_data[v].is_amputation_shown = false
|
||||||
limbs_data[v].is_cicatrized = true
|
limbs_data[v].is_cicatrized = true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Sub function of TocSetInitData
|
||||||
|
local function TocUpdateBaseData(mod_data)
|
||||||
|
|
||||||
|
-- TODO The prosthetic knife needs to be a weapon first and foremost, so other than a
|
||||||
|
-- clothing item it needs to be a weapon too (an invisible one maybe?)
|
||||||
|
|
||||||
|
--local prosthesis_list = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
||||||
|
|
||||||
|
local accepted_prosthesis_hand = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
||||||
|
local accepted_prosthesis_lowerarm = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
||||||
|
local accepted_prosthesis_upperarm = {} -- For future stuff
|
||||||
|
|
||||||
|
for _, side in ipairs(TOC_sides) do
|
||||||
|
for _, limb in ipairs(TOC_limbs) do
|
||||||
|
|
||||||
|
local part_name = side .. "_" .. limb
|
||||||
|
|
||||||
|
if limb == "Hand" then
|
||||||
|
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1700
|
||||||
|
mod_data.TOC.Limbs[part_name].depends_on = {}
|
||||||
|
|
||||||
|
|
||||||
|
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_hand
|
||||||
|
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.3
|
||||||
|
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.2
|
||||||
|
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.1
|
||||||
|
--mod_data.TOC.Prosthesis["ProstheticKnife"][part_name].prosthesis_factor = 1.5
|
||||||
|
|
||||||
|
|
||||||
|
elseif limb == "LowerArm" then
|
||||||
|
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1800
|
||||||
|
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", }
|
||||||
|
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_lowerarm
|
||||||
|
|
||||||
|
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.35
|
||||||
|
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.25
|
||||||
|
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.15
|
||||||
|
--mod_data.TOC.Prosthesis["ProstheticKnife"][part_name].prosthesis_factor = 1.6
|
||||||
|
|
||||||
|
elseif limb == "UpperArm" then
|
||||||
|
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 2000
|
||||||
|
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", side .. "_LowerArm", }
|
||||||
|
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_upperarm
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function TocSetInitData(mod_data, player)
|
local function TocSetInitData(mod_data, player)
|
||||||
@@ -121,7 +174,7 @@ local function TocSetInitData(mod_data, player)
|
|||||||
|
|
||||||
|
|
||||||
mod_data.TOC.Limbs[part_name].is_prosthesis_equipped = false
|
mod_data.TOC.Limbs[part_name].is_prosthesis_equipped = false
|
||||||
mod_data.TOC.Limbs[part_name].equipped_prosthesis = {} -- TODO i'm still not usign this, I should though
|
mod_data.TOC.Limbs[part_name].equipped_prosthesis = {}
|
||||||
|
|
||||||
-- Even if there are some duplicates, this is just easier in the end since we're gonna get fairly easily part_name
|
-- Even if there are some duplicates, this is just easier in the end since we're gonna get fairly easily part_name
|
||||||
|
|
||||||
@@ -144,57 +197,6 @@ local function TocSetInitData(mod_data, player)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function TocUpdateBaseData(mod_data)
|
|
||||||
|
|
||||||
-- TODO The prosthetic knife needs to be a weapon first and foremost, so other than a
|
|
||||||
-- clothing item it needs to be a weapon too (an invisible one maybe?)
|
|
||||||
|
|
||||||
--local prosthesis_list = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
|
||||||
|
|
||||||
local accepted_prosthesis_hand = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
|
||||||
local accepted_prosthesis_lowerarm = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
|
|
||||||
local accepted_prosthesis_upperarm = {} -- For future stuff
|
|
||||||
|
|
||||||
for _, side in ipairs(TOC_sides) do
|
|
||||||
for _, limb in ipairs(TOC_limbs) do
|
|
||||||
|
|
||||||
local part_name = side .. "_" .. limb
|
|
||||||
|
|
||||||
if limb == "Hand" then
|
|
||||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1700
|
|
||||||
mod_data.TOC.Limbs[part_name].depends_on = {}
|
|
||||||
|
|
||||||
|
|
||||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_hand
|
|
||||||
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.3
|
|
||||||
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.2
|
|
||||||
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.1
|
|
||||||
--mod_data.TOC.Prosthesis["ProstheticKnife"][part_name].prosthesis_factor = 1.5
|
|
||||||
|
|
||||||
|
|
||||||
elseif limb == "LowerArm" then
|
|
||||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1800
|
|
||||||
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", }
|
|
||||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_lowerarm
|
|
||||||
|
|
||||||
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.35
|
|
||||||
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.25
|
|
||||||
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.15
|
|
||||||
--mod_data.TOC.Prosthesis["ProstheticKnife"][part_name].prosthesis_factor = 1.6
|
|
||||||
|
|
||||||
elseif limb == "UpperArm" then
|
|
||||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 2000
|
|
||||||
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", side .. "_LowerArm", }
|
|
||||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_upperarm
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function TheOnlyCure.InitTheOnlyCure(_, player)
|
function TheOnlyCure.InitTheOnlyCure(_, player)
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ function ISUninstallProsthesis:perform()
|
|||||||
|
|
||||||
if self.patient ~= self.surgeon and isClient() then
|
if self.patient ~= self.surgeon and isClient() then
|
||||||
|
|
||||||
SendUnequipProsthesis(self.patient, self.part_name)
|
SendUnequipProsthesis(self.patient, self.part_name, self.item)
|
||||||
else
|
else
|
||||||
TheOnlyCure.UnequipProsthesis(self.patient, self.part_name)
|
TheOnlyCure.UnequipProsthesis(self.patient, self.part_name, self.item)
|
||||||
end
|
end
|
||||||
|
|
||||||
ISBaseTimedAction.perform(self)
|
ISBaseTimedAction.perform(self)
|
||||||
@@ -69,7 +69,7 @@ function ISUninstallProsthesis:new(surgeon, patient, part_name)
|
|||||||
|
|
||||||
local toc_limbs_data = patient:getModData().TOC.Limbs
|
local toc_limbs_data = patient:getModData().TOC.Limbs
|
||||||
|
|
||||||
o.item = toc_limbs_data[part_name].equipped_prosthesis
|
o.item = TocFindItemInProstBodyLocation(part_name, patient)
|
||||||
o.character = surgeon -- For animation purposes
|
o.character = surgeon -- For animation purposes
|
||||||
|
|
||||||
o.patient = patient
|
o.patient = patient
|
||||||
|
|||||||
Reference in New Issue
Block a user