Refactoring even more since why not at this point
This commit is contained in:
@@ -55,7 +55,7 @@ local function TocDeleteOtherAmputatedLimbs(side)
|
||||
-- if left hand is cut and we cut left lowerarm, then delete hand
|
||||
|
||||
|
||||
for _, limb in pairs(TOC_limbs) do
|
||||
for _, limb in pairs(TOC.limb_names) do
|
||||
local part_name = "TOC.Amputation_" .. side .. "_" .. limb
|
||||
local amputated_limb = getPlayer():getInventory():FindAndReturn(part_name)
|
||||
if amputated_limb then
|
||||
|
||||
@@ -91,7 +91,7 @@ end
|
||||
|
||||
function CheckIfProsthesisAlreadyInstalled(limbs_data, part_name)
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
if string.find(part_name, side) then
|
||||
return (limbs_data[side .. "_Hand"].is_prosthesis_equipped or limbs_data[side .. "_LowerArm"].is_prosthesis_equipped)
|
||||
end
|
||||
|
||||
@@ -7,8 +7,8 @@ local function TocReapplyAmputationClothingItem(mod_data)
|
||||
local player = getPlayer()
|
||||
local player_inv = player:getInventory()
|
||||
|
||||
for _, side in ipairs(TOC_sides) do
|
||||
for _, limb in ipairs(TOC_limbs) do
|
||||
for _, side in ipairs(TOC.side_names) do
|
||||
for _, limb in ipairs(TOC.limb_names) do
|
||||
local part_name = side .. "_" .. limb
|
||||
|
||||
-- Check this before since we could have changed some stuff about part names before fixing them. Could break things
|
||||
|
||||
@@ -42,12 +42,12 @@ function TocResetEverything()
|
||||
toc_traits:remove("Amputee_UpperArm")
|
||||
|
||||
|
||||
TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
TOC.Init(_, player)
|
||||
|
||||
-- Destroy the amputation or prosthesis item
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, limb in pairs(TOC_limbs) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
for _, limb in pairs(TOC.limb_names) do
|
||||
|
||||
local part_name = side .. "_" .. limb
|
||||
local amputation_item_name = TocFindAmputationOrProsthesisName(part_name, player, "Amputation")
|
||||
|
||||
@@ -74,7 +74,7 @@ end
|
||||
-- Override and mod compat helper
|
||||
function TocPopulateCanBeHeldTable(can_be_held, limbs_data)
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
can_be_held[side] = true
|
||||
|
||||
if limbs_data[side .. "_Hand"].is_cut then
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
------------------------------------------
|
||||
------------- INIT FUNCTIONS -------------
|
||||
|
||||
if not TheOnlyCure then
|
||||
TheOnlyCure = {}
|
||||
end
|
||||
if not TOC then
|
||||
TOC = {}
|
||||
|
||||
TOC_sides = { "Left", "Right" }
|
||||
TOC_limbs = { "Hand", "LowerArm", "UpperArm", "Foot"}
|
||||
end
|
||||
|
||||
local function TocCutLimbForTrait(player, limbs_data, part_name)
|
||||
local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_" .. part_name)
|
||||
@@ -66,8 +64,8 @@ local function TocUpdateBaseData(mod_data)
|
||||
local accepted_prosthesis_upperarm = {} -- For future stuff
|
||||
local accepted_prosthesis_foot = {}
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, limb in pairs(TOC_limbs) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
for _, limb in pairs(TOC.limb_names) do
|
||||
|
||||
local part_name = side .. "_" .. limb
|
||||
|
||||
@@ -122,68 +120,6 @@ end
|
||||
local function TocSetInitData(mod_data, player)
|
||||
|
||||
print("TOC: Creating mod_data.TOC")
|
||||
|
||||
|
||||
-- TODO this is gonna become a mess really fast, i fucked up.
|
||||
-- TODO Move prosthesis to something more easily accessible
|
||||
-- TODO Acceptable prosthesis need to be moved to something more accessible
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mod_data.TOC = {
|
||||
|
||||
Limbs = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
|
||||
Left_Foot = {},
|
||||
Right_Foot = {},
|
||||
|
||||
is_other_bodypart_infected = false
|
||||
},
|
||||
Prosthesis = {
|
||||
WoodenHook = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
MetalHook = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
MetalHand = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
|
||||
|
||||
|
||||
Accepted_Prosthesis = {}
|
||||
|
||||
},
|
||||
Generic = {},
|
||||
}
|
||||
--------
|
||||
-- NEW NAMING SCHEME
|
||||
|
||||
@@ -200,13 +136,72 @@ local function TocSetInitData(mod_data, player)
|
||||
--- Objects
|
||||
-- Prost_Object_WoddenHook
|
||||
|
||||
-- TODO this is gonna become a mess really fast, i fucked up.
|
||||
-- TODO Move prosthesis to something more easily accessible
|
||||
-- TODO Acceptable prosthesis need to be moved to something more accessible
|
||||
|
||||
mod_data.TOC = {}
|
||||
|
||||
-- Limbs
|
||||
mod_data.TOC.Limbs = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
|
||||
Left_Foot = {},
|
||||
Right_Foot = {},
|
||||
|
||||
is_other_bodypart_infected = false
|
||||
}
|
||||
|
||||
-- TODO Move this to the global TOC thing
|
||||
-- Prosthetics
|
||||
mod_data.TOC.Prosthesis = {
|
||||
WoodenHook = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
MetalHook = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
MetalHand = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
|
||||
Left_Hand = {},
|
||||
Left_LowerArm = {},
|
||||
Left_UpperArm = {},
|
||||
},
|
||||
|
||||
|
||||
|
||||
Accepted_Prosthesis = {}
|
||||
|
||||
}
|
||||
|
||||
-- TODO Move this to the global TOC thing
|
||||
-- Generic (future uses)
|
||||
mod_data.TOC.Generic = {}
|
||||
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, limb in pairs(TOC_limbs) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
for _, limb in pairs(TOC.limb_names) do
|
||||
|
||||
local part_name = side .. "_" .. limb
|
||||
|
||||
@@ -244,7 +239,7 @@ local function TocSetInitData(mod_data, player)
|
||||
|
||||
end
|
||||
|
||||
function TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
function TOC.Init(_, player)
|
||||
|
||||
local mod_data = player:getModData()
|
||||
if mod_data.TOC == nil then
|
||||
@@ -257,7 +252,7 @@ function TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
|
||||
end
|
||||
|
||||
local function TocDeclareTraits()
|
||||
local function InitializeTraits()
|
||||
local amp1 = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8,
|
||||
getText("UI_trait_Amputee_Hand_desc"), false, false)
|
||||
amp1:addXPBoost(Perks.Left_Hand, 4)
|
||||
@@ -283,6 +278,21 @@ local function TocDeclareTraits()
|
||||
TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm")
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
Events.OnCreatePlayer.Add(TheOnlyCure.InitTheOnlyCure)
|
||||
Events.OnGameBoot.Add(TocDeclareTraits)
|
||||
-- Rewrite 2 Electirc Bogaloo
|
||||
local function InitializeTheOnlyCure()
|
||||
|
||||
-- Initializes global lists
|
||||
TOC.side_names = {"Left", "Right"}
|
||||
TOC.limb_names = { "Hand", "LowerArm", "UpperArm", "Foot"}
|
||||
|
||||
InitializeTraits()
|
||||
|
||||
|
||||
Events.OnCreatePlayer.Add(TOC.Init)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Events.OnGameBoot.Add(InitializeTheOnlyCure)
|
||||
|
||||
@@ -197,7 +197,7 @@ function ISWearClothing:isValid()
|
||||
-- TODO Sides
|
||||
local limbs_data = self.character:getModData().TOC.Limbs
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
if string.find(item_full_type, "Test_Tourniquet_" .. side) then
|
||||
if limbs_data[side .. "_UpperArm"].is_cut then
|
||||
return false
|
||||
|
||||
@@ -197,7 +197,7 @@ local function TocUpdateEveryTenMinutes()
|
||||
local part_data = player:getModData().TOC.Limbs
|
||||
|
||||
--Experience for prosthesis user
|
||||
for _, side in pairs(TOC_sides) do
|
||||
for _, side in pairs(TOC.side_names) do
|
||||
if part_data[side .. "_Hand"].is_prosthesis_equipped or part_data[side .. "_LowerArm"].is_prosthesis_equipped then
|
||||
player:getXp():AddXP(Perks[side .. "_Hand"], 4)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user