Fixed overriden functions
This commit is contained in:
@@ -104,16 +104,29 @@ end
|
||||
function CheckIfItemIsProsthesis(item)
|
||||
local item_full_type = item:getFullType()
|
||||
local prosthesis_list = GetProsthesisList()
|
||||
--return (item_full_type == "TOC.WoodenHook" or item_full_type == "TOC.MetalHook" or item_full_type == "TOC.MetalHand")
|
||||
local check = prosthesis_list[item_full_type]
|
||||
return check
|
||||
|
||||
for _, v in pairs(prosthesis_list) do
|
||||
if v == item_full_type then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
function CheckIfItemIsInstalledProsthesis(item)
|
||||
local item_full_type = item:getFullType()
|
||||
local installable_prosthesis_list = GetInstallableProsthesisList()
|
||||
local check = installable_prosthesis_list[item_full_type]
|
||||
return check
|
||||
|
||||
print("Checking for " .. item_full_type)
|
||||
|
||||
for _, v in pairs(installable_prosthesis_list)do
|
||||
print(v)
|
||||
if (v == item_full_type) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
require "TimedActions/ISBaseTimedAction"
|
||||
require "TimedActions/ISEquipWeaponAction"
|
||||
require "TimedActions/ISUnequipAction"
|
||||
require "TimedActions/ISDropItemAction"
|
||||
require "ISUI/ISInventoryPaneContextMenu"
|
||||
|
||||
local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
|
||||
|
||||
@@ -101,102 +101,32 @@ function ISEquipWeaponAction:perform()
|
||||
end
|
||||
|
||||
|
||||
-- local og_ISUnequipActionPerform = ISUnequipAction.perform
|
||||
-- function ISUnequipAction:perform()
|
||||
-- -- -- check if the "clothing" is actually an amputation or an equipped prosthesis
|
||||
|
||||
|
||||
-- local og_ISInventoryPaneContextMenuDoWearClothingMenu = ISInventoryPaneContextMenu.doWearClothingMenu
|
||||
|
||||
-- function ISInventoryPaneContextMenu.doWearClothingMenu(player, clothing, items, context)
|
||||
|
||||
-- og_ISInventoryPaneContextMenuDoWearClothingMenu(self, player, clothing, items, context)
|
||||
|
||||
|
||||
-- -- TODO Find a way to disable the green advancement UI thing
|
||||
-- if CheckIfItemIsAmputatedLimb(self.item) == false and CheckIfItemIsInstalledProsthesis(self.item) == false then
|
||||
-- og_ISUnequipActionPerform(self)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
-- TODO override equip action
|
||||
|
||||
|
||||
|
||||
|
||||
local og_ISUnequipActionPerform = ISUnequipAction.perform
|
||||
|
||||
function ISUnequipAction:perform()
|
||||
-- -- check if the "clothing" is actually an amputation
|
||||
|
||||
|
||||
-- -- for _, v in ipairs(GetBodyParts()) do
|
||||
-- -- local amputation = TocFindAmputatedClothingFromPartName(v)
|
||||
-- -- if amputation then
|
||||
|
||||
-- -- end
|
||||
-- -- end
|
||||
|
||||
if CheckIfItemIsAmputatedLimb(self.item) == false and CheckIfItemIsInstalledProsthesis(self.item) == false then
|
||||
og_ISUnequipActionPerform(self)
|
||||
local og_ISInventoryPaneContextMenuUnequipItem = ISInventoryPaneContextMenu.unequipItem
|
||||
function ISInventoryPaneContextMenu.unequipItem(item, player)
|
||||
if CheckIfItemIsAmputatedLimb(item) == false and CheckIfItemIsInstalledProsthesis(item) == false then
|
||||
og_ISInventoryPaneContextMenuUnequipItem(item, player)
|
||||
end
|
||||
end
|
||||
|
||||
-- if not CheckIfItemIsAmputatedLimb(self.item) then
|
||||
-- og_ISUnequipActionPerform(self)
|
||||
-- end
|
||||
local og_ISInventoryPaneContextMenuDropItem = ISInventoryPaneContextMenu.dropItem
|
||||
|
||||
-- if CheckIfItemIsInstalledProsthesis(self.item) then
|
||||
-- og_ISUnequipActionPerform(self)
|
||||
-- end
|
||||
function ISInventoryPaneContextMenu.dropItem(item, player)
|
||||
|
||||
if CheckIfItemIsAmputatedLimb(item) == false and CheckIfItemIsInstalledProsthesis(item) == false then
|
||||
og_ISInventoryPaneContextMenuDropItem(item, player)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
local og_ISDropItemActionPerform = ISDropItemAction.perform
|
||||
|
||||
function ISDropItemAction:perform()
|
||||
|
||||
if not CheckIfItemIsAmputatedLimb(self.item)then
|
||||
og_ISDropItemActionPerform(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
-- TODO Add "Clean Wound" to make the cicatrization faster
|
||||
|
||||
|
||||
|
||||
-- local og_ISInventoryPaneContextMenuCreateMenu = ISInventoryPaneContextMenu.createMenu
|
||||
|
||||
-- function ISInventoryPaneContextMenu.createMenu(player, isInPlayerInventory, items, x, y, origin)
|
||||
|
||||
-- og_ISInventoryPaneContextMenuCreateMenu(player, isInPlayerInventory, items, x, y, origin)
|
||||
|
||||
-- local items_to_delete = GetAmputatedLimbFullTypes()
|
||||
-- local item_try_again
|
||||
-- local test_item = nil
|
||||
-- local item_to_test = nil
|
||||
-- --local seccontext = ISContextMenu.get(player, x, y);
|
||||
|
||||
|
||||
|
||||
|
||||
-- for index, v in ipairs(items) do
|
||||
-- test_item = v
|
||||
|
||||
-- if not instanceof(v, "InventoryItem") then
|
||||
-- item_to_test = v.items[1]
|
||||
-- for _, item_to_delete in ipairs(items_to_delete) do
|
||||
-- local item_type = item_to_test:getFullType()
|
||||
-- print("ITEM IN INV " ..item_type)
|
||||
-- print("CHECKING STRING " .. item_to_delete)
|
||||
-- if item_type == item_to_delete then
|
||||
-- --seccontext:removeOptionByName(getText("ContextMenu_Unequip")) -- IT IS ALREADY DEFINED!!!
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- end
|
||||
|
||||
@@ -11,7 +11,7 @@ end
|
||||
function GetInstallableProsthesisList()
|
||||
|
||||
|
||||
-- To make it future proff since i'm gonna add stuff, let's cycle through already known prosthesis
|
||||
-- To make it future proof since i'm gonna add stuff, let's cycle through already known prosthesis
|
||||
local prosthesis_list = GetProsthesisList()
|
||||
|
||||
local sides = {"right", "left"}
|
||||
@@ -22,15 +22,10 @@ function GetInstallableProsthesisList()
|
||||
for _, prost in pairs(prosthesis_list) do
|
||||
for _, body_part in pairs(body_parts) do
|
||||
local installable_prost = prost .. "_" .. side .. "_no" .. body_part
|
||||
print(installable_prost)
|
||||
table.insert(installed_prosthesis_list, installable_prost)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
return installed_prosthesis_list
|
||||
|
||||
Reference in New Issue
Block a user