Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
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;
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
15 {
16 return "pour_HardGround_WatterBottle_SoundSet";
17 }
18
20 {
21 return "pour_SoftGround_WatterBottle_SoundSet";
22 }
23
25 {
26 return "pour_Water_WatterBottle_SoundSet";
27 }
28
30 {
31 return "pour_End_HardGround_WatterBottle_SoundSet";
32 }
33
35 {
36 return "pour_End_SoftGround_WatterBottle_SoundSet";
37 }
38
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 = g_Game.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 = g_Game.GetMission().GetWorldData().GetLiquidTypeEnviroTemperature(liquid_type);
85 if (liquidTemperature >= GetItemOverheatThreshold())
86 {
87 float temperatureDiff = liquidTemperature - GetTemperature();
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();
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
110 {
111 return GetTemperatureMax();
112 }
113}
override string GetEmptyingEndSoundsetSoft()
Definition waterbottle.c:34
const float DAMAGE_ENVIRO_TEMPDIFF_MIN
Definition waterbottle.c:6
override bool IsOpen()
Definition waterbottle.c:55
override void OnDebugSpawn()
Definition waterbottle.c:75
override float GetItemOverheatThreshold()
disregards liquid boil threshold if filled
const float DAMAGE_ENVIRO_TEMPDIFF_MAX
Definition waterbottle.c:7
override string GetEmptyingEndSoundsetHard()
Definition waterbottle.c:29
override string GetPouringSoundset()
Definition waterbottle.c:9
override bool CanPutInCargo(EntityAI parent)
Definition waterbottle.c:44
override void EEOnCECreate()
Definition waterbottle.c:60
const float DAMAGE_ENVIRO_LIQUID_COEF_MAX
Definition waterbottle.c:5
override string GetEmptyingLoopSoundsetWater()
Definition waterbottle.c:24
override string GetEmptyingEndSoundsetWater()
Definition waterbottle.c:39
const float DAMAGE_ENVIRO_LIQUID_COEF_MIN
Definition waterbottle.c:4
override void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
Definition waterbottle.c:95
override void AffectLiquidContainerOnFill(int liquid_type, float amount)
Definition waterbottle.c:82
const float DAMAGE_OVERHEAT_PER_S
Definition waterbottle.c:3
override string GetEmptyingLoopSoundsetSoft()
Definition waterbottle.c:19
override string GetEmptyingLoopSoundsetHard()
Definition waterbottle.c:14
Definition enmath.c:7
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
float GetAgentSpawnChance(eAgents agent)
Definition worlddata.c:254
DayZGame g_Game
Definition dayzgame.c:3942
eAgents
Definition eagents.c:3
float GetTemperature()
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
override void InsertAgent(int agent, float count=1)
Definition itembase.c:8895
override int GetQuantityMax()
Definition itembase.c:8349