Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
waterbottle.c
Go to the documentation of this file.
1class WaterBottle extends Bottle_Base
2{
3 const float DAMAGE_OVERHEAT_PER_S = 0.1;
4 const float DAMAGE_ENVIRO_LIQUID_COEF_MIN = 1;
5 const float DAMAGE_ENVIRO_LIQUID_COEF_MAX = 2;
6 const float DAMAGE_ENVIRO_TEMPDIFF_MIN = 80; //min damage at this demperature diff
7 const float DAMAGE_ENVIRO_TEMPDIFF_MAX = 10; //maximum damage at this demperature diff
8
9 override string GetPouringSoundset()
10 {
11 return "emptyVessle_WaterBottle_SoundSet";
12 }
13
14 override string GetEmptyingLoopSoundsetHard()
15 {
16 return "pour_HardGround_WatterBottle_SoundSet";
17 }
18
19 override string GetEmptyingLoopSoundsetSoft()
20 {
21 return "pour_SoftGround_WatterBottle_SoundSet";
22 }
23
24 override string GetEmptyingLoopSoundsetWater()
25 {
26 return "pour_Water_WatterBottle_SoundSet";
27 }
28
29 override string GetEmptyingEndSoundsetHard()
30 {
31 return "pour_End_HardGround_WatterBottle_SoundSet";
32 }
33
34 override string GetEmptyingEndSoundsetSoft()
35 {
36 return "pour_End_SoftGround_WatterBottle_SoundSet";
37 }
38
39 override string GetEmptyingEndSoundsetWater()
40 {
41 return "pour_End_Water_WatterBottle_SoundSet";
42 }
43
44 override bool CanPutInCargo( EntityAI parent )
45 {
46 if( !super.CanPutInCargo(parent) ) {return false;}
47 if ( parent && (parent.IsKindOf("WatterBottle"))/* && !(parent.IsKindOf("Container_Base"))*/)
48 {
49 return false;
50 }
51
52 return true;
53 }
54
55 override bool IsOpen()
56 {
57 return true;
58 }
59
60 override void EEOnCECreate()
61 {
62 super.EEOnCECreate();
63
64 WorldData data = GetGame().GetMission().GetWorldData();
65 if (data)
66 {
67 float chance = data.GetAgentSpawnChance(eAgents.CHOLERA);
68 int rand = Math.RandomFloat(0, 100);
69
70 if (rand < chance)
71 InsertAgent(eAgents.CHOLERA, 1);
72 }
73 }
74
75 override void OnDebugSpawn()
76 {
77 super.OnDebugSpawn();
78
79 InsertAgent(eAgents.CHOLERA, 1);
80 }
81
82 override void AffectLiquidContainerOnFill(int liquid_type, float amount)
83 {
84 float liquidTemperature = GetGame().GetMission().GetWorldData().GetLiquidTypeEnviroTemperature(liquid_type);
85 if (liquidTemperature >= GetItemOverheatThreshold())
86 {
87 float temperatureDiff = liquidTemperature - GetTemperature();
88 float tTime = Math.Clamp(Math.InverseLerp(DAMAGE_ENVIRO_TEMPDIFF_MIN,DAMAGE_ENVIRO_TEMPDIFF_MAX,temperatureDiff),0,1);
89 float temperatureDiffCoef = Math.Lerp(DAMAGE_ENVIRO_LIQUID_COEF_MIN,DAMAGE_ENVIRO_LIQUID_COEF_MAX,tTime);
90 float damageVal = GetMaxHealth("","Health") / GetQuantityMax();
91 DecreaseHealth(amount * damageVal * temperatureDiffCoef,false);
92 }
93 }
94
95 override void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
96 {
97 //does damage if receiving scalding liquid
98 if (sourceLiquidTemperature >= GetItemOverheatThreshold())
99 {
100 float temperatureDiff = sourceLiquidTemperature - GetTemperature();
101 float tTime = Math.Clamp(Math.InverseLerp(DAMAGE_ENVIRO_TEMPDIFF_MIN,DAMAGE_ENVIRO_TEMPDIFF_MAX,temperatureDiff),0,1);
102 float temperatureDiffCoef = Math.Lerp(DAMAGE_ENVIRO_LIQUID_COEF_MIN,DAMAGE_ENVIRO_LIQUID_COEF_MAX,tTime);
103 float damageVal = GetMaxHealth("","Health") / GetQuantityMax();
104 DecreaseHealth(amount * damageVal * temperatureDiffCoef,false);
105 }
106 }
107
109 override float GetItemOverheatThreshold()
110 {
111 return GetTemperatureMax();
112 }
113}
Definition enmath.c:7
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
float GetAgentSpawnChance(eAgents agent)
Definition worlddata.c:253
float GetLiquidTypeEnviroTemperature(int liquidType)
Definition worlddata.c:228
override void EEOnCECreate()
eAgents
Definition eagents.c:3
float GetTemperature()
override bool CanPutInCargo(EntityAI parent)
proto native CGame GetGame()
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
override void InsertAgent(int agent, float count=1)
Definition itembase.c:8795
bool IsOpen()
Definition itembase.c:8938
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
override float GetItemOverheatThreshold()
Definition itembase.c:9534
override int GetQuantityMax()
Definition itembase.c:8248