DayZ 1.24
Loading...
Searching...
No Matches
Fence.c
Go to the documentation of this file.
1class Fence extends BaseBuildingBase
2{
3 const int GATE_STATE_NONE = 0;
4 const int GATE_STATE_PARTIAL = 1;
5 const int GATE_STATE_FULL = 2;
6
7 const string ATTACHMENT_SLOT_COMBINATION_LOCK = "Att_CombinationLock";
8 const string SOUND_GATE_OPEN_START = "DoorWoodTowerOpen_SoundSet";
9 const string SOUND_GATE_CLOSE_START = "DoorWoodTowerClose_start_SoundSet";
10 const string SOUND_GATE_CLOSE_END = "DoorWoodTowerClose_end_SoundSet";
11
12 //gate openining
13 const float GATE_ROTATION_ANGLE_DEG = 100;
14 const float GATE_ROTATION_TIME_APPROX = 2000; //ms
15
16 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3; //1.3 RAD = ~75 DEG
17 const float MAX_ACTION_DETECTION_DISTANCE = 2.0; //meters
18
19 typename ATTACHMENT_WOODEN_LOG = WoodenLog;
20 typename ATTACHMENT_COMBINATION_LOCK = CombinationLock;
21
22 string ATTSLOT_CAMONET = "Wall_Camonet";
23 string ATTSLOT_BARBEDWIRE_DOWN = "Wall_Barbedwire_1";
24 string ATTSLOT_BARBEDWIRE_UP = "Wall_Barbedwire_2";
25
26 //protected bool m_HasHinges = false;
27 //protected bool m_GateFullyConstructed = false;
28 protected bool m_ToDiscard = false; //for legacy OnStoreLoad handling
29 protected bool m_IsOpened = false;
30 protected bool m_IsOpenedClient = false;
31 protected int m_GateState = 0;
32
35
36 void Fence()
37 {
38 //synchronized variables
39 //RegisterNetSyncVariableBool( "m_HasHinges" );
40 //RegisterNetSyncVariableBool( "m_GateFullyConstructed" );
41 RegisterNetSyncVariableBool("m_IsOpened");
42 RegisterNetSyncVariableInt("m_GateState");
43 }
44
45 override string GetConstructionKitType()
46 {
47 return "FenceKit";
48 }
49
50 override int GetMeleeTargetType()
51 {
52 return EMeleeTargetType.NONALIGNABLE;
53 }
54
55 //Gate
56 bool HasHinges()
57 {
58 return m_GateState > GATE_STATE_NONE;
59 }
60
62 {
63 return m_GateState == GATE_STATE_FULL;
64 }
65
67 {
68 m_GateState = state;
69 SetSynchDirty();
70 }
71
73 {
74 return m_GateState;
75 }
76
78 {
79 ConstructionPart gate_part = GetConstruction().GetGateConstructionPart();
81 if (gate_part.IsBuilt())
82 {
84 array<string> req_parts = gate_part.GetRequiredParts();
85 for (int i = 0; i < req_parts.Count(); i++)
86 {
87 req_part = GetConstruction().GetConstructionPart(req_parts.Get(i));
88 if (!req_part.IsBuilt())
89 break;
90 }
91
92 if (i != req_parts.Count())
94 else
96
97 }
98 return state;
99 }
100
102 {
104 }
105
106 override bool IsOpened()
107 {
108 return m_IsOpened;
109 }
110
111 bool IsLocked()
112 {
114 if (combination_lock && combination_lock.IsLocked())
115 return true;
116
117 return false;
118 }
119
120 override bool NameOverride(out string output)
121 {
122 if (m_GateState != GATE_STATE_NONE)
123 {
124 output = "#str_cfgvehicles_construction_part_gate"; //changes object displayed name if in 'gate' state
125 output.ToUpper();
126 return true;
127 }
128 return false;
129 }
130 //
132 {
133 CombinationLock combination_lock = CombinationLock.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_COMBINATION_LOCK));
134 return combination_lock;
135 }
136
138 {
139 CamoNet camonet = CamoNet.Cast(FindAttachmentBySlotName("Wall_Camonet"));
140 return camonet;
141 }
142
143 BarbedWire GetBarbedWire1()
144 {
145 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName("Wall_Barbedwire_1"));
146 return barbedwire;
147 }
148
149 BarbedWire GetBarbedWire2()
150 {
151 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName("Wall_Barbedwire_2"));
152 return barbedwire;
153 }
154
155 //--- CONSTRUCTION KIT
157 {
158 if (MemoryPointExists("kit_spawn_position"))
159 {
161 position = GetMemoryPointPos("kit_spawn_position");
162
163 return ModelToWorld(position);
164 }
165
166 return GetPosition();
167 }
168
169 // --- INVENTORY
171 {
172 if (!super.CanDisplayAttachmentSlot(slot_id))
173 return false;
174
176
177 if (slot_name == "Att_CombinationLock")
178 {
180 return false;
181 }
182
184 return false;
185
186 return true;
187 }
188
190 {
191 if (category_name == "Attachments" || category_name == "Material")
192 {
193 if (!HasBase())
194 return false;
195 }
196
197 return true;
198 }
199 // ---
200
201 // --- EVENTS
203 {
204 super.OnStoreSave(ctx);
205
206 //write
207 ctx.Write(m_GateState);
208 ctx.Write(m_IsOpened);
209 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreSave - build=" + m_GateState + " opened=" + m_IsOpened);
210 }
211
212 override bool OnStoreLoad(ParamsReadContext ctx, int version)
213 {
214 if (!super.OnStoreLoad(ctx, version))
215 return false;
216
217 //--- Fence data ---
218 //has gate
219 if (version < 110)
220 {
221 if (!ctx.Read(m_ToDiscard))
222 {
223 m_ToDiscard = false;
224 return false;
225 }
226 m_GateState = GATE_STATE_NONE;
227 }
228 else if (!ctx.Read(m_GateState))
229 {
230 m_GateState = GATE_STATE_NONE;
231 return false;
232 }
233
234 //is opened
235 if (!ctx.Read(m_IsOpened))
236 {
237 m_IsOpened = false;
238 return false;
239 }
240
241 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreLoad - build=" + m_GateState + " opened=" + m_IsOpened);
242 //---
243
244 return true;
245 }
246
247 override void AfterStoreLoad()
248 {
249 super.AfterStoreLoad();
250
251 //set gate state
252 ConstructionPart gate_part = GetConstruction().GetGateConstructionPart();
254
255 //update gate state visual
256 if (IsOpened())
257 OpenFence();
258
260
261 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] AfterStoreLoad - build=" + gate_part.IsBuilt() + " opened=" + IsOpened());
262 }
263
265 {
266 super.OnVariablesSynchronized();
267
268 if (m_IsOpenedClient != m_IsOpened)
269 {
270 m_IsOpenedClient = m_IsOpened;
271
272 if (m_IsOpenedClient)
273 OpenFence();
274 else
275 CloseFence();
276 }
277 }
278
279 //--- BUILD EVENTS
280 //CONSTRUCTION EVENTS
281 override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
282 {
284
285 super.OnPartBuiltServer(player, part_name, action_id);
286
288
289 //update visuals (server)
291 }
292
294 {
296
297 //check gate state
298 if (constrution_part.IsGate())
299 {
300 if (IsLocked())
301 {
302 CombinationLock combination_lock = CombinationLock.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_COMBINATION_LOCK));
303 combination_lock.UnlockServer(player, this);
304 }
305 }
306
307 super.OnPartDismantledServer(player, part_name, action_id);
308
310
311 //update visuals (server)
313 }
314
315 override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part = false)
316 {
317 super.OnPartDestroyedServer(player, part_name, action_id);
318
319 //check gate state
321 if (constrution_part.IsGate() && destroyed_by_connected_part) //avoids attachment dropping on regular hinges destruction
322 {
323 //drop regular attachments
328
329 //rotate back to place
330 if (IsOpened())
331 CloseFence();
332 }
333 if (part_name == "wall_base_down")
334 {
337 }
338 if (part_name == "wall_base_up")
339 {
343 }
344
346 //update visuals (server)
348 }
349
350 //--- ATTACHMENT & CONDITIONS
352 {
353 if (!super.CanReceiveAttachment(attachment, slotId))
354 return false;
355
356 //manage action initiator (AT_ATTACH_TO_CONSTRUCTION)
357 if (!GetGame().IsDedicatedServer())
358 {
360 if (player)
361 {
362 ConstructionActionData construction_action_data = player.GetConstructionActionData();
363
364 //reset action initiator
365 construction_action_data.SetActionInitiator(NULL);
366 }
367 }
368
369 //conditions
370 if (attachment.Type() != ATTACHMENT_WOODEN_LOG)
371 {
372 if (!HasBase())
373 return false;
374 }
375
376 if (attachment.IsInherited(ATTACHMENT_COMBINATION_LOCK))
377 return (HasFullyConstructedGate() && !IsOpened());
378
380 return false;
381
382 return true;
383 }
384
385 //hands
386 override bool CanPutIntoHands(EntityAI parent)
387 {
388 if (!super.CanPutIntoHands(parent))
389 return false;
390
391 if (HasBase())
392 return false;
393
394 return true;
395 }
396
398 {
399 return true;
400 }
401
402 //--- OPEN/CLOSE ACTIONS
404 {
405 if (HasHinges() && !IsOpened() && !IsLocked())
406 return true;
407
408 return false;
409 }
410
412 {
413 if (HasHinges() && IsOpened())
414 return true;
415
416 return false;
417 }
418
420 {
421 //server or single player
422 if (GetGame().IsServer())
423 {
425 SetAnimationPhase("Wall_Interact_Rotate", value);
426 SetAnimationPhase("Wall_Barbedwire_1_Mounted_Rotate", value);
427 SetAnimationPhase("Wall_Barbedwire_2_Mounted_Rotate", value);
428 SetAnimationPhase("Wall_Camonet_Rotate", value);
429 SetAnimationPhase("Wall_Gate_Rotate", value);
430 SetAnimationPhase("Wall_Base_Down_Rotate", value);
431 SetAnimationPhase("Wall_Base_Up_Rotate", value);
432 SetAnimationPhase("Wall_Wood_Down_Rotate", value);
433 SetAnimationPhase("Wall_Wood_Up_Rotate", value);
434 SetAnimationPhase("Wall_Metal_Down_Rotate", value);
435 SetAnimationPhase("Wall_Metal_Up_Rotate", value);
436
437 SetOpenedState(true);
438
439 //regenerate navmesh
440 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(UpdateNavmesh, GATE_ROTATION_TIME_APPROX, false);
441
442 //synchronize
444 }
445
446 //client or single player
447 if (!GetGame().IsDedicatedServer())
448 {
449 //play sound
451 }
452
453 //remove BarbedWire AreaDamageTrigger
455
456 //add check
457 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
458 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceOpened, 0, true);
459 }
460
462 {
463 //server or single player
464 if (GetGame().IsServer())
465 {
466 float value = 0;
467 SetAnimationPhase("Wall_Interact_Rotate", value);
468 SetAnimationPhase("Wall_Barbedwire_1_Mounted_Rotate", value);
469 SetAnimationPhase("Wall_Barbedwire_2_Mounted_Rotate", value);
470 SetAnimationPhase("Wall_Camonet_Rotate", value);
471 SetAnimationPhase("Wall_Gate_Rotate", value);
472 SetAnimationPhase("Wall_Base_Down_Rotate", value);
473 SetAnimationPhase("Wall_Base_Up_Rotate", value);
474 SetAnimationPhase("Wall_Wood_Down_Rotate", value);
475 SetAnimationPhase("Wall_Wood_Up_Rotate", value);
476 SetAnimationPhase("Wall_Metal_Down_Rotate", value);
477 SetAnimationPhase("Wall_Metal_Up_Rotate", value);
478
479 SetOpenedState(false);
480
481 //regenerate navmesh
482 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(UpdateNavmesh, GATE_ROTATION_TIME_APPROX, false);
483
484 //synchronize
486 }
487
488 //client or single player
489 if (!GetGame().IsDedicatedServer())
490 {
491 //play sound
493 }
494
495 //remove BarbedWire AreaDamageTrigger
497
498 //add check
499 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
500 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceClosed, 0, true);
501 }
502
503 protected void CheckFenceOpened()
504 {
505 if (GetAnimationPhase("Wall_Gate_Rotate") == GATE_ROTATION_ANGLE_DEG) //animation finished - open
506 {
507 UpdateBarbedWireAreaDamagePos(GetAnimationPhase("Wall_Gate_Rotate"));
508 //remove check
509 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
510 }
511 }
512
513 protected void CheckFenceClosed()
514 {
515 if (GetAnimationPhase("Wall_Gate_Rotate") == 0) //animation finished - closed
516 {
517 //client or single player
518 if (!GetGame().IsDedicatedServer())
519 {
520 //play sound
521 if (this) SoundGateCloseEnd();
522 }
523 UpdateBarbedWireAreaDamagePos(GetAnimationPhase("Wall_Gate_Rotate"));
524 //remove check
525 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
526 }
527 }
528
529 //Damage triggers
530 override void CreateAreaDamage(string slot_name, float rotation_angle = 0)
531 {
532 if (IsOpened())
533 rotation_angle = 100;
534
535 super.CreateAreaDamage(slot_name, rotation_angle);
536 }
537
538 //BarbedWire update
540 {
541 int slot_id;
542 string slot_name;
543 string slot_name_mounted;
544 if (GetBarbedWire1() && GetBarbedWire1().IsMounted())
545 {
546 GetBarbedWire1().GetInventory().GetCurrentAttachmentSlotInfo(slot_id, slot_name);
547 slot_name_mounted = slot_name + "_Mounted";
548 if (to_delete)
550 else
551 super.CreateAreaDamage(slot_name_mounted, rotation_angle);
552 }
553 if (GetBarbedWire2() && GetBarbedWire2().IsMounted())
554 {
555 GetBarbedWire2().GetInventory().GetCurrentAttachmentSlotInfo(slot_id, slot_name);
556 slot_name_mounted = slot_name + "_Mounted";
557 if (to_delete)
559 else
560 super.CreateAreaDamage(slot_name_mounted, rotation_angle);
561 }
562 }
563
564 //Here deal damage to BarbedWire when entity taking damage from it
565 override void PostAreaDamageActions()
566 {
567 /*if (GetBarbedWire1())
568 {
569 //DecreaseHealth("Wall_BarbedWire_1", "", 1000); //why no dmg to wire???
570 //BarbedWire wire = GetBarbedWire1();
571 //wire.PostAreaDamageActions();
572 //Print(GetHealth("BarbedWire1", ""));
573 }*/
574 }
575
576 //--- ACTION CONDITIONS
577 override bool IsPlayerInside(PlayerBase player, string selection)
578 {
579 vector player_pos = player.GetPosition();
581 vector ref_dir = GetDirection();
582 ref_dir[1] = 0;
583 ref_dir.Normalize();
584
585 vector x[2];
586 vector b1, b2;
587 GetCollisionBox(x);
588 b1 = x[0];
589 b2 = x[1];
590
592 dir_to_fence[1] = 0;
593 float len = dir_to_fence.Length();
594
595 dir_to_fence.Normalize();
596
597 vector ref_dir_angle = ref_dir.VectorToAngles();
598 vector dir_to_fence_angle = dir_to_fence.VectorToAngles();
600
601 vector test_position = test_angles.AnglesToVector() * len;
602
603 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
604 return false;
605 else
606 return true;
607 }
608
609 override bool IsFacingPlayer(PlayerBase player, string selection)
610 {
612 vector player_pos = player.GetPosition();
613 vector ref_dir = GetDirection();
614
615 //vector fence_player_dir = player_pos - fence_pos;
616 vector fence_player_dir = player.GetDirection();
617 fence_player_dir.Normalize();
618 fence_player_dir[1] = 0; //ignore height
619
620 ref_dir.Normalize();
621 ref_dir[1] = 0; //ignore height
622
623 if (ref_dir.Length() != 0)
624 {
626
627 if (angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
628 return true;
629 }
630
631 return false;
632 }
633
634 override bool IsFacingCamera(string selection)
635 {
636 vector ref_dir = GetDirection();
637 vector cam_dir = GetGame().GetCurrentCameraDirection();
638
639 //ref_dir = GetGame().GetCurrentCameraPosition() - GetPosition();
640 ref_dir.Normalize();
641 ref_dir[1] = 0; //ignore height
642
643 cam_dir.Normalize();
644 cam_dir[1] = 0; //ignore height
645
646 if (ref_dir.Length() != 0)
647 {
648 float angle = Math.Acos(cam_dir * ref_dir);
649
650 if (angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
651 return true;
652 }
653
654 return false;
655 }
656
657 override bool HasProperDistance(string selection, PlayerBase player)
658 {
659 if (MemoryPointExists(selection))
660 {
661 vector selection_pos = ModelToWorld(GetMemoryPointPos(selection));
662 float distance = vector.Distance(selection_pos, player.GetPosition());
663 if (distance >= MAX_ACTION_DETECTION_DISTANCE)
664 return false;
665 }
666
667 return true;
668 }
669
671 {
672 return !IsOpened();
673 }
674
675 //================================================================
676 // SOUNDS
677 //================================================================
678 protected void SoundGateOpenStart()
679 {
680 //client or single player
681 if (!GetGame().IsDedicatedServer())
682 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_OPEN_START, 0.1, 0.1);
683 }
684
685 protected void SoundGateCloseStart()
686 {
687 //client or single player
688 if (!GetGame().IsDedicatedServer())
689 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_CLOSE_START, 0.1, 0.1);
690 }
691
692 protected void SoundGateCloseEnd()
693 {
694 //client or single player
695 if (!GetGame().IsDedicatedServer())
696 PlaySoundSet(m_SoundGate_End, SOUND_GATE_CLOSE_END, 0.1, 0.1);
697 }
698
700 {
701 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
702 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
703 if (GetBarbedWire1() && !wall_base_down.IsBuilt())
704 {
707 }
708 if ((GetCamoNet() || GetBarbedWire2()) && !wall_base_up.IsBuilt())
709 {
713 }
714 }
715
717 {
718 BarbedWire wire;
720 if (Class.CastTo(wire, item)) //special barbed wire beh.
721 {
722 wire.SetMountedState(false);
723 GetInventory().DropEntity(InventoryMode.SERVER, this, wire);
724 }
725 else if (Class.CastTo(lock, item))
726 lock.UnlockServer(null, this);
727 else if (item)//generic behaviour
728 GetInventory().DropEntity(InventoryMode.SERVER, this, item);
729 }
730
732 {
733 if (GetGateState() == GATE_STATE_PARTIAL)
734 {
735 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
736 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
738 if (!wall_base_up.IsBuilt())
739 {
740 if (slot_name == ATTSLOT_CAMONET || slot_name == ATTSLOT_BARBEDWIRE_UP)
741 return false;
742 }
743 if (!wall_base_down.IsBuilt())
744 {
745 if (slot_name == ATTSLOT_BARBEDWIRE_DOWN)
746 return false;
747 }
748 }
749 return true;
750 }
751
752 //specific selection for camonet attaching (other ones might be animated via rotation!)
754 {
755 if (selection_name == "wall_camonet_attach")
756 {
758 return true;
759 }
760 return false;
761 }
762
763 override void SetActions()
764 {
765 super.SetActions();
766
770 //AddAction(ActionDialCombinationLockOnTarget);
771 //AddAction(ActionNextCombinationLockDialOnTarget);
774 }
775
776 //================================================================
777 // DEBUG
778 //================================================================
779 /*
780 override void DebugCustomState()
781 {
782 //debug
783 m_SyncParts01 = 881; //full fence with gate
784 m_HasHinges = true;
785 m_HasBase = true;
786
787 OnVariablesSynchronized();
788 }
789 */
790
793 {
795
796#ifdef DIAG_DEVELOPER
797 bool bWood = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_WOOD);
798#else
799 bool bWood = false;
800#endif
801
802 if (bWood)
803 excludes.Insert("_metal_");
804 else
805 excludes.Insert("_wood_");
806
807#ifdef DIAG_DEVELOPER
808 bool bGate = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_GATE);
809#else
810 bool bGate = false;
811#endif
812
813 if (bGate)
814 excludes.Insert("platform");
815 else
816 excludes.Insert("gate");
817
818 return excludes;
819 }
820
821 //Debug menu Spawn Ground Special
822 override void OnDebugSpawn()
823 {
824 super.OnDebugSpawn();
825
826 GetInventory().CreateInInventory("CamoNet");
827
828 for (int i = 0; i < 2; ++i)
829 {
830 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory("BarbedWire"));
831 wire.SetMountedState(true);
832 }
833 }
834}
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
void AddAction(typename actionName)
void UpdateNavmesh()
Construction GetConstruction()
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
bool IsOpened()
bool HasBase()
void SynchronizeBaseState()
void CombinationLock()
DiagMenuIDs
Definition EDiagMenuIDs.c:2
EMeleeTargetType
void DestroyAreaDamage()
Icon x
bool m_IsOpened
PlayerBase GetPlayer()
class JsonUndergroundAreaTriggerData GetPosition
override bool CanDisplayAttachmentCategory(string category_name)
Definition Fence.c:189
bool HasHinges()
Definition Fence.c:56
override void PostAreaDamageActions()
Definition Fence.c:565
override void OnDebugSpawn()
Definition Fence.c:822
override bool IsPlayerInside(PlayerBase player, string selection)
Definition Fence.c:577
override void OnVariablesSynchronized()
Definition Fence.c:264
override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
Definition Fence.c:753
void SetOpenedState(bool state)
Definition Fence.c:101
void Fence()
Definition Fence.c:36
override bool CanDisplayAttachmentSlot(int slot_id)
Definition Fence.c:170
EffectSound m_SoundGate_Start
Definition Fence.c:33
override string GetConstructionKitType()
Definition Fence.c:45
void CloseFence()
Definition Fence.c:461
void SetGateState(int state)
Definition Fence.c:66
override bool IsOpened()
Definition Fence.c:106
override bool NameOverride(out string output)
Definition Fence.c:120
bool IsLocked()
Definition Fence.c:111
const int GATE_STATE_NONE
Definition Fence.c:3
override bool CanPutIntoHands(EntityAI parent)
Definition Fence.c:386
override array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
Definition Fence.c:792
override void UpdateVisuals()
Definition Watchtower.c:44
void GateAttachmentsSanityCheck()
Definition Fence.c:699
const float GATE_ROTATION_ANGLE_DEG
Definition Fence.c:13
void SoundGateOpenStart()
Definition Fence.c:678
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
Definition Fence.c:281
bool HasFullyConstructedGate()
Definition Fence.c:61
bool GateAttachmentConditions(int slotId)
Definition Fence.c:731
EffectSound m_SoundGate_End
Definition Fence.c:34
override void SetActions()
Definition Fence.c:763
const int GATE_STATE_FULL
Definition Fence.c:5
void HandleDropAttachment(ItemBase item)
Definition Fence.c:716
bool m_IsOpened
Definition Fence.c:29
void CheckFenceClosed()
Definition Fence.c:513
void SoundGateCloseStart()
Definition Fence.c:685
CamoNet GetCamoNet()
Definition Fence.c:137
override bool IsFacingCamera(string selection)
Definition Fence.c:634
override bool IsFacingPlayer(PlayerBase player, string selection)
Definition Fence.c:609
override void AfterStoreLoad()
Definition Fence.c:247
override bool CanUseConstructionBuild()
Definition Fence.c:670
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition Fence.c:212
void CheckFenceOpened()
Definition Fence.c:503
override int GetMeleeTargetType()
Definition Fence.c:50
bool CanCloseFence()
Definition Fence.c:411
override bool HasProperDistance(string selection, PlayerBase player)
Definition Fence.c:657
BarbedWire GetBarbedWire1()
Definition Fence.c:143
int GetGateState()
Definition Fence.c:72
bool CanOpenFence()
Definition Fence.c:403
void OpenFence()
Definition Fence.c:419
CombinationLock GetCombinationLock()
Definition Fence.c:131
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
Definition Fence.c:315
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition Fence.c:351
override void OnStoreSave(ParamsWriteContext ctx)
Definition Fence.c:202
void UpdateBarbedWireAreaDamagePos(float rotation_angle=0, bool to_delete=false)
Definition Fence.c:539
override vector GetKitSpawnPosition()
Definition Fence.c:156
void SoundGateCloseEnd()
Definition Fence.c:692
override bool CanBeRepairedToPristine()
Definition Fence.c:397
const int GATE_STATE_PARTIAL
Definition Fence.c:4
int m_GateState
Definition Fence.c:31
int CheckGateState()
Definition Fence.c:77
override void CreateAreaDamage(string slot_name, float rotation_angle=0)
Definition Fence.c:530
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
Definition Fence.c:293
BarbedWire GetBarbedWire2()
Definition Fence.c:149
Super root of all classes in Enforce script.
Definition EnScript.c:11
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static bool IsBaseBuildingLogEnable()
Definition Debug.c:779
Definition EnMath.c:7
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Acos(float c)
Returns angle in radians from cosinus.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10