Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74bb34bbc8 |
@@ -6,9 +6,9 @@ Wait until you succumb to the virus or take matters into your hands. Cut off tha
|
|||||||
|
|
||||||
This version of [b]The Only Cure[/b] has been rebuilt from scratch to support future additions and to feel as close as possible as a vanilla mechanic.
|
This version of [b]The Only Cure[/b] has been rebuilt from scratch to support future additions and to feel as close as possible as a vanilla mechanic.
|
||||||
|
|
||||||
[b]If you're using an older version of The Only Cure and want to switch with this, you're gonna need to create a new character\save to prevent issues.[/b]
|
|
||||||
[b]The older version will be delisted shortly and it will not be supported anymore.[/b]
|
[b]The older version will be delisted shortly and it will not be supported anymore.[/b]
|
||||||
[h1]Supports [b]Single Player[/b] and [b]Multiplayer[/b]. Host Mode is currently [b]UNSUPPORTED![/b][/h1]
|
|
||||||
|
Supports [b]Single Player[/b] and [b]Multiplayer[/b]!
|
||||||
|
|
||||||
[h1]Setup[/h1]
|
[h1]Setup[/h1]
|
||||||
Use it with the following mods for the intended experience:
|
Use it with the following mods for the intended experience:
|
||||||
@@ -17,8 +17,6 @@ Use it with the following mods for the intended experience:
|
|||||||
[*] [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2934621024]Brutal Handwork[/url]
|
[*] [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2934621024]Brutal Handwork[/url]
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
Place them [b]BEFORE[/b] The Only Cure in your mod list!
|
|
||||||
|
|
||||||
[hr][/hr]
|
[hr][/hr]
|
||||||
|
|
||||||
[h1]Quick guide[/h1]
|
[h1]Quick guide[/h1]
|
||||||
@@ -76,10 +74,6 @@ Got any issues or found some pesky bugs? Report them on GitHub!
|
|||||||
[th]dhert[/th]
|
[th]dhert[/th]
|
||||||
[th]Compatibility API[/th]
|
[th]Compatibility API[/th]
|
||||||
[/tr]
|
[/tr]
|
||||||
[tr]
|
|
||||||
[th]JCloudJalix[/th]
|
|
||||||
[th]German translation[/th]
|
|
||||||
[/tr]
|
|
||||||
[/table]
|
[/table]
|
||||||
|
|
||||||
[hr][/hr]
|
[hr][/hr]
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ end
|
|||||||
function DataController:apply()
|
function DataController:apply()
|
||||||
TOC_DEBUG.print("Applying data for " .. self.username)
|
TOC_DEBUG.print("Applying data for " .. self.username)
|
||||||
ModData.transmit(CommandsData.GetKey(self.username))
|
ModData.transmit(CommandsData.GetKey(self.username))
|
||||||
|
|
||||||
-- if getPlayer():getUsername() ~= self.username then
|
-- if getPlayer():getUsername() ~= self.username then
|
||||||
-- sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayApplyFromOtherClient, {patientUsername = self.username} )
|
-- sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayApplyFromOtherClient, {patientUsername = self.username} )
|
||||||
-- -- force request from the server for that other client...
|
-- -- force request from the server for that other client...
|
||||||
@@ -380,9 +380,8 @@ function DataController.ReceiveData(key, data)
|
|||||||
|
|
||||||
|
|
||||||
TOC_DEBUG.print("ReceiveData for " .. key)
|
TOC_DEBUG.print("ReceiveData for " .. key)
|
||||||
|
if data == {} or data == nil then
|
||||||
if data == nil or data.limbs == nil then
|
error("Data is nil, new character or something is wrong")
|
||||||
TOC_DEBUG.print("Data is nil, new character or something is wrong")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get DataController instance if there was none for that user and reapply the correct ModData table as a reference
|
-- Get DataController instance if there was none for that user and reapply the correct ModData table as a reference
|
||||||
@@ -400,8 +399,7 @@ function DataController.ReceiveData(key, data)
|
|||||||
if handler.isResetForced then
|
if handler.isResetForced then
|
||||||
TOC_DEBUG.print("Forced reset")
|
TOC_DEBUG.print("Forced reset")
|
||||||
handler:setup(key)
|
handler:setup(key)
|
||||||
elseif data and data.limbs then
|
elseif data then
|
||||||
-- Let's validate that the data structure is actually valid to prevent issues
|
|
||||||
if data.isUpdateFromServer then
|
if data.isUpdateFromServer then
|
||||||
TOC_DEBUG.print("Update from the server")
|
TOC_DEBUG.print("Update from the server")
|
||||||
end
|
end
|
||||||
@@ -476,12 +474,4 @@ function DataController.GetInstance(username)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function DataController.DestroyInstance(username)
|
|
||||||
if DataController.instances[username] ~= nil then
|
|
||||||
DataController.instances[username] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
return DataController
|
return DataController
|
||||||
@@ -43,18 +43,13 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
|
|
||||||
for k, _ in pairs(amputatedLimbs) do
|
for k, _ in pairs(amputatedLimbs) do
|
||||||
local limbName = k
|
local limbName = k
|
||||||
local perkAmp = Perks["Side_" .. CommonMethods.GetSide(limbName)]
|
--if dcInst:getIsCut(limbName) then
|
||||||
local perkLevel = pl:getPerkLevel(perkAmp)
|
local perk = Perks["Side_" .. CommonMethods.GetSide(limbName)]
|
||||||
|
local perkLevel = pl:getPerkLevel(perk)
|
||||||
if dcInst:getIsProstEquipped(limbName) then
|
|
||||||
-- TODO We should separate this in multiple perks, since this is gonna be a generic familiarity and could make no actual sense
|
|
||||||
local perkProst = Perks["ProstFamiliarity"]
|
|
||||||
perkLevel = perkLevel + pl:getPerkLevel(perkProst)
|
|
||||||
end
|
|
||||||
|
|
||||||
local perkLevelScaled
|
local perkLevelScaled
|
||||||
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
||||||
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return time
|
return time
|
||||||
@@ -68,31 +63,22 @@ function ISBaseTimedAction:perform()
|
|||||||
og_ISBaseTimedAction_perform(self)
|
og_ISBaseTimedAction_perform(self)
|
||||||
|
|
||||||
TOC_DEBUG.print("Running ISBaseTimedAction.perform override")
|
TOC_DEBUG.print("Running ISBaseTimedAction.perform override")
|
||||||
TOC_DEBUG.print("max time: " .. tostring(self.maxTime))
|
|
||||||
|
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
if not dcInst:getIsAnyLimbCut() then return end
|
if not dcInst:getIsAnyLimbCut() then return end
|
||||||
|
|
||||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(LocalPlayerController.username)
|
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(LocalPlayerController.username)
|
||||||
local xp = self.maxTime/100
|
|
||||||
for k, _ in pairs(amputatedLimbs) do
|
for k, _ in pairs(amputatedLimbs) do
|
||||||
local limbName = k
|
local limbName = k
|
||||||
|
|
||||||
-- We're checking for only "visible" amputations to prevent from having bleeds everywhere
|
-- We're checking for only "visible" amputations to prevent from having bleeds everywhere
|
||||||
if dcInst:getIsCut(limbName) and dcInst:getIsVisible(limbName) then
|
if dcInst:getIsCut(limbName) and dcInst:getIsVisible(limbName) then
|
||||||
local side = CommonMethods.GetSide(limbName)
|
local side = CommonMethods.GetSide(limbName)
|
||||||
LocalPlayerController.playerObj:getXp():AddXP(Perks["Side_" .. side], xp)
|
LocalPlayerController.playerObj:getXp():AddXP(Perks["Side_" .. side], 1) -- TODO Make it dynamic
|
||||||
if not dcInst:getIsCicatrized(limbName) and dcInst:getIsProstEquipped(limbName) then
|
if not dcInst:getIsCicatrized(limbName) and dcInst:getIsProstEquipped(limbName) then
|
||||||
TOC_DEBUG.print("Trying for bleed, player met the criteria")
|
TOC_DEBUG.print("Trying for bleed, player met the criteria")
|
||||||
LocalPlayerController.TryRandomBleed(self.character, limbName)
|
LocalPlayerController.TryRandomBleed(self.character, limbName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Level up prosthesis perk
|
|
||||||
if dcInst:getIsProstEquipped(limbName) then
|
|
||||||
LocalPlayerController.playerObj:getXp():AddXP(Perks["ProstFamiliarity"], xp)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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(extraItem, true)
|
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, true)
|
||||||
local group
|
local group
|
||||||
if isProst then
|
if isProst then
|
||||||
group = BodyLocations.getGroup("Human")
|
group = BodyLocations.getGroup("Human")
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ require("TOC/Events")
|
|||||||
|
|
||||||
---@class Main
|
---@class Main
|
||||||
local Main = {
|
local Main = {
|
||||||
_version = "2.0.7"
|
_version = "2.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Main.Start()
|
function Main.Start()
|
||||||
TOC_DEBUG.print("Starting The Only Cure version " .. tostring(Main._version))
|
TOC_DEBUG.print("Starting The Only Cure version " .. tostring(Main._version))
|
||||||
|
--Main.SetupTraits()
|
||||||
Main.SetupEvents()
|
Main.SetupEvents()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -36,15 +37,16 @@ function Main.InitializePlayer()
|
|||||||
CommonMethods.SafeStartEvent("OnTick", TryToInitialize)
|
CommonMethods.SafeStartEvent("OnTick", TryToInitialize)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Clean the TOC table for that SP player, to prevent it from clogging ModData up
|
---Clean the TOC table for that SP player, to prevent from clogging it up
|
||||||
---@param player IsoPlayer
|
---@param player IsoPlayer
|
||||||
function Main.WipeData(player)
|
function Main.WipeData(player)
|
||||||
local username = player:getUsername()
|
TOC_DEBUG.print("Wiping data after death")
|
||||||
TOC_DEBUG.print("Wiping data after death: " .. username)
|
local key = CommandsData.GetKey(player:getUsername())
|
||||||
local key = CommandsData.GetKey(username)
|
|
||||||
|
|
||||||
--ModData.remove(key)
|
--ModData.remove(key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not isClient() then
|
if not isClient() then
|
||||||
-- For SP, it's enough just removing the data this way
|
-- For SP, it's enough just removing the data this way
|
||||||
ModData.remove(key)
|
ModData.remove(key)
|
||||||
@@ -53,14 +55,7 @@ function Main.WipeData(player)
|
|||||||
-- at the next character by passing an empty mod data
|
-- at the next character by passing an empty mod data
|
||||||
ModData.add(key, {})
|
ModData.add(key, {})
|
||||||
ModData.transmit(key)
|
ModData.transmit(key)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Let's wipe the instance too just to be sure
|
|
||||||
local DataController = require("TOC/Controllers/DataController")
|
|
||||||
DataController.DestroyInstance(username)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--* Events *--
|
--* Events *--
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ local StaticData = require("TOC/StaticData")
|
|||||||
TestFramework.registerTestModule("LocalPlayerController", "Setup", function()
|
TestFramework.registerTestModule("LocalPlayerController", "Setup", function()
|
||||||
local Tests = {}
|
local Tests = {}
|
||||||
function Tests.InitializePlayer()
|
function Tests.InitializePlayer()
|
||||||
|
local pl = getPlayer()
|
||||||
LocalPlayerController.InitializePlayer(true)
|
LocalPlayerController.InitializePlayer(true)
|
||||||
end
|
end
|
||||||
return Tests
|
return Tests
|
||||||
@@ -153,38 +154,6 @@ TestFramework.registerTestModule("Various", "Player", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
TestFramework.registerTestModule("Various", "Visuals", function()
|
|
||||||
local Tests = {}
|
|
||||||
|
|
||||||
function Tests.AddBloodLeftForearm()
|
|
||||||
local playerObj = getPlayer()
|
|
||||||
local limbName = "ForeArm_L"
|
|
||||||
local fullType = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
|
||||||
|
|
||||||
|
|
||||||
local item = playerObj:getInventory():FindAndReturn(fullType)
|
|
||||||
if instanceof(item, "Clothing") then
|
|
||||||
|
|
||||||
---@cast item Clothing
|
|
||||||
|
|
||||||
print("Found limb to add blood onto")
|
|
||||||
item:setBloodLevel(100)
|
|
||||||
local coveredParts = BloodClothingType.getCoveredParts(item:getBloodClothingType())
|
|
||||||
if coveredParts then
|
|
||||||
for j=0,coveredParts:size()-1 do
|
|
||||||
item:setBlood(coveredParts:get(j), 100)
|
|
||||||
item:setDirt(coveredParts:get(j), 100)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
playerObj:resetModelNextFrame()
|
|
||||||
end
|
|
||||||
|
|
||||||
return Tests
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
if not getActivatedMods():contains("PerfTestFramework") or not isDebugEnabled() then return end
|
if not getActivatedMods():contains("PerfTestFramework") or not isDebugEnabled() then return end
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
|
||||||
local StaticData = require("TOC/StaticData")
|
|
||||||
|
|
||||||
-- 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
|
|
||||||
function ISWashYourself:perform()
|
|
||||||
|
|
||||||
TOC_DEBUG.print("ISWashYourself override")
|
|
||||||
|
|
||||||
---@type IsoPlayer
|
|
||||||
local pl = self.character
|
|
||||||
local plInv = pl:getInventory()
|
|
||||||
-- Search for amputations and clean them here
|
|
||||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
|
||||||
for limbName, _ in pairs(amputatedLimbs) do
|
|
||||||
|
|
||||||
TOC_DEBUG.print("Checking if " .. limbName .. " is in inventory and washing it")
|
|
||||||
|
|
||||||
-- get clothing item
|
|
||||||
local foundItem = plInv:FindAndReturn(StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName)
|
|
||||||
if foundItem and instanceof(foundItem, "Clothing") then
|
|
||||||
|
|
||||||
TOC_DEBUG.print("Washing " .. limbName)
|
|
||||||
|
|
||||||
---@cast foundItem Clothing
|
|
||||||
foundItem:setWetness(100)
|
|
||||||
foundItem:setBloodLevel(0)
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -34,10 +34,6 @@ function ServerDataHandler.AddTable(key, table)
|
|||||||
ModData.add(key, table) -- Add it to the server mod data
|
ModData.add(key, table) -- Add it to the server mod data
|
||||||
ServerDataHandler.modData[key] = table
|
ServerDataHandler.modData[key] = table
|
||||||
|
|
||||||
|
|
||||||
-- Check integrity of table. if it doesn't contains toc data, it means that we received a reset
|
|
||||||
if table.limbs == nil then return end
|
|
||||||
|
|
||||||
-- Since this could be triggered by a different client than the one referenced in the key, we're gonna
|
-- Since this could be triggered by a different client than the one referenced in the key, we're gonna
|
||||||
-- apply the changes back to the key client again to be sure that everything is in sync
|
-- apply the changes back to the key client again to be sure that everything is in sync
|
||||||
local username = CommandsData.GetUsername(key)
|
local username = CommandsData.GetUsername(key)
|
||||||
|
|||||||
2
mod.info
2
mod.info
@@ -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.7
|
modversion=2.0.3
|
||||||
pzversion=41.65
|
pzversion=41.65
|
||||||
|
|||||||
Reference in New Issue
Block a user