I'm a dum dum and my brain no work

This commit is contained in:
Pao
2023-02-10 04:10:06 +01:00
parent dad01605d0
commit 031af29b51
5 changed files with 110 additions and 2 deletions

View File

@@ -8,6 +8,10 @@
---@param part_name string ---@param part_name string
---@param prosthesis_base_name string ---@param prosthesis_base_name string
function TocEquipProsthesis(part_name, prosthesis_base_name) function TocEquipProsthesis(part_name, prosthesis_base_name)
-- TODO probably will have to move this from the TOC menu to classic equip to have dynamic durability
local player = getPlayer() local player = getPlayer()
local toc_data = player:getModData().TOC local toc_data = player:getModData().TOC

View File

@@ -45,8 +45,9 @@ function TocCheckCompatibilityWithOlderVersions(mod_data)
print("TOC: Something was wrongly initiliazed before. Resetting parameters") print("TOC: Something was wrongly initiliazed before. Resetting parameters")
TocResetEverything() TocResetEverything()
else else
print("TOC: Found compatible data, correcting models in case of errors and adding limbs") print("TOC: Bypassing reapplying of amputations, assuming that everything is correct")
TocReapplyAmputationClothingItem(mod_data) --print("TOC: Found compatible data, correcting models in case of errors and adding limbs")
--TocReapplyAmputationClothingItem(mod_data)
end end
end end

View File

@@ -137,4 +137,14 @@ function TocTestBodyLocations()
print(list:get(i -1):getId()) print(list:get(i -1):getId())
end end
end
function TocTestItem()
local player = getPlayer()
local player_inventory = player:getInventory()
local item_name = "TOC.Amputation_" .. "Right" .. "_" .. "Hand"
local found_item = player_inventory:FindAndReturn(item_name)
print(found_item:getID())
end end

View File

@@ -0,0 +1,92 @@
local BaseStats = {
LeatherBase = {
durability = 25,
speed = 15
},
WoodenBase = {
durability = 10,
speed = 5,
},
MetalBase = {
durability = 75,
speed = 7,
}
}
local TopStats = {
}
function GenerateEquippedProsthesis(prosthesis_item)
-- TODO Durability should be decided from the clothing item xml. Same thing for disassembling stuff
local durability = 0
local speed = 0
local prosthesis_name = prosthesis_item:getFullType()
for base_name, base_values in pairs(BaseStats) do
-- Check the name of the prosthesis item, set the correct values
if string.find(prosthesis_name, base_name) then
durability = base_values.durability
speed = base_values.speed
end
end
for top_name, top_values in pairs(TopStats) do
-- Check the name of the prosthesis item, set the correct values
if string.find(prosthesis_name, top_name) then
durability = durability + top_values.durability
speed = speed + top_values.speed
end
end
-- TODO This won't work since if we unequip it we would lose this stuff. We need to bind it to the item
local prosthesis_table = {
prost_id = prosthesis_item:getID(),
prost_name = prosthesis_name,
durability = durability,
speed = speed
}
return prosthesis_table
end
local ProsthesisRecipe = {}
function ProsthesisRecipe.OnCreate.Hook(items, result, player, selectedItem)
-- Set mod data for item with durability and all that crap
-- when we equip a prosthesis, we're gonna pass these parameters to the newly generated clothing item
-- when we unequip it, we regen the normal item with the parameters from the clothing item
end
function DoWeReallyNeedThis()
-- We need a durability check... so in modData
--
end

View File

@@ -82,6 +82,7 @@ recipe Make wooden hook
Category: Surgeon, Category: Surgeon,
Tooltip: Recipe_Tooltip_Wooden_hook, Tooltip: Recipe_Tooltip_Wooden_hook,
NeedToBeLearn: true, NeedToBeLearn: true,
OnCreate: ProsthesisRecipe.OnCreate.Hook,
} }
recipe Make metal hook recipe Make metal hook