Barotrauma

Barotrauma

More Blood
Nupaska  [developer] 30 May @ 10:20am
Config explained
Main config is stored in mod folder in Config.xml, decal settings are stored in Prefabs folder

There are 2 sources of blood now: projectile impact and bleeding

Generally decal size is calculated from bleeding amount/damage and then decal lifetime is calculated from decal size

Global parameters
DecalDrawDepth
It's sprite depth at which blood is drawn, vanilla is 1.0, humans are drawn at 0.5 iirc
GlobalBloodAmount
Global multiplier for all blood, it's linked to the slider in graphics menu
GlobalDecalLifetime
Global multiplier for blood decal lifetime, also linked to a slider in graphics menu
DecalCleaningSpeed
% of TimeLeft substracted from Lifetime on cleaning
VitalityMultiplier
This is how much difference in max vitality between this character and human should affect decal size
Version
Autogenerated, there's a method that's supposed to move config to OldConfig.xml if it's outdated, and which i tested multiple times localy, but apparently it didn't worked

FromBleeding
It controls how amount of bleeding is converted into blood flow and then into decal size and position

Flow depends on bleeding severity, limb movements and character's pulse
BloodAmountFromBleeding
Global multiplier for all decal size from bleeding, i use 1/0 to turn it on/off for testing
LifetimeMultiplier
Multiplies lifetime of decal after it created, it's just to make decals from impact stay longer
DecalCreationInterval
Interval in seconds at which decals are created, limited by Timing.Step

Pulse stuff

Pulse is a multiplier to blood flow, it's calculated as sin(time*BasicPulseSpeed)^PulseSteepness
BasicPulseSpeed
Frequency of character's pulse
UnconciousPulseSpeed
pulse speed multiplier when character is unconcious
PulseSteepness
Sharpness of pulse spikes, should be even i guess
PulseFlowFactor
Impact of pulse to the blood flow


Flow
Flow is calculated as MinFlow + GlobalBloodAmount*BloodAmountFromBleeding*vitalityFactor*AfflictionStrength*pulseFactor*(SeverityFlowFactor + LimbSpeedFlowFactor*limbSpeed)

Flow then directly passed as decal size
MinFlow
Minimal flow if you are bleeding, offset to decal size
FlowCutoff
If result flow is below this decal won't be created
SeverityFlowFactor
How much severity of bleeding affects blood flow
PulseFlowFactor
Impact of pulse to the blood flow
LimbSpeedFlowFactor
How much limb speed affects blood flow
UnconciousBloodFlow
Flow multiplier when character is unconcious

Position
RandomPosFactor
Random decal position offset
LimbSpeedPosFactor
How much limb speed affects decal position

FromImpact
It controls how damage is converted into decal size and position

At first i wanted to create decals on projectile impact but then i realised that i'd need bleeding amount which depends on gear and talents and is properly calculated only in Limb.AddDamage
So, i decided to add decal after any damage but track damage source
Some sources have their own settings

MinBloodFlyDistance
Minimum flight distance of blood drops
BloodSpeed
Maximum flight distance of blood drops, the actual value is random between MinBloodFlyDistance and BloodSpeed
BloodAmountFromImpact
Global decal size from impact multiplier, i use 1/0 to turn it on/off for testing
LifetimeMultiplier
This makes blood from damage stay longer
BleedingDamageToDecalSize
At last, a meaningful name
MinSplash
Decal size offset
Cutoff
Decals smaller than this won't be created

Decal Prefabs
These settings control how decal is drawn and how size is converted into lifetime
I decited to extract them from configs to prefabs to make same decals from different sources look and behave similarly

Decal lives its lifetime seconds and changes color according to ColorPoints, Lambdas are [0,1]

I use exp segments to calculate multipliers, it's basically unit segment [0,1] raised to some power and then streched between [min,max]

BasedOn
I'm too lazy to create/manage sprites, i take them from vanilla decals, this is the identifier of vanilla decal which sprites will be used
SizeFluctuation
Random multiplier to sprite size
LifetimeFluctuation
Random multiplier to lifetime
MinSpriteSize/MaxSpriteSize
Size of the sprite will be clipped between these no matter what, because it looks too ugly outside this gap
Lifetime
Lifetime is calculated from input size
Basically, size segment [MinSize, MaxSize] is compressed to [0,1], raised to LifetimeExponent power and then stretched to [MinLifetime,MaxLifetime]
So, MinSize corresponds to MinLifetime and MaxSize to MaxLifetime
LifetimeExponent controls how much faster smaller splashes dry than large ones
lifetime is clamped to [MinLifetime,MaxLifetime] so size < MinSize transforms to MinLifetime
Last edited by Nupaska; 19 Jun @ 2:23am