Merge pull request #45 from ZioPao/dev

v2.0.6
This commit is contained in:
Pao
2024-05-05 18:05:06 +02:00
committed by GitHub
5 changed files with 67 additions and 25 deletions

View File

@@ -145,8 +145,8 @@ end
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
function ISClothingExtraAction:perform() function ISClothingExtraAction:perform()
--local extraItem = InventoryItemFactory.CreateItem(self.extra) local extraItem = InventoryItemFactory.CreateItem(self.extra)
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, true) local isProst = ProsthesisHandler.SearchAndSetupProsthesis(extraItem, true)
local group local group
if isProst then if isProst then
group = BodyLocations.getGroup("Human") group = BodyLocations.getGroup("Human")

View File

@@ -6,7 +6,7 @@ require("TOC/Events")
---@class Main ---@class Main
local Main = { local Main = {
_version = "2.0.5" _version = "2.0.6"
} }
function Main.Start() function Main.Start()

View File

@@ -156,28 +156,30 @@ end)
TestFramework.registerTestModule("Various", "Visuals", function() TestFramework.registerTestModule("Various", "Visuals", function()
local Tests = {} local Tests = {}
function Tests.AddBloodRightForearm() function Tests.AddBloodLeftForearm()
local playerObj = getPlayer() local playerObj = getPlayer()
-- local wornItems = playerObj:getWornItems() local limbName = "ForeArm_L"
-- local limbName = "ForeArm_R" local fullType = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
-- local fullType = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
-- for i = 1, wornItems:size() do local item = playerObj:getInventory():FindAndReturn(fullType)
-- local it = wornItems:get(i - 1) if instanceof(item, "Clothing") then
-- if it then
-- local wornItem = wornItems:get(i - 1):getItem() ---@cast item Clothing
-- TOC_DEBUG.print(wornItem:getFullType())
-- if wornItem:getFullType() == fullType then print("Found limb to add blood onto")
-- TOC_DEBUG.print("Found amputation item for " .. limbName) item:setBloodLevel(100)
local coveredParts = BloodClothingType.getCoveredParts(item:getBloodClothingType())
-- -- change it here if coveredParts then
-- wornItem:setBloodLevel for j=0,coveredParts:size()-1 do
-- wornItem:getVisual():setTextureChoice(texId) item:setBlood(coveredParts:get(j), 100)
-- playerObj:resetModelNextFrame() -- necessary to update the model item:setDirt(coveredParts:get(j), 100)
-- return end
-- end end
-- end
-- end end
playerObj:resetModelNextFrame()
end end
return Tests return Tests

View File

@@ -3,6 +3,7 @@ local StaticData = require("TOC/StaticData")
-- Since amputations are actually clothing items, we need to override ISWashYourself to account for that -- Since amputations are actually clothing items, we need to override ISWashYourself to account for that
-- TODO Clean this up
local og_ISWashYourself_perform = ISWashYourself.perform local og_ISWashYourself_perform = ISWashYourself.perform
function ISWashYourself:perform() function ISWashYourself:perform()
@@ -29,6 +30,11 @@ function ISWashYourself:perform()
foundItem:setBloodLevel(0) foundItem:setBloodLevel(0)
foundItem:setDirtyness(0) -- TODO Integrate with other dirtyness foundItem:setDirtyness(0) -- TODO Integrate with other dirtyness
local coveredParts = BloodClothingType.getCoveredParts(foundItem:getBloodClothingType())
for j=0, coveredParts:size() - 1 do
foundItem:setBlood(coveredParts:get(j), 0)
foundItem:setDirt(coveredParts:get(j), 0)
end
end end
end end
@@ -37,4 +43,38 @@ function ISWashYourself:perform()
og_ISWashYourself_perform(self) og_ISWashYourself_perform(self)
end
local og_ISWashYourself_GetRequiredWater = ISWashYourself.GetRequiredWater
---@param character IsoPlayer
---@return integer
function ISWashYourself.GetRequiredWater(character)
local units = og_ISWashYourself_GetRequiredWater(character)
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(character:getUsername())
local plInv = character:getInventory()
for limbName, _ in pairs(amputatedLimbs) do
TOC_DEBUG.print("Checking if " .. limbName .. " is in inventory and washing it")
-- get clothing item
local item = plInv:FindAndReturn(StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName)
if item and instanceof(item, "Clothing") then
local coveredParts = BloodClothingType.getCoveredParts(item:getBloodClothingType())
if coveredParts then
for i=1,coveredParts:size() do
local part = coveredParts:get(i-1)
if item:getBlood(part) > 0 then
units = units + 1
end
end
end
end
end
return units
end end

View File

@@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices.
id=TheOnlyCure id=TheOnlyCure
icon=icon.png icon=icon.png
url=https://github.com/ZioPao/The-Only-Cure url=https://github.com/ZioPao/The-Only-Cure
modversion=2.0.5 modversion=2.0.6
pzversion=41.65 pzversion=41.65