DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Broom.c
См. документацию.
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
29 override void ApplyResultModifications(ItemBase result)
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
44 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
45 {
46 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
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 {
68 float normalizedQuant = GetQuantity() / GetQuantityMax();
69
70 if (!m_FireParticle)
71 {
73 }
74 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
75 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
77 {
78 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
79
80 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
81 }
82 }
83
84 // DEBUG BELLOW
85 void DebugSetHealthAndEnergy(float time)
86 {
87 float max_energy = GetCompEM().GetEnergyMaxPristine();
88 float health01 = Math.InverseLerp(0, max_energy, time);
89 SetHealth01("","", health01);
90 GetCompEM().SetEnergy( time );
91 }
92
93 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
94 {
95 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
96 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
97 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
98 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
99 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
100
101 super.GetDebugActions(outputList);
102 }
103
104 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
105 {
106 if (super.OnAction(action_id, player, ctx))
107 return true;
108 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
109 {
110 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
111 {
113 OnIgnitedThis(null);
114 }
115 else if (action_id == EActions.BROOM_BURN_SHORT)
116 {
118 OnIgnitedThis(null);
119 }
120 else if (action_id == EActions.BROOM_BURN_MEDIUM)
121 {
123 OnIgnitedThis(null);
124 }
125 else if (action_id == EActions.BROOM_BURN_LONG)
126 {
127 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
128 OnIgnitedThis(null);
129 }
130 }
131 return false;
132 }
133
134}
135
136class Broom: BroomBase
137{
138 override string GetBurningMaterial()
140 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
141 }
142
143 override string GetBurntMaterial()
144 {
145 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
147};
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
EActions
Определения EActions.c:2
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override float GetQuantity()
Определения ItemBase.c:8154
float GetEnergy()
Определения ItemBase.c:8278
override int GetQuantityMax()
Определения ItemBase.c:8106
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
override void ApplyResultModifications(ItemBase result)
Определения Broom.c:29
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения Broom.c:93
override bool CanReceiveUpgrade()
Определения Broom.c:18
override void SetActions()
Определения Broom.c:10
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения Broom.c:44
override void CalculateQuantity()
Определения Broom.c:52
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения Broom.c:104
override void Init()
Определения Broom.c:3
override void OnWorkStart()
Определения Broom.c:23
void DebugSetHealthAndEnergy(float time)
Определения Broom.c:85
override void UpdateParticle()
Определения Broom.c:66
override bool CanTransformIntoStick()
Определения Broom.c:35
Определения Broom.c:2
Определения Building.c:6
void FlammableBase()
Определения Torch.c:3
vector m_ParticleLocalPos
Определения Torch.c:23
override bool IsIgnited()
Определения Torch.c:134
override void OnIgnitedThis(EntityAI fire_source)
Определения Torch.c:197
string GetBurningMaterial()
Определения Torch.c:796
Particle m_FireParticle
Определения Torch.c:9
string m_DecraftResult
Определения Torch.c:25
string GetBurntMaterial()
Определения Torch.c:801
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
Определения InventoryItem.c:731
Определения EnMath.c:7
static const int BROOM_TORCH_T1
Определения ParticleList.c:78
Определения ParticleList.c:12
Определения DamageSystem.c:2
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
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
Определения EnVisual.c:114
const int SAT_DEBUG_ACTION
Определения constants.c:452