DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CanReceiveUpgrade()

override bool GetBurningMaterial::CanReceiveUpgrade ( )

См. определение в файле Broom.c строка 154

155{
156 override void Init()
157 {
158 super.Init();
159 m_DecraftResult = "LongWoodenStick";
160 m_ParticleLocalPos = Vector(0, 1.2, 0);
161 }
162
163 override void SetActions()
164 {
165 super.SetActions();
166
169 }
170
171 override bool CanReceiveUpgrade()
172 {
173 return false;
174 }
175
176 override void OnWorkStart()
177 {
178 super.OnWorkStart();
180 }
181
182 override void ApplyResultModifications(ItemBase result)
183 {
184 result.SetHealth(result.GetHealthLevelValue(2,""));
185 result.SetQuantity(1);
186 }
187
188 override bool CanTransformIntoStick()
189 {
190 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
191 return true;
192 else
193 return false;
194 }
195
196
197 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
198 {
199 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
200
201 GetCompEM().SetEnergy0To1(GetHealth01("",""));
202 }
203
204
205 override void CalculateQuantity()
206 {
207 if (GetGame().IsServer())
208 {
209 float currentHealth01 = GetHealth01();
210 float currentEnergy01 = GetCompEM().GetEnergy0To1();
211
212 //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)
213 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
214 //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
215 GetCompEM().SetEnergy0To1(GetHealth01());
216 }
217 }
218
219 override void UpdateParticle()
220 {
221 float normalizedQuant = GetQuantity() / GetQuantityMax();
222
223 if (!m_FireParticle)
224 {
225 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
226 }
227 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
228 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
229 if (m_FireParticle)
230 {
231 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
232
233 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
234 }
235 }
236
237 // DEBUG BELLOW
238 void DebugSetHealthAndEnergy(float time)
239 {
240 float max_energy = GetCompEM().GetEnergyMaxPristine();
241 float health01 = Math.InverseLerp(0, max_energy, time);
242 SetHealth01("","", health01);
243 GetCompEM().SetEnergy( time );
244 }
245
246 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
247 {
248 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
249 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
250 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
251 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
252 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
253
254 super.GetDebugActions(outputList);
255 }
256
257 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
258 {
259 if (super.OnAction(action_id, player, ctx))
260 return true;
261 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
262 {
263 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
264 {
266 OnIgnitedThis(null);
267 }
268 else if (action_id == EActions.BROOM_BURN_SHORT)
269 {
271 OnIgnitedThis(null);
272 }
273 else if (action_id == EActions.BROOM_BURN_MEDIUM)
274 {
276 OnIgnitedThis(null);
277 }
278 else if (action_id == EActions.BROOM_BURN_LONG)
279 {
280 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
281 OnIgnitedThis(null);
282 }
283 }
284 return false;
285 }
286
287}
288
289class Broom: BroomBase
290{
291 override string GetBurningMaterial()
292 {
293 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
294 }
295
296 override string GetBurntMaterial()
297 {
298 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
299 }
300}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
override void UpdateParticle()
Определения Broom.c:202
override void CalculateQuantity()
Определения Broom.c:188
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения Broom.c:229
override bool CanReceiveUpgrade()
Определения Broom.c:154
override void SetActions()
Определения Broom.c:146
override void OnWorkStart()
Определения Broom.c:159
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения Broom.c:240
override bool CanTransformIntoStick()
Определения Broom.c:171
override void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
Определения Broom.c:139
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения Broom.c:180
void DebugSetHealthAndEnergy(float time)
Определения Broom.c:221
override void ApplyResultModifications(ItemBase result)
Определения Broom.c:165
EActions
Определения EActions.c:2
override void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
Определения FireworksBase.c:96
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
Определения Broom.c:2
Определения Building.c:6
override void SetActions()
Определения Torch.c:754
string GetBurningMaterial()
Определения Torch.c:796
string GetBurntMaterial()
Определения Torch.c:801
Определения Torch.c:2
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