@@ -17,10 +17,12 @@ ItemsController.Player = {}
|
|||||||
---@return number
|
---@return number
|
||||||
---@private
|
---@private
|
||||||
function ItemsController.Player.GetAmputationTexturesIndex(playerObj, isCicatrized)
|
function ItemsController.Player.GetAmputationTexturesIndex(playerObj, isCicatrized)
|
||||||
|
-- FIX Broken
|
||||||
local textureString = playerObj:getHumanVisual():getSkinTexture()
|
local textureString = playerObj:getHumanVisual():getSkinTexture()
|
||||||
local isHairy = textureString:sub(-1) == "a"
|
local isHairy = textureString:sub(-1) == "a"
|
||||||
|
|
||||||
local matchedIndex = tonumber(textureString:match("%d$")) or 0
|
local matchedIndex = tonumber(textureString:match("%d%d")) -- it must always be at least 1
|
||||||
|
TOC_DEBUG.print("Texture string: " .. tostring(textureString))
|
||||||
|
|
||||||
if isHairy then
|
if isHairy then
|
||||||
matchedIndex = matchedIndex + 5
|
matchedIndex = matchedIndex + 5
|
||||||
|
|||||||
@@ -149,7 +149,11 @@ LocalPlayerController.hasBeenDamaged = false
|
|||||||
function LocalPlayerController.HandleDamage(character)
|
function LocalPlayerController.HandleDamage(character)
|
||||||
--TOC_DEBUG.print("Player got hit!")
|
--TOC_DEBUG.print("Player got hit!")
|
||||||
-- TOC_DEBUG.print(damageType)
|
-- TOC_DEBUG.print(damageType)
|
||||||
if character ~= getPlayer() then return end
|
if character ~= getPlayer() then
|
||||||
|
-- Disable lock before doing anything else
|
||||||
|
LocalPlayerController.hasBeenDamaged = false
|
||||||
|
return
|
||||||
|
end
|
||||||
local bd = character:getBodyDamage()
|
local bd = character:getBodyDamage()
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
local modDataNeedsUpdate = false
|
local modDataNeedsUpdate = false
|
||||||
@@ -198,17 +202,13 @@ function LocalPlayerController.HandleDamage(character)
|
|||||||
LocalPlayerController.hasBeenDamaged = false
|
LocalPlayerController.hasBeenDamaged = false
|
||||||
end
|
end
|
||||||
|
|
||||||
---Setup HandleDamage, triggered by OnPlayerGetDamage
|
---Setup HandleDamage, triggered by OnPlayerGetDamage. To prevent a spam caused by this awful event, we use a bool lock
|
||||||
---@param character IsoPlayer|IsoGameCharacter
|
---@param character IsoPlayer|IsoGameCharacter
|
||||||
---@param damageType string
|
---@param damageType string
|
||||||
---@param damageAmount number
|
---@param damageAmount number
|
||||||
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
||||||
-- TODO Check if other players in the online triggers this
|
|
||||||
|
|
||||||
if LocalPlayerController.hasBeenDamaged == false then
|
if LocalPlayerController.hasBeenDamaged == false then
|
||||||
-- Start checks
|
-- Start checks
|
||||||
|
|
||||||
-- TODO Add a timer before we can re-enable this bool?
|
|
||||||
LocalPlayerController.hasBeenDamaged = true
|
LocalPlayerController.hasBeenDamaged = true
|
||||||
LocalPlayerController.HandleDamage(character)
|
LocalPlayerController.HandleDamage(character)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,16 +133,21 @@ function CachedDataHandler.CalculateBothHandsFeasibility()
|
|||||||
CachedDataHandler.CalculateHandFeasibility("Hand_L")
|
CachedDataHandler.CalculateHandFeasibility("Hand_L")
|
||||||
CachedDataHandler.CalculateHandFeasibility("Hand_R")
|
CachedDataHandler.CalculateHandFeasibility("Hand_R")
|
||||||
local interactStr = "Interact"
|
local interactStr = "Interact"
|
||||||
|
|
||||||
|
if CachedDataHandler.interactKey == nil or CachedDataHandler.interactKey == 0 then
|
||||||
|
CachedDataHandler.interactKey = getCore():getKey(interactStr)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not CachedDataHandler.GetBothHandsFeasibility() then
|
if not CachedDataHandler.GetBothHandsFeasibility() then
|
||||||
TOC_DEBUG.print("Disabling interact key")
|
TOC_DEBUG.print("Disabling interact key")
|
||||||
|
TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
||||||
-- Cache the current key
|
|
||||||
CachedDataHandler.interactKey = getCore():getKey(interactStr)
|
|
||||||
getCore():addKeyBinding(interactStr, Keyboard.KEY_NONE)
|
getCore():addKeyBinding(interactStr, Keyboard.KEY_NONE)
|
||||||
else
|
else
|
||||||
TOC_DEBUG.print("Re-enabling interact key")
|
TOC_DEBUG.print("Re-enabling interact key")
|
||||||
|
TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
||||||
|
|
||||||
if not CachedDataHandler.interactKey then CachedDataHandler.interactKey = getCore():getKey(interactStr) end
|
|
||||||
getCore():addKeyBinding(interactStr, CachedDataHandler.interactKey)
|
getCore():addKeyBinding(interactStr, CachedDataHandler.interactKey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require("TOC/Events")
|
|||||||
|
|
||||||
---@class Main
|
---@class Main
|
||||||
local Main = {
|
local Main = {
|
||||||
_version = "2.0.10"
|
_version = "2.0.11"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Main.Start()
|
function Main.Start()
|
||||||
@@ -58,8 +58,9 @@ function Main.WipeData(player)
|
|||||||
|
|
||||||
|
|
||||||
-- Let's wipe the instance too just to be sure
|
-- Let's wipe the instance too just to be sure
|
||||||
local DataController = require("TOC/Controllers/DataController")
|
-- TODO This can break things I guess
|
||||||
DataController.DestroyInstance(username)
|
--local DataController = require("TOC/Controllers/DataController")
|
||||||
|
--DataController.DestroyInstance(username)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
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.10
|
modversion=2.0.11
|
||||||
pzversion=41.65
|
pzversion=41.65
|
||||||
|
|||||||
Reference in New Issue
Block a user