missed some stuff
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
-- Use the XLSX as a base for these stats
|
-- Use the XLSX as a base for these stats
|
||||||
local base_table = {
|
local baseTable = {
|
||||||
LeatherBase = {
|
LeatherBase = {
|
||||||
durability = 25,
|
durability = 25,
|
||||||
speed = 15
|
speed = 15
|
||||||
@@ -17,7 +17,7 @@ local base_table = {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
local top_table = {
|
local topTable = {
|
||||||
MetalHook = {
|
MetalHook = {
|
||||||
durability = 1,
|
durability = 1,
|
||||||
speed = 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 durability
|
||||||
local speed
|
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
|
-- 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
|
durability = values.durability
|
||||||
speed = values.speed
|
speed = values.speed
|
||||||
|
|
||||||
@@ -48,45 +48,45 @@ end
|
|||||||
|
|
||||||
|
|
||||||
---comment
|
---comment
|
||||||
---@param prosthesis_item any Normal item
|
---@param prosthesisItem any Normal item
|
||||||
---@param inventory any player inventory
|
---@param inventory any player inventory
|
||||||
---@param limb any
|
---@param limb any
|
||||||
---@return any equipped_prosthesis clothing item equipped prosthesis
|
---@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 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
|
-- 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 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
|
-- when we unequip it, we regen the normal item with the parameters from the clothing item
|
||||||
|
|
||||||
local prosthesis_name = prosthesis_item:getFullType()
|
local prosthesisName = prosthesisItem:getFullType()
|
||||||
local item_mod_data = prosthesis_item:getModData()
|
local itemModData = prosthesisItem:getModData()
|
||||||
|
|
||||||
local durability_base = 0
|
local durabilityBase = 0
|
||||||
local speed_base = 0
|
local speedBase = 0
|
||||||
|
|
||||||
local durability_top = 0
|
local durabilityTop = 0
|
||||||
local speed_top = 0
|
local speedTop = 0
|
||||||
|
|
||||||
|
|
||||||
-- Check the item mod data if the values are different than the default values
|
-- Check the item mod data if the values are different than the default values
|
||||||
|
|
||||||
if item_mod_data.JCIO ~= nil then
|
if itemModData.JCIO ~= nil then
|
||||||
durability_base = item_mod_data.baseDurability
|
durabilityBase = itemModData.baseDurability
|
||||||
durability_top = item_mod_data.topDurability
|
durabilityTop = itemModData.topDurability
|
||||||
-- else
|
-- else
|
||||||
-- durability_base, speed_base = GetProsthesisStats(base_table, prosthesis_name)
|
-- durability_base, speed_base = GetProsthesisStats(base_table, prosthesis_name)
|
||||||
-- durability_top, speed_top = GetProsthesisStats(top_table, prosthesis_name)
|
-- durability_top, speed_top = GetProsthesisStats(top_table, prosthesis_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local equipped_prosthesis = inventory:AddItem(prosthesis_name)
|
local equippedProsthesis = inventory:AddItem(prosthesisName)
|
||||||
equipped_prosthesis:setCondition(prosthesis_item:getCondition())
|
equippedProsthesis:setCondition(prosthesisItem:getCondition())
|
||||||
|
|
||||||
equipped_prosthesis:getModData().JCIO = {
|
equippedProsthesis:getModData().JCIO = {
|
||||||
baseDurability = durability_base,
|
baseDurability = durabilityBase,
|
||||||
topDurability = durability_top,
|
topDurability = durabilityTop,
|
||||||
}
|
}
|
||||||
|
|
||||||
return equipped_prosthesis
|
return equippedProsthesis
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -102,9 +102,9 @@ ProsthesisRecipes = {}
|
|||||||
-- Speed stat should be managed in another way, so change it
|
-- Speed stat should be managed in another way, so change it
|
||||||
|
|
||||||
|
|
||||||
local function GetProsthesisPartName(array_stats, prosthesis_name)
|
local function GetProsthesisPartName(arrayStats, prosthesisName)
|
||||||
for name, _ in pairs(array_stats) do
|
for name, _ in pairs(arrayStats) do
|
||||||
if string.find(prosthesis_name, name) then
|
if string.find(prosthesisName, name) then
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -152,8 +152,8 @@ function ProsthesisRecipes.OnDisassembleProsthesis(item, resultItems, player, se
|
|||||||
-- Check name of the item
|
-- Check name of the item
|
||||||
local prosthesisItemName = item:getFullType()
|
local prosthesisItemName = item:getFullType()
|
||||||
|
|
||||||
local baseName = GetProsthesisPartName(base_table, prosthesisItemName)
|
local baseName = GetProsthesisPartName(baseTable, prosthesisItemName)
|
||||||
local topName = GetProsthesisPartName(top_table, prosthesisItemName)
|
local topName = GetProsthesisPartName(topTable, prosthesisItemName)
|
||||||
|
|
||||||
print("JCIO: " .. baseName .. " and " .. topName)
|
print("JCIO: " .. baseName .. " and " .. topName)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user