I'm a dum dum and my brain no work
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -138,3 +138,13 @@ function TocTestBodyLocations()
|
|||||||
|
|
||||||
end
|
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
|
||||||
92
media/lua/client/TOC_ProsthesisHandler.lua
Normal file
92
media/lua/client/TOC_ProsthesisHandler.lua
Normal 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
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user