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

◆ UpdateParticle()

override void GetBurningMaterial::UpdateParticle ( )

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

203{
204 override void Init()
205 {
206 super.Init();
207 m_DecraftResult = "LongWoodenStick";
208 m_ParticleLocalPos = Vector(0, 1.2, 0);
209 }
210
211 override void SetActions()
212 {
213 super.SetActions();
214
217 }
218
219 override bool CanReceiveUpgrade()
220 {
221 return false;
222 }
223
224 override void OnWorkStart()
225 {
226 super.OnWorkStart();
228 }
229
230 override void ApplyResultModifications(ItemBase result)
231 {
232 result.SetHealth(result.GetHealthLevelValue(2,""));
233 result.SetQuantity(1);
234 }
235
236 override bool CanTransformIntoStick()
237 {
238 if ( GetGame().IsServer() && !IsIgnited() && GetEnergy() < 1 && !IsSetForDeletion())
239 return true;
240 else
241 return false;
242 }
243
244
245 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
246 {
247 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
248
249 GetCompEM().SetEnergy0To1(GetHealth01("",""));
250 }
251
252
253 override void CalculateQuantity()
254 {
255 if (GetGame().IsServer())
256 {
257 float currentHealth01 = GetHealth01();
258 float currentEnergy01 = GetCompEM().GetEnergy0To1();
259
260 //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)
261 SetHealth01("","",Math.Min(currentHealth01,currentEnergy01));
262 //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
263 GetCompEM().SetEnergy0To1(GetHealth01());
264 }
265 }
266
267 override void UpdateParticle()
268 {
269 float normalizedQuant = GetQuantity() / GetQuantityMax();
270
271 if (!m_FireParticle)
272 {
273 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.BROOM_TORCH_T1, this, m_ParticleLocalPos);
274 }
275 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, 1.0);
276 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, 1.0);
277 if (m_FireParticle)
278 {
279 float scale = Math.Max(normalizedQuant * 2.4, 0.4);
280
281 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
282 }
283 }
284
285 // DEBUG BELLOW
286 void DebugSetHealthAndEnergy(float time)
287 {
288 float max_energy = GetCompEM().GetEnergyMaxPristine();
289 float health01 = Math.InverseLerp(0, max_energy, time);
290 SetHealth01("","", health01);
291 GetCompEM().SetEnergy( time );
292 }
293
294 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
295 {
296 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_VERY_SHORT, "SetBurnTimeTo15Secs", FadeColors.LIGHT_GREY));
297 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_SHORT, "SetBurnTimeTo1Min", FadeColors.LIGHT_GREY));
298 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_MEDIUM, "SetBurnTimeTo10Min", FadeColors.LIGHT_GREY));
299 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BROOM_BURN_LONG, "SetBurnTimeToMax", FadeColors.LIGHT_GREY));
300 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
301
302 super.GetDebugActions(outputList);
303 }
304
305 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
306 {
307 if (super.OnAction(action_id, player, ctx))
308 return true;
309 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
310 {
311 if (action_id == EActions.BROOM_BURN_VERY_SHORT)
312 {
314 OnIgnitedThis(null);
315 }
316 else if (action_id == EActions.BROOM_BURN_SHORT)
317 {
319 OnIgnitedThis(null);
320 }
321 else if (action_id == EActions.BROOM_BURN_MEDIUM)
322 {
324 OnIgnitedThis(null);
325 }
326 else if (action_id == EActions.BROOM_BURN_LONG)
327 {
328 DebugSetHealthAndEnergy(GetCompEM().GetEnergyMaxPristine());
329 OnIgnitedThis(null);
330 }
331 }
332 return false;
333 }
334
335}
336
337class Broom: BroomBase
338{
339 override string GetBurningMaterial()
340 {
341 return "DZ\\gear\\tools\\data\\broom_emissive.rvmat";
342 }
343
344 override string GetBurntMaterial()
345 {
346 return "DZ\\gear\\tools\\data\\broom_burn.rvmat";
347 }
348}
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