Trying to work out TryRandomBleed
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
local CommonMethods = {}
|
local CommonMethods = {}
|
||||||
|
|
||||||
---comment
|
---TODO This is useless
|
||||||
---@param val number
|
---@param val number
|
||||||
---@param min number
|
---@param min number
|
||||||
---@param max number
|
---@param max number
|
||||||
|
|||||||
@@ -108,11 +108,12 @@ function PlayerHandler.TryRandomBleed(character, limbName)
|
|||||||
if cicTime == 0 then return end
|
if cicTime == 0 then return end
|
||||||
-- TODO Sometimes we get cicTime = 0... Shouldn't really do it
|
-- TODO Sometimes we get cicTime = 0... Shouldn't really do it
|
||||||
|
|
||||||
local normCicTime = CommonMethods.Normalize(cicTime, 0, 100)
|
-- TODO This is just a placeholder, we need to figure out a better way to calculate this chance
|
||||||
|
local normCicTime = CommonMethods.Normalize(cicTime, 0, StaticData.LIMBS_CICATRIZATION_TIME_IND_NUM[limbName])/2
|
||||||
TOC_DEBUG.print("OG cicTime: " .. tostring(cicTime))
|
TOC_DEBUG.print("OG cicTime: " .. tostring(cicTime))
|
||||||
TOC_DEBUG.print("Normalized cic time : " .. tostring(normCicTime))
|
TOC_DEBUG.print("Normalized cic time : " .. tostring(normCicTime))
|
||||||
|
|
||||||
local chance = ZombRand(0,100)
|
local chance = ZombRandFloat(0.0, 1.0)
|
||||||
if chance > normCicTime then
|
if chance > normCicTime then
|
||||||
TOC_DEBUG.print("Triggered bleeding from non cicatrized wound")
|
TOC_DEBUG.print("Triggered bleeding from non cicatrized wound")
|
||||||
local adjacentBodyPartType = BodyPartType[StaticData.LIMBS_ADJACENT_IND_STR[limbName]]
|
local adjacentBodyPartType = BodyPartType[StaticData.LIMBS_ADJACENT_IND_STR[limbName]]
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
if isClient() then return end -- The event makes this necessary to prevent clients from running this file
|
if isClient() then return end -- The event makes this necessary to prevent clients from running this file
|
||||||
|
local StaticData = require("TOC/StaticData")
|
||||||
|
------------------------
|
||||||
|
|
||||||
local ServerDataHandler = {}
|
local ServerDataHandler = {}
|
||||||
ServerDataHandler.modData = {}
|
ServerDataHandler.modData = {}
|
||||||
|
|
||||||
|
|
||||||
---Get the server mod data table containing that player TOC data
|
---Get the server mod data table containing that player TOC data
|
||||||
---@param key string
|
---@param key string
|
||||||
---@return tocModData
|
---@return tocModData
|
||||||
@@ -14,10 +17,10 @@ end
|
|||||||
---@param key string
|
---@param key string
|
||||||
---@param table tocModData
|
---@param table tocModData
|
||||||
function ServerDataHandler.AddTable(key, table)
|
function ServerDataHandler.AddTable(key, table)
|
||||||
print("TOC: received ModData => " .. key)
|
-- Check if key is valid
|
||||||
|
if not luautils.stringStarts(key, StaticData.MOD_NAME .. "_") then return end
|
||||||
|
|
||||||
TOC_DEBUG.printTable(table)
|
TOC_DEBUG.print("received TOC ModData: " .. tostring(key))
|
||||||
--TOC_DEBUG.print("Adding table with key: " .. tostring(key))
|
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user