DayZ 1.24
Loading...
Searching...
No Matches
Broom.c
Go to the documentation of this file.
2{
3 override void Init()
4 {
5 super.Init();
6 m_DecraftResult = "LongWoodenStick";
7 m_ParticleLocalPos = Vector(0, 1.2, 0);
8 }
9
10 override void SetActions()
11 {
12 super.SetActions();
13
16 }
17
18 override bool CanReceiveUpgrade()
19 {
20 return false;
21 }
22
23 override void OnWorkStart()
24 {
25 super.OnWorkStart();
27 }
28
30 {
31 result.SetHealth(result.GetHealthLevelValue(2, ""));
32 result.SetQuantity(1);
33 }
34
35 override bool CanTransformIntoStick()
36 {
37 if (GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
38 return true;
39 else
40 return false;
41 }
42
43
45 {
47
48 GetCompEM().SetEnergy0To1(GetHealth01("", ""));
49 }
50
51
52 override void CalculateQuantity()
53 {
54 if (GetGame().IsServer())
55 {
56 float currentHealth01 = GetHealth01();
57 float currentEnergy01 = GetCompEM().GetEnergy0To1();
58
59 //Health needs to copy internal energy, but only if that means it will be going down from its current value(the item can't heal itself after obtaining damage just because it has full internal energy)
60 SetHealth01("", "", Math.Min(currentHealth01, currentEnergy01));
61 //Energy needs to copy health, but only if it is higher(in 01 terms) than health, that means if an item with full energy gets damaged and lit, the internal energy needs to be adjusted to follow the health. Situations where internal energy is lower than health are handled on the line above
62 GetCompEM().SetEnergy0To1(GetHealth01());
63 }
64 }
65
66 override void UpdateParticle()
67 {
69
70 if (!m_FireParticle)
75 {
76 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
77
79 }
80 }
81
82 // DEBUG BELLOW
84 {
85 float max_energy = GetCompEM().GetEnergyMaxPristine();
87 SetHealth01("", "", health01);
88 GetCompEM().SetEnergy(time);
89 }
90
92 {
93 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
94 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
95 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
96 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
97 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
98
99 super.GetDebugActions(outputList);
100 }
101
103 {
104 if (super.OnAction(action_id, player, ctx))
105 return true;
106 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
107 {
108 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
109 {
112 }
113 else if (action_id == EActions.BROOM_BURN_SHORT)
114 {
117 }
118 else if (action_id == EActions.BROOM_BURN_MEDIUM)
119 {
122 }
123 else if (action_id == EActions.BROOM_BURN_LONG)
124 {
125 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
127 }
128 }
129 return false;
130 }
131
132}
133
134class Broom: BroomBase
135{
136 override string GetBurningMaterial()
138 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
139 }
140
141 override string GetBurntMaterial()
142 {
143 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
145};
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
void AddAction(typename actionName)
override string GetBurntMaterial()
Definition Broom.c:141
BroomBase FlammableBase GetBurningMaterial()
Definition Broom.c:136
EActions
Definition EActions.c:2
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override float GetQuantity()
Definition ItemBase.c:7995
float GetEnergy()
Definition ItemBase.c:8140
override int GetQuantityMax()
Definition ItemBase.c:7941
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
override void ApplyResultModifications(ItemBase result)
Definition Broom.c:29
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition Broom.c:91
override bool CanReceiveUpgrade()
Definition Broom.c:18
override void SetActions()
Definition Broom.c:10
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition Broom.c:44
override void CalculateQuantity()
Definition Broom.c:52
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition Broom.c:102
override void Init()
Definition Broom.c:3
override void OnWorkStart()
Definition Broom.c:23
void DebugSetHealthAndEnergy(float time)
Definition Broom.c:83
override void UpdateParticle()
Definition Broom.c:66
override bool CanTransformIntoStick()
Definition Broom.c:35
vector m_ParticleLocalPos
Definition Torch.c:23
override bool IsIgnited()
Definition Torch.c:129
override void OnIgnitedThis(EntityAI fire_source)
Definition Torch.c:190
Particle m_FireParticle
Definition Torch.c:9
string m_DecraftResult
Definition Torch.c:25
Definition EnMath.c:7
void ScaleParticleParamFromOriginal(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their ORIGINAL value.
Definition Particle.c:646
static const int BROOM_TORCH_T1
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
EmitorParam
Definition EnVisual.c:114
const int SAT_DEBUG_ACTION
Definition constants.c:424