Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
barrelholes_colorbase.c
Go to the documentation of this file.
2{
3 //Visual animations
4 const string ANIMATION_OPENED = "LidOff";
5 const string ANIMATION_CLOSED = "LidOn";
6
7 protected bool m_IsOpenedClient = false;
8
10
12 {
13 //Particles - default for FireplaceBase
21
22 m_Openable = new OpenableBehaviour(false);
23
24 //synchronized variables
25 RegisterNetSyncVariableBool("m_Openable.m_IsOpened");
26
27 ProcessInvulnerabilityCheck(GetInvulnerabilityTypeString());
28
29 m_LightDistance = 50;
30
33 m_UTSSettings.m_TemperatureCap = 20;
34
35 m_UnderObjectDecalSpawnSettings.m_ScaleMax = 0.44;
36
38 }
39
48
49 override bool CanCookOnStick()
50 {
51 return false;
52 }
53
54 override bool IsBaseFireplace()
55 {
56 return true;
57 }
58
59 override void CreateAreaDamage()
60 {
62
64 m_AreaDamage.SetDamageComponentType(AreaDamageComponentTypes.HITZONE);
65 m_AreaDamage.SetExtents("-0.15 0 -0.15", "0.15 0.75 0.15");
66 m_AreaDamage.SetLoopInterval(0.5);
67 m_AreaDamage.SetDeferDuration(0.5);
68 m_AreaDamage.SetHitZones({"Head","Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot"});
69 m_AreaDamage.SetAmmoName("FireDamage");
70 m_AreaDamage.Spawn();
71 }
72
74 {
75 return 110;
76 }
77
79 {
80 return "disableContainerDamage";
81 }
82
83 override void OnWasAttached(EntityAI parent, int slot_id)
84 {
85 super.OnWasAttached(parent, slot_id);
86
87 Open();
88 }
89
90 override void OnWasDetached(EntityAI parent, int slot_id)
91 {
92 super.OnWasDetached(parent, slot_id);
93
94 Close();
95 }
96
97 override bool CanDetachAttachment(EntityAI parent)
98 {
99 return GetNumberOfItems() == 0;
100 }
101
102
104 {
105 super.OnStoreSave(ctx);
106
107 ctx.Write(m_Openable.IsOpened());
108 }
109
110 override bool OnStoreLoad(ParamsReadContext ctx, int version)
111 {
112 if (!super.OnStoreLoad(ctx, version))
113 return false;
114
115 bool opened;
116 if (version >= 110 && !ctx.Read(opened))
117 {
118 return false;
119 }
120
121 if (opened)
122 {
123 OpenLoad();
124 }
125 else
126 {
127 CloseLoad();
128 }
129
130 return true;
131 }
132
133 override bool IsBarrelWithHoles()
134 {
135 return true;
136 }
137
139 {
140 super.OnVariablesSynchronized();
141
142 if (!IsBeingPlaced())
143 {
144 //Refresh particles and sounds
146 }
147
149 }
150
151 //ATTACHMENTS
152 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
153 {
154 ItemBase item = ItemBase.Cast(attachment);
155
156 if (GetHealthLevel() == GameConstants.STATE_RUINED || GetHierarchyRootPlayer() != null)
157 return false;
158
159 //direct cooking slots
160 if (!IsOpen())
161 {
162 if ((item.Type() == ATTACHMENT_CAULDRON) || (item.Type() == ATTACHMENT_COOKING_POT) || (item.Type() == ATTACHMENT_FRYING_PAN) || (item.IsKindOf("Edible_Base")))
163 {
164 return super.CanReceiveAttachment(attachment, slotId);
165 }
166 }
167 else
168 {
169 if (IsKindling(item) || IsFuel(item))
170 {
171 return super.CanReceiveAttachment(attachment, slotId);
172 }
173 }
174
175 return false;
176 }
177
178 override bool CanLoadAttachment(EntityAI attachment)
179 {
180 ItemBase item = ItemBase.Cast(attachment);
181
182 if (GetHealthLevel() == GameConstants.STATE_RUINED)
183 return false;
184
185 return super.CanLoadAttachment(attachment);
186 }
187
188 override void EEItemAttached(EntityAI item, string slot_name)
189 {
190 super.EEItemAttached(item, slot_name);
191
192 ItemBase item_base = ItemBase.Cast(item);
193
194 if (IsKindling(item_base) || IsFuel(item_base))
195 {
196 AddToFireConsumables(item_base);
197 }
198
199 // direct cooking/smoking slots
200 bool edible_base_attached = false;
201 switch (slot_name)
202 {
203 case "DirectCookingA":
204 m_DirectCookingSlots[0] = item_base;
205 edible_base_attached = true;
206 break;
207 case "DirectCookingB":
208 m_DirectCookingSlots[1] = item_base;
209 edible_base_attached = true;
210 break;
211 case "DirectCookingC":
212 m_DirectCookingSlots[2] = item_base;
213 edible_base_attached = true;
214 break;
215
216 case "SmokingA":
217 m_SmokingSlots[0] = item_base;
218 edible_base_attached = true;
219 break;
220 case "SmokingB":
221 m_SmokingSlots[1] = item_base;
222 edible_base_attached = true;
223 break;
224 case "SmokingC":
225 m_SmokingSlots[2] = item_base;
226 edible_base_attached = true;
227 break;
228 case "SmokingD":
229 m_SmokingSlots[3] = item_base;
230 edible_base_attached = true;
231 break;
232 }
233
235 }
236
237 override bool IsPrepareToDelete()
238 {
239 return false;
240 }
241
242 override void EEItemDetached(EntityAI item, string slot_name)
243 {
244 super.EEItemDetached(item, slot_name);
245
246 ItemBase item_base = ItemBase.Cast(item);
247 if (IsKindling(item_base) || IsFuel(item_base))
248 {
250 }
251
252 // direct cooking / smoking slots
253 switch (slot_name)
254 {
255 case "DirectCookingA":
256 m_DirectCookingSlots[0] = null;
257 break;
258 case "DirectCookingB":
259 m_DirectCookingSlots[1] = null;
260 break;
261 case "DirectCookingC":
262 m_DirectCookingSlots[2] = null;
263 break;
264
265 case "SmokingA":
266 m_SmokingSlots[0] = null;
267 break;
268 case "SmokingB":
269 m_SmokingSlots[1] = null;
270 break;
271 case "SmokingC":
272 m_SmokingSlots[2] = null;
273 break;
274 case "SmokingD":
275 m_SmokingSlots[3] = null;
276 break;
277 }
278
279 if (item_base.IsCookware())
280 {
281 ClearCookingEquipment(item_base);
282 item_base.RemoveAudioVisualsOnClient();
283 }
284
285 if (item_base.IsLiquidContainer()) //boiling bottle effects stop
286 item_base.RemoveAudioVisualsOnClient();
287
289 }
290
291 //CONDITIONS
292 //this into/outo parent.Cargo
293 override bool CanPutInCargo(EntityAI parent)
294 {
295 if (!super.CanPutInCargo(parent) || parent.Type().IsInherited(Barrel_ColorBase) || parent.Type().IsInherited(BarrelHoles_ColorBase))
296 return false;
297
299 return false;
300
301 return true;
302 }
303
304 override bool CanRemoveFromCargo(EntityAI parent)
305 {
306 return true;
307 }
308
309 //cargo item into/outo this.Cargo
311 {
312 if (GetHealthLevel() == GameConstants.STATE_RUINED)
313 return false;
314
315 if (!IsOpen())
316 return false;
317
318 return super.CanReceiveItemIntoCargo(item);
319 }
320
321 override bool CanLoadItemIntoCargo(EntityAI item)
322 {
323 if (!super.CanLoadItemIntoCargo(item))
324 return false;
325
326 if (GetHealthLevel() == GameConstants.STATE_RUINED)
327 return false;
328
329 return true;
330 }
331
332 override bool CanReleaseCargo(EntityAI cargo)
333 {
334 return IsOpen();
335 }
336
337 //hands
338 override bool CanPutIntoHands(EntityAI parent)
339 {
340 if (!super.CanPutIntoHands(parent))
341 {
342 return false;
343 }
344
346 {
347 return false;
348 }
349
350 if (!GetInventory().IsAttachment() && IsOpen())
351 {
352 return false;
353 }
354
355 return true;
356 }
357
358 //INVENTORY DISPLAY CONDITIONS
359 override bool CanDisplayCargo()
360 {
361 //super
362 if (!super.CanDisplayCargo())
363 {
364 return false;
365 }
366 //
367
368 return IsOpen();
369 }
370
371 override bool CanDisplayAttachmentCategory(string category_name)
372 {
373 //super
374 if (!super.CanDisplayAttachmentCategory(category_name))
375 {
376 return false;
377 }
378 //
379
380 if ((category_name == "CookingEquipment") || (category_name == "Smoking"))
381 {
382 return !IsOpen();
383 }
384 else
385 {
386 return IsOpen();
387 }
388
389 return true;
390 }
391 // ---
392
393 //ACTIONS
394 override void Open()
395 {
396 m_Openable.Open();
397
398 SetTakeable(false);
400 }
401
402 void OpenLoad()
403 {
404 m_Openable.Open();
405
406 SetSynchDirty();
407 SetTakeable(false);
409 }
410
411 override void Close()
412 {
413 m_Openable.Close();
414
415 SetTakeable(true);
417 }
418
420 {
421 m_Openable.Close();
422
423 SetSynchDirty();
424 SetTakeable(true);
426 }
427
428 override bool IsOpen()
429 {
430 return m_Openable.IsOpened();
431 }
432
433 protected void UpdateVisualState()
434 {
435 if (IsOpen())
436 {
437 SetAnimationPhase(ANIMATION_OPENED, 0);
438 SetAnimationPhase(ANIMATION_CLOSED, 1);
439 }
440 else
441 {
442 SetAnimationPhase(ANIMATION_OPENED, 1);
443 SetAnimationPhase(ANIMATION_CLOSED, 0);
444 }
445 }
446
447 //Can extinguish fire
448 override bool CanExtinguishFire()
449 {
450 if (IsOpen() && IsBurning())
451 {
452 return true;
453 }
454
455 return false;
456 }
457
458 //particles
459 override bool CanShowSmoke()
460 {
461 return IsOpen();
462 }
463
464 // Item-to-item fire distribution
465 override bool HasFlammableMaterial()
466 {
467 return true;
468 }
469
470 override bool CanBeIgnitedBy(EntityAI igniter = NULL)
471 {
472 if (HasAnyKindling() && !IsBurning() && IsOpen() && !GetHierarchyParent())
473 {
474 return true;
475 }
476
477 return false;
478 }
479
480 override bool CanIgniteItem(EntityAI ignite_target = NULL)
481 {
482 if (IsBurning() && IsOpen())
483 {
484 return true;
485 }
486
487 return false;
488 }
489
490 override bool IsIgnited()
491 {
492 return IsBurning();
493 }
494
495 override void OnIgnitedTarget(EntityAI target_item)
496 {
497 }
498
499 override void OnIgnitedThis(EntityAI fire_source)
500 {
501 //remove grass
502 Object cc_object = g_Game.CreateObjectEx(OBJECT_CLUTTER_CUTTER , GetPosition(), ECE_PLACE_ON_SURFACE);
503 cc_object.SetOrientation (GetOrientation());
504 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DestroyClutterCutter, 0.2, false, cc_object);
505
506 //start fire
507 StartFire();
508 }
509
510 void DestroyClutterCutter(Object clutter_cutter)
511 {
512 g_Game.ObjectDelete(clutter_cutter);
513 }
514
515 override bool IsThisIgnitionSuccessful(EntityAI item_source = NULL)
516 {
517 //check kindling
518 if (!HasAnyKindling() && IsOpen())
519 {
520 return false;
521 }
522
523 //check surface
524 if (IsOnWaterSurface())
525 {
526 return false;
527 }
528
529 return true;
530 }
531
533 {
534 return "barrel_open_SoundSet";
535 }
536
538 {
539 return "barrel_close_SoundSet";
540 }
541
542 override string GetDeploySoundset()
543 {
544 return "placeBarrel_SoundSet";
545 }
546
547 override void InitItemSounds()
548 {
549 super.InitItemSounds();
550
552
553 if (GetBarrelOpenSoundset() != string.Empty)
554 handler.AddSound(SoundConstants.ITEM_BARREL_OPEN, GetBarrelOpenSoundset());
555
556 if (GetBarrelCloseSoundset() != string.Empty)
557 handler.AddSound(SoundConstants.ITEM_BARREL_CLOSE, GetBarrelCloseSoundset());
558 }
559
570
571 override void OnDebugSpawn()
572 {
573 m_Openable.Open();
574 super.OnDebugSpawn();
575 m_Openable.Close();
576 }
577
578 // DEPRECATED
581}
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
void AddAction(typename actionName)
vector GetOrientation()
override string GetInvulnerabilityTypeString()
const int ECE_PLACE_ON_SURFACE
Open
Implementations only.
Deferred version of AreaDamageLooped.
override bool IsOpen()
override void OnDebugSpawn()
override bool CanDisplayAttachmentCategory(string category_name)
override string GetDeploySoundset()
override bool IsBarrelWithHoles()
override bool CanCookOnStick()
override bool IsBaseFireplace()
override bool CanDisplayCargo()
override void OnStoreSave(ParamsWriteContext ctx)
void SoundBarrelOpenPlay()
override bool CanReceiveItemIntoCargo(EntityAI item)
const string ANIMATION_CLOSED
override bool CanLoadItemIntoCargo(EntityAI item)
override bool CanExtinguishFire()
override bool CanBeIgnitedBy(EntityAI igniter=NULL)
override bool CanPutInCargo(EntityAI parent)
override bool IsIgnited()
void SoundBarrelClosePlay()
override bool CanReleaseCargo(EntityAI cargo)
override void EEItemDetached(EntityAI item, string slot_name)
override void OnIgnitedThis(EntityAI fire_source)
override int GetDamageSystemVersionChange()
override bool CanIgniteItem(EntityAI ignite_target=NULL)
override void CreateAreaDamage()
override bool IsThisIgnitionSuccessful(EntityAI item_source=NULL)
const string ANIMATION_OPENED
override void OnWasDetached(EntityAI parent, int slot_id)
override bool CanPutIntoHands(EntityAI parent)
ref OpenableBehaviour m_Openable
override bool CanRemoveFromCargo(EntityAI parent)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void Close()
override bool HasFlammableMaterial()
override void EEItemAttached(EntityAI item, string slot_name)
override bool IsPrepareToDelete()
void DestroyClutterCutter(Object clutter_cutter)
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanShowSmoke()
override void OnVariablesSynchronized()
override void OnIgnitedTarget(EntityAI target_item)
override bool CanDetachAttachment(EntityAI parent)
override void Open()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanLoadAttachment(EntityAI attachment)
override string GetInvulnerabilityTypeString()
override void InitItemSounds()
override void SetActions()
void InitializeTemperatureSources()
override bool CanLoadAttachment(EntityAI attachment)
static const int BARREL_NORMAL_SMOKE
static const int BARREL_NORMAL_FIRE
static const int BARREL_FIRE_END
static const int BARREL_FIRE_START
static const int BARREL_SMALL_SMOKE
static const int BARREL_SMALL_FIRE
static const int BARREL_FIRE_STEAM_2END
proto bool Write(void value_out)
proto bool Read(void value_in)
original Timer deletes m_params which is unwanted
DayZGame g_Game
Definition dayzgame.c:3942
void RefreshFireplaceVisuals()
void RemoveFromFireConsumables(FireConsumable fire_consumable)
ref UniversalTemperatureSourceSettings m_UTSSettings
bool HasAnyKindling()
bool SmokingSlotsInUse()
bool DirectCookingSlotsInUse()
ATTACHMENT_FRYING_PAN
ATTACHMENT_CAULDRON
float m_LightDistance
ref UnderObjectDecalSpawnSettings m_UnderObjectDecalSpawnSettings
void AddToFireConsumables(ItemBase item)
int PARTICLE_STEAM_END
int PARTICLE_NORMAL_FIRE
bool IsOnWaterSurface()
const string OBJECT_CLUTTER_CUTTER
int PARTICLE_FIRE_START
bool IsCargoEmpty()
bool IsFuel(ItemBase item)
Returns if item attached to fireplace is fuel.
void RefreshFireParticlesAndSounds(bool force_refresh)
ref AreaDamageManager m_AreaDamage
const float PARAM_SMALL_FIRE_TEMPERATURE
int PARTICLE_NORMAL_SMOKE
void DestroyAreaDamage()
ATTACHMENT_COOKING_POT
bool IsBurning()
void StartFire(bool force_start=false)
ItemBase m_DirectCookingSlots[DIRECT_COOKING_SLOT_COUNT]
int PARTICLE_FIRE_END
ref UniversalTemperatureSourceLambdaFireplace m_UTSLFireplace
ref UniversalTemperatureSource m_UTSource
int PARTICLE_SMALL_SMOKE
void ClearCookingEquipment()
DEPRECATED.
FireConsumable GetFireConsumableByItem(ItemBase item)
ItemBase m_SmokingSlots[SMOKING_SLOT_COUNT]
bool IsKindling(ItemBase item)
Returns if item attached to fireplace is kindling.
bool m_ThawnSurfaceUnderSupport
size of wetness increment (per FP heating tick) added to overall FP wetness when ignited on wet surfa...
int PARTICLE_SMALL_FIRE
const float PARAM_OUTDOOR_FIRE_TEMPERATURE
maximum fireplace temperature of a normal fire (degree Celsius)
Serializer ParamsReadContext
Definition gameplay.c:15
Serializer ParamsWriteContext
Definition gameplay.c:16
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Definition constants.c:811
const int STATE_RUINED
Definition constants.c:851
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
Empty
Definition hand_states.c:14
bool IsOpen()
Definition itembase.c:9038
ItemSoundHandler GetItemSoundHandler()
Definition itembase.c:9329
override bool IsBeingPlaced()
Definition itembase.c:5869
override void SetTakeable(bool pState)
Definition itembase.c:9284
void Close()
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Definition itembase.c:8462
void ItemSoundHandler(ItemBase parent)