missed some stuff

This commit is contained in:
Pao
2023-02-28 02:23:47 +01:00
parent 672a6c9aac
commit 43b5b1a144

View File

@@ -1,5 +1,5 @@
-- Use the XLSX as a base for these stats
local base_table = {
local baseTable = {
LeatherBase = {
durability = 25,
speed = 15
@@ -17,7 +17,7 @@ local base_table = {
}
local top_table = {
local topTable = {
MetalHook = {
durability = 1,
speed = 1,
@@ -31,12 +31,12 @@ local top_table = {
local function GetProsthesisStats(array_stats, prosthesis_name)
local function GetProsthesisStats(arrayStats, prosthesisName)
local durability
local speed
for name, values in pairs(array_stats) do
for name, values in pairs(arrayStats) do
-- Check the name of the prosthesis item, set the correct values
if string.find(prosthesis_name, name) then
if string.find(prosthesisName, name) then
durability = values.durability
speed = values.speed
@@ -48,45 +48,45 @@ end
---comment
---@param prosthesis_item any Normal item
---@param prosthesisItem any Normal item
---@param inventory any player inventory
---@param limb any
---@return any equipped_prosthesis clothing item equipped prosthesis
function GenerateEquippedProsthesis(prosthesis_item, inventory, limb)
function GenerateEquippedProsthesis(prosthesisItem, inventory, limb)
-- TODO Durability should be decided from the clothing item xml. Same thing for disassembling stuff
-- TODO some stuff should be defined by the limb, like -10 if forearm in speed
-- 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
local prosthesis_name = prosthesis_item:getFullType()
local item_mod_data = prosthesis_item:getModData()
local prosthesisName = prosthesisItem:getFullType()
local itemModData = prosthesisItem:getModData()
local durability_base = 0
local speed_base = 0
local durabilityBase = 0
local speedBase = 0
local durability_top = 0
local speed_top = 0
local durabilityTop = 0
local speedTop = 0
-- Check the item mod data if the values are different than the default values
if item_mod_data.JCIO ~= nil then
durability_base = item_mod_data.baseDurability
durability_top = item_mod_data.topDurability
if itemModData.JCIO ~= nil then
durabilityBase = itemModData.baseDurability
durabilityTop = itemModData.topDurability
-- else
-- durability_base, speed_base = GetProsthesisStats(base_table, prosthesis_name)
-- durability_top, speed_top = GetProsthesisStats(top_table, prosthesis_name)
end
local equipped_prosthesis = inventory:AddItem(prosthesis_name)
equipped_prosthesis:setCondition(prosthesis_item:getCondition())
local equippedProsthesis = inventory:AddItem(prosthesisName)
equippedProsthesis:setCondition(prosthesisItem:getCondition())
equipped_prosthesis:getModData().JCIO = {
baseDurability = durability_base,
topDurability = durability_top,
equippedProsthesis:getModData().JCIO = {
baseDurability = durabilityBase,
topDurability = durabilityTop,
}
return equipped_prosthesis
return equippedProsthesis
end
@@ -102,9 +102,9 @@ ProsthesisRecipes = {}
-- Speed stat should be managed in another way, so change it
local function GetProsthesisPartName(array_stats, prosthesis_name)
for name, _ in pairs(array_stats) do
if string.find(prosthesis_name, name) then
local function GetProsthesisPartName(arrayStats, prosthesisName)
for name, _ in pairs(arrayStats) do
if string.find(prosthesisName, name) then
return name
end
end
@@ -152,8 +152,8 @@ function ProsthesisRecipes.OnDisassembleProsthesis(item, resultItems, player, se
-- Check name of the item
local prosthesisItemName = item:getFullType()
local baseName = GetProsthesisPartName(base_table, prosthesisItemName)
local topName = GetProsthesisPartName(top_table, prosthesisItemName)
local baseName = GetProsthesisPartName(baseTable, prosthesisItemName)
local topName = GetProsthesisPartName(topTable, prosthesisItemName)
print("JCIO: " .. baseName .. " and " .. topName)