DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Fence.c
См. документацию.
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 SOUND_GATE_OPEN_START = "DoorWoodTowerOpen_SoundSet";
8 const string SOUND_GATE_CLOSE_START = "DoorWoodTowerClose_start_SoundSet";
9 const string SOUND_GATE_CLOSE_END = "DoorWoodTowerClose_end_SoundSet";
10
11 //gate openining
12 const float GATE_ROTATION_ANGLE_DEG = 100;
13 const float GATE_ROTATION_TIME_APPROX = 2000; //ms
14
15 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3; //1.3 RAD = ~75 DEG
16 const float MAX_ACTION_DETECTION_DISTANCE = 2.0; //meters
17
18 typename ATTACHMENT_WOODEN_LOG = WoodenLog;
21
22 const string ATTACHMENT_SLOT_CAMONET = "Wall_Camonet";
23 const string ATTACHMENT_SLOT_BARBEDWIRE_DOWN = "Wall_Barbedwire_1";
24 const string ATTACHMENT_SLOT_BARBEDWIRE_UP = "Wall_Barbedwire_2";
25 const string ATTACHMENT_SLOT_COMBINATION_LOCK = "Att_CombinationLock";
26 const string ATTACHMENT_SLOT_CODE_LOCK = "Att_CodeLock";
27
28 const string MEM_POINT_SPAWN = "kit_spawn_position";
29
30 const string ATT_CATEGORY_ATTACHMENTS = "Attachments";
31 const string ATT_CATEGORY_MATERIAL = "Material";
32
33 //protected bool m_HasHinges = false;
34 //protected bool m_GateFullyConstructed = false;
35 protected bool m_ToDiscard = false; //for legacy OnStoreLoad handling
36 protected bool m_IsOpened = false;
37 protected bool m_IsOpenedClient = false;
38 protected int m_GateState = 0;
39
42
43 void Fence()
44 {
45 //synchronized variables
46 //RegisterNetSyncVariableBool("m_HasHinges");
47 //RegisterNetSyncVariableBool("m_GateFullyConstructed");
48 RegisterNetSyncVariableBool("m_IsOpened");
49 RegisterNetSyncVariableInt("m_GateState");
50 }
51
52 override bool IsActionTargetVisible()
53 {
54 return true;
55 }
56
57 override string GetConstructionKitType()
58 {
59 return "FenceKit";
60 }
61
62 override int GetMeleeTargetType()
63 {
64 return EMeleeTargetType.NONALIGNABLE;
65 }
66
67 //Gate
68 bool HasHinges()
69 {
71 }
72
74 {
76 }
77
78 void SetGateState( int state )
79 {
80 m_GateState = state;
81 SetSynchDirty();
82 }
83
85 {
86 return m_GateState;
87 }
88
90 {
92 int state = GATE_STATE_NONE;
93 if( gate_part.IsBuilt() )
94 {
95 ConstructionPart req_part;
96 array<string> req_parts = gate_part.GetRequiredParts();
97 for (int i = 0; i < req_parts.Count(); i++)
98 {
99 req_part = GetConstruction().GetConstructionPart(req_parts.Get(i));
100 if(!req_part.IsBuilt())
101 break;
102 }
103
104 if( i != req_parts.Count() )
105 {
106 state = GATE_STATE_PARTIAL;
107 }
108 else
109 {
110 state = GATE_STATE_FULL;
111 }
112
113 }
114 return state;
115 }
116
117 void SetOpenedState( bool state )
118 {
119 m_IsOpened = state;
120 }
121
122 override bool IsOpened()
123 {
124 return m_IsOpened;
125 }
126
127 bool IsLocked()
128 {
129 CombinationLock combinationLock = GetCombinationLock();
130 if (combinationLock && combinationLock.IsLocked())
131 {
132 return true;
133 }
134
135 DigitalCodeLock codeLock = GetCodeLock();
136 if (codeLock && codeLock.IsLocked())
137 {
138 return true;
139 }
140
141 return false;
142 }
143
144 override bool NameOverride(out string output)
145 {
147 {
148 output = "#str_cfgvehicles_construction_part_gate"; //changes object displayed name if in 'gate' state
149 output.ToUpper();
150 return true;
151 }
152 return false;
153 }
154
156 {
157 CombinationLock combinationLock = CombinationLock.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_COMBINATION_LOCK));
158 return combinationLock;
159 }
160
162 {
163 DigitalCodeLock codeLock = DigitalCodeLock.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_CODE_LOCK));
164 return codeLock;
165 }
166
167 CamoNet GetCamoNet()
168 {
169 CamoNet camonet = CamoNet.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_CAMONET));
170 return camonet;
171 }
172
173 BarbedWire GetBarbedWire1()
174 {
175 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_BARBEDWIRE_DOWN));
176 return barbedwire;
177 }
178
179 BarbedWire GetBarbedWire2()
180 {
181 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName(ATTACHMENT_SLOT_BARBEDWIRE_UP));
182 return barbedwire;
183 }
184
185 //--- CONSTRUCTION KIT
187 {
188 if (MemoryPointExists(MEM_POINT_SPAWN))
189 {
191 position = GetMemoryPointPos(MEM_POINT_SPAWN);
192
193 return ModelToWorld(position);
194 }
195
196 return GetPosition();
197 }
198
199 // --- INVENTORY
200 override bool CanDisplayAttachmentSlot(int slot_id)
201 {
202 if (!super.CanDisplayAttachmentSlot(slot_id))
203 return false;
204
205 string slotName = InventorySlots.GetSlotName(slot_id);
207 {
209 {
210 return false;
211 }
212 }
213
215 {
217 {
218 return false;
219 }
220 }
221
222 if (!GateAttachmentConditions(slot_id))
223 return false;
224
225 return true;
226 }
227
228 override bool CanDisplayAttachmentCategory(string category_name)
229 {
230 if (!super.CanDisplayAttachmentCategory(category_name))
231 return false;
232
233 if (category_name == ATT_CATEGORY_ATTACHMENTS || category_name == ATT_CATEGORY_MATERIAL)
234 {
235 if (!HasBase())
236 {
237 return false;
238 }
239 }
240
241 return true;
242 }
243 // ---
244
245 // --- EVENTS
246 override void OnStoreSave( ParamsWriteContext ctx )
247 {
248 super.OnStoreSave( ctx );
249
250 //write
251 ctx.Write( m_GateState );
252 ctx.Write( m_IsOpened );
253 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreSave - build=" + m_GateState + " opened=" + m_IsOpened);
254 }
255
256 override bool OnStoreLoad( ParamsReadContext ctx, int version )
257 {
258 if ( !super.OnStoreLoad( ctx, version ) )
259 return false;
260
261 //--- Fence data ---
262 //has gate
263 if (version < 110)
264 {
265 if ( !ctx.Read( m_ToDiscard ) )
266 {
267 m_ToDiscard = false;
268 return false;
269 }
271 }
272 else if ( !ctx.Read( m_GateState ) )
273 {
275 return false;
276 }
277
278 //is opened
279 if ( !ctx.Read( m_IsOpened ) )
280 {
281 m_IsOpened = false;
282 return false;
283 }
284
285 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreLoad - build=" + m_GateState + " opened=" + m_IsOpened);
286 //---
287
288 return true;
289 }
290
291 override void AfterStoreLoad()
292 {
293 super.AfterStoreLoad();
294
295 //set gate state
298
299 //update gate state visual
300 if ( IsOpened() )
301 {
302 OpenFence();
303 }
304
306
307 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] AfterStoreLoad - build=" + gate_part.IsBuilt() + " opened=" + IsOpened());
308 }
309
311 {
312 super.OnVariablesSynchronized();
313
315 {
317
318 if ( m_IsOpenedClient )
319 {
320 OpenFence();
321 }
322 else
323 {
324 CloseFence();
325 }
326 }
327 }
328
329 //--- BUILD EVENTS
330 //CONSTRUCTION EVENTS
331 override void OnPartBuiltServer( notnull Man player, string part_name, int action_id )
332 {
333 super.OnPartBuiltServer(player, part_name, action_id);
334
336
337 //update visuals (server)
339 }
340
341 override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
342 {
343 ConstructionPart construtionPart = GetConstruction().GetConstructionPart(part_name);
344
345 //check gate state
346 if (construtionPart.IsGate())
347 {
348 if (IsLocked())
349 {
350 CombinationLock combinationLock = GetCombinationLock();
351 if (combinationLock)
352 {
353 combinationLock.UnlockOnServer(player, this);
354 }
355 }
356
357 DigitalCodeLock codeLock = GetCodeLock();
358 if (codeLock)
359 {
360 codeLock.UnlockOnServer(this);
361 }
362 }
363
364 super.OnPartDismantledServer(player, part_name, action_id);
365
367
368 //update visuals (server)
370 }
371
372 override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part = false)
373 {
374 super.OnPartDestroyedServer(player, part_name, action_id);
375
376 //check gate state
377 ConstructionPart constrution_part = GetConstruction().GetConstructionPart(part_name);
378 if (constrution_part.IsGate() && destroyed_by_connected_part) //avoids attachment dropping on regular hinges destruction
379 {
380 //drop regular attachments
386
387 //rotate back to place
388 if (IsOpened())
389 CloseFence();
390 }
391 if (part_name == "wall_base_down")
392 {
396 }
397 if (part_name == "wall_base_up")
398 {
403 }
404
406 //update visuals (server)
408 }
409
410 //--- ATTACHMENT & CONDITIONS
411 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
412 {
413 if (!super.CanReceiveAttachment(attachment, slotId))
414 return false;
415
416 //manage action initiator (AT_ATTACH_TO_CONSTRUCTION)
417 if ( !g_Game.IsDedicatedServer() )
418 {
419 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
420 if ( player )
421 {
422 ConstructionActionData construction_action_data = player.GetConstructionActionData();
423
424 //reset action initiator
425 construction_action_data.SetActionInitiator(NULL);
426 }
427 }
428
429 //conditions
430 if ( attachment.Type() != ATTACHMENT_WOODEN_LOG )
431 {
432 if ( !HasBase() )
433 {
434 return false;
435 }
436 }
437
438 if (attachment.IsInherited(ATTACHMENT_COMBINATION_LOCK))
439 {
440 return HasFullyConstructedGate() && !GetCodeLock() && !IsOpened();
441 }
442
443 if (attachment.IsInherited(ATTACHMENT_CODE_LOCK))
444 {
446 }
447
448 if ( !GateAttachmentConditions(slotId) )
449 return false;
450
451 return true;
452 }
453
454 //hands
455 override bool CanPutIntoHands(EntityAI parent)
456 {
457 if(!super.CanPutIntoHands(parent))
458 return false;
459
460 if (HasBase())
461 return false;
462
463 return true;
464 }
465
467 {
468 return true;
469 }
470
471 //--- OPEN/CLOSE ACTIONS
473 {
474 if (HasHinges() && !IsOpened() && !IsLocked())
475 return true;
476
477 return false;
478 }
479
481 {
482 if (HasHinges() && IsOpened())
483 return true;
484
485 return false;
486 }
487
489 {
490 //server or single player
491 if (g_Game.IsServer())
492 {
493 float value = GATE_ROTATION_ANGLE_DEG;
494 SetAnimationPhase( "Wall_Interact_Rotate", value );
495 SetAnimationPhase( "Wall_Barbedwire_1_Mounted_Rotate", value );
496 SetAnimationPhase( "Wall_Barbedwire_2_Mounted_Rotate", value );
497 SetAnimationPhase( "Wall_Camonet_Rotate", value );
498 SetAnimationPhase( "Wall_Gate_Rotate", value );
499 SetAnimationPhase( "Wall_Base_Down_Rotate", value );
500 SetAnimationPhase( "Wall_Base_Up_Rotate", value );
501 SetAnimationPhase( "Wall_Wood_Down_Rotate", value );
502 SetAnimationPhase( "Wall_Wood_Up_Rotate", value );
503 SetAnimationPhase( "Wall_Metal_Down_Rotate", value );
504 SetAnimationPhase( "Wall_Metal_Up_Rotate", value );
505
506 SetOpenedState( true );
507
508 //regenerate navmesh
509 g_Game.GetCallQueue( CALL_CATEGORY_GAMEPLAY ).CallLater( UpdateNavmesh, GATE_ROTATION_TIME_APPROX, false );
510
511 //synchronize
513 }
514
515 //client or single player
516 if (!g_Game.IsHeadlessOrDedicatedServer())
517 {
518 //play sound
520 }
521
522 //remove BarbedWire AreaDamageTrigger
524
525 //add check
526 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
527 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceOpened, 0, true);
528 }
529
531 {
532 //server or single player
533 if (g_Game.IsServer())
534 {
535 float value = 0;
536 SetAnimationPhase( "Wall_Interact_Rotate", value );
537 SetAnimationPhase( "Wall_Barbedwire_1_Mounted_Rotate", value );
538 SetAnimationPhase( "Wall_Barbedwire_2_Mounted_Rotate", value );
539 SetAnimationPhase( "Wall_Camonet_Rotate", value );
540 SetAnimationPhase( "Wall_Gate_Rotate", value );
541 SetAnimationPhase( "Wall_Base_Down_Rotate", value );
542 SetAnimationPhase( "Wall_Base_Up_Rotate", value );
543 SetAnimationPhase( "Wall_Wood_Down_Rotate", value );
544 SetAnimationPhase( "Wall_Wood_Up_Rotate", value );
545 SetAnimationPhase( "Wall_Metal_Down_Rotate", value );
546 SetAnimationPhase( "Wall_Metal_Up_Rotate", value );
547
548 SetOpenedState( false );
549
550 //regenerate navmesh
551 g_Game.GetCallQueue( CALL_CATEGORY_GAMEPLAY ).CallLater( UpdateNavmesh, GATE_ROTATION_TIME_APPROX, false );
552
553 //synchronize
555 }
556
557 //client or single player
558 if (!g_Game.IsHeadlessOrDedicatedServer())
559 {
560 //play sound
562 }
563
564 //remove BarbedWire AreaDamageTrigger
566
567 //add check
568 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
569 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceClosed, 0, true);
570 }
571
572 protected override void UpdateNavmesh()
573 {
574 SetAffectPathgraph(false, !IsOpened());
575 }
576
577 protected void CheckFenceOpened()
578 {
579 if ( GetAnimationPhase( "Wall_Gate_Rotate" ) == GATE_ROTATION_ANGLE_DEG ) //animation finished - open
580 {
581 UpdateBarbedWireAreaDamagePos(GetAnimationPhase( "Wall_Gate_Rotate" ));
582 //remove check
583 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
584 }
585 }
586
587 protected void CheckFenceClosed()
588 {
589 if ( GetAnimationPhase( "Wall_Gate_Rotate" ) == 0 ) //animation finished - closed
590 {
591 //client or single player
592 if ( !g_Game.IsHeadlessOrDedicatedServer() )
593 {
594 //play sound
596 }
597 UpdateBarbedWireAreaDamagePos(GetAnimationPhase( "Wall_Gate_Rotate" ));
598 //remove check
599 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
600 }
601 }
602
603 //Damage triggers
604 override void CreateAreaDamage( string slot_name, float rotation_angle = 0 )
605 {
606 if ( IsOpened() )
607 {
608 rotation_angle = 100;
609 }
610
611 super.CreateAreaDamage( slot_name, rotation_angle );
612 }
613
614 //BarbedWire update
615 void UpdateBarbedWireAreaDamagePos(float rotation_angle = 0, bool to_delete = false )
616 {
617 int slot_id;
618 string slot_name;
619 string slot_name_mounted;
620 if ( GetBarbedWire1() && GetBarbedWire1().IsMounted() )
621 {
622 GetBarbedWire1().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
623 slot_name_mounted = slot_name + "_Mounted";
624 if (to_delete)
625 {
626 DestroyAreaDamage( slot_name_mounted );
627 }
628 else
629 {
630 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
631 }
632 }
633 if ( GetBarbedWire2() && GetBarbedWire2().IsMounted() )
634 {
635 GetBarbedWire2().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
636 slot_name_mounted = slot_name + "_Mounted";
637 if (to_delete)
638 {
639 DestroyAreaDamage( slot_name_mounted );
640 }
641 else
642 {
643 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
644 }
645 }
646 }
647
648 //Here deal damage to BarbedWire when entity taking damage from it
649 override void PostAreaDamageActions()
650 {
651 /*if (GetBarbedWire1())
652 {
653 //DecreaseHealth("Wall_BarbedWire_1", "", 1000); //why no dmg to wire???
654 //BarbedWire wire = GetBarbedWire1();
655 //wire.PostAreaDamageActions();
656 //Print(GetHealth("BarbedWire1", ""));
657 }*/
658 }
659
660 //--- ACTION CONDITIONS
661 override bool IsPlayerInside( PlayerBase player, string selection )
662 {
663 vector player_pos = player.GetPosition();
664 vector fence_pos = GetPosition();
665 vector ref_dir = GetDirection();
666 ref_dir[1] = 0;
667 ref_dir.Normalize();
668
669 vector x[2];
670 vector b1,b2;
671 GetCollisionBox(x);
672 b1 = x[0];
673 b2 = x[1];
674
675 vector dir_to_fence = fence_pos - player_pos;
676 dir_to_fence[1] = 0;
677 float len = dir_to_fence.Length();
678
679 dir_to_fence.Normalize();
680
681 vector ref_dir_angle = ref_dir.VectorToAngles();
682 vector dir_to_fence_angle = dir_to_fence.VectorToAngles();
683 vector test_angles = dir_to_fence_angle - ref_dir_angle;
684
685 vector test_position = test_angles.AnglesToVector() * len;
686
687 if(test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
688 {
689 return false;
690 }
691 else
692 {
693 return true;
694 }
695 }
696
697 override bool IsFacingPlayer( PlayerBase player, string selection )
698 {
699 vector fence_pos = GetPosition();
700 vector player_pos = player.GetPosition();
701 vector ref_dir = GetDirection();
702
703 //vector fence_player_dir = player_pos - fence_pos;
704 vector fence_player_dir = player.GetDirection();
705 fence_player_dir.Normalize();
706 fence_player_dir[1] = 0; //ignore height
707
708 ref_dir.Normalize();
709 ref_dir[1] = 0; //ignore height
710
711 if ( ref_dir.Length() != 0 )
712 {
713 float angle = Math.Acos( fence_player_dir * ref_dir );
714
715 if ( angle >= MAX_ACTION_DETECTION_ANGLE_RAD )
716 {
717 return true;
718 }
719 }
720
721 return false;
722 }
723
724 override bool IsFacingCamera( string selection )
725 {
726 vector ref_dir = GetDirection();
727 vector cam_dir = g_Game.GetCurrentCameraDirection();
728
729 //ref_dir = g_Game.GetCurrentCameraPosition() - GetPosition();
730 ref_dir.Normalize();
731 ref_dir[1] = 0; //ignore height
732
733 cam_dir.Normalize();
734 cam_dir[1] = 0; //ignore height
735
736 if ( ref_dir.Length() != 0 )
737 {
738 float angle = Math.Acos( cam_dir * ref_dir );
739
740 if ( angle >= MAX_ACTION_DETECTION_ANGLE_RAD )
741 {
742 return true;
743 }
744 }
745
746 return false;
747 }
748
749 override bool HasProperDistance( string selection, PlayerBase player )
750 {
751 if ( MemoryPointExists( selection ) )
752 {
753 vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
754 float distance = vector.Distance( selection_pos, player.GetPosition() );
755 if ( distance >= MAX_ACTION_DETECTION_DISTANCE )
756 {
757 return false;
758 }
759 }
760
761 return true;
762 }
763
765 {
766 return !IsOpened();
767 }
768
769 //================================================================
770 // SOUNDS
771 //================================================================
772 protected void SoundGateOpenStart()
773 {
774 //client or single player
775 if ( !g_Game.IsHeadlessOrDedicatedServer() )
776 {
777 PlaySoundSet( m_SoundGate_Start, SOUND_GATE_OPEN_START, 0.1, 0.1 );
778 }
779 }
780
781 protected void SoundGateCloseStart()
782 {
783 //client or single player
784 if ( !g_Game.IsHeadlessOrDedicatedServer() )
785 {
786 PlaySoundSet( m_SoundGate_Start, SOUND_GATE_CLOSE_START, 0.1, 0.1 );
787 }
788 }
789
790 protected void SoundGateCloseEnd()
791 {
792 //client or single player
793 if ( !g_Game.IsHeadlessOrDedicatedServer() )
794 {
795 PlaySoundSet( m_SoundGate_End, SOUND_GATE_CLOSE_END, 0.1, 0.1 );
796 }
797 }
798
800 {
801 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
802 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
803 if(GetBarbedWire1() && !wall_base_down.IsBuilt())
804 {
807 }
808 if( ( GetCamoNet() || GetBarbedWire2() ) && !wall_base_up.IsBuilt() )
809 {
813 }
814 }
815
817 {
818 BarbedWire wire;
819 CombinationLock lock;
820 DigitalCodeLock codeLock;
821 if (Class.CastTo(wire,item)) //special barbed wire beh.
822 {
823 wire.SetMountedState( false );
824 GetInventory().DropEntity(InventoryMode.SERVER, this, wire);
825 }
826 else if (Class.CastTo(lock,item))
827 {
828 lock.UnlockOnServer(null,this);
829 }
830 else if (Class.CastTo(codeLock,item))
831 {
832 codeLock.UnlockOnServer(this);
833 }
834 else if (item)//generic behaviour
835 {
836 GetInventory().DropEntity(InventoryMode.SERVER, this, item);
837 }
838 }
839
841 {
843 {
844 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
845 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
846 string slot_name = InventorySlots.GetSlotName(slotId);
847 if ( !wall_base_up.IsBuilt() )
848 {
849 if ( slot_name == ATTACHMENT_SLOT_CAMONET || slot_name == ATTACHMENT_SLOT_BARBEDWIRE_UP )
850 {
851 return false;
852 }
853 }
854 if ( !wall_base_down.IsBuilt() )
855 {
856 if ( slot_name == ATTACHMENT_SLOT_BARBEDWIRE_DOWN )
857 {
858 return false;
859 }
860 }
861 }
862 return true;
863 }
864
865 //specific selection for camonet attaching (other ones might be animated via rotation!)
866 override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
867 {
868 if ( selection_name == "wall_camonet_attach" )
869 {
870 slot_id = InventorySlots.GetSlotIdFromString("Wall_Camonet");
871 return true;
872 }
873 return false;
874 }
875
886
887 override bool DestroyOnFall()
888 {
889 return true;
890 }
891
892 //================================================================
893 // DEBUG
894 //================================================================
895
898 {
899 array<string> excludes = {};
900
901 #ifdef DIAG_DEVELOPER
902 bool bWood = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_WOOD);
903 #else
904 bool bWood = false;
905 #endif
906
907 if (bWood)
908 {
909 excludes.Insert("_metal_");
910 }
911 else
912 {
913 excludes.Insert("_wood_");
914 }
915
916 #ifdef DIAG_DEVELOPER
917 bool bGate = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_GATE);
918 #else
919 bool bGate = false;
920 #endif
921
922 if (bGate)
923 {
924 excludes.Insert("platform");
925 }
926 else
927 {
928 excludes.Insert("gate");
929 }
930
931 return excludes;
932 }
933
934 //Debug menu Spawn Ground Special
935 override void OnDebugSpawn()
936 {
937 super.OnDebugSpawn();
938
939 GetInventory().CreateInInventory("CamoNet");
940
941 for (int i = 0; i < 2; ++i)
942 {
943 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory("BarbedWire"));
944 wire.SetMountedState(true);
945 }
946 }
947}
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
Определения ActionFoldBaseBuildingObject.c:11
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
Определения ActionPlaceObject.c:11
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
Construction GetConstruction()
Определения BaseBuildingBase.c:2171
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
Определения BaseBuildingBase.c:1291
bool HasBase()
Определения BaseBuildingBase.c:1632
void SynchronizeBaseState()
Определения BaseBuildingBase.c:1396
PlayerSpawnPreset slotName
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
DiagMenuIDs
Определения EDiagMenuIDs.c:2
EMeleeTargetType
Определения EMeleeTargetType.c:2
void DestroyAreaDamage()
Определения FireplaceBase.c:2363
Icon x
Определения ActionOpenFence.c:2
override bool CanDisplayAttachmentCategory(string category_name)
Определения Fence.c:228
bool HasHinges()
Определения Fence.c:68
override void PostAreaDamageActions()
Определения Fence.c:649
const string ATTACHMENT_SLOT_BARBEDWIRE_DOWN
Определения Fence.c:23
override void OnDebugSpawn()
Определения Fence.c:935
override bool IsPlayerInside(PlayerBase player, string selection)
Определения Fence.c:661
override void OnVariablesSynchronized()
Определения Fence.c:310
override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
Определения Fence.c:866
override void UpdateNavmesh()
Определения Fence.c:572
void SetOpenedState(bool state)
Определения Fence.c:117
void Fence()
Определения Fence.c:43
override bool CanDisplayAttachmentSlot(int slot_id)
Определения Fence.c:200
override bool DestroyOnFall()
Определения Fence.c:887
EffectSound m_SoundGate_Start
Определения Fence.c:40
override string GetConstructionKitType()
Определения Fence.c:57
const string SOUND_GATE_CLOSE_END
Определения Fence.c:9
ATTACHMENT_COMBINATION_LOCK
Определения Fence.c:19
const string ATTACHMENT_SLOT_BARBEDWIRE_UP
Определения Fence.c:24
void CloseFence()
Определения Fence.c:530
void SetGateState(int state)
Определения Fence.c:78
bool m_IsOpenedClient
Определения Fence.c:37
override bool IsOpened()
Определения Fence.c:122
override bool NameOverride(out string output)
Определения Fence.c:144
bool IsLocked()
Определения Fence.c:127
const string ATT_CATEGORY_ATTACHMENTS
Определения Fence.c:30
const int GATE_STATE_NONE
Определения Fence.c:3
override bool CanPutIntoHands(EntityAI parent)
Определения Fence.c:455
override array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
Определения Fence.c:897
override void UpdateVisuals()
Определения Watchtower.c:49
void GateAttachmentsSanityCheck()
Определения Fence.c:799
const float GATE_ROTATION_ANGLE_DEG
Определения Fence.c:12
const string ATTACHMENT_SLOT_CODE_LOCK
Определения Fence.c:26
const string ATTACHMENT_SLOT_CAMONET
Определения Fence.c:22
void SoundGateOpenStart()
Определения Fence.c:772
const string SOUND_GATE_CLOSE_START
Определения Fence.c:8
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
Определения Fence.c:331
bool HasFullyConstructedGate()
Определения Fence.c:73
bool GateAttachmentConditions(int slotId)
Определения Fence.c:840
EffectSound m_SoundGate_End
Определения Fence.c:41
override void SetActions()
Определения Fence.c:876
const string MEM_POINT_SPAWN
Определения Fence.c:28
const float GATE_ROTATION_TIME_APPROX
Определения Fence.c:13
const string ATT_CATEGORY_MATERIAL
Определения Fence.c:31
const int GATE_STATE_FULL
Определения Fence.c:5
ATTACHMENT_WOODEN_LOG
Определения Fence.c:18
void HandleDropAttachment(ItemBase item)
Определения Fence.c:816
bool m_IsOpened
Определения Fence.c:36
bool m_ToDiscard
Определения Fence.c:35
ATTACHMENT_CODE_LOCK
Определения Fence.c:20
void CheckFenceClosed()
Определения Fence.c:587
void SoundGateCloseStart()
Определения Fence.c:781
const float MAX_ACTION_DETECTION_ANGLE_RAD
Определения Fence.c:15
CamoNet GetCamoNet()
Определения Fence.c:167
override bool IsFacingCamera(string selection)
Определения Fence.c:724
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения Fence.c:697
const float MAX_ACTION_DETECTION_DISTANCE
Определения Fence.c:16
override void AfterStoreLoad()
Определения Fence.c:291
override bool CanUseConstructionBuild()
Определения Fence.c:764
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения Fence.c:256
void CheckFenceOpened()
Определения Fence.c:577
override int GetMeleeTargetType()
Определения Fence.c:62
bool CanCloseFence()
Определения Fence.c:480
override bool HasProperDistance(string selection, PlayerBase player)
Определения Fence.c:749
BarbedWire GetBarbedWire1()
Определения Fence.c:173
int GetGateState()
Определения Fence.c:84
bool CanOpenFence()
Определения Fence.c:472
void OpenFence()
Определения Fence.c:488
const string ATTACHMENT_SLOT_COMBINATION_LOCK
Определения Fence.c:25
CombinationLock GetCombinationLock()
Определения Fence.c:155
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
Определения Fence.c:372
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения Fence.c:411
override void OnStoreSave(ParamsWriteContext ctx)
Определения Fence.c:246
void UpdateBarbedWireAreaDamagePos(float rotation_angle=0, bool to_delete=false)
Определения Fence.c:615
const string SOUND_GATE_OPEN_START
Определения Fence.c:7
override vector GetKitSpawnPosition()
Определения Fence.c:186
DigitalCodeLock GetCodeLock()
Определения Fence.c:161
void SoundGateCloseEnd()
Определения Fence.c:790
override bool CanBeRepairedToPristine()
Определения Fence.c:466
const int GATE_STATE_PARTIAL
Определения Fence.c:4
int m_GateState
Определения Fence.c:38
int CheckGateState()
Определения Fence.c:89
override void CreateAreaDamage(string slot_name, float rotation_angle=0)
Определения Fence.c:604
override bool IsActionTargetVisible()
Определения Fence.c:52
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
Определения Fence.c:341
BarbedWire GetBarbedWire2()
Определения Fence.c:179
Определения Fence.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
ConstructionPart GetGateConstructionPart()
Определения Construction.c:152
void SetActionInitiator(PlayerBase action_initiator)
Определения ConstructionActionData.c:131
bool IsGate()
Определения ConstructionPart.c:278
bool IsBuilt()
Определения ConstructionPart.c:160
array< string > GetRequiredParts()
Определения ConstructionPart.c:283
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
Определения EnDebug.c:241
bool IsLocked()
Определения CodeLock.c:373
void UnlockOnServer(EntityAI parent)
Unlock AND drop.
Определения CodeLock.c:277
Определения CodeLock.c:2
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
Определения InventorySlots.c:6
static bool IsBaseBuildingLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:809
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
proto float Normalize()
Normalizes vector. Returns length.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
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.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10