Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
tentbase.c
Go to the documentation of this file.
1class TentBase extends ItemBase
2{
3 const int OPENING_0 = 1;
4 const int OPENING_1 = 2;
5 const int OPENING_2 = 4;
6 const int OPENING_3 = 8;
7 const int OPENING_4 = 16;
8 const int OPENING_5 = 32;
9 const int OPENING_6 = 64;
10 const int OPENING_7 = 128;
11 const int OPENING_8 = 256;
12 const int OPENING_9 = 512;
13 const int OPENING_10 = 1024;
14 const int OPENING_11 = 2048;
15 const int OPENING_12 = 4096;
16 const int OPENING_13 = 8192;
17 const int OPENING_14 = 16384;
18 const int OPENING_15 = 32768;
19
20 static const int PACKED = 0;
21 static const int PITCHED = 1;
22 const float MAX_PLACEMENT_HEIGHT_DIFF = 1.5;
23
24 protected int m_State;
25 protected int m_StateLocal = -1;
26 protected bool m_IsEntrance;
27 protected bool m_IsWindow;
28 protected bool m_IsToggle;
29 protected bool m_IsBeingPacked = false;
30 protected int m_OpeningMask = 0;
31 protected int m_OpeningMaskLocal = -1;
32
37 protected CamoNet m_CamoNet;
38 protected vector m_HalfExtents; // The Y value contains a heightoffset and not the halfextent !!!
39
40 void TentBase()
41 {
42 m_ToggleAnimations = new map<ref ToggleAnimations, bool>;
43 m_ShowAnimationsWhenPitched = new array<string>;
44 m_ShowAnimationsWhenPacked = new array<string>;
45
46 m_HalfExtents = vector.Zero;
47 RegisterNetSyncVariableInt("m_State");
48 RegisterNetSyncVariableBool("m_IsEntrance");
49 RegisterNetSyncVariableBool("m_IsWindow");
50 RegisterNetSyncVariableBool("m_IsToggle");
51 RegisterNetSyncVariableInt("m_OpeningMask");
52 RegisterNetSyncVariableBool("m_IsBeingPacked");
53
54 ProcessInvulnerabilityCheck(GetInvulnerabilityTypeString());
55 }
56
57 void ~TentBase()
58 {
59 if (GetGame())
60 {
61 DestroyClutterCutter();
62 }
63 }
64
66 {
67 return "disableContainerDamage";
68 }
69
70 override bool HasProxyParts()
71 {
72 return true;
73 }
74
76 override bool CanProxyObstructSelf()
77 {
78 return true;
79 }
80
81 override bool IsItemTent()
82 {
83 return true;
84 }
85
87 {
88 return false;
89 }
90
91 override int GetMeleeTargetType()
92 {
93 return EMeleeTargetType.NONALIGNABLE;
94 }
95
97 {
98 super.OnStoreSave(ctx);
99
100 ctx.Write(m_State);
101 ctx.Write(m_OpeningMask);
102 }
103
104 override bool OnStoreLoad(ParamsReadContext ctx, int version)
105 {
106 if (!super.OnStoreLoad(ctx, version))
107 return false;
108
109 ctx.Read(m_State);
110 if (version >= 110)
111 {
112 if (!ctx.Read(m_OpeningMask))
113 Print("ERROR: no opening mask found! Default openinng settings initialized.");
114 }
115
116 if (m_State == PITCHED)
117 {
118 TryPitch(true);
119
120 if (GetGame().IsServer())
121 {
122 if (!m_ClutterCutter && HasClutterCutter())
123 {
124 m_ClutterCutter = GetGame().CreateObjectEx(GetClutterCutter(), GetPosition(), ECE_PLACE_ON_SURFACE);
125 m_ClutterCutter.SetOrientation(GetOrientation());
126 }
127
128 RefreshAttachements();
129 }
130 }
131 else
132 {
133 Pack(true);
134 }
135
136 return true;
137 }
138
139 override void RefreshPhysics()
140 {
141 super.RefreshPhysics();
142
143 if (m_State == PITCHED)
144 {
145 TryPitch(false, true);
146 }
147 else
148 {
149 Pack(false, true);
150 }
151 }
152
153 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
154 {
155 super.OnItemLocationChanged(old_owner, new_owner);
156
157 if (new_owner || old_owner)
158 {
159 if (GetInventory().CountInventory() == 1) // refuse to pack tent with anything inside
160 Pack(false);
161 }
162 }
163
165 {
166 super.OnVariablesSynchronized();
167
168 if (m_State != m_StateLocal)
169 {
170 if (m_State == PACKED)
171 Pack(false);
172 else
173 TryPitch(false);
174
175 m_StateLocal = m_State;
176 }
177
178 if ((m_OpeningMaskLocal != m_OpeningMask)) //opening synchronization for physics recalculation
179 {
180 HandleOpeningsPhysics();
181 m_OpeningMaskLocal = m_OpeningMask;
182
183 if (m_State == PACKED)
184 {
185 Pack(false); //intentional
186 }
187 }
188 }
189
190 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
191 {
192 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
193
195 return;
196
197 if (zone == "" && GetState() == PITCHED && newLevel == GameConstants.STATE_RUINED && GetGame().IsServer())
198 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(this, m_HalfExtents);
199
200 if (zone != "Body" && zone != "Inventory" && zone != "")
201 {
202 if (newLevel == GameConstants.STATE_RUINED)
203 {
204 array<string> selections = new array<string>;
205 DamageSystem.GetComponentNamesFromDamageZone(this,zone,selections);
206 for (int j = 0; j < selections.Count(); j++)
207 {
208 if (selections.Get(j) != "")
209 {
210 RemoveProxyPhysics(selections.Get(j)); //To keep
211 //HideSelection(selections.Get(j)); //To change
212 AnimateCamonetByOpeningSelection(selections.Get(j)); //To keep
213 }
214 }
215 }
216 else if (oldLevel == GameConstants.STATE_RUINED)
217 {
218 if (GetState() == PITCHED)
219 {
220 TryPitch(true);
221 }
222 }
223 }
224 }
225
226 void HideAllAnimationsAndProxyPhysics(bool hide_animations = true, bool hide_physics = true)
227 {
228 string cfg_path = "cfgVehicles " + GetType() + " AnimationSources";
229
230 if (GetGame().ConfigIsExisting(cfg_path))
231 {
232 int selections = GetGame().ConfigGetChildrenCount(cfg_path);
233 string proxy_selection_name;
234
235 for (int i = 0; i < selections; i++)
236 {
237 string selection_name;
238 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
239 if (hide_animations)
240 {
241 SetAnimationPhase(selection_name, 1);
242 }
243
244 proxy_selection_name = selection_name;
245 proxy_selection_name.ToLower();
246 if (hide_physics)
247 {
248 RemoveProxyPhysics(proxy_selection_name);
249 }
250 }
251 }
252 }
253
255 {
256 return CanBeManipulated();
257 }
258
259 override bool IsTakeable()
260 {
261 if (!super.IsTakeable())
262 return false;
263
264 return CanBeManipulated();
265 }
266
267 override bool CanPutIntoHands(EntityAI parent)
268 {
269 if (!super.CanPutIntoHands(parent))
270 {
271 return false;
272 }
273
274 return CanBeManipulated();
275 }
276
277 override bool CanPutInCargo(EntityAI parent)
278 {
279 if (!super.CanPutInCargo(parent))
280 {
281 return false;
282 }
283
284 return CanBeManipulated();
285 }
286
287 override bool CanRemoveFromCargo(EntityAI parent)
288 {
289 if (!super.CanRemoveFromCargo(parent))
290 return false;
291
292 return CanBeManipulated();
293 }
294
295 override bool CanRemoveFromHands(EntityAI parent)
296 {
297 if (!super.CanRemoveFromHands(parent))
298 return false;
299
300 return CanBeManipulated();
301 }
302
304 {
305 return CanBeManipulated();
306 }
307
309 {
310 return true;
311 }
312
314 {
315 int slot_id_camo;
316 int slot_id_xlights;
317 EntityAI eai_xlights;
318
319 slot_id_camo = InventorySlots.GetSlotIdFromString("CamoNet");
320 m_CamoNet = CamoNet.Cast(GetInventory().FindAttachment(slot_id_camo));
321
322 slot_id_xlights = InventorySlots.GetSlotIdFromString("Lights");
323 eai_xlights = GetInventory().FindAttachment(slot_id_xlights);
324
325 if (m_CamoNet)
326 {
327 HandleCamoNetAttachment(false);
328 //SetAnimationPhase("Camonet", 0);
329
330 if (!IsKindOf("MediumTent"))
331 {
332 AddProxyPhysics("camonet");
333 }
334 }
335
336 if (eai_xlights)
337 {
338 SetAnimationPhase("Xlights", 0);
339 SetAnimationPhase("Xlights_glass_r", 0);
340 SetAnimationPhase("Xlights_glass_g", 0);
341 SetAnimationPhase("Xlights_glass_b", 0);
342 SetAnimationPhase("Xlights_glass_y", 0);
343 }
344 }
345
346 override void EEItemAttached(EntityAI item, string slot_name)
347 {
348 super.EEItemAttached(item, slot_name);
349
350 if (item.IsKindOf ("CamoNet"))
351 {
352 m_CamoNet = CamoNet.Cast(item);
353 HandleCamoNetAttachment(false);
354 //SetAnimationPhase("Camonet", 0);
355
356 if (!IsKindOf ("MediumTent"))
357 {
358 AddProxyPhysics("camonet");
359 }
360 }
361
362 if (item.IsKindOf ("XmasLights"))
363 {
364 SetAnimationPhase("Xlights", 0);
365 SetAnimationPhase("Xlights_glass_r", 0);
366 SetAnimationPhase("Xlights_glass_g", 0);
367 SetAnimationPhase("Xlights_glass_b", 0);
368 SetAnimationPhase("Xlights_glass_y", 0);
369
370 XmasLights xlights = XmasLights.Cast(item);
371 xlights.AttachToObject(this);
372 }
373 }
374
375 override void EEItemDetached(EntityAI item, string slot_name)
376 {
377 super.EEItemDetached(item, slot_name);
378
379 if (item.IsKindOf ("CamoNet"))
380 {
381 m_CamoNet = null;
382 HandleCamoNetAttachment(true);
383 //SetAnimationPhase("Camonet", 1);
384
385 if (!IsKindOf ("MediumTent"))
386 {
387 RemoveProxyPhysics("camonet");
388 }
389 }
390
391 if (item.IsKindOf ("XmasLights"))
392 {
393 SetAnimationPhase("Xlights", 1);
394 SetAnimationPhase("Xlights_glass_r", 1);
395 SetAnimationPhase("Xlights_glass_g", 1);
396 SetAnimationPhase("Xlights_glass_b", 1);
397 SetAnimationPhase("Xlights_glass_y", 1);
398
399 XmasLights xlights = XmasLights.Cast(item);
400 xlights.DetachFromObject(this);
401 }
402 }
403
404 override int GetViewIndex()
405 {
406 if (MemoryPointExists("invView2"))
407 {
409 GetInventory().GetCurrentInventoryLocation(il);
410 InventoryLocationType type = il.GetType();
411
412 if (GetState() == PACKED)
413 {
414 switch (type)
415 {
416 case InventoryLocationType.ATTACHMENT:
417 return 1;
418 default:
419 return 0;
420 }
421 }
422 else
423 {
424 switch (type)
425 {
426 case InventoryLocationType.ATTACHMENT:
427 case InventoryLocationType.GROUND:
428 return 1;
429 default:
430 return 0;
431 }
432 }
433 }
434
435 return 0;
436 }
437
439 {
440 return m_State;
441 }
442
444 {
445 return m_StateLocal;
446 }
447
449 {
450 if (GetState() == PITCHED)
451 {
452 if (GetInventory().GetCargo().GetItemCount() == 0 && GetInventory().AttachmentCount() == 0)
453 {
454 return true;
455 }
456 }
457
458 return false;
459 }
460
462 {
463 if (GetState() == PACKED)
464 {
465 return true;
466 }
467 else
468 {
469 return false;
470 }
471 }
472
474 {
475 if (item.IsKindOf ("CamoNet") && GetState() == PITCHED)
476 {
477 return true;
478 }
479
480 return false;
481 }
482
484 {
485 return false;
486 }
487
488 void Pack(bool update_navmesh, bool init = false)
489 {
490 HideAllAnimationsAndProxyPhysics();
491
492 m_State = PACKED;
493 m_IsEntrance = PACKED;
494 m_IsWindow = PACKED;
495 m_IsToggle = PACKED;
496
497 Refresh();
498
499 GetInventory().LockInventory(HIDE_INV_FROM_SCRIPT);
500
501 if (update_navmesh)
502 {
503 RegenerateNavmesh();
504 }
505
506 DestroyClutterCutter();
507
508 if (GetGame().IsServer() && !IsHologram())
509 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(this, m_HalfExtents);
510
511 SetSynchDirty();
512
513 if ((!GetGame().IsDedicatedServer()) && !init)
514 {
515 GetOnViewIndexChanged().Invoke();
516 }
517 }
518
519 void Pitch(bool update_navmesh, bool init = false)
520 {
521 HideAllAnimationsAndProxyPhysics();
522
523 m_State = PITCHED;
524 m_IsEntrance = PITCHED;
525 m_IsWindow = PITCHED;
526 m_IsToggle = PITCHED;
527
528 Refresh();
529
530 GetInventory().UnlockInventory(HIDE_INV_FROM_SCRIPT);
531
532 if (update_navmesh)
533 {
534 RegenerateNavmesh();
535 }
536
537 SetSynchDirty();
538
539 if ((!GetGame().IsDedicatedServer()) && !init)
540 {
541 GetOnViewIndexChanged().Invoke();
542 }
543 }
544
545 protected void TryPitch(bool update_navmesh, bool init = false)
546 {
547 if (GetHierarchyRootPlayer())
548 {
549 if (GetGame().IsDedicatedServer())
550 {
551 Pack(update_navmesh,init);
552 }
553
554 return;
555 }
556
557 Pitch(update_navmesh,init);
558 }
559
561 {
562 string proxy_selection_name;
563 string animation_name;
564
565 if (GetState() == PITCHED)
566 {
567 for (int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
568 {
569 animation_name = m_ShowAnimationsWhenPitched.Get(i);
570
571 SetAnimationPhase(animation_name, 0);
572 }
573
574 HandleOpeningsVisuals();
575 }
576 else
577 {
578 for (int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
579 {
580 animation_name = m_ShowAnimationsWhenPacked.Get(j);
581
582 SetAnimationPhase(animation_name, 0);
583 }
584 }
585 }
586
588 {
589 string proxy_selection_name;
590 string animation_name;
591
592 if (GetState() == PITCHED)
593 {
594 for (int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
595 {
596 animation_name = m_ShowAnimationsWhenPitched.Get(i);
597
598 proxy_selection_name = animation_name;
599 proxy_selection_name.ToLower();
600 AddProxyPhysics(proxy_selection_name);
601 }
602
603 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(HandleOpeningsPhysics);
604 }
605 else
606 {
607 for (int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
608 {
609 animation_name = m_ShowAnimationsWhenPacked.Get(j);
610
611 proxy_selection_name = animation_name;
612 proxy_selection_name.ToLower();
613 AddProxyPhysics(proxy_selection_name);
614 }
615 }
616 }
617
618 //refresh visual/physics state
619 void Refresh()
620 {
621 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(UpdateVisuals);
623 }
624
625 bool CanToggleAnimations(string selection)
626 {
627 for (int i = 0; i < m_ToggleAnimations.Count(); i++)
628 {
629 ToggleAnimations toggle = m_ToggleAnimations.GetKey(i);
630 string toggle_off = toggle.GetToggleOff();
631 toggle_off.ToLower();
632 string toggle_on = toggle.GetToggleOn();
633 toggle_on.ToLower();
634
635 if (toggle_off == selection || toggle_on == selection)
636 {
637 string zone;
638 DamageSystem.GetDamageZoneFromComponentName(this,selection,zone);
639 return GetHealthLevel(zone) < GameConstants.STATE_RUINED;
640 }
641 }
642
643 return false;
644 }
645
647 {
648 m_IsEntrance = false;
649 m_IsWindow = false;
650 m_IsToggle = false;
651 }
652
654 {
655 m_IsEntrance = true;
656 }
657
659 {
660 m_IsWindow = true;
661 }
662
664 {
665 return m_IsEntrance;
666 }
667
669 {
670 return m_IsWindow;
671 }
672
673 //used by user action
674 void ToggleAnimation(string selection)
675 {
676 if (m_State == PACKED)
677 {
678 return;
679 }
680
681 bool is_closed;
682 ResetToggle();
683
684 for (int i = 0; i < m_ToggleAnimations.Count(); i++)
685 {
686 ToggleAnimations toggle = m_ToggleAnimations.GetKey(i);
687
688 string toggle_off = toggle.GetToggleOff();
689 toggle_off.ToLower();
690 string toggle_on = toggle.GetToggleOn();
691 toggle_on.ToLower();
692
693 if (toggle_off == selection || toggle_on == selection)
694 {
695 is_closed = m_OpeningMask & toggle.GetOpeningBit();
696 if (is_closed)
697 {
698 SetAnimationPhase(toggle.GetToggleOff(), 0);
699 AddProxyPhysics(toggle.GetToggleOff());
700 SetAnimationPhase(toggle.GetToggleOn(), 1);
701 RemoveProxyPhysics(toggle.GetToggleOn());
702 m_ToggleAnimations.Set(toggle, false);
703 m_IsToggle = true;
704 m_OpeningMask &= ~toggle.GetOpeningBit();
705
706 if (selection.Contains("window"))
707 {
708 ManipulateWindow();
709 if (GetSoundOpenWindow() != string.Empty)
710 StartItemSoundServer(SoundConstants.ITEM_TENT_WINDOW_OPEN);
711 }
712
713 if (selection.Contains("entrance") || selection.Contains("door"))
714 {
715 ManipulateEntrance();
716 if (GetSoundOpen() != string.Empty)
717 StartItemSoundServer(SoundConstants.ITEM_TENT_OPEN);
718 }
719
720 AnimateCamonetToggle(toggle);
721 }
722 else
723 {
724 SetAnimationPhase(toggle.GetToggleOff(), 1);
725 RemoveProxyPhysics(toggle.GetToggleOff());
726 SetAnimationPhase(toggle.GetToggleOn(), 0);
727 AddProxyPhysics(toggle.GetToggleOn());
728 m_ToggleAnimations.Set(toggle, true);
729 m_IsToggle = false;
730 m_OpeningMask |= toggle.GetOpeningBit();
731
732 if (selection.Contains("window"))
733 {
734 ManipulateWindow();
735 if (GetSoundCloseWindow() != string.Empty)
736 StartItemSoundServer(SoundConstants.ITEM_TENT_WINDOW_CLOSE);
737 }
738
739 if (selection.Contains("entrance") || selection.Contains("door"))
740 {
741 ManipulateEntrance();
742 if (GetSoundClose() != string.Empty)
743 StartItemSoundServer(SoundConstants.ITEM_TENT_CLOSE);
744 }
745
746 AnimateCamonetToggle(toggle);
747 }
748 }
749 }
750 SetSynchDirty();
751 }
752
754 {
755 SetAnimationPhase("CamoNet", hide);
756 }
757
759
760 void AnimateCamonetByOpeningSelection(string opening_selection) {};
761
762 string GetSoundOpen() {};
763
764 string GetSoundClose() {};
765
767
769
771 {
772 SetAffectPathgraph(true, false);
773
774 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, this);
775 }
776
778 string GetClutterCutter() {};
779
781 {
782 if (GetGame().IsMultiplayer() || GetGame().IsServer())
783 {
784 if (m_ClutterCutter)
785 {
786 GetGame().ObjectDelete(m_ClutterCutter);
787 }
788 }
789 }
790
791 //================================================================
792 // ADVANCED PLACEMENT
793 //================================================================
794
795 override bool IsDeployable()
796 {
797 return true;
798 }
799
800 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
801 {
802 super.OnPlacementComplete(player, position, orientation);
803
804 if (GetGame().IsServer())
805 {
806 TryPitch(true);
807 }
808 }
809
810 override void InitItemSounds()
811 {
812 super.InitItemSounds();
813
815
816 if (GetSoundOpen() != string.Empty)
817 handler.AddSound(SoundConstants.ITEM_TENT_OPEN, GetSoundOpen());
818
819 if (GetSoundClose() != string.Empty)
820 handler.AddSound(SoundConstants.ITEM_TENT_CLOSE, GetSoundClose());
821
822 if (GetSoundOpenWindow() != string.Empty)
823 handler.AddSound(SoundConstants.ITEM_TENT_WINDOW_OPEN, GetSoundOpenWindow());
824
825 if (GetSoundCloseWindow() != string.Empty)
826 handler.AddSound(SoundConstants.ITEM_TENT_WINDOW_CLOSE, GetSoundCloseWindow());
827 }
828
829 override void SetActions()
830 {
831 super.SetActions();
832
837 }
838
840 {
841 bool is_closed;
842 bool is_ruined;
843 string zone;
844 string component;
845 ToggleAnimations toggle;
846
847 for (int i = 0; i < m_ToggleAnimations.Count(); i++)
848 {
849 toggle = m_ToggleAnimations.GetKey(i);
850 is_closed = m_OpeningMask & toggle.GetOpeningBit();
851 component = toggle.GetToggleOff(); //either one works
852 component.ToLower();
853 DamageSystem.GetDamageZoneFromComponentName(this,component,zone);
854 //is_ruined = (GetHealthLevel(zone) == GameConstants.STATE_RUINED);
855
856 if (is_closed)
857 {
858 SetAnimationPhase(toggle.GetToggleOff(),1);
859 SetAnimationPhase(toggle.GetToggleOn(),is_ruined);
860 m_ToggleAnimations.Set(toggle, false);
861 }
862 else
863 {
864 SetAnimationPhase(toggle.GetToggleOn(),1);
865 SetAnimationPhase(toggle.GetToggleOff(),is_ruined);
866 m_ToggleAnimations.Set(toggle, true);
867 }
868 //AnimateCamonetToggle(toggle);
869 }
870 }
871
873 {
874 bool is_closed;
875 bool is_ruined;
876 int hplevel;
877 string zone;
878 string component;
879 ToggleAnimations toggle;
880
881 for (int i = 0; i < m_ToggleAnimations.Count(); i++)
882 {
883 toggle = m_ToggleAnimations.GetKey(i);
884 is_closed = m_OpeningMask & toggle.GetOpeningBit();
885 component = toggle.GetToggleOff(); //either one works
886 component.ToLower();
887 DamageSystem.GetDamageZoneFromComponentName(this,component,zone);
888 is_ruined = (GetHealthLevel(zone) == GameConstants.STATE_RUINED);
889
890 //re-adding physics to avoid proxy physics stacking
891 RemoveProxyPhysics(toggle.GetToggleOff());
892 RemoveProxyPhysics(toggle.GetToggleOn());
893
894 if (!is_ruined && GetState() == PITCHED)
895 {
896 if (is_closed)
897 {
898 AddProxyPhysics(toggle.GetToggleOn());
899 }
900 else
901 {
902 AddProxyPhysics(toggle.GetToggleOff());
903 }
904 }
905 }
906 }
907
909 {
910 return 110;
911 }
912
914 {
915 if (GetHealthLevel() == GameConstants.STATE_RUINED || m_IsBeingPacked)
916 return false;
917
918 return super.CanReceiveItemIntoCargo(item);
919 }
920
921 override bool CanLoadItemIntoCargo(EntityAI item)
922 {
923 if (!super.CanLoadItemIntoCargo(item))
924 return false;
925 if (GetHealthLevel() == GameConstants.STATE_RUINED)
926 return false;
927
928 return true;
929 }
930
931 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
932 {
933 if (GetHealthLevel() == GameConstants.STATE_RUINED)
934 return false;
935
936 return super.CanReceiveAttachment(attachment, slotId);
937 }
938
939 override bool CanLoadAttachment(EntityAI attachment)
940 {
941 if (GetHealthLevel() == GameConstants.STATE_RUINED)
942 return false;
943
944 return super.CanLoadAttachment(attachment);
945 }
946
947 override bool CanBePlaced(Man player, vector position)
948 {
949 vector playerpos = player.GetPosition();
950 float delta1 = playerpos[1] - position[1];
951
952 if (delta1 > MAX_PLACEMENT_HEIGHT_DIFF || delta1 < -MAX_PLACEMENT_HEIGHT_DIFF)
953 return false;
954 return true;
955 }
956
957 void SetIsBeingPacked(bool isBeingPacked)
958 {
959 m_IsBeingPacked = isBeingPacked;
960 SetSynchDirty();
961 }
962
964 protected ref EffectSound m_DeployLoopSound; //DEPRECATED in favor of m_DeployLoopSoundEx
965
972};
eBleedingSourceType GetType()
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
void AddAction(typename actionName)
vector GetOrientation()
override string GetInvulnerabilityTypeString()
const int ECE_PLACE_ON_SURFACE
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
InventoryLocation.
provides access to slot configuration
override int GetMeleeTargetType()
Definition tentbase.c:91
override void EEItemAttached(EntityAI item, string slot_name)
Definition tentbase.c:346
bool CanToggleAnimations(string selection)
Definition tentbase.c:625
bool IsManipulatedWindow()
Definition tentbase.c:668
bool CanAttach(ItemBase item)
Definition tentbase.c:473
void UpdateVisuals()
Definition tentbase.c:560
void HandleOpeningsPhysics()
Definition tentbase.c:872
void SoundTentClosePlay()
override bool CanReceiveItemIntoCargo(EntityAI item)
Definition tentbase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition tentbase.c:104
void HandleOpeningsVisuals()
Definition tentbase.c:839
bool IsManipulatedEntrance()
Definition tentbase.c:663
int GetStateLocal()
Definition tentbase.c:443
void SoundTentOpenPlay()
DEPRECATED.
override int GetViewIndex()
Definition tentbase.c:404
override bool CanProxyObstructSelf()
prevents showing cargo when outside the tent geometry
Definition tentbase.c:76
override bool HasProxyParts()
Definition tentbase.c:70
override bool CanBeRepairedByCrafting()
Definition tentbase.c:86
bool ConditionOutOfHands(EntityAI player)
Definition tentbase.c:303
void Refresh()
Definition tentbase.c:619
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition tentbase.c:153
string GetSoundCloseWindow()
Definition tentbase.c:768
override bool CanPutIntoHands(EntityAI parent)
Definition tentbase.c:267
void PlayDeployLoopSound()
override bool IsItemTent()
Definition tentbase.c:81
override void SetActions()
Definition tentbase.c:829
void HideAllAnimationsAndProxyPhysics(bool hide_animations=true, bool hide_physics=true)
Definition tentbase.c:226
bool CanBeManipulated()
Definition tentbase.c:461
override string GetInvulnerabilityTypeString()
Definition tentbase.c:65
override bool CanLoadAttachment(EntityAI attachment)
Definition tentbase.c:939
bool m_IsEntrance
Definition tentbase.c:26
string GetClutterCutter()
Definition tentbase.c:778
override int GetDamageSystemVersionChange()
Definition tentbase.c:908
ref array< string > m_ShowAnimationsWhenPacked
Definition tentbase.c:35
string GetSoundOpenWindow()
Definition tentbase.c:766
override bool CanRemoveFromHands(EntityAI parent)
Definition tentbase.c:295
CamoNet m_CamoNet
Definition tentbase.c:37
string GetSoundOpen()
Definition tentbase.c:762
void Pack(bool update_navmesh, bool init=false)
Definition tentbase.c:488
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Definition tentbase.c:190
override void OnStoreSave(ParamsWriteContext ctx)
Definition tentbase.c:96
bool m_IsToggle
Definition tentbase.c:28
bool HasClutterCutter()
Definition tentbase.c:777
void Pitch(bool update_navmesh, bool init=false)
Definition tentbase.c:519
vector m_HalfExtents
Definition tentbase.c:38
void SoundTentOpenWindowPlay()
void ResetToggle()
Definition tentbase.c:646
override bool CanLoadItemIntoCargo(EntityAI item)
Definition tentbase.c:921
void ManipulateEntrance()
Definition tentbase.c:653
int m_State
Definition tentbase.c:24
void HandleCamoNetAttachment(bool hide)
Definition tentbase.c:753
override void EEItemDetached(EntityAI item, string slot_name)
Definition tentbase.c:375
void AnimateCamonetToggle(ToggleAnimations toggle)
Definition tentbase.c:758
override void OnVariablesSynchronized()
Definition tentbase.c:164
override void RefreshPhysics()
Definition tentbase.c:139
override bool CanRemoveFromCargo(EntityAI parent)
Definition tentbase.c:287
void SetIsBeingPacked(bool isBeingPacked)
Definition tentbase.c:957
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition tentbase.c:931
override bool CanPutInCargo(EntityAI parent)
Definition tentbase.c:277
void RefreshAttachements()
Definition tentbase.c:313
ref array< string > m_ShowAnimationsWhenPitched
Definition tentbase.c:34
void UpdatePhysics()
Definition tentbase.c:587
void TryPitch(bool update_navmesh, bool init=false)
Definition tentbase.c:545
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition tentbase.c:800
string GetSoundClose()
Definition tentbase.c:764
override bool IsTakeable()
Definition tentbase.c:259
void SoundTentCloseWindowPlay()
override bool IsIgnoredByConstruction()
Definition tentbase.c:483
void ManipulateWindow()
Definition tentbase.c:658
override void InitItemSounds()
Definition tentbase.c:810
Object m_ClutterCutter
Definition tentbase.c:36
ref map< ref ToggleAnimations, bool > m_ToggleAnimations
Definition tentbase.c:33
void TentBase()
Definition tentbase.c:40
bool CanBePacked()
Definition tentbase.c:448
void StopDeployLoopSound()
DEPRECATED.
bool ConditionIntoInventory(EntityAI player)
Definition tentbase.c:254
bool m_IsWindow
Definition tentbase.c:27
void RegenerateNavmesh()
Definition tentbase.c:770
override bool CanBePlaced(Man player, vector position)
Definition tentbase.c:947
void AnimateCamonetByOpeningSelection(string opening_selection)
Definition tentbase.c:760
override bool CanBeRepairedToPristine()
Definition tentbase.c:308
override bool IsDeployable()
Definition tentbase.c:795
void DestroyClutterCutter()
Definition tentbase.c:780
void ToggleAnimation(string selection)
Definition tentbase.c:674
void ~TentBase()
Definition tentbase.c:57
int GetState()
Definition tentbase.c:438
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void UpdateVisuals()
void UpdatePhysics()
Container_Base m_HalfExtents
int m_OpeningMask
EMeleeTargetType
Object m_ClutterCutter
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
class JsonUndergroundAreaTriggerData GetPosition
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
Empty
Definition hand_states.c:14
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
void StartItemSoundServer(int id)
Definition itembase.c:9258
ItemSoundHandler GetItemSoundHandler()
Definition itembase.c:9229
bool m_FixDamageSystemInit
Definition itembase.c:4907
void ItemSoundHandler(ItemBase parent)
enum MagnumStableStateID init
enum EObjectTemperatureState m_State
void Refresh()
ref EffectSound m_DeployLoopSound
DEPRECATED.
Definition trapbase.c:692