Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
filteringbottle.c
Go to the documentation of this file.
2{
3 const float DAMAGE_CONSUME_PER_ML = 0.01;
4 const float DAMAGE_OVERHEAT_PER_S = 1;
5 const float DAMAGE_ENVIRO_LIQUID_COEF_MIN = 1;
6 const float DAMAGE_ENVIRO_LIQUID_COEF_MAX = 1.5;
7 const float DAMAGE_ENVIRO_TEMPDIFF_MIN = 80; //min damage at this demperature diff
8 const float DAMAGE_ENVIRO_TEMPDIFF_MAX = 10; //maximum damage at this demperature diff
9
10 override string GetPouringSoundset()
11 {
12 return "emptyVessle_WaterBottle_SoundSet";
13 }
14
15 override string GetEmptyingLoopSoundsetHard()
16 {
17 return "pour_HardGround_WatterBottle_SoundSet";
18 }
19
20 override string GetEmptyingLoopSoundsetSoft()
21 {
22 return "pour_SoftGround_WatterBottle_SoundSet";
23 }
24
25 override string GetEmptyingLoopSoundsetWater()
26 {
27 return "pour_Water_WatterBottle_SoundSet";
28 }
29
30 override string GetEmptyingEndSoundsetHard()
31 {
32 return "pour_End_HardGround_WatterBottle_SoundSet";
33 }
34
35 override string GetEmptyingEndSoundsetSoft()
36 {
37 return "pour_End_SoftGround_WatterBottle_SoundSet";
38 }
39
40 override string GetEmptyingEndSoundsetWater()
41 {
42 return "pour_End_Water_WatterBottle_SoundSet";
43 }
44
45 override bool CanPutInCargo( EntityAI parent )
46 {
47 if( !super.CanPutInCargo(parent) ) {return false;}
48 if ( parent && (parent.IsKindOf("WatterBottle"))/* && !(parent.IsKindOf("Container_Base"))*/)
49 {
50 return false;
51 }
52
53 return true;
54 }
55
56 override bool IsOpen()
57 {
58 return true;
59 }
60
61 override int FilterAgents(int agentsIn)
62 {
63 int agentsOut = agentsIn & (~eAgents.HEAVYMETAL) & (~eAgents.CHOLERA);
64
65 return agentsOut;
66 }
67
68 override void OnConsume(float amount, PlayerBase consumer)
69 {
70 super.OnConsume(amount,consumer);
71
72 DamageBottleConsume(amount,consumer);
73 }
74
75 protected void DamageBottleConsume(float amount, PlayerBase consumer)
76 {
77 DecreaseHealth(amount * DAMAGE_CONSUME_PER_ML,false);
78 }
79
80 override void AffectLiquidContainerOnFill(int liquid_type, float amount)
81 {
82 float liquidTemperature = GetGame().GetMission().GetWorldData().GetLiquidTypeEnviroTemperature(liquid_type);
83 if (liquidTemperature >= GetTemperatureMax())
84 {
85 float temperatureDiff = liquidTemperature - GetTemperature();
86 float tTime = Math.Clamp(Math.InverseLerp(DAMAGE_ENVIRO_TEMPDIFF_MIN,DAMAGE_ENVIRO_TEMPDIFF_MAX,temperatureDiff),0,1);
87 float temperatureDiffCoef = Math.Lerp(DAMAGE_ENVIRO_LIQUID_COEF_MIN,DAMAGE_ENVIRO_LIQUID_COEF_MAX,tTime);
88 float damageVal = GetMaxHealth("","Health") / GetQuantityMax();
89 DecreaseHealth(amount * damageVal * temperatureDiffCoef,false);
90 }
91 }
92
93 override void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
94 {
95 //does damage if receiving scalding liquid
96 if (sourceLiquidTemperature >= GetItemOverheatThreshold())
97 {
98 float temperatureDiff = sourceLiquidTemperature - GetTemperature();
99 float tTime = Math.Clamp(Math.InverseLerp(DAMAGE_ENVIRO_TEMPDIFF_MIN,DAMAGE_ENVIRO_TEMPDIFF_MAX,temperatureDiff),0,1);
100 float temperatureDiffCoef = Math.Lerp(DAMAGE_ENVIRO_LIQUID_COEF_MIN,DAMAGE_ENVIRO_LIQUID_COEF_MAX,tTime);
101 float damageVal = GetMaxHealth("","Health") / GetQuantityMax();
102 DecreaseHealth(amount * damageVal * temperatureDiffCoef,false);
103 }
104 }
105
108 {
109 return GetTemperatureMax();
110 }
111};
override float GetItemOverheatThreshold()
disregards liquid boil threshold if filled
override void AffectLiquidContainerOnFill(int liquid_type, float amount)
override void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
void DamageBottleConsume(float amount, PlayerBase consumer)
Definition enmath.c:7
float GetLiquidTypeEnviroTemperature(int liquidType)
Definition worlddata.c:228
eAgents
Definition eagents.c:3
float GetTemperature()
proto native CGame GetGame()
override int GetQuantityMax()
Definition itembase.c:8248