DayZ 1.24
Loading...
Searching...
No Matches
EntityAI.c
Go to the documentation of this file.
9
11{
16}
17
18enum PlantType
19{
20 TREE_HARD = 1000,
21 TREE_SOFT = 1001,
22 BUSH_HARD = 1002,
23 BUSH_SOFT = 1003,
24}
25
27{
28 FULL = 0,
33}
34
36{
37 UPDATE, //generic operation
40}
41
44{
45 ALWAYS = 0,
47 //further values yet unused, but nice to have anyway
50}
51
54{
56 //Legacy relations
67 //
68 EXCLUSION_HEADGEAR_HELMET_0, //full helmet
69 //EXCLUSION_HEADGEAR_HELMET_0_A, //example of another 'vector' of potential conflict, like between helmet and eyewear..otherwise the other non-helmet entities would collide through the 'EXCLUSION_HEADSTRAP_0' value.
73 EXCLUSION_MASK_2, //Mostly Gasmasks
74 EXCLUSION_MASK_3, //bandana mask special behavior
77 //values to solve the edge-cases with shaving action
81}
82
84{
85 Man m_Player;
86
88 {
90 params.m_Player = player;
91 return params;
92 }
93};
94
98
99class EntityAI extends Entity
100{
103 bool m_PreparedToDelete = false;
104 bool m_RefresherViable = false;
105 bool m_WeightDirty = 1;
106 private ref map<int, ref set<int>> m_AttachmentExclusionSlotMap; //own masks for different slots <slot,mask>. Kept on instance to better respond to various state changes
107 private ref set<int> m_AttachmentExclusionMaskGlobal; //additional mask values and simple item values. Independent of slot-specific behavior!
108 private ref set<int> m_AttachmentExclusionMaskChildren; //additional mask values and simple item values
109
111
114
115 const int DEAD_REPLACE_DELAY = 2000;
116 const int DELETE_CHECK_DELAY = 100;
117
121
123 private ref map<int, string> m_DamageDisplayNameMap = new map<int, string>; //values are localization keys as strings, use 'Widget.TranslateString' method to get the localized one
124
125 float m_Weight;
127 float m_ConfigWeight = ConfigGetInt("weight");
128 protected bool m_CanDisplayWeight;
129 private float m_LastUpdatedTime;
131
133
134 bool m_PendingDelete = false;
135 bool m_Initialized = false;
136 bool m_TransportHitRegistered = false;
138
139 //Called on item attached to this item (EntityAI item, string slot, EntityAI parent)
141 //Called on item detached from this item (EntityAI item, string slot, EntityAI parent)
143 //Called when an item is added to the cargo of this item (EntityAI item, EntityAI parent)
145 //Called when an item is removed from the cargo of this item (EntityAI item, EntityAI parent)
147 //Called when an item is moved around in the cargo of this item (EntityAI item, EntityAI parent)
149 //Called when an item is flipped around in cargo (bool flip)
151 //Called when an items view index is changed
153 //Called when an location in this item is reserved (EntityAI item) - cargo
155 //Called when this item is unreserved (EntityAI item) - cargo
157 //Called when an location in this item is reserved (EntityAI item) - attachment
159 //Called when this item is unreserved (EntityAI item) - attachment
161 //Called when this entity is hit
163 //Called when this entity is killed
165
166 void EntityAI()
167 {
168 // Set up the Energy Manager
169 string type = GetType();
170 string param_access_energy_sys = "CfgVehicles " + type + " EnergyManager ";
171 bool is_electic_device = GetGame().ConfigIsExisting(param_access_energy_sys);
172
173 if (is_electic_device) // TO DO: Check if this instance is a hologram (advanced placement). If Yes, then do not create Energy Manager component.
174 {
175 CreateComponent(COMP_TYPE_ENERGY_MANAGER);
176 RegisterNetSyncVariableBool("m_EM.m_IsSwichedOn");
177 RegisterNetSyncVariableBool("m_EM.m_CanWork");
178 RegisterNetSyncVariableBool("m_EM.m_IsPlugged");
179 RegisterNetSyncVariableInt("m_EM.m_EnergySourceNetworkIDLow");
180 RegisterNetSyncVariableInt("m_EM.m_EnergySourceNetworkIDHigh");
181 RegisterNetSyncVariableFloat("m_EM.m_Energy");
182 }
183
184 // Item preview index
185 RegisterNetSyncVariableInt("m_ViewIndex", 0, 99);
186 // Refresher signalization
187 RegisterNetSyncVariableBool("m_RefresherViable");
188
189 m_AttachmentsWithCargo = new array<EntityAI>();
190 m_AttachmentsWithAttachments = new array<EntityAI>();
191 m_LastUpdatedTime = 0.0;
192 m_ElapsedSinceLastUpdate = 0.0;
193
194 m_CanDisplayWeight = ConfigGetBool("displayWeight");
195
196 InitDamageZoneMapping();
197 InitDamageZoneDisplayNameMapping();
198
199 m_HiddenSelectionsData = new HiddenSelectionsData(GetType());
200
201 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DeferredInit, 34);
202 }
203
205 {
206
207 }
208
210 {
211 m_Initialized = true;
212 }
213
215 {
216 return m_Initialized;
217 }
218
221 {
222 return EInventoryIconVisibility.ALWAYS;
223 }
224
226 ComponentEnergyManager m_EM; // This reference is necesarry due to synchronization, since it's impossible to synchronize values from a component :(
227
230 {
231 return GetComponent(comp_type, extended_class_name);
232 }
233
236 {
237 if (m_ComponentsBank == NULL)
238 m_ComponentsBank = new ComponentsBank(this);
239
240 return m_ComponentsBank.GetComponent(comp_type, extended_class_name);
241 }
242
245 {
246 return m_ComponentsBank.DeleteComponent(comp_type);
247 }
248
250 {
251 return "";
252 }
253
255 {
256 return false;
257 }
258
261 {
262 if (m_ComponentsBank)
263 return m_ComponentsBank.IsComponentAlreadyExist(comp_type);
264
265 return false;
266 }
267
270 {
271 if ((!GetGame().IsMultiplayer() || GetGame().IsServer()) && GetEconomyProfile())
272 {
273 float lifetime = GetEconomyProfile().GetLifetime();
274 int frequency = GetCEApi().GetCEGlobalInt("FlagRefreshFrequency");
275 if (frequency <= 0)
277
278 if (frequency <= lifetime)
279 {
280 m_RefresherViable = true;
281 SetSynchDirty();
282 }
283 }
284 }
285
287 {
288 if (IsRuined())
289 return false;
290 return m_RefresherViable;
291 }
292
293#ifdef DEVELOPER
294 override void SetDebugItem()
295 {
296 super.SetDebugItem();
297 _item = this;
298 }
299#endif
300
301
304 {
305 m_DamageZoneMap = new DamageZoneMap;
306 DamageSystem.GetDamageZoneMap(this, m_DamageZoneMap);
307 }
308
311 {
312 string path_base;
313 string path;
314 string component_name;
315
316 if (IsWeapon())
318 else if (IsMagazine())
320 else
322
323 path_base = string.Format("%1 %2 DamageSystem DamageZones", path_base, GetType());
324
325 if (!GetGame().ConfigIsExisting(path_base))
326 {
327 component_name = GetDisplayName();
328 GetGame().FormatRawConfigStringKeys(component_name);
329 m_DamageDisplayNameMap.Insert("".Hash(), component_name);
330 }
331 else
332 {
334 GetDamageZones(zone_names);
335
336 for (int i = 0; i < zone_names.Count(); i++)
337 {
338 path = string.Format("%1 %2 displayName", path_base, zone_names[i]);
339
340 if (GetGame().ConfigIsExisting(path) && GetGame().ConfigGetTextRaw(path, component_name))
341 {
342 GetGame().FormatRawConfigStringKeys(component_name);
343 m_DamageDisplayNameMap.Insert(zone_names[i].Hash(), component_name);
344 }
345 }
346 }
347 }
348
350 {
351 return 0.0;
352 }
353
356 {
357 return 0.0;
358 }
359
361 {
362 return m_DamageZoneMap;
363 }
364
366 {
367 return m_DamageDisplayNameMap;
368 }
369
372 {
373 return m_CanDisplayWeight;
374 }
375
377 void Log(string msg, string fnc_name = "n/a")
378 {
379 Debug.Log(msg, "Object", "n/a", fnc_name, this.GetType());
380 }
381
383 void LogWarning(string msg, string fnc_name = "n/a")
384 {
385 Debug.LogWarning(msg, "Object", "n/a", fnc_name, this.GetType());
386 }
387
389 void LogError(string msg, string fnc_name = "n/a")
390 {
391 Debug.LogError(msg, "Object", "n/a", fnc_name, this.GetType());
392 }
393
396 {
397 return GetCompBS() && GetCompBS().IsSkinned();
398 }
399
401 {
402 if (GetCompBS())
403 GetCompBS().SetAsSkinned();
404 }
405
407 {
408 if (!IsSkinned() && tool)
409 if (!IsAlive())
410 return true;
411 return false;
412 }
414
415 // ITEM TO ITEM FIRE DISTRIBUTION
418 {
419 return false;
420 }
421
424 {
425 return false;
426 }
427
430 {
431 return false;
432 }
433
436 {
437 if (m_EM)
438 return m_EM.IsWorking();
439 return false;
440 }
441
442 // Change return value to true if last detached item cause disassemble of item - different handlig some inventory operations
444 {
445 return false;
446 }
447
449 {
450 return false;
451 }
452
455 {
456 return true;
457 }
458
461 {
462
463 }
464
467 {
468
469 }
470
476
482
485 {
486 return true;
487 }
488
491 {
492 return true;
493 }
494 // End of fire distribution ^
495
496 // ADVANCED PLACEMENT EVENTS
501
503 {
504 return true;
505 }
506
509 {
510 return "";
511 }
512
515 {
516 return false;
517 }
518
521 {
522 return 0.0;
523 }
524
527 {
528 return 0.0;
529 }
530
532 bool IsEmpty()
533 {
534 return (!HasAnyCargo() && GetInventory().AttachmentCount() == 0);
535 }
536
538 {
539 return false;
540 }
541
544 {
545 CargoBase cargo = GetInventory().GetCargo();
546
547 if (!cargo) return false; //this is not a cargo container
548
549 if (cargo.GetItemCount() > 0)
550 return true;
551 else
552 return false;
553 }
554
556 {
557 return m_AttachmentsWithCargo;
558 }
559
561 {
562 return m_AttachmentsWithAttachments;
563 }
564
565 int GetAgents() { return 0; }
569 void InsertAgent(int agent, float count = 1);
570
571 override bool IsEntityAI() { return true; }
572
574 {
575 return !(GetParent() || GetHierarchyParent());
576 }
577
578 bool IsPlayer()
579 {
580 return false;
581 }
582
583 bool IsAnimal()
584 {
585 return false;
586 }
587
588 bool IsZombie()
589 {
590 return false;
591 }
592
594 {
595 return false;
596 }
597
599 {
600 return IsDamageDestroyed();
601 }
602
604 {
605 if (ai && ai.IsBeingBackstabbed())
606 return false;
607
608 if (!dBodyIsActive(this) && !IsMan())
609 return false;
610 return !IsDamageDestroyed();
611 }
612
614 {
615 return false;
616 }
617
626 override void Delete()
627 {
628 m_PendingDelete = true;
629 super.Delete();
630 }
631
633 {
634 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().ObjectDeleteOnClient, this);
635 }
636
637 // delete synchronized between server and client
639 {
640 if (GetHierarchyRootPlayer() == null)
641 Delete();
642 else
643 {
644 if (GetGame().IsServer() && GetGame().IsMultiplayer())
645 GetHierarchyRootPlayer().JunctureDeleteItem(this);
646 else
647 GetHierarchyRootPlayer().AddItemToDelete(this);
648 }
649 }
650
651 //legacy, wrong name, use 'DeleteSafe()' instead
653 {
654 DeleteSafe();
655 }
656
658 {
659 return IsPreparedToDelete() || m_PendingDelete || ToDelete() || IsPendingDeletion();
660 }
661
662 override bool CanBeActionTarget()
663 {
664 if (super.CanBeActionTarget())
665 return !IsSetForDeletion();
666 else
667 return false;
668 }
669
671 {
672 m_PreparedToDelete = true;
673 }
674
676 {
677 return m_PreparedToDelete;
678 }
679
680
682 {
683 if (IsPrepareToDelete())
684 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(TryDelete, DELETE_CHECK_DELAY, false);
685 }
686
688 {
689 return false;
690 }
691
693 {
694 if (!IsPrepareToDelete())
695 {
696 Debug.Log("TryDelete - not ready for deletion");
697 return false;
698 }
699
700 if (GetGame().HasInventoryJunctureItem(this))
701 {
702 Debug.Log("TryDelete - deferred call");
703 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(TryDelete, DELETE_CHECK_DELAY, false);
704 return false;
705 }
706
707 OnBeforeTryDelete();
708 Debug.Log("TryDelete - OnBeforeTryDelete end");
709 DeleteSafe();
710 Debug.Log("TryDelete - DeleteSafe end");
711
712 return true;
713 }
714
716
719
722
725
728
729 // !returns the number of levels bellow the hierarchy root this entity is at
731 {
732 if (!GetHierarchyParent())
733 return lvl;
734
735 return GetHierarchyParent().GetHierarchyLevel(lvl + 1);
736 }
737
739 {
740 InitAttachmentExclusionValues();
741 }
742
744 void EEInit()
745 {
746 if (GetInventory())
747 {
748 GetInventory().EEInit();
749 m_AttachmentsWithCargo.Clear();
750 m_AttachmentsWithAttachments.Clear();
751 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
752 {
753 EntityAI attachment = GetInventory().GetAttachmentFromIndex(i);
754 if (attachment)
755 {
756 if (attachment.GetInventory().GetCargo())
757 m_AttachmentsWithCargo.Insert(attachment);
758
759 if (attachment.GetInventory().GetAttachmentSlotsCount() > 0)
760 m_AttachmentsWithAttachments.Insert(attachment);
761 }
762 }
763 }
764
765 MaxLifetimeRefreshCalc();
766 }
767
769 void EEDelete(EntityAI parent)
770 {
771 m_PendingDelete = true;
772 GetInventory().EEDelete(parent);
773
774 if (m_EM)
775 m_EM.OnDeviceDestroyed();
776 }
777
779 {
781#ifndef SERVER
782 g_Game.GetWorld().AddEnvShootingSource(pos, 1.0);
783#endif
784 if (m_DestructionBehaviourObj && m_DestructionBehaviourObj.HasExplosionDamage())
785 m_DestructionBehaviourObj.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
786 }
787
788
790
792
794 {
795 EntityAI old_owner = oldLoc.GetParent();
796 EntityAI new_owner = newLoc.GetParent();
798
799 if (oldLoc.GetType() == InventoryLocationType.ATTACHMENT && newLoc.GetType() == InventoryLocationType.ATTACHMENT)
801
802 if (oldLoc.GetType() == InventoryLocationType.ATTACHMENT)
803 {
804 if (old_owner)
805 OnWasDetached(old_owner, oldLoc.GetSlot());
806 else
807 Error("EntityAI::EEItemLocationChanged - detached, but old_owner is null");
808 }
809
810 if (newLoc.GetType() == InventoryLocationType.ATTACHMENT)
811 {
812 if (new_owner)
813 OnWasAttached(newLoc.GetParent(), newLoc.GetSlot());
814 else
815 Error("EntityAI::EEItemLocationChanged - attached, but new_owner is null");
816 }
817 }
818
821 {
822 }
823
826 {
827 }
828
833 {
834 m_LastUpdatedTime = 0.0;
835
836 if (GetInventory() && newParent == null)
837 GetInventory().ResetFlipCargo();
838 }
839
841 {
842 SetWeightDirty();
843 }
844
846 {
847 // Notify potential parent that this item was ruined
848 EntityAI parent = GetHierarchyParent();
849
851 {
852 if (parent)
853 parent.OnAttachmentRuined(this);
854 if (!zone)
856 AttemptDestructionBehaviour(oldLevel, newLevel, zone);
857 }
858 }
859
862
864 {
866 {
867 typename destType = GetDestructionBehaviour().ToType();
868
869 if (destType)
870 {
871 if (!m_DestructionBehaviourObj)
872 m_DestructionBehaviourObj = DestructionEffectBase.Cast(destType.Spawn());
873
874 if (m_DestructionBehaviourObj)
875 m_DestructionBehaviourObj.OnHealthLevelChanged(this, oldLevel, newLevel, zone);
876 }
877 else
878 ErrorEx("Incorrect destruction behaviour type, make sure the class returned in 'GetDestructionBehaviour()' is a valid type inheriting from 'DestructionEffectBase'");
879 }
880 }
881
882
883 void SetTakeable(bool pState);
884
887 {
888 if (m_OnKilledInvoker)
889 m_OnKilledInvoker.Invoke(this, killer);
890 //analytics
891 GetGame().GetAnalyticsServer().OnEntityKilled(killer, this);
892
893 if (ReplaceOnDeath())
894 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DeathUpdate, DEAD_REPLACE_DELAY, false);
895 }
896
898 {
899 return false;
900 }
901
903 {
904 return "";
905 }
906
908 {
909 return false;
910 }
911
913 {
915 dead_entity.SetOrientation(GetOrientation());
917 dead_entity.SetHealth(GetHealth());
918 this.Delete();
919 }
920
923 {
924 // ...
925 }
926
928 {
929 if (m_OnHitByInvoker)
930 m_OnHitByInvoker.Invoke(this, damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
931#ifdef DEVELOPER
932 //Print("EEHitBy: " + this + "; damageResult:"+ damageResult.GetDamage("","") +"; damageType: "+ damageType +"; source: "+ source +"; component: "+ component +"; dmgZone: "+ dmgZone +"; ammo: "+ ammo +"; modelPos: "+ modelPos);
933#endif
934 }
935
936 // called only on the client who caused the hit
938 {
939
940 }
941
942 // !Called on PARENT when a child is attached to it.
944 {
946 PropagateExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId), slotId); //Performed from parent to avoid event order issues on swap
947 SetWeightDirty();
948
949 if (m_ComponentsBank != NULL)
950 {
951 for (int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key)
952 {
953 if (m_ComponentsBank.IsComponentAlreadyExist(comp_key))
954 m_ComponentsBank.GetComponent(comp_key).Event_OnItemAttached(item, slot_name);
955 }
956 }
957
958 // Energy Manager
959 if (m_EM && item.GetCompEM())
961
962 if (item.GetInventory().GetCargo())
963 m_AttachmentsWithCargo.Insert(item);
964
965 if (item.GetInventory().GetAttachmentSlotsCount() > 0)
966 m_AttachmentsWithAttachments.Insert(item);
967
968 if (m_OnItemAttached)
969 m_OnItemAttached.Invoke(item, slot_name, this);
970 }
971
974
975 // !Called on PARENT when a child is detached from it.
977 {
979 ClearExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId), slotId); //Performed from parent to avoid event order issues on swap
980 SetWeightDirty();
981
982 if (m_ComponentsBank != NULL)
983 {
984 for (int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key)
985 {
986 if (m_ComponentsBank.IsComponentAlreadyExist(comp_key))
987 m_ComponentsBank.GetComponent(comp_key).Event_OnItemDetached(item, slot_name);
988 }
989 }
990
991 // Energy Manager
992 if (m_EM && item.GetCompEM())
994
995 if (m_AttachmentsWithCargo.Find(item) > -1)
996 m_AttachmentsWithCargo.RemoveItem(item);
997
998 if (m_AttachmentsWithAttachments.Find(item) > -1)
999 m_AttachmentsWithAttachments.RemoveItem(item);
1000
1001
1002 if (m_OnItemDetached)
1003 m_OnItemDetached.Invoke(item, slot_name, this);
1004 }
1005
1007 {
1008 SetWeightDirty();
1009
1010 if (m_OnItemAddedIntoCargo)
1011 m_OnItemAddedIntoCargo.Invoke(item, this);
1012
1013 item.OnMovedInsideCargo(this);
1014 }
1015
1017 {
1018 SetWeightDirty();
1019
1020 if (m_OnItemRemovedFromCargo)
1021 m_OnItemRemovedFromCargo.Invoke(item, this);
1022
1023 item.OnRemovedFromCargo(this);
1024 }
1025
1027 {
1028 if (m_OnItemMovedInCargo)
1029 m_OnItemMovedInCargo.Invoke(item, this);
1030 item.OnMovedWithinCargo(this);
1031 }
1032
1034 {
1035 if (!m_OnItemAttached)
1036 m_OnItemAttached = new ScriptInvoker;
1037 return m_OnItemAttached;
1038 }
1039
1041 {
1042 if (!m_OnItemDetached)
1043 m_OnItemDetached = new ScriptInvoker;
1044 return m_OnItemDetached;
1045 }
1046
1048 {
1049 if (!m_OnItemAddedIntoCargo)
1050 m_OnItemAddedIntoCargo = new ScriptInvoker;
1051 return m_OnItemAddedIntoCargo;
1052 }
1053
1055 {
1056 if (!m_OnItemRemovedFromCargo)
1057 m_OnItemRemovedFromCargo = new ScriptInvoker;
1058 return m_OnItemRemovedFromCargo;
1059 }
1060
1062 {
1063 if (!m_OnItemMovedInCargo)
1064 m_OnItemMovedInCargo = new ScriptInvoker;
1065 return m_OnItemMovedInCargo;
1066 }
1067
1069 {
1070 if (!m_OnItemFlipped)
1071 m_OnItemFlipped = new ScriptInvoker;
1072 return m_OnItemFlipped;
1073 }
1074
1076 {
1077 if (!m_OnViewIndexChanged)
1078 m_OnViewIndexChanged = new ScriptInvoker;
1079 return m_OnViewIndexChanged;
1080 }
1081
1083 {
1084 if (!m_OnSetLock)
1085 m_OnSetLock = new ScriptInvoker;
1086 return m_OnSetLock;
1087 }
1088
1090 {
1091 if (!m_OnReleaseLock)
1092 m_OnReleaseLock = new ScriptInvoker;
1093 return m_OnReleaseLock;
1094 }
1095
1097 {
1098 if (!m_OnAttachmentSetLock)
1099 m_OnAttachmentSetLock = new ScriptInvoker;
1100 return m_OnAttachmentSetLock;
1101 }
1102
1104 {
1105 if (!m_OnAttachmentReleaseLock)
1106 m_OnAttachmentReleaseLock = new ScriptInvoker;
1107 return m_OnAttachmentReleaseLock;
1108 }
1109
1111 {
1112 if (!m_OnHitByInvoker)
1113 m_OnHitByInvoker = new ScriptInvoker;
1114 return m_OnHitByInvoker;
1115 }
1116
1118 {
1119 if (!m_OnKilledInvoker)
1120 m_OnKilledInvoker = new ScriptInvoker;
1121 return m_OnKilledInvoker;
1122 }
1123
1124
1127 {
1128 if (m_EM)
1130 }
1131
1134 {
1135
1136 }
1137
1140 {
1141
1142 }
1143
1146 {
1147 // ENERGY MANAGER
1148 // Restore connections between devices which were connected before server restart
1149 if (m_EM && m_EM.GetRestorePlugState())
1150 {
1151 int b1 = m_EM.GetEnergySourceStorageIDb1();
1152 int b2 = m_EM.GetEnergySourceStorageIDb2();
1153 int b3 = m_EM.GetEnergySourceStorageIDb3();
1154 int b4 = m_EM.GetEnergySourceStorageIDb4();
1155
1156 // get pointer to EntityAI based on this ID
1157 EntityAI potential_energy_source = GetGame().GetEntityByPersitentID(b1, b2, b3, b4); // This function is available only in this event!
1158
1159 // IMPORTANT!
1160 // Object IDs acquired here become INVALID when electric devices are transfered to another server while in plugged state (like Flashlight plugged into its attachment 9V battery)
1161 // To avoid issues, these items must be excluded from this system of restoring plug state so they don't unintentionally plug to incorrect devices through these invalid IDs.
1162 // Therefore their plug state is being restored withing the EEItemAttached() event while being excluded by the following 'if' conditions...
1163
1164 bool is_attachment = false;
1165
1167 is_attachment = GetInventory().HasAttachment(potential_energy_source);
1168
1170 is_attachment = potential_energy_source.GetInventory().HasAttachment(this);
1171
1172 if (potential_energy_source && potential_energy_source.GetCompEM() /*&& potential_energy_source.HasEnergyManager()*/ && !is_attachment)
1173 m_EM.PlugThisInto(potential_energy_source); // restore connection
1174 }
1175 }
1176
1179 {
1180 }
1181
1184 {
1185 }
1186
1189 {
1190 if (GetHierarchyRootPlayer())
1191 GetHierarchyRootPlayer().SetProcessUIWarning(true);
1192 }
1193
1196 {
1197 string cfg_path = "cfgVehicles " + GetType() + " AnimationSources";
1198
1199 if (GetGame().ConfigIsExisting(cfg_path))
1200 {
1201 int selections = GetGame().ConfigGetChildrenCount(cfg_path);
1202
1203 for (int i = 0; i < selections; i++)
1204 {
1205 string selection_name;
1206 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1207 HideSelection(selection_name);
1208 }
1209 }
1210 }
1211
1214 {
1215 string cfg_path = "cfgVehicles " + GetType() + " AnimationSources";
1216
1217 if (GetGame().ConfigIsExisting(cfg_path))
1218 {
1219 int selections = GetGame().ConfigGetChildrenCount(cfg_path);
1220
1221 for (int i = 0; i < selections; i++)
1222 {
1223 string selection_name;
1224 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1225 ShowSelection(selection_name);
1226 }
1227 }
1228 }
1229
1237 {
1238 //generic occupancy check
1239 EntityAI currentAtt = GetInventory().FindAttachment(slotId);
1240 bool hasInternalConflict = attachment.HasInternalExclusionConflicts(slotId);
1241 if (currentAtt) //probably a swap or same-type swap
1242 {
1243 set<int> diff = attachment.GetAttachmentExclusionMaskAll(slotId);
1244 diff.RemoveItems(currentAtt.GetAttachmentExclusionMaskAll(slotId));
1245 if (diff.Count() == 0)
1246 return !hasInternalConflict;
1247 else
1248 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(diff, slotId);
1249 }
1250 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(attachment.GetAttachmentExclusionMaskAll(slotId), slotId);
1251 }
1252
1260 {
1261 return true;
1262 }
1263
1272 {
1273 return !IsHologram();
1274 }
1275
1276 //If return true, item can be attached even from parent to this. Item will be switched during proccess. (only hands)
1278 {
1279 return false;
1280 }
1288 {
1289 if (attachment && attachment.GetInventory() && GetInventory())
1290 {
1292 attachment.GetInventory().GetCurrentInventoryLocation(il);
1293 if (il.IsValid())
1294 {
1295 int slot = il.GetSlot();
1296 return !GetInventory().GetSlotLock(slot);
1297 }
1298 }
1299 return true;
1300 }
1308 {
1309 return true;
1310 }
1311
1313 {
1314 return true;
1315 }
1316
1318 {
1319 EntityAI att = GetInventory().FindAttachment(slot);
1320 if (att)
1321 return att.CanBeCombined(e, true, stack_max_limit);
1322 return false;
1323 }
1324
1326 {
1327 return false;
1328 }
1329
1332
1340 {
1341 if (GetInventory() && GetInventory().GetCargo())
1342 return GetInventory().GetCargo().CanReceiveItemIntoCargo(item));
1343
1344 return true;
1345 }
1346
1354 {
1355 return true;
1356 }
1357
1365 {
1366 return !IsHologram();
1367 }
1368
1376 {
1377 if (GetInventory() && GetInventory().GetCargo())
1378 return GetInventory().GetCargo().CanSwapItemInCargo(child_entity, new_entity));
1379
1380 return true;
1381 }
1382
1390 {
1391 return true;
1392 }
1393
1401 {
1402 return true;
1403 }
1404
1411 /*bool CanReceiveItemIntoInventory (EntityAI entity_ai)
1412 {
1413 return true;
1414 }*/
1415
1422 /*bool CanPutInInventory (EntityAI parent)
1423 {
1424 return true;
1425 }*/
1426
1434 {
1435 return true;
1436 }
1437
1439 {
1440 return false;
1441 }
1442
1443 override bool IsHologram()
1444 {
1445 return false;
1446 }
1447
1449 {
1450 return true;
1451 }
1452
1460 {
1461 return !IsHologram();
1462 }
1463
1471 {
1472 return true;
1473 }
1474
1482 {
1483 return true;
1484 }
1485
1491 {
1492 Debug.LogWarning("Obsolete function - use CanDisplayAttachmentSlot with slot id parameter");
1494 }
1495
1504
1509 {
1510 int count = GetInventory().GetAttachmentSlotsCount();
1511 int slotID;
1512 for (int i = 0; i < count; i++)
1513 {
1514 slotID = GetInventory().GetAttachmentSlotId(i);
1516 return true;
1517 }
1518
1519 return false;
1520 }
1521
1527 {
1528 return true;
1529 }
1530
1535 {
1536 return GetInventory().GetCargo() != null;
1537 }
1538
1543 {
1544 return true;
1545 }
1546
1551 {
1552 return true;
1553 }
1554
1559 {
1560 return GetHierarchyRootPlayer() == GetGame().GetPlayer();
1561 }
1562
1563 // !Called on CHILD when it's attached to parent.
1564 void OnWasAttached(EntityAI parent, int slot_id);
1565
1566 // !Called on CHILD when it's detached from parent.
1568 {
1569 if (!IsFlagSet(EntityFlags.VISIBLE))
1570 {
1571 SetInvisible(false);
1572 OnInvisibleSet(false);
1573 SetInvisibleRecursive(false, parent);
1574 }
1575 }
1576
1578
1580 {
1581 return false;
1582 }
1583
1587
1589 {
1590 if (GetInventory())
1591 return GetInventory().GetAttachmentSlotsCount();
1592 else
1593 return -1;
1594 }
1595
1597 {
1598 if (GetGame())
1599 {
1602 return GetInventory().FindAttachment(slot_id);
1603 }
1604 return null;
1605 }
1606
1611 {
1612 EntityAI parent = GetHierarchyParent();
1613 if (parent)
1614 {
1616 GetInventory().GetCurrentInventoryLocation(inventory_location);
1617
1618 return parent.GetInventory().GetSlotLock(inventory_location.GetSlot());
1619 }
1620
1621 return false;
1622 }
1623
1628 {
1629 if (GetGame().IsMultiplayer())
1630 return GetInventory().TakeEntityToInventory(InventoryMode.JUNCTURE, flags, item);
1631 else
1632 return GetInventory().TakeEntityToInventory(InventoryMode.PREDICTIVE, flags, item);
1633 }
1635 {
1636 return GetInventory().TakeEntityToInventory(InventoryMode.LOCAL, flags, item);
1637 }
1639 {
1640 return GetInventory().TakeEntityToInventory(InventoryMode.SERVER, flags, item);
1641 }
1643 {
1644 if (GetGame().IsMultiplayer())
1645 return GetInventory().TakeEntityToTargetInventory(InventoryMode.JUNCTURE, target, flags, item);
1646 else
1647 return GetInventory().TakeEntityToTargetInventory(InventoryMode.PREDICTIVE, target, flags, item);
1648 }
1650 {
1651 return GetInventory().TakeEntityToTargetInventory(InventoryMode.LOCAL, target, flags, item);
1652 }
1654 {
1655 return GetInventory().TakeEntityToTargetInventory(InventoryMode.SERVER, target, flags, item);
1656 }
1661 {
1662 if (GetGame().IsMultiplayer())
1663 return GetInventory().TakeEntityToCargo(InventoryMode.JUNCTURE, item);
1664 else
1665 return GetInventory().TakeEntityToCargo(InventoryMode.PREDICTIVE, item);
1666 }
1668 {
1669 return GetInventory().TakeEntityToCargo(InventoryMode.LOCAL, item);
1670 }
1672 {
1673 return GetInventory().TakeEntityToCargo(InventoryMode.SERVER, item);
1674 }
1675
1677 {
1678 if (GetGame().IsMultiplayer())
1679 return GetInventory().TakeEntityToTargetCargo(InventoryMode.JUNCTURE, target, item);
1680 else
1681 return GetInventory().TakeEntityToTargetCargo(InventoryMode.PREDICTIVE, target, item);
1682 }
1684 {
1685 return GetInventory().TakeEntityToTargetCargo(InventoryMode.LOCAL, target, item);
1686 }
1688 {
1689 return GetInventory().TakeEntityToTargetCargo(InventoryMode.SERVER, target, item);
1690 }
1695 {
1696 if (GetGame().IsMultiplayer())
1697 return GetInventory().TakeEntityToCargoEx(InventoryMode.JUNCTURE, item, idx, row, col);
1698 else
1699 return GetInventory().TakeEntityToCargoEx(InventoryMode.PREDICTIVE, item, idx, row, col);
1700 }
1702 {
1703 return GetInventory().TakeEntityToCargoEx(InventoryMode.LOCAL, item, idx, row, col);
1704 }
1705
1707 {
1708 if (GetGame().IsMultiplayer())
1709 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.JUNCTURE, cargo, item, row, col);
1710 else
1711 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.PREDICTIVE, cargo, item, row, col);
1712 }
1714 {
1715 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.LOCAL, cargo, item, row, col);
1716 }
1718 {
1719 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.SERVER, cargo, item, row, col);
1720 }
1725 {
1726 if (GetGame().IsMultiplayer())
1727 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.JUNCTURE, item, slot);
1728 else
1729 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.PREDICTIVE, item, slot);
1730 }
1732 {
1733 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.LOCAL, item, slot);
1734 }
1736 {
1737 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.SERVER, item, slot);
1738 }
1739
1741 {
1742 if (GetGame().IsMultiplayer())
1743 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.JUNCTURE, target, item, slot);
1744 else
1745 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.PREDICTIVE, target, item, slot);
1746 }
1748 {
1749 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.LOCAL, target, item, slot);
1750 }
1752 {
1753 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.SERVER, target, item, slot);
1754 }
1755
1757 {
1758 if (GetGame().IsMultiplayer())
1759 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.JUNCTURE, target, item);
1760 else
1761 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.PREDICTIVE, target, item);
1762 }
1764 {
1765 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.LOCAL, target, item);
1766 }
1768 {
1769 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.SERVER, target, item);
1770 }
1771
1773 {
1774 if (GetGame().IsMultiplayer())
1775 return GetInventory().TakeToDst(InventoryMode.JUNCTURE, src, dst);
1776 else
1777 return GetInventory().TakeToDst(InventoryMode.PREDICTIVE, src, dst);
1778 }
1780 {
1781 return GetInventory().TakeToDst(InventoryMode.LOCAL, src, dst);
1782 }
1784 {
1785 return GetInventory().TakeToDst(InventoryMode.SERVER, src, dst);
1786 }
1787
1792 {
1793 if (GetGame().IsMultiplayer())
1794 return GetInventory().TakeEntityAsAttachment(InventoryMode.JUNCTURE, item);
1795 else
1796 return GetInventory().TakeEntityAsAttachment(InventoryMode.PREDICTIVE, item);
1797 }
1799 {
1800 return GetInventory().TakeEntityAsAttachment(InventoryMode.LOCAL, item);
1801 }
1803 {
1804 return GetInventory().TakeEntityAsAttachment(InventoryMode.SERVER, item);
1805 }
1806
1808 {
1809 return false;
1810 }
1811
1813 {
1814 return false;
1815 }
1816
1818 {
1819 return false;
1820 }
1821
1826 {
1827 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
1828 {
1829 EntityAI attachment = GetInventory().GetAttachmentFromIndex(i);
1830 if (attachment && attachment.IsInherited(type))
1831 return attachment;
1832 }
1833 return NULL;
1834 }
1835
1840 {
1841 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
1842 {
1843 EntityAI attachment = GetInventory().GetAttachmentFromIndex(i);
1844 if (attachment.IsKindOf(type))
1845 return attachment;
1846 }
1847 return NULL;
1848 }
1853 {
1854 return true;
1855 }
1856
1858 {
1859 if (inv)
1860 {
1861 EntityAI res = inv.CreateInInventory(object_name);
1862 if (res)
1863 return res;
1864 }
1865
1866 return SpawnEntityOnGroundPos(object_name, pos);
1867 }
1868
1872 {
1874 vector mat[4];
1876 mat[3] = pos;
1877 il.SetGround(NULL, mat);
1879 }
1888
1889 //----------------------------------------------------------------
1890
1895
1896 // Forward declarations to allow lower modules to access properties that are modified from higher modules
1897 // These are mainly used within the ItemBase
1898 void SetWet(float value, bool allow_client = false);
1899 void AddWet(float value);
1901
1902 float GetWet()
1903 {
1904 return 0;
1905 }
1906
1908 {
1909 return 0;
1910 }
1911
1913 {
1914 return 0;
1915 }
1916
1918 {
1919 return 0;
1920 }
1921
1923 {
1924 return GetWetMax() - GetWetMin() != 0;
1925 }
1926
1927 void OnWetChanged(float newVal, float oldVal);
1928
1930 // ! Returns current wet level of the entity
1932
1933 // ! Calculates wet level from a given wetness, to get level of an entity, use 'GetWetLevel()' instead
1935 {
1937 return EWetnessLevel.DRY;
1938 else if (wetness < GameConstants.STATE_WET)
1939 return EWetnessLevel.DAMP;
1941 return EWetnessLevel.WET;
1943 return EWetnessLevel.SOAKING;
1944 return EWetnessLevel.DRENCHED;
1945 }
1946 //----------------------------------------------------------------
1947
1949 {
1950 return 0;
1951 }
1952
1954 {
1955 return 0;
1956 }
1957
1959
1961 {
1962 return 0;
1963 }
1964
1966 {
1967 return 0;
1968 }
1969
1970 //----------------------------------------------------------------
1971
1972 void SetTemperature(float value, bool allow_client = false) {};
1973 void AddTemperature(float value) {};
1975
1977 {
1978 return 0;
1979 }
1980
1982 {
1983 return 0;
1984 }
1985
1987 {
1988 return 0;
1989 }
1990
1992 {
1993 return 0;
1994 }
1995
1996 //----------------------------------------------------------------
1997
1999 {
2000 return m_HiddenSelectionsData;
2001 }
2002
2004 int GetHiddenSelectionIndex(string selection)
2005 {
2006 if (m_HiddenSelectionsData)
2007 return m_HiddenSelectionsData.GetHiddenSelectionIndex(selection);
2008
2009 return -1;
2010 }
2011
2014 {
2015 if (m_HiddenSelectionsData)
2016 return m_HiddenSelectionsData.m_HiddenSelections;
2017 else
2018 return super.GetHiddenSelections();
2019 }
2020
2023 {
2024 if (m_HiddenSelectionsData)
2025 return m_HiddenSelectionsData.m_HiddenSelectionsTextures;
2026 else
2027 return super.GetHiddenSelectionsTextures();
2028 }
2029
2032 {
2033 if (m_HiddenSelectionsData)
2034 return m_HiddenSelectionsData.m_HiddenSelectionsMaterials;
2035 else
2036 return super.GetHiddenSelectionsMaterials();
2037 }
2038
2050 proto native void PlaceOnSurfaceRotated(out vector trans[4], vector pos, float dx = 0, float dz = 0, float fAngle = 0, bool align = false);
2051
2059
2067
2077
2088
2096
2099
2101
2105
2112
2115
2134 {
2135 // Saving of energy related states
2136 if (m_EM)
2137 {
2138 // Save energy amount
2139 ctx.Write(m_EM.GetEnergy());
2140
2141 // Save passive/active state
2142 ctx.Write(m_EM.IsPassive());
2143
2144 // Save ON/OFF state
2145 ctx.Write(m_EM.IsSwitchedOn());
2146
2147 // Save plugged/unplugged state
2148 ctx.Write(m_EM.IsPlugged());
2149
2150 // ENERGY SOURCE
2151 // Save energy source IDs
2153 int b1 = 0;
2154 int b2 = 0;
2155 int b3 = 0;
2156 int b4 = 0;
2157
2158 if (energy_source)
2159 energy_source.GetPersistentID(b1, b2, b3, b4);
2160
2161 ctx.Write(b1); // Save energy source block 1
2162 ctx.Write(b2); // Save energy source block 2
2163 ctx.Write(b3); // Save energy source block 3
2164 ctx.Write(b4); // Save energy source block 4
2165 }
2166 }
2167
2193 {
2194 // Restoring of energy related states
2195
2196 if (m_EM)
2197 {
2198 // Load energy amount
2199 float f_energy = 0;
2200 if (!ctx.Read(f_energy))
2201 f_energy = 0;
2202 m_EM.SetEnergy(f_energy);
2203
2204 // Load passive/active state
2205 bool b_is_passive = false;
2206 if (!ctx.Read(b_is_passive))
2207 return false;
2209
2210 // Load ON/OFF state
2211 bool b_is_on = false;
2212 if (!ctx.Read(b_is_on))
2213 {
2214 m_EM.SwitchOn();
2215 return false;
2216 }
2217
2218 // Load plugged/unplugged state
2219 bool b_is_plugged = false;
2220 if (!ctx.Read(b_is_plugged))
2221 return false;
2222
2223 // ENERGY SOURCE
2224 if (version <= 103)
2225 {
2226 // Load energy source ID low
2227 int i_energy_source_ID_low = 0; // Even 0 can be valid ID!
2228 if (!ctx.Read(i_energy_source_ID_low))
2229 return false;
2230
2231 // Load energy source ID high
2232 int i_energy_source_ID_high = 0; // Even 0 can be valid ID!
2233 if (!ctx.Read(i_energy_source_ID_high))
2234 return false;
2235 }
2236 else
2237 {
2238 int b1 = 0;
2239 int b2 = 0;
2240 int b3 = 0;
2241 int b4 = 0;
2242
2243 if (!ctx.Read(b1)) return false;
2244 if (!ctx.Read(b2)) return false;
2245 if (!ctx.Read(b3)) return false;
2246 if (!ctx.Read(b4)) return false;
2247
2248 if (b_is_plugged)
2249 {
2250 // Because function GetEntityByPersitentID() cannot be called here, ID values must be stored and used later.
2251 m_EM.StoreEnergySourceIDs(b1, b2, b3, b4);
2252 m_EM.RestorePlugState(true);
2253 }
2254 }
2255
2256 if (b_is_on)
2257 m_EM.SwitchOn();
2258 }
2259 return true;
2260 }
2261
2264
2269 {
2270 if (m_EM)
2271 {
2272 if (GetGame().IsMultiplayer())
2273 {
2274 bool is_on = m_EM.IsSwitchedOn();
2275
2276 if (is_on != m_EM.GetPreviousSwitchState())
2277 {
2278 if (is_on)
2279 m_EM.SwitchOn();
2280 else
2281 m_EM.SwitchOff();
2282 }
2283
2286
2287 EntityAI energy_source = EntityAI.Cast(GetGame().GetObjectByNetworkId(id_low, id_High));
2288
2289 if (energy_source)
2290 {
2292
2293 if (!esem)
2294 {
2295 string object = energy_source.GetType();
2296 Error("Synchronization error! Object " + object + " has no instance of the Energy Manager component!");
2297 }
2298
2300
2301 }
2302 else
2303 m_EM.UnplugThis();
2304
2305 m_EM.DeviceUpdate();
2306 m_EM.StartUpdates();
2307 }
2308 }
2309 }
2310
2312
2313 override void EOnFrame(IEntity other, float timeSlice)
2314 {
2315 if (m_ComponentsBank != NULL)
2316 {
2317 for (int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key)
2318 {
2319 if (m_ComponentsBank.IsComponentAlreadyExist(comp_key))
2320 m_ComponentsBank.GetComponent(comp_key).Event_OnFrame(other, timeSlice);
2321 }
2322 }
2323 }
2324
2326 {
2327 string text = string.Empty;
2328
2329 text += "Weight: " + GetWeightEx() + "\n";
2330 text += "Disabled: " + GetIsSimulationDisabled() + "\n";
2331#ifdef SERVER
2332 if (GetEconomyProfile())
2333 text += "CE Lifetime default: " + (int)GetEconomyProfile().GetLifetime() + "\n";
2334 text += "CE Lifetime remaining: " + (int)GetLifetime() + "\n";
2335#endif
2336
2337 ComponentEnergyManager compEM = GetCompEM();
2338 if (compEM)
2339 {
2340 text += "Energy Source: " + Object.GetDebugName(compEM.GetEnergySource()) + "\n";
2341 text += "Switched On: " + compEM.IsSwitchedOn() + "\n";
2342 text += "Is Working: " + compEM.IsWorking() + "\n";
2343 }
2344
2345 return text;
2346 }
2347
2348
2349 void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4) {} //DEPRICATED, USE GetDebugActions / OnAction
2350 void OnDebugButtonPressClient(int button_index) {} //DEPRICATED, USE GetDebugActions / OnAction
2351 void OnDebugButtonPressServer(int button_index) {} //DEPRICATED, USE GetDebugActions / OnAction
2352
2353
2355 {
2356 return GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxDraw();
2357 }
2358
2360 {
2361 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxSetColor(color);
2362 }
2363
2365 {
2366 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxDelete();
2367 }
2368
2370 {
2371 return GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionDraw(distance);
2372 }
2373
2375 {
2376 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionSetColor(color);
2377 }
2378
2380 {
2381 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionDelete();
2382 }
2383
2386 {
2387 if (!ToDelete())
2388 {
2389 SetAnimationPhase(selection_name, 1); // 1 = hide, 0 = unhide!
2390 }
2391 }
2392
2395 {
2396 if (!ToDelete())
2397 {
2398 SetAnimationPhase(selection_name, 0); // 1 = hide, 0 = unhide!
2399 }
2400 }
2401
2404 proto void GetPersistentID(out int b1, out int b2, out int b3, out int b4);
2405
2412
2417
2420 {
2421 IncreaseLifetime();
2422 if (GetHierarchyParent())
2423 GetHierarchyParent().IncreaseLifetimeUp();
2424 }
2425
2426
2427 // BODY STAGING
2430 {
2431 if (HasComponent(COMP_TYPE_BODY_STAGING))
2432 return ComponentBodyStaging.Cast(GetComponent(COMP_TYPE_BODY_STAGING));
2433 return NULL;
2434 }
2435
2440 {
2441 if (m_EM)
2442 return m_EM;
2443
2444 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))
2445 return ComponentEnergyManager.Cast(GetComponent(COMP_TYPE_ENERGY_MANAGER));
2446 return NULL;
2447 }
2448
2451 {
2452 return HasComponent(COMP_TYPE_ENERGY_MANAGER);
2453 }
2454
2455 // ------ Public Events for Energy manager component. Overwrite these and put your own functionality into them. ------
2456
2458 void OnWorkStart() {}
2459
2462
2464 void OnWorkStop() {}
2465
2467 void OnSwitchOn() {}
2468
2470 void OnSwitchOff() {}
2471
2474
2477
2480
2483
2486
2489
2493
2495 {
2496 super.OnRPC(sender, rpc_type, ctx);
2497
2498 if (GetGame().IsClient())
2499 {
2500 switch (rpc_type)
2501 {
2502 // BODY STAGING - server => client synchronization of skinned state.
2503 case ERPCs.RPC_BS_SKINNED_STATE:
2504 {
2506 if (ctx.Read(p_skinned_state))
2507 {
2508 float state = p_skinned_state.param1;
2509 if (state && GetCompBS())
2510 GetCompBS().SetAsSkinnedClient();
2511 }
2512 break;
2513 }
2514
2515 case ERPCs.RPC_EXPLODE_EVENT:
2516 {
2517 OnExplodeClient();
2518 break;
2519 }
2520 }
2521 }
2522 }
2523
2524#ifdef DIAG_DEVELOPER
2525 void FixEntity()
2526 {
2527 if (!(GetGame().IsServer()))
2528 return;
2529 SetFullHealth();
2530
2531 if (GetInventory())
2532 {
2533 int i = 0;
2534 int AttachmentsCount = GetInventory().AttachmentCount();
2535 if (AttachmentsCount > 0)
2536 {
2537 for (i = 0; i < AttachmentsCount; i++)
2538 GetInventory().GetAttachmentFromIndex(i).FixEntity();
2539 }
2540
2541 CargoBase cargo = GetInventory().GetCargo();
2542 if (cargo)
2543 {
2544 int cargoCount = cargo.GetItemCount();
2545 for (i = 0; i < cargoCount; i++)
2546 cargo.GetItem(i).FixEntity();
2547 }
2548 }
2549 }
2550#endif
2551
2556
2558 {
2559 return m_ConfigWeight * GetWetWeightModifier();
2560 }
2561
2562#ifdef DEVELOPER
2564 {
2565 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
2566 return "(" + m_ConfigWeight + "(config weight) * " + GetWetWeightModifier() + "(Wetness Modifier))";
2567 return string.Empty;
2568 }
2569#endif
2570
2571
2572 //Obsolete, use GetWeightEx()
2574 {
2575 return GetWeightEx();
2576 }
2577
2579 {
2580 //Print("ent:" + this + " - ClearWeightDirty");
2581 m_WeightDirty = 0;
2582 }
2583
2585 {
2586#ifdef DEVELOPER
2587 if (WeightDebug.m_VerbosityFlags & WeightDebugType.SET_DIRTY_FLAG)
2588 {
2589 Print("---------------------------------------");
2590 Print("ent:" + this + " - SetWeightDirty");
2591 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
2592 DumpStack();
2593 Print("---------------------------------------");
2594 }
2595#endif
2596 m_WeightDirty = 1;
2597 if (GetHierarchyParent())
2598 GetHierarchyParent().SetWeightDirty();
2599 }
2600 // returns weight of all cargo and attachments
2602 {
2603 float totalWeight;
2604 if (GetInventory())
2605 {
2606 int i = 0;
2607 int AttachmentsCount = GetInventory().AttachmentCount();
2608 if (AttachmentsCount > 0)
2609 {
2610 for (i = 0; i < AttachmentsCount; i++)
2611 totalWeight += GetInventory().GetAttachmentFromIndex(i).GetWeightEx(forceRecalc);
2612 }
2613
2614 CargoBase cargo = GetInventory().GetCargo();
2615 if (cargo)
2616 {
2617 int cargoCount = cargo.GetItemCount();
2618 for (i = 0; i < cargoCount; i++)
2619 totalWeight += cargo.GetItem(i).GetWeightEx(forceRecalc);
2620 }
2621 }
2622 return totalWeight;
2623 }
2625 protected float GetWeightSpecialized(bool forceRecalc = false)
2626 {
2627 return GetInventoryAndCargoWeight(forceRecalc);
2628 }
2629
2631 //this method is not meant to be overriden, to adjust weight calculation for specific item type, override 'GetWeightSpecialized(bool forceRecalc = false)' instead
2632 float GetWeightEx(bool forceRecalc = false)
2633 {
2634 if (m_WeightDirty || forceRecalc)//recalculate
2635 {
2636 m_WeightEx = GetWeightSpecialized(forceRecalc);
2637 ClearWeightDirty();
2638
2639#ifdef DEVELOPER
2640 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
2641 WeightDebug.GetWeightDebug(this).SetWeight(m_WeightEx);
2642 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_DIRTY)
2643 {
2644 Print("ent:" + this + " - Dirty Recalc");
2645 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
2646 DumpStack();
2647 }
2648#endif
2649 }
2650
2651 return m_WeightEx;
2652 }
2653
2655
2657
2659 {
2660 //fix entity
2661 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FIX_ENTITY, "Fix Entity", FadeColors.LIGHT_GREY));
2662
2663 //weight
2664 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_TOTAL_WEIGHT, "Print Weight", FadeColors.LIGHT_GREY));
2665 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_TOTAL_WEIGHT_RECALC, "Print Weight Verbose", FadeColors.LIGHT_GREY));
2666 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_PLAYER_WEIGHT, "Print Player Weight", FadeColors.LIGHT_GREY));
2667 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_PLAYER_WEIGHT_RECALC, "Print Player Weight Verbose", FadeColors.LIGHT_GREY));
2668 }
2670 {
2671 if (action_id == EActions.FIX_ENTITY)
2672 {
2673#ifdef DIAG_DEVELOPER
2674 FixEntity();
2675#endif
2676 }
2677 else if (action_id == EActions.GET_TOTAL_WEIGHT) //Prints total weight of item + its contents
2678 {
2679 WeightDebug.ClearWeightDebug();
2680#ifndef SERVER
2681 Debug.Log("======================== " + GetType() + " =================================");
2682#endif
2683 Debug.Log("Weight:" + GetWeightEx().ToString());
2684 Debug.Log("Weight excluding cargo and attachments:" + GetSingleInventoryItemWeightEx());
2685 Debug.Log("----------------------------------------------------------------------------------------------");
2686 }
2687 else if (action_id == EActions.GET_TOTAL_WEIGHT_RECALC) //Prints total weight of item + its contents
2688 {
2689 WeightDebug.ClearWeightDebug();
2690 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2691#ifndef SERVER
2692 Debug.Log("======================== " + GetType() + " RECALC ===========================");
2693#endif
2694 Debug.Log("Weight:" + GetWeightEx(true).ToString());
2695 Debug.Log("Weight excluding cargo and attachments:" + GetSingleInventoryItemWeightEx());
2696 WeightDebug.PrintAll(this);
2697 Debug.Log("----------------------------------------------------------------------------------------------");
2698 WeightDebug.SetVerbosityFlags(0);
2699 }
2700 else if (action_id == EActions.GET_PLAYER_WEIGHT) //Prints total weight of item + its contents
2701 {
2702 WeightDebug.ClearWeightDebug();
2703#ifndef SERVER
2704 Debug.Log("======================== PLAYER: " + player + " ===========================");
2705#endif
2706 Debug.Log("New overall weight Player:" + player.GetWeightEx().ToString());
2707
2708 Debug.Log("----------------------------------------------------------------------------------------------");
2709 }
2710 else if (action_id == EActions.GET_PLAYER_WEIGHT_RECALC) //Prints total weight of item + its contents
2711 {
2712 WeightDebug.ClearWeightDebug();
2713 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2714#ifndef SERVER
2715 Debug.Log("======================== PLAYER RECALC: " + player + " ===========================");
2716#endif
2717 Debug.Log("New overall weight Player:" + player.GetWeightEx(true).ToString());
2718 WeightDebug.PrintAll(player);
2719 Debug.Log("----------------------------------------------------------------------------------------------");
2720 WeightDebug.SetVerbosityFlags(0);
2721 }
2722 return false;
2723 }
2724
2728 int m_ViewIndex = 0;
2729
2732 {
2733 m_ViewIndex = index;
2734
2735 if (GetGame().IsServer())
2736 SetSynchDirty();
2737 }
2738
2741 {
2742 if (MemoryPointExists("invView2"))
2743 {
2744#ifdef PLATFORM_WINDOWS
2746 GetInventory().GetCurrentInventoryLocation(il);
2747 InventoryLocationType type = il.GetType();
2748 switch (type)
2749 {
2750 case InventoryLocationType.CARGO:
2751 {
2752 return 0;
2753 }
2754 case InventoryLocationType.ATTACHMENT:
2755 {
2756 return 1;
2757 }
2758 case InventoryLocationType.HANDS:
2759 {
2760 return 0;
2761 }
2762 case InventoryLocationType.GROUND:
2763 {
2764 return 1;
2765 }
2766 case InventoryLocationType.PROXYCARGO:
2767 {
2768 return 0;
2769 }
2770 default:
2771 {
2772 return 0;
2773 }
2774 }
2775#endif
2776
2777#ifdef PLATFORM_CONSOLE
2778 return 1;
2779#endif
2780 }
2781 return 0;
2782 }
2784
2787 {
2788 Debug.LogError("EntityAI: HitComponentForAI not set properly for that entity (" + GetType() + ")");
2790 return "";
2791 }
2792
2795 {
2796 Debug.LogError("EntityAI: DefaultHitComponent not set properly for that entity (" + GetType() + ")");
2798 return "";
2799 }
2800
2803 {
2804 Debug.LogError("EntityAI: DefaultHitPositionComponent not set for that entity (" + GetType() + ")");
2805 return "";
2806 }
2807
2809 {
2810 Debug.LogError("EntityAI: SuitableFinisherHitComponents not set for that entity (" + GetType() + ")");
2811 return null;
2812 }
2813
2815 {
2816 Debug.LogError("EntityAI: DefaultHitPosition not set for that entity (" + GetType() + ")");
2817 return vector.Zero;
2818 }
2819
2822 {
2823 return EMeleeTargetType.ALIGNABLE;
2824 }
2825
2828 {
2829 return "None";
2830 }
2831
2834 {
2835 return false;
2836 }
2837
2840 {
2841 return false;
2842 }
2843
2846 {
2847 return false;
2848 }
2849
2850 string ChangeIntoOnAttach(string slot) {}
2852
2866 {
2867 float currentTime = GetGame().GetTickTime();
2868 if (m_LastUpdatedTime == 0)
2869 m_LastUpdatedTime = currentTime;
2870
2871 m_ElapsedSinceLastUpdate = currentTime - m_LastUpdatedTime;
2872 m_LastUpdatedTime = currentTime;
2873 }
2874
2879
2881 {
2883 ConfigGetTextArray("Attachments", slots);
2884
2886 ConfigGetTextArray("magazines", mags);
2887
2888 //-------
2889
2891
2894 all_paths.Insert(CFG_WEAPONSPATH);
2895
2896 string config_path;
2897 string child_name;
2898 int scope;
2899 string path;
2900 int consumable_count;
2901
2902 for (int i = 0; i < all_paths.Count(); i++)
2903 {
2904 config_path = all_paths.Get(i);
2905 int children_count = GetGame().ConfigGetChildrenCount(config_path);
2906
2907 for (int x = 0; x < children_count; x++)
2908 {
2909 GetGame().ConfigGetChildName(config_path, x, child_name);
2910 path = config_path + " " + child_name;
2911 scope = GetGame().ConfigGetInt(config_path + " " + child_name + " scope");
2912 bool should_check = 1;
2913 if (config_path == "CfgVehicles" && scope == 0)
2914 should_check = 0;
2915
2916 if (should_check)
2917 {
2918 string inv_slot;
2919 GetGame().ConfigGetText(config_path + " " + child_name + " inventorySlot", inv_slot);
2920 for (int z = 0; z < slots.Count(); z++)
2921 {
2922 if (slots.Get(z) == inv_slot)
2923 {
2924 this.GetInventory().CreateInInventory(child_name);
2925 continue;
2926 //Print("matching attachment: " + child_name + " for inv. slot name:" +inv_slot);
2927 }
2928 }
2929 }
2930 }
2931 }
2932 };
2933
2935 {
2936 if (GetGame().IsServer())
2937 AddHealth("", "Health", -MELEE_ITEM_DAMAGE);
2938 return this;
2939 }
2940
2943 {
2945 }
2946
2948 {
2949 return "";
2950 }
2951
2953 {
2954 if (GetGame() && GetGame().IsMultiplayer() && GetGame().IsServer())
2955 {
2956 int invulnerability;
2957 switch (servercfg_param)
2958 {
2959 case "disableContainerDamage":
2961 break;
2962
2963 case "disableBaseDamage":
2965 break;
2966 }
2967
2968 if (invulnerability > 0)
2969 SetAllowDamage(false);
2970 }
2971 }
2972
2973 void SetBayonetAttached(bool pState, int slot_idx = -1) {};
2976
2977 void SetButtstockAttached(bool pState, int slot_idx = -1) {};
2980
2982 {
2985 if (attachments)
2987 else
2988 {
2989 for (int i = 0; i < GetInventory().GetAttachmentSlotsCount(); i++)
2990 attachmentsArray.Insert(GetInventory().GetAttachmentSlotId(i));
2991 }
2992
2993 EntityAI item;
2994
2995 foreach (int slot : attachmentsArray)
2996 {
2997 if (parent)
2998 item = parent.GetInventory().FindAttachment(slot);
2999 else
3000 item = this;//GetInventory().FindAttachment(slot);
3001
3002 if (item)
3003 {
3004 if (item.GetInventory().AttachmentCount() > 0)
3005 {
3006 for (i = 0; i < item.GetInventory().GetAttachmentSlotsCount(); i++)
3007 childrenAtt.Insert(item.GetInventory().GetAttachmentSlotId(i));
3008
3009 SetInvisibleRecursive(invisible, item, childrenAtt);
3010 }
3011
3012 item.SetInvisible(invisible);
3013 item.OnInvisibleSet(invisible);
3014 }
3015 }
3016 }
3017
3019 {
3020 EffectSound sound = SEffectManager.PlaySound("hardTreeFall_SoundSet", GetPosition());
3021 sound.SetAutodestroy(true);
3022 }
3023
3025 {
3026 EffectSound sound = SEffectManager.PlaySound("softTreeFall_SoundSet", GetPosition());
3027 sound.SetAutodestroy(true);
3028 }
3029
3031 {
3032 EffectSound sound = SEffectManager.PlaySound("hardBushFall_SoundSet", GetPosition());
3033 sound.SetAutodestroy(true);
3034 }
3035
3037 {
3038 EffectSound sound = SEffectManager.PlaySound("softBushFall_SoundSet", GetPosition());
3039 sound.SetAutodestroy(true);
3040 }
3041
3043 {
3044 if (!m_TransportHitRegistered)
3045 {
3046 m_TransportHitRegistered = true;
3047 m_TransportHitVelocity = GetVelocity(transport);
3048 Car car;
3049 float damage;
3051
3052 // a different attempt to solve hits from "standing" car to the players
3053 if (Car.CastTo(car, transport))
3054 {
3055 if (car.GetSpeedometerAbsolute() > 2)
3056 {
3057 damage = m_TransportHitVelocity.Length();
3058 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
3059 }
3060 else
3061 m_TransportHitRegistered = false;
3062
3063 // compute impulse and apply only if the body dies
3064 if (IsDamageDestroyed() && car.GetSpeedometerAbsolute() > 3)
3065 {
3066 impulse = 40 * m_TransportHitVelocity;
3067 impulse[1] = 40 * 1.5;
3069 }
3070 }
3071 else //old solution just in case if somebody use it
3072 {
3073 // avoid damage because of small movements
3074 if (m_TransportHitVelocity.Length() > 0.1)
3075 {
3076 damage = m_TransportHitVelocity.Length();
3077 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
3078 }
3079 else
3080 m_TransportHitRegistered = false;
3081
3082 // compute impulse and apply only if the body dies
3083 if (IsDamageDestroyed() && m_TransportHitVelocity.Length() > 0.3)
3084 {
3085 impulse = 40 * m_TransportHitVelocity;
3086 impulse[1] = 40 * 1.5;
3088 }
3089 }
3090 }
3091 }
3092
3094 {
3095 value = -1;
3096 return false;
3097 }
3098
3100 {
3101 return false;
3102 }
3103
3106 {
3107 return GetUniversalTemperatureSource() != null && GetUniversalTemperatureSource().IsActive();
3108 }
3109
3111 {
3112 return m_UniversalTemperatureSource;
3113 }
3114
3116 {
3117 m_UniversalTemperatureSource = uts;
3118 }
3119
3124
3127
3129
3131
3133
3135 {
3137 if (raib)
3138 raib.SetPersistentPairID(id);
3139 }
3140
3146
3148 // attachment exclusion section //
3151 {
3152 m_AttachmentExclusionSlotMap = new map<int, ref set<int>>();
3153 m_AttachmentExclusionMaskGlobal = new set<int>;
3154 m_AttachmentExclusionMaskChildren = new set<int>();
3155
3156 int count = GetInventory().GetSlotIdCount();
3157 //no sense in performing inits for something that cannot be attached anywhere (hand/lefthand and some other 'special' slots are the reason for creating 'new' sets above)
3158 if (count == 0)
3159 return;
3160
3161 InitInherentSlotExclusionMap();
3162 InitGlobalExclusionValues();
3163 InitLegacyConfigExclusionValues();
3164 }
3165
3168 {
3169 int count = GetInventory().GetSlotIdCount();
3170 //starting with the INVALID slot, so it is always in the map of attachable items
3171 SetAttachmentExclusionMaskSlot(InventorySlots.INVALID, GetAttachmentExclusionInitSlotValue(InventorySlots.INVALID));
3172
3173 int slotId;
3174 for (int i = 0; i < count; i++)
3175 {
3176 slotId = GetInventory().GetSlotId(i);
3177 SetAttachmentExclusionMaskSlot(slotId, GetAttachmentExclusionInitSlotValue(slotId));
3178 }
3179 }
3180
3183 {
3184 set<int> dflt = new set<int>;
3185 return dflt;
3186 }
3187
3188 //Initiated last, and only for items that do not have others defined already
3190 {
3191 bool performLegacyInit = InitLegacyExclusionCheck();
3192
3193 //adding implicit slot info AFTER the check is performed
3194 InitLegacySlotExclusionValuesImplicit();
3195
3197 InitLegacySlotExclusionValuesDerived();
3198 }
3199
3200 //returns 'false' if the script initialization
3202 {
3203 //first check the globals
3204 if (m_AttachmentExclusionMaskGlobal.Count() > 0)
3205 return false;
3206
3207 //now the map
3208 int count = m_AttachmentExclusionSlotMap.Count();
3209 if (count > 1) //more than InventorySlots.INVALID
3210 {
3211 for (int i = 0; i < count; i++)
3212 {
3213 int countSet = m_AttachmentExclusionSlotMap.GetElement(i).Count();
3214 if (countSet > 0) //SOMETHING is defined
3215 return false;
3216 }
3217 }
3218
3219 return true;
3220 }
3221
3228 {
3229 int slotId;
3230 int slotCount = GetInventory().GetSlotIdCount();
3231 for (int i = 0; i < slotCount; i++)
3232 {
3233 slotId = GetInventory().GetSlotId(i);
3234 set<int> tmp;
3235 switch (slotId)
3236 {
3237 case InventorySlots.HEADGEAR:
3238 {
3239 tmp = new set<int>;
3240 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3241 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
3242 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
3243 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
3244 SetAttachmentExclusionMaskSlot(slotId, tmp);
3245 break;
3246 }
3247
3248 case InventorySlots.MASK:
3249 {
3250 tmp = new set<int>;
3251 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3252 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
3253 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
3254 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
3255 SetAttachmentExclusionMaskSlot(slotId, tmp);
3256 break;
3257 }
3258
3259 case InventorySlots.EYEWEAR:
3260 {
3261 tmp = new set<int>;
3262 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3263 if (ConfigGetBool("isStrap"))
3264 {
3265 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
3266 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
3267 }
3268 else
3269 {
3270 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
3271 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
3272 }
3273 SetAttachmentExclusionMaskSlot(slotId, tmp);
3274 break;
3275 }
3276 }
3277 }
3278 }
3279
3281 {
3282 int slotId;
3283 int slotCount = GetInventory().GetSlotIdCount();
3284 for (int i = 0; i < slotCount; i++)
3285 {
3286 slotId = GetInventory().GetSlotId(i);
3287 set<int> tmp;
3288 switch (slotId)
3289 {
3290 case InventorySlots.HEADGEAR:
3291 {
3292 tmp = new set<int>;
3293 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3294 if (ConfigGetBool("noNVStrap"))
3295 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
3296 if (ConfigGetBool("noMask"))
3297 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
3298 if (ConfigGetBool("noEyewear"))
3299 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
3300 SetAttachmentExclusionMaskSlot(slotId, tmp);
3301 break;
3302 }
3303
3304 case InventorySlots.MASK:
3305 {
3306 tmp = new set<int>;
3307 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3308 if (ConfigGetBool("noNVStrap"))
3309 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
3310 if (ConfigGetBool("noHelmet"))
3311 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
3312 if (ConfigGetBool("noEyewear"))
3313 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
3314 SetAttachmentExclusionMaskSlot(slotId, tmp);
3315 break;
3316 }
3317
3318 case InventorySlots.EYEWEAR:
3319 {
3320 tmp = new set<int>;
3321 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3322 if (ConfigGetBool("isStrap"))
3323 {
3324 if (ConfigGetBool("noHelmet"))
3325 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
3326 if (ConfigGetBool("noMask"))
3327 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
3328 }
3329 else
3330 {
3331 if (ConfigGetBool("noHelmet"))
3332 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
3333 if (ConfigGetBool("noMask"))
3334 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
3335 }
3336 SetAttachmentExclusionMaskSlot(slotId, tmp);
3337 break;
3338 }
3339 }
3340 }
3341 }
3342
3345
3348 {
3349 if (m_AttachmentExclusionMaskGlobal.Find(value) == -1)
3350 m_AttachmentExclusionMaskGlobal.Insert(value);
3351 }
3352
3355 {
3356 int idx = m_AttachmentExclusionMaskGlobal.Find(value);
3357 if (idx != -1)
3358 m_AttachmentExclusionMaskGlobal.Remove(idx);
3359 }
3360
3362 {
3363 m_AttachmentExclusionMaskGlobal.Clear();
3364 m_AttachmentExclusionMaskGlobal.Copy(values);
3365 }
3366
3369 {
3370 if (m_AttachmentExclusionSlotMap)
3371 m_AttachmentExclusionSlotMap.Set(slotId, values);
3372 else
3373 ErrorEx("m_AttachmentExclusionSlotMap not available! Fill the 'inventorySlot[]' in the " + this + " config file.");
3374 }
3375
3377 {
3378 if (values && values.Count() != 0)
3379 {
3382 GetInventory().GetCurrentInventoryLocation(lcn);
3383 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
3384 {
3385 m_AttachmentExclusionMaskChildren.InsertSet(passThis);
3386 EntityAI parent = GetHierarchyParent();
3387 if (parent)
3388 parent.PropagateExclusionValueRecursive(passThis, lcn.GetSlot());
3389 }
3390 }
3391 }
3392
3394 {
3395 if (values && values.Count() != 0)
3396 {
3399 GetInventory().GetCurrentInventoryLocation(lcn);
3400 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
3401 {
3402 int count = passThis.Count();
3403 for (int i = 0; i < count; i++)
3404 m_AttachmentExclusionMaskChildren.RemoveItem(passThis[i]);
3405 EntityAI parent = GetHierarchyParent();
3406 if (parent)
3407 parent.ClearExclusionValueRecursive(passThis, lcn.GetSlot());
3408 }
3409 }
3410 }
3411
3414 {
3415 set<int> values = new set<int>();
3416 set<int> slotValues = GetAttachmentExclusionMaskSlot(slotId);
3417 if (slotValues)
3418 values.InsertSet(slotValues);
3419 values.InsertSet(m_AttachmentExclusionMaskGlobal);
3420 values.InsertSet(m_AttachmentExclusionMaskChildren);
3421
3422 return values;
3423 }
3424
3427 {
3428 return m_AttachmentExclusionSlotMap.Get(slotId);
3429 }
3430
3433 {
3434 return m_AttachmentExclusionMaskGlobal;
3435 }
3436
3439 {
3440 return m_AttachmentExclusionMaskChildren;
3441 }
3442
3445 {
3446 set<int> targetSlotValues = GetAttachmentExclusionMaskSlot(targetSlot);
3447 if (targetSlotValues) //can be null, if so, no conflict
3448 {
3449 set<int> additionalValues = new set<int>(); //NOT slot values
3450 additionalValues.InsertSet(GetAttachmentExclusionMaskGlobal());
3451 additionalValues.InsertSet(GetAttachmentExclusionMaskChildren());
3452
3453 int countTarget = targetSlotValues.Count();
3454 for (int i = 0; i < countTarget; i++)
3455 {
3456 if (additionalValues.Find(targetSlotValues[i]) != -1)
3457 return true;
3458 }
3459 }
3460 return false;
3461 }
3462
3465 {
3466 int slotId;
3467 string slotName;
3468 GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName); //if currently attached, treat it accordingly
3469
3470 set<int> currentSlotValuesAll = GetAttachmentExclusionMaskAll(slotId);
3471 int count = values.Count();
3472 for (int i = 0; i < count; i++)
3473 {
3474 if (currentSlotValuesAll.Find(values[i]) != -1)
3475 return true;
3476 }
3477 return false;
3478 }
3479
3482 {
3483 if (values && values.Count() != 0)
3484 {
3486 GetInventory().GetCurrentInventoryLocation(lcn);
3487 EntityAI parent = GetHierarchyParent();
3489 if (CheckExclusionAccessCondition(lcn.GetSlot(), targetSlot, values, passThis))
3490 {
3491 if (parent && parent != this) //we reached root if false
3492 return parent.IsExclusionFlagPresentRecursive(passThis, lcn.GetSlot());
3493 }
3494 return IsExclusionFlagPresent(passThis);
3495 }
3496
3497 return false;
3498 }
3499
3502 {
3505
3507 {
3509 return false;
3510 }
3511
3512 if (targetException)
3513 {
3515 return false;
3516 }
3517
3518 AdjustExclusionAccessCondition(occupiedSlot, targetSlot, value, adjustedValue);
3519 return adjustedValue.Count() != 0;
3520 }
3521
3527
3530 {
3533
3534 if (targetException)
3535 {
3537 return false;
3538 }
3539
3540 AdjustExclusionAccessPropagation(occupiedSlot, targetSlot, value, adjustedValue);
3541 return adjustedValue.Count() != 0;
3542 }
3543
3546 {
3547 AdjustExclusionAccessCondition(occupiedSlot, testedSlot, value, adjustedValue);
3548 }
3549
3551 {
3552 return false;
3553 }
3554
3556 {
3557 return null;
3558 }
3559
3563
3565};
3566
3567#ifdef DEVELOPER
3568void SetDebugDeveloper_item(Object entity)//without a setter,the place where the setting happens is near impossible to find as way too many hits for "_item" exist
3569{
3570 if (entity)
3571 entity.SetDebugItem();
3572
3573}
3574Object _item;//watched item goes here(LCTRL+RMB->Watch)
3575#endif
enum EWetnessLevel BUSH_SOFT
enum EWetnessLevel FULL
enum EWetnessLevel HIDE_HANDS_SLOT
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
enum EWetnessLevel UPDATE
enum EWetnessLevel HIDE_VICINITY
enum EWetnessLevel DETACHING
enum EWetnessLevel BUSH_HARD
enum EWetnessLevel LeftFrontLimb
enum EWetnessLevel REMOVE
enum EWetnessLevel RECURSIVE_ADD
enum EWetnessLevel TREE_HARD
Param3 int
enum EWetnessLevel TREE_SOFT
Param3 TSelectableActionInfo
enum EWetnessLevel ALWAYS
icon visibility, meant to be used in a bitmask
enum EWetnessLevel HIDE_PLAYER_CONTAINER
enum EWetnessLevel RightFrontLimb
enum EWetnessLevel LeftBackLimb
EWetnessLevel
Definition EntityAI.c:2
@ DAMP
Definition EntityAI.c:4
@ DRENCHED
Definition EntityAI.c:7
@ WET
Definition EntityAI.c:5
@ DRY
Definition EntityAI.c:3
@ SOAKING
Definition EntityAI.c:6
enum EWetnessLevel ADD
enum EWetnessLevel ATTACHING
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
eBleedingSourceType GetType()
bool IsDamageDestroyed(ActionTarget target)
Definition ActionBase.c:841
override bool IsDestructionBehaviour()
Definition AnimalBase.c:109
override bool ReplaceOnDeath()
Definition AnimalBase.c:217
override string GetDeadItemName()
Definition AnimalBase.c:227
class Animal_CapraHircus extends AnimalBase GetDestructionBehaviour()
Definition AnimalBase.c:104
override void OnDamageDestroyed(int oldLevel)
Definition AnimalBase.c:128
override bool KeepHealthOnReplace()
Definition AnimalBase.c:232
vector GetOrientation()
proto native CEApi GetCEApi()
Get the CE API.
const int ECE_OBJECT_SWAP
const int RF_ORIGINAL
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int RF_DEFAULT
PlayerSpawnPreset slotName
map< string, ref array< string > > DamageZoneMap
DamageType
exposed from C++ (do not change)
DayZGame g_Game
Definition DayZGame.c:3528
EActions
Definition EActions.c:2
EMeleeTargetType
ERPCs
Definition ERPCs.c:2
proto string ToString()
override bool IsPrepareToDelete()
DayZPlayer m_Player
Definition Hand_Events.c:42
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Icon x
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
float GetWeightSpecialized(bool forceRecalc=false)
Definition ItemBase.c:8020
override EWetnessLevel GetWetLevel()
Definition ItemBase.c:8316
override float GetWetMax()
Definition ItemBase.c:8286
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition ItemBase.c:5867
override float GetSingleInventoryItemWeightEx()
Definition ItemBase.c:8006
override bool IsHologram()
Definition ItemBase.c:5641
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition ItemBase.c:5862
override void OnWasAttached(EntityAI parent, int slot_id)
Definition ItemBase.c:5983
override float GetWetMin()
Definition ItemBase.c:8291
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
override void OnWasDetached(EntityAI parent, int slot_id)
override bool CanDisplayAttachmentSlot(int slot_id)
bool m_Initialized
class JsonUndergroundAreaTriggerData GetPosition
represents base for cargo storage for entities
Definition Cargo.c:7
static bool GetDisableBaseDamage()
static bool GetDisableContainerDamage()
static array< float > GetWetnessWeightModifiers()
void SwitchOn()
Energy manager: Switches ON the device so it starts doing its work if it has enough energy.
bool IsWorking()
Energy manager: Returns true if this device is working right now.
void SetPassiveState(bool state=true)
Energy manager: Changes the status of this device. When it's passive (true), the main timer and OnWor...
void UnplugThis()
Energy manager: Unplugs this device from its power source.
void HandleMoveInsideCargo(EntityAI container)
float GetEnergy()
Energy manager: Returns the amount of stored energy this device has.
bool IsPlugged()
Energy manager: Returns true if this device is plugged into some other device (even if they are OFF o...
EntityAI GetEnergySource()
Energy manager: Returns the energy source this device is plugged into.
void OnAttachmentRemoved(EntityAI elec_device)
bool IsPassive()
Energy manager: Returns true if this device is set to be passive. False if otherwise.
void StoreEnergySourceIDs(int b1, int b2, int b3, int b4)
void OnAttachmentAdded(EntityAI elec_device)
void SetEnergy(float new_energy)
Energy manager: Sets stored energy for this device. It ignores the min/max limit!
void SwitchOff()
Energy manager: Switches OFF the device.
bool PlugThisInto(EntityAI energy_source, int socket_id=-1)
Energy manager: Attempts to plug this device into the energy_source. Returns true if the action was s...
bool IsSwitchedOn()
Energy manager: Returns state of the switch. Whenever the device is working or not does not matter....
Definition Debug.c:14
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Definition Debug.c:321
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
void Man()
Definition Man.c:28
override bool IsMan()
Definition Man.c:33
Definition Camera.c:2
bool PredictiveDropEntity(notnull EntityAI item)
Definition EntityAI.c:1807
bool CanLoadAttachment(EntityAI attachment)
Definition EntityAI.c:1259
void LogError(string msg, string fnc_name="n/a")
LogError.
Definition EntityAI.c:389
void OnSwitchOff()
Energy manager event: Called when the device is switched OFF.
Definition EntityAI.c:2470
bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1756
bool CanReceiveItemIntoCargo(EntityAI item)
calls this->CanReceiveItemIntoCargo(item)
Definition EntityAI.c:1339
float GetWetWeightModifier()
Definition EntityAI.c:2552
void OnEnergyConsumed()
Energy manager event: Called when energy was consumed on this device. ALWAYS CALL super....
Definition EntityAI.c:2488
proto native EntityAI GetHierarchyParent()
Returns direct parent of current entity.
bool IsZombie()
Definition EntityAI.c:588
proto native Man GetHierarchyRootPlayer()
Returns root of current hierarchy cast to Man.
EntityAI GetAttachmentByType(typename type)
Get attached entity by type.
Definition EntityAI.c:1825
bool IsEmpty()
is this container empty or not, checks both cargo and attachments
Definition EntityAI.c:532
vector GetUniversalTemperatureSourcePosition()
Definition EntityAI.c:3120
float GetQuantity()
Definition EntityAI.c:1948
void SoundSoftBushFallingPlay()
Definition EntityAI.c:3036
bool CanPutInCargo(EntityAI parent)
calls this->CanPutInCargo(parent)
Definition EntityAI.c:1364
bool ServerTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1767
bool CanCombineAttachment(notnull EntityAI e, int slot, bool stack_max_limit=false)
Definition EntityAI.c:1317
void HideSelection(string selection_name)
Hides selection of the given name. Must be configed in config.cpp and models.cfg.
Definition EntityAI.c:2385
int GetHideIconMask()
should the item's icon be hidden in any part of the inventory?
Definition EntityAI.c:220
float m_Weight
Definition EntityAI.c:125
void ClearWeightDirty()
Definition EntityAI.c:2578
bool CanRemoveFromHands(EntityAI parent)
calls this->CanRemoveFromHands(parent)
Definition EntityAI.c:1481
bool CanBeTargetedByAI(EntityAI ai)
Definition EntityAI.c:603
int GetTurnableValveIndex(int pComponentIndex)
bool CanBePlaced(Man player, vector position)
Definition EntityAI.c:502
void EEDelete(EntityAI parent)
Called right before object deleting.
Definition EntityAI.c:769
proto native float GetLifetimeMax()
Get max economy lifetime per instance - default is from DB (seconds)
int GetQuantityMax()
Definition EntityAI.c:1953
bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition EntityAI.c:1772
ArrowManagerBase GetArrowManager()
Definition EntityAI.c:3555
float GetTemperatureInit()
Definition EntityAI.c:1981
void ProcessInvulnerabilityCheck(string servercfg_param)
Definition EntityAI.c:2952
bool CanDisplayAttachmentSlot(string slot_name)
Definition EntityAI.c:1490
void DeleteOnClient()
Definition EntityAI.c:632
void ClearExclusionValueRecursive(set< int > values, int slotId)
Definition EntityAI.c:3393
void OnOwnSocketReleased(EntityAI device)
Energy manager event: When something is UNPLUGGED from this device.
Definition EntityAI.c:2482
bool LocalTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition EntityAI.c:1713
float GetWeightSpecialized(bool forceRecalc=false)
returns weight of the entity in a way that's specific to the entity type and is internal to the weigh...
Definition EntityAI.c:2625
void SoundHardBushFallingPlay()
Definition EntityAI.c:3030
bool ServerTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition EntityAI.c:1751
float ConvertNonlethalDamage(float damage)
DEPRECATED - for legacy purposes.
Definition EntityAI.c:355
void DeathUpdate()
Definition EntityAI.c:912
void EEInventoryIn(Man newParentMan, EntityAI diz, EntityAI newParent)
Definition EntityAI.c:829
string GetAttachmentSoundType()
returns sound type of attachment (used for clothing and weapons on DayZPlayerImplement,...
Definition EntityAI.c:2827
bool IgnoreOutOfReachCondition()
Definition EntityAI.c:1558
float GetWetMin()
Definition EntityAI.c:1912
bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1676
proto native bool IsPilotLight()
bool CanRemoveFromCargo(EntityAI parent)
calls this->CanRemoveFromCargo(parent)
Definition EntityAI.c:1400
bool IsSetForDeletion()
Definition EntityAI.c:657
EntityAI SpawnEntityOnGround(string object_name, vector mat[4])
Definition EntityAI.c:1882
void SwitchItemSelectionTexture(EntityAI item, string slot_name)
void EEParentedFrom(EntityAI parent)
Called from 'IEntity.RemoveChild' or 'IEntity.AddChild' when hierarchy changes.
Definition EntityAI.c:825
bool GetInventoryHandAnimation(notnull InventoryLocation loc, out int value)
Definition EntityAI.c:3093
ScriptInvoker GetOnItemRemovedFromCargo()
Definition EntityAI.c:1054
void AfterStoreLoad()
Called when entity is being loaded from DB or Storage (after all children loaded)
Definition EntityAI.c:1183
bool CanBeBackstabbed()
Definition EntityAI.c:613
void RegisterTransportHit(Transport transport)
Definition EntityAI.c:3042
bool OnStoreLoad(ParamsReadContext ctx, int version)
Called when data is loaded from persistence (on server side).
Definition EntityAI.c:2192
EntityAI GetPairDevice()
void SetPersistentPairID(int id)
Definition EntityAI.c:3134
void OnIsUnplugged(EntityAI last_energy_source)
Energy manager event: Called when this device is UNPLUGGED from the energy source.
Definition EntityAI.c:2476
array< EntityAI > GetAttachmentsWithAttachments()
Definition EntityAI.c:560
bool HasAnyCargo()
is this container empty or not, checks only cargo
Definition EntityAI.c:543
ScriptInvoker GetOnSetLock()
Definition EntityAI.c:1082
bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
Definition EntityAI.c:1891
void OnBinLoadItemsDropped()
Called when an item fails to get loaded into the inventory of an entity and gets dropped.
Definition EntityAI.c:1188
int GetWeight()
Definition EntityAI.c:2573
float m_WeightEx
Definition EntityAI.c:126
void OnDebugSpawnEx(DebugSpawnParams params)
Definition EntityAI.c:2875
bool m_CanDisplayWeight
Definition EntityAI.c:128
ref ScriptInvoker m_OnAttachmentSetLock
Definition EntityAI.c:158
EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
Definition EntityAI.c:1871
override TStringArray GetHiddenSelectionsMaterials()
Returns the hiddenSelectionsMaterials array from the object's config.
Definition EntityAI.c:2031
ref array< EntityAI > m_AttachmentsWithCargo
Definition EntityAI.c:118
override TStringArray GetHiddenSelections()
Returns the hiddenSelectionsTextures array from the object's config.
Definition EntityAI.c:2013
ref InventoryLocation m_OldLocation
Definition EntityAI.c:120
bool IsIgnoredByConstruction()
Definition EntityAI.c:598
void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition EntityAI.c:927
float HeightCheckOverride()
used as script-side override of distance for specific height checks
Definition EntityAI.c:520
Shape DebugBBoxDraw()
Definition EntityAI.c:2354
set< int > GetAttachmentExclusionMaskSlot(int slotId)
Specific slot behavior.
Definition EntityAI.c:3426
proto native void PlaceOnSurfaceRotated(out vector trans[4], vector pos, float dx=0, float dz=0, float fAngle=0, bool align=false)
void SetAttachmentExclusionMaskSlot(int slotId, set< int > values)
sets values for specific slot
Definition EntityAI.c:3368
bool IsRefresherSignalingViable()
Definition EntityAI.c:286
ScriptInvoker GetOnKilledInvoker()
Definition EntityAI.c:1117
EntityAI SpawnInInventoryOrGroundPos(string object_name, GameInventory inv, vector pos)
Definition EntityAI.c:1857
ScriptInvoker GetOnAttachmentReleaseLock()
Definition EntityAI.c:1103
void SetBayonetAttached(bool pState, int slot_idx=-1)
Definition EntityAI.c:2973
bool TranslateSlotFromSelection(string selection_name, out int slot_id)
Definition EntityAI.c:3099
override TStringArray GetHiddenSelectionsTextures()
Returns the hiddenSelectionsTextures array from the object's config.
Definition EntityAI.c:2022
bool IsPrepareToDelete()
Definition EntityAI.c:687
bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition EntityAI.c:2669
float GetInventoryAndCargoWeight(bool forceRecalc=false)
Definition EntityAI.c:2601
ref array< EntityAI > m_AttachmentsWithAttachments
Definition EntityAI.c:119
override EntityAI ProcessMeleeItemDamage(int mode=0)
Definition EntityAI.c:2934
void IncreaseLifetimeUp()
Reset economy lifetime to default across entity hierarchy all the way to the topmost entity.
Definition EntityAI.c:2419
void EEAmmoChanged()
Definition EntityAI.c:840
void OnIgnitedThisFailed(EntityAI fire_source)
Executed on Server when some item failed to ignite this one.
Definition EntityAI.c:478
bool CanReleaseFromHands(EntityAI handheld)
calls this->CanReleaseFromHands(handheld)
Definition EntityAI.c:1470
float GetWeightEx(bool forceRecalc=false)
returns overall weight of the entity, 'forceRecalc = true' is meant to be used only when debugging,...
Definition EntityAI.c:2632
void EEItemDetached(EntityAI item, string slot_name)
Definition EntityAI.c:976
bool IsValveTurnable(int pValveIndex)
void OnDebugButtonPressServer(int button_index)
Definition EntityAI.c:2351
proto native GameInventory GetInventory()
void SetTemperatureMax()
Definition EntityAI.c:1974
ref ScriptInvoker m_OnKilledInvoker
Definition EntityAI.c:164
void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition EntityAI.c:789
bool LocalTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1683
bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition EntityAI.c:1779
void OnInitEnergy()
Energy manager event: Object's initialization. Energy Manager is fully initialized by this point.
Definition EntityAI.c:2485
bool IsTwoHandedBehaviour()
returns item behaviour of item (more in ItemBase)
Definition EntityAI.c:2845
bool LocalTakeEntityToCargo(notnull EntityAI item)
Definition EntityAI.c:1667
string ChangeIntoOnAttach(string slot)
Definition EntityAI.c:2850
bool m_DeathSyncSent
Definition EntityAI.c:101
void OnStoreSave(ParamsWriteContext ctx)
Engine calls this function to collect data from entity to store for persistence (on server side).
Definition EntityAI.c:2133
ref ScriptInvoker m_OnSetLock
Definition EntityAI.c:154
void UnpairRemote()
bool IsPlayer()
Definition EntityAI.c:578
void InitDamageZoneMapping()
Initializes script-side map of damage zones and their components (named selections in models)
Definition EntityAI.c:303
ref ScriptInvoker m_OnItemDetached
Definition EntityAI.c:142
void OnPlacementCancelled(Man player)
void RemoveAllAgents()
bool DoPlacingHeightCheck()
Do the roof check when placing this?
Definition EntityAI.c:514
proto native void CreateAndInitInventory()
void OnDebugSpawn()
Definition EntityAI.c:2880
void OnWorkStart()
Energy manager event: Called only once when this device starts doing its work.
Definition EntityAI.c:2458
bool HasTurnableValveBehavior()
Turnable Valve behaviour.
bool PredictiveTakeEntityToCargoEx(notnull EntityAI item, int idx, int row, int col)
Put item into into cargo on specific cargo location.
Definition EntityAI.c:1694
bool PredictiveTakeEntityToCargo(notnull EntityAI item)
Put item into into cargo.
Definition EntityAI.c:1660
ScriptInvoker GetOnItemMovedInCargo()
Definition EntityAI.c:1061
bool CanPutIntoHands(EntityAI parent)
calls this->CanPutIntoHands(parent)
Definition EntityAI.c:1459
void EECargoMove(EntityAI item)
Definition EntityAI.c:1026
bool IsUniversalTemperatureSource()
Universal Temperature Sources Helpers.
Definition EntityAI.c:3105
proto native void RegisterNetSyncVariableBoolSignal(string variableName)
when bool variable is true, it's sent to clients and become false again
set< int > GetAttachmentExclusionMaskGlobal()
Global mask value, independent of slot-specific behavior!
Definition EntityAI.c:3432
bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition EntityAI.c:1740
bool LocalTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition EntityAI.c:1649
void SetFromProjectile(ProjectileStoppedInfo info)
Definition EntityAI.c:3560
float m_LastUpdatedTime
Definition EntityAI.c:129
string GetDestructionBehaviour()
Definition EntityAI.c:249
proto native owned string GetObjectMaterial(int index)
void SetWetMax()
bool IsManagingArrows()
Definition EntityAI.c:3550
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
override this to modify slot behavior for specific items, or just set 'm_AttachmentExclusionMaskGloba...
Definition EntityAI.c:3182
void OnWork(float consumed_energy)
Energy manager event: Called every device update if its supposed to do some work. The update can be e...
Definition EntityAI.c:2461
void CombineItemsClient(EntityAI entity2, bool use_stack_max=false)
Definition EntityAI.c:1330
void EntityAI()
Definition EntityAI.c:166
void DebugDirectionDelete()
Definition EntityAI.c:2379
bool IsSkinned()
Skinning.
Definition EntityAI.c:395
static EWetnessLevel GetWetLevelInternal(float wetness)
Definition EntityAI.c:1934
void OnIsPlugged(EntityAI source_device)
Energy manager event: Called when this device is plugged into some energy source.
Definition EntityAI.c:2473
ref ScriptInvoker m_OnViewIndexChanged
Definition EntityAI.c:152
proto native void SetObjectMaterial(int index, string mat_name)
Change material in hiddenSelections.
Shape DebugDirectionDraw(float distance=1)
Definition EntityAI.c:2369
UTemperatureSource GetUniversalTemperatureSource()
Definition EntityAI.c:3110
int GetAgents()
Definition EntityAI.c:565
bool CanBeFSwaped()
Definition EntityAI.c:1312
void DeleteSafe()
Definition EntityAI.c:638
bool HasWetness()
Definition EntityAI.c:1922
bool DisassembleOnLastDetach()
Definition EntityAI.c:443
bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Definition EntityAI.c:1783
void EEItemAttached(EntityAI item, string slot_name)
Definition EntityAI.c:943
void EEOnAfterLoad()
Called when entity is part of "connected system" and being restored after load.
Definition EntityAI.c:1145
int GetButtstockAttachmentIdx()
Definition EntityAI.c:2979
bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Definition EntityAI.c:1325
proto native void UpdateNetSyncVariableFloat(string variableName, float minValue=0, float maxValue=0, int precision=1)
void OnWasDetached(EntityAI parent, int slot_id)
Definition EntityAI.c:1567
proto native void SetSimpleHiddenSelectionState(int index, bool state)
Simple hidden selection state; 0 == hidden.
void ExecuteActionsConnectedToValve(int pValveIndex)
void DeleteSave()
Definition EntityAI.c:652
string CanBePlacedFailMessage(Man player, vector position)
Method which returns message why object can't be placed at given position.
Definition EntityAI.c:508
void OnIgnitedTarget(EntityAI target_item)
Executed on Server when this item ignites some target item.
Definition EntityAI.c:460
bool CanReceiveItemIntoHands(EntityAI item_to_hands)
calls this->CanReceiveItemIntoHands(item_to_hands)
Definition EntityAI.c:1433
bool CanBeSkinnedWith(EntityAI tool)
Definition EntityAI.c:406
void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Definition EntityAI.c:1178
bool CanDisplayAttachmentSlot(int slot_id)
Definition EntityAI.c:1500
bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Definition EntityAI.c:1798
bool IsOneHandedBehaviour()
returns item behaviour of item (more in ItemBase)
Definition EntityAI.c:2839
ref ScriptInvoker m_OnItemMovedInCargo
Definition EntityAI.c:148
void OnBeforeTryDelete()
void EECargoIn(EntityAI item)
Definition EntityAI.c:1006
int GetMeleeTargetType()
value is related to EMeleeTargetType
Definition EntityAI.c:2821
ref HiddenSelectionsData m_HiddenSelectionsData
Definition EntityAI.c:113
void OnIgnitedTargetFailed(EntityAI target_item)
Executed on Server when this item failed to ignite target item.
Definition EntityAI.c:472
bool HasButtstockAttached()
Definition EntityAI.c:2978
proto native void UpdateNetSyncVariableInt(string variableName, float minValue=0, float maxValue=0)
array< EntityAI > GetAttachmentsWithCargo()
Definition EntityAI.c:555
int GetViewIndex()
Returns item preview index !!!! IF OVERRIDING with more dynamic events call GetOnViewIndexChanged() i...
Definition EntityAI.c:2740
void OnOwnSocketTaken(EntityAI device)
Energy manager event: When something is plugged into this device.
Definition EntityAI.c:2479
bool IsPreparedToDelete()
Definition EntityAI.c:675
bool ServerTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1687
string GetDefaultHitPositionComponent()
returns default hit position component name for the Entity (overriden by type if needed - used mainly...
Definition EntityAI.c:2802
bool LocalTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition EntityAI.c:1634
override bool IsHologram()
Definition EntityAI.c:1443
void AdjustExclusionAccessPropagation(int occupiedSlot, int testedSlot, set< int > value, inout set< int > adjustedValue)
if we want to filter propagation specifically; DO NOT override unless you know what you are doing.
Definition EntityAI.c:3545
void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4)
Definition EntityAI.c:2349
void EEKilled(Object killer)
called on server when the entity is killed
Definition EntityAI.c:886
EntityAI GetAttachmentByConfigTypeName(string type)
Get attached entity by config type name.
Definition EntityAI.c:1839
void ClearInventory()
ref set< int > m_AttachmentExclusionMaskGlobal
Definition EntityAI.c:107
bool IsTargetIgnitionSuccessful(EntityAI item_target)
Final evaluation just before the target item is actually ignited. Evaluated on Server.
Definition EntityAI.c:484
ref ComponentsBank m_ComponentsBank
Definition EntityAI.c:225
proto native void IncreaseLifetime()
Reset economy lifetime to default (seconds)
bool KeepHealthOnReplace()
Definition EntityAI.c:907
bool TryDelete()
Definition EntityAI.c:692
void AddWet(float value)
override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
Definition EntityAI.c:778
void InsertAgent(int agent, float count=1)
ref ScriptInvoker m_OnItemAddedIntoCargo
Definition EntityAI.c:144
void AddTemperature(float value)
Definition EntityAI.c:1973
void OnRemovedFromCargo(EntityAI container)
Called when this item exits cargo of some container.
Definition EntityAI.c:1133
proto native float GetLifetime()
Get remaining economy lifetime (seconds)
proto native owned string GetObjectTexture(int index)
bool IsHeavyBehaviour()
returns item behaviour of item (more in ItemBase)
Definition EntityAI.c:2833
bool IsZombieMilitary()
Definition EntityAI.c:593
void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
Definition EntityAI.c:466
void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Definition EntityAI.c:845
void OnSwitchOn()
Energy manager event: Called when the device is switched on.
Definition EntityAI.c:2467
bool IsAnimal()
Definition EntityAI.c:583
bool CanDropEntity(notnull EntityAI item)
Returns if item can be dropped out from this entity.
Definition EntityAI.c:1852
bool IsTakeable()
Definition EntityAI.c:1579
float GetTemperatureMin()
Definition EntityAI.c:1986
bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition EntityAI.c:1642
ScriptInvoker GetOnItemAttached()
Definition EntityAI.c:1033
void OnDamageDestroyed(int oldLevel)
Called when the health gets to the min value, 'oldLevel' is previous health level,...
float m_ElapsedSinceLastUpdate
Definition EntityAI.c:130
void OnWorkStop()
Energy manager event: Called when the device stops working (was switched OFF or ran out of energy)
Definition EntityAI.c:2464
bool CanIgniteItem(EntityAI ignite_target=NULL)
Override this method and check if the given item can be ignited right now by this one....
Definition EntityAI.c:429
ScriptInvoker GetOnItemAddedIntoCargo()
Definition EntityAI.c:1047
ref ScriptInvoker m_OnItemAttached
Definition EntityAI.c:140
RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Remotely controlled devices helpers.
float GetWetInit()
Definition EntityAI.c:1917
bool ServerTakeEntityToCargo(notnull EntityAI item)
Definition EntityAI.c:1671
ref ScriptInvoker m_OnItemFlipped
Definition EntityAI.c:150
bool CanSaveItemInHands(EntityAI item_in_hands)
Definition EntityAI.c:1448
UTemperatureSource m_UniversalTemperatureSource
Definition EntityAI.c:132
bool CanBeIgnitedBy(EntityAI igniter=NULL)
Override this method so it checks whenever this item can be ignited right now or not....
Definition EntityAI.c:423
override void EOnFrame(IEntity other, float timeSlice)
Definition EntityAI.c:2313
ScriptInvoker GetOnHitByInvoker()
Definition EntityAI.c:1110
void MaxLifetimeRefreshCalc()
Calculates if the max lifetime is higher than refresher frequency (i.e. gets kept alive by refresher)
Definition EntityAI.c:269
bool ServerDropEntity(notnull EntityAI item)
Definition EntityAI.c:1817
proto native void DestroyInventory()
bool LocalTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Definition EntityAI.c:1747
void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition EntityAI.c:793
void SetViewIndex(int index)
Sets item preview index.
Definition EntityAI.c:2731
void ShowSelection(string selection_name)
Shows selection of the given name. Must be configed in config.hpp and models.cfg.
Definition EntityAI.c:2394
string GetDebugText()
Definition EntityAI.c:2325
void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
bool CanAssignToQuickbar()
Definition EntityAI.c:1542
array< string > GetSuitableFinisherHitComponents()
Definition EntityAI.c:2808
void OnCEUpdate()
Central economy calls this function whenever going over all the entities.
Definition EntityAI.c:2865
bool IsBeingPlaced()
Definition EntityAI.c:1438
bool ReplaceOnDeath()
Definition EntityAI.c:897
void SetAsSkinned()
Definition EntityAI.c:400
float GetWet()
Definition EntityAI.c:1902
ref KillerData m_KillerData
Definition EntityAI.c:112
proto native void RegisterNetSyncVariableObject(string variableName)
registers object variable synchronized over network, only synchronizes if network id is assigned....
proto native void SetLifetimeMax(float fLifeTime)
Set (override) max economy lifetime per entity instance (seconds)
void OnHologramBeingPlaced(Man player)
DamageZoneMap GetEntityDamageZoneMap()
Definition EntityAI.c:360
void CheckForDestroy()
Definition EntityAI.c:681
bool ServerTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition EntityAI.c:1717
void SetTemperature(float value, bool allow_client=false)
Definition EntityAI.c:1972
void OnEnergyAdded()
Energy manager event: Called when energy was added on this device. ALWAYS CALL super....
Definition EntityAI.c:2491
ref ScriptInvoker m_OnHitByInvoker
Definition EntityAI.c:162
string GetInvulnerabilityTypeString()
Definition EntityAI.c:2947
bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Definition EntityAI.c:1706
proto native CEItemProfile GetEconomyProfile()
Get economy item profile (if assigned, otherwise null)
bool CheckExclusionAccessCondition(int occupiedSlot, int targetSlot, set< int > value, inout set< int > adjustedValue)
Definition EntityAI.c:3501
bool HasInternalExclusionConflicts(int targetSlot)
checks if any attachment or item state would interfere with this being attached into a different slot...
Definition EntityAI.c:3444
void DebugDirectionSetColor(int color)
Definition EntityAI.c:2374
bool LocalTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Definition EntityAI.c:1763
ComponentEnergyManager m_EM
Definition EntityAI.c:226
proto native bool IsSimpleHiddenSelectionVisible(int index)
float GetTemperature()
Definition EntityAI.c:1976
proto native void RegisterNetSyncVariableFloat(string variableName, float minValue=0, float maxValue=0, int precision=1)
registers float variable synchronized over network
bool LocalTakeEntityToCargoEx(notnull EntityAI item, int idx, int row, int col)
Definition EntityAI.c:1701
bool ServerTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition EntityAI.c:1735
void UpdateWeight(WeightUpdateType updateType=WeightUpdateType.FULL, float weightAdjustment=0)
float ConvertNonlethalDamage(float damage, DamageType damageType)
Definition EntityAI.c:349
void InitLegacySlotExclusionValuesImplicit()
adding base one-directional relations between headgear, masks, eyewear, and headstraps (exception)
Definition EntityAI.c:3227
proto native EntityAI GetHierarchyRoot()
Returns root of current hierarchy (for example: if this entity is in Backpack on gnd,...
void SwitchItemSelectionTextureEx(EItemManipulationContext context, Param par=null)
float HeightStartCheckOverride()
used as script-side override of start pos for specific height checks
Definition EntityAI.c:526
bool HasFlammableMaterial()
Override this method to return TRUE when this item has or can provide fire. Evaluated on server and c...
Definition EntityAI.c:417
bool IsExclusionFlagPresentRecursive(set< int > values, int targetSlot)
Gets flag from what is effectively an owner.
Definition EntityAI.c:3481
ComponentBodyStaging GetCompBS()
Use this to access Body Staging component on dead character. Returns NULL if the given object lacks s...
Definition EntityAI.c:2429
HiddenSelectionsData GetHiddenSelectionsData()
Definition EntityAI.c:1998
void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void DebugBBoxSetColor(int color)
Definition EntityAI.c:2359
void AdjustExclusionAccessCondition(int occupiedSlot, int testedSlot, set< int > value, inout set< int > adjustedValue)
if we want to filter
Definition EntityAI.c:3523
string GetHitComponentForAI()
Returns hit component for the Entity (overriden for each Type - PlayerBase, DayZInfected,...
Definition EntityAI.c:2786
bool HasComponent(int comp_type)
IsComponentExist.
Definition EntityAI.c:260
void LogWarning(string msg, string fnc_name="n/a")
LogWarning.
Definition EntityAI.c:383
string GetDeadItemName()
Definition EntityAI.c:902
void SetWeightDirty()
Definition EntityAI.c:2584
ScriptInvoker GetOnViewIndexChanged()
Definition EntityAI.c:1075
void SoundHardTreeFallingPlay()
Definition EntityAI.c:3018
void AttemptDestructionBehaviour(int oldLevel, int newLevel, string zone)
Definition EntityAI.c:863
void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition EntityAI.c:791
void SetUniversalTemperatureSource(UTemperatureSource uts)
Definition EntityAI.c:3115
float GetConfigWeightModified()
Definition EntityAI.c:2557
bool IsInitialized()
Definition EntityAI.c:214
void OnCargoChanged()
Definition EntityAI.c:1577
int GetBayonetAttachmentIdx()
Definition EntityAI.c:2975
ComponentEnergyManager GetCompEM()
Definition EntityAI.c:2439
void RemoveAllAgentsExcept(int agent_to_keep)
void SetTakeable(bool pState)
bool IsDestructionBehaviour()
Definition EntityAI.c:254
bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Put item anywhere into this entity (as attachment or into cargo, recursively)
Definition EntityAI.c:1627
proto native void SetObjectTexture(int index, string texture_name)
Change texture in hiddenSelections.
bool ServerTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Definition EntityAI.c:1638
set< int > GetAttachmentExclusionMaskAll(int slotId)
Slot-specific, children (attachments), and additional (state etc.) masks combined.
Definition EntityAI.c:3413
void SetButtstockAttached(bool pState, int slot_idx=-1)
Definition EntityAI.c:2977
int GetTargetQuantityMax(int attSlotID=-1)
Definition EntityAI.c:1960
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Definition EntityAI.c:2494
int GetQuickBarBonus()
Definition EntityAI.c:1965
override void Delete()
Delete this object in next frame.
Definition EntityAI.c:626
bool CanDisplayWeight()
'displayWeight' in item config
Definition EntityAI.c:371
proto void GetPersistentID(out int b1, out int b2, out int b3, out int b4)
void SoundSoftTreeFallingPlay()
Definition EntityAI.c:3024
bool InitLegacyExclusionCheck()
Definition EntityAI.c:3201
float GetSingleInventoryItemWeightEx()
Definition EntityAI.c:2656
void PropagateExclusionValueRecursive(set< int > values, int slotId)
Definition EntityAI.c:3376
proto native void SwitchLight(bool isOn)
float GetWetMax()
Definition EntityAI.c:1907
EWetnessLevel GetWetLevel()
bool HasEnergyManager()
If this item has class EnergyManager in its config then it returns true. Otherwise returns false.
Definition EntityAI.c:2450
void ShowAllSelections()
Sets all animation values to 0, making them VISIBLE if they are configured in models....
Definition EntityAI.c:1213
bool CanSwitchDuringAttach(EntityAI parent)
Definition EntityAI.c:1277
bool CanBeSplit()
Definition EntityAI.c:537
ScriptInvoker GetOnItemFlipped()
Definition EntityAI.c:1068
bool CanReceiveAttachment(EntityAI attachment, int slotId)
calls this->CanReceiveAttachment(attachment)
Definition EntityAI.c:1236
void HideAllSelections()
Sets all animation values to 1, making them INVISIBLE if they are configured in models....
Definition EntityAI.c:1195
void InitGlobalExclusionValues()
override to init part of the mask, independent of slot-specific behavior
bool IsBasebuildingKit()
Definition EntityAI.c:448
void SetPrepareToDelete()
Definition EntityAI.c:670
override bool IsEntityAI()
Definition EntityAI.c:571
void ~EntityAI()
Definition EntityAI.c:204
proto native void RegisterNetSyncVariableBool(string variableName)
registers bool variable synchronized over network
void SetWet(float value, bool allow_client=false)
bool LocalDropEntity(notnull EntityAI item)
Definition EntityAI.c:1812
void OnInventoryInit()
Definition EntityAI.c:738
bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity)
calls this->CanSwapItemInCargo(child_entity, new_entity)
Definition EntityAI.c:1375
bool IsInventoryVisible()
Definition EntityAI.c:573
void OnPlacementStarted(Man player)
bool PlacementCanBeRotated()
Should return false if you want to disable hologram rotation.
Definition EntityAI.c:454
Component GetComponent(int comp_type, string extended_class_name="")
GetComponent.
Definition EntityAI.c:235
ScriptInvoker GetOnAttachmentSetLock()
Definition EntityAI.c:1096
void EEInventoryOut(Man oldParentMan, EntityAI diz, EntityAI newParent)
Definition EntityAI.c:832
bool CanPutAsAttachment(EntityAI parent)
calls this->CanPutAsAttachment(parent)
Definition EntityAI.c:1271
proto native void SetAITargetCallbacks(AbstractAITargetCallbacks callbacks)
void InitDamageZoneDisplayNameMapping()
Initialize map of damage zone display names for more optimized retrieval.
Definition EntityAI.c:310
ref DestructionEffectBase m_DestructionBehaviourObj
Definition EntityAI.c:110
Component CreateComponent(int comp_type, string extended_class_name="")
CreateComponent.
Definition EntityAI.c:229
void OnWasAttached(EntityAI parent, int slot_id)
ref ScriptInvoker m_OnItemRemovedFromCargo
Definition EntityAI.c:146
void EECargoOut(EntityAI item)
Definition EntityAI.c:1016
void InitLegacySlotExclusionValuesDerived()
Definition EntityAI.c:3280
void InitLegacyConfigExclusionValues()
Definition EntityAI.c:3189
proto native void SetLifetime(float fLifeTime)
Set (override) remaining economy lifetime (seconds)
int GetHierarchyLevel(int lvl=0)
Definition EntityAI.c:730
EntityAI FindAttachmentBySlotName(string slot_name)
Definition EntityAI.c:1596
bool IsLockedInSlot()
Definition EntityAI.c:1610
bool CanDisplayAnyAttachmentSlot()
Definition EntityAI.c:1508
void SetQuantityToMinimum()
bool CanAssignAttachmentsToQuickbar()
Definition EntityAI.c:1550
bool CanLoadItemIntoCargo(EntityAI item)
calls this->CanLoadItemIntoCargo(item), is called on server start when loading in the storage
Definition EntityAI.c:1353
bool IsThisIgnitionSuccessful(EntityAI item_source=NULL)
Final evaluation just before this item is actually ignited from fire source. Evaluated on Server.
Definition EntityAI.c:490
bool PredictiveTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Returns if item can be added as attachment on specific slot. Note that slot index IS NOT slot ID!...
Definition EntityAI.c:1724
void RemoveAgent(int agent_id)
bool DeleteComponent(int comp_type)
DeleteComponent.
Definition EntityAI.c:244
bool IsExclusionFlagPresent(set< int > values)
checks 'this' if the incoming flag is present for the current state (slot behavior and others)
Definition EntityAI.c:3464
void SetAttachmentExclusionMaskGlobal(set< int > values)
Definition EntityAI.c:3361
void SetInvisibleRecursive(bool invisible, EntityAI parent=null, array< int > attachments=null)
Definition EntityAI.c:2981
bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition EntityAI.c:1731
void Log(string msg, string fnc_name="n/a")
Log.
Definition EntityAI.c:377
proto native void SetSynchDirty()
Sets object synchronization dirty flag, which signalize that object wants to be synchronized (take ef...
void EEInit()
Called upon object creation.
Definition EntityAI.c:744
vector GetDefaultHitPosition()
Definition EntityAI.c:2814
bool PredictiveTakeEntityAsAttachment(notnull EntityAI item)
Put item into as attachment.
Definition EntityAI.c:1791
int GetHiddenSelectionIndex(string selection)
Returns index of the string found in cfg array 'hiddenSelections'. If it's not found then it returns ...
Definition EntityAI.c:2004
bool HasBayonetAttached()
Definition EntityAI.c:2974
void InitInherentSlotExclusionMap()
map stored on instance to better respond to various state changes
Definition EntityAI.c:3167
void DebugBBoxDelete()
Definition EntityAI.c:2364
bool CanReleaseCargo(EntityAI cargo)
calls this->CanReleaseCargo(cargo)
Definition EntityAI.c:1389
float GetLiquidThroughputCoef()
Returns liquid throughput coeficient.
Definition EntityAI.c:2942
bool CanDisplayCargo()
Definition EntityAI.c:1534
bool CanDetachAttachment(EntityAI parent)
calls this->CanDetachAttachment(parent)
Definition EntityAI.c:1307
ref ScriptInvoker m_OnAttachmentReleaseLock
Definition EntityAI.c:160
void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition EntityAI.c:2658
ref ScriptInvoker m_OnReleaseLock
Definition EntityAI.c:156
void EEParentedTo(EntityAI parent)
Called from 'IEntity.AddChild'.
Definition EntityAI.c:820
map< int, string > GetEntityDamageDisplayNameMap()
Definition EntityAI.c:365
void OnMovedInsideCargo(EntityAI container)
Called when this item enters cargo of some container.
Definition EntityAI.c:1126
void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
Definition EntityAI.c:937
void ClearSingleExclusionValueGlobal(EAttExclusions value)
to help with item staging exclusions
Definition EntityAI.c:3354
void OnVariablesSynchronized()
Called on clients after receiving synchronization data from server.
Definition EntityAI.c:2268
void OnAttachmentRuined(EntityAI attachment)
Called when some attachment of this parent is ruined. Called on server and client side.
Definition EntityAI.c:922
void OnDebugButtonPressClient(int button_index)
Definition EntityAI.c:2350
proto native void SetPilotLight(bool isOn)
set< int > GetAttachmentExclusionMaskChildren()
Mask value coming from the item's attachments.
Definition EntityAI.c:3438
void AddSingleExclusionValueGlobal(EAttExclusions value)
to help with item staging exclusions
Definition EntityAI.c:3347
proto native void RegisterNetSyncVariableInt(string variableName, int minValue=0, int maxValue=0)
registers int variable synchronized over network
bool CanReleaseAttachment(EntityAI attachment)
calls this->CanReleaseAttachment(attachment)
Definition EntityAI.c:1287
bool CanDisplayAttachmentCategory(string category_name)
Definition EntityAI.c:1526
void OnMovedWithinCargo(EntityAI container)
Called when this item moves within cargo of some container.
Definition EntityAI.c:1139
void DeferredInit()
Definition EntityAI.c:209
override bool CanBeActionTarget()
Definition EntityAI.c:662
bool ServerTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Definition EntityAI.c:1653
vector m_TransportHitVelocity
Definition EntityAI.c:137
void PairRemote(notnull EntityAI trigger)
void OnWetChanged(float newVal, float oldVal)
string GetDefaultHitComponent()
returns default hit component for the Entity (overriden for each Type - PlayerBase,...
Definition EntityAI.c:2794
ref DamageZoneMap m_DamageZoneMap
Definition EntityAI.c:122
bool IsIgnited()
Override this method and make it so it returns whenever this item is on fire right now or not....
Definition EntityAI.c:435
bool CheckExclusionAccessPropagation(int occupiedSlot, int targetSlot, set< int > value, inout set< int > adjustedValue)
special propagation contition
Definition EntityAI.c:3529
ScriptInvoker GetOnReleaseLock()
Definition EntityAI.c:1089
ref set< int > m_AttachmentExclusionMaskChildren
Definition EntityAI.c:108
float GetTemperatureMax()
Definition EntityAI.c:1991
bool m_KilledByHeadshot
Definition EntityAI.c:102
bool ServerTakeEntityAsAttachment(notnull EntityAI item)
Definition EntityAI.c:1802
ref map< int, ref set< int > > m_AttachmentExclusionSlotMap
Definition EntityAI.c:106
string ChangeIntoOnDetach()
Definition EntityAI.c:2851
ScriptInvoker GetOnItemDetached()
Definition EntityAI.c:1040
void InitAttachmentExclusionValues()
Definition EntityAI.c:3150
int GetSlotsCountCorrect()
Definition EntityAI.c:1588
script counterpart to engine's class Inventory
Definition Inventory.c:79
InventoryLocation.
provides access to slot configuration
const int INVALID
Invalid slot (-1)
static proto native bool GetShowForSlotId(int slot_Id)
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
The class that will be instanced (moddable)
Definition gameplay.c:376
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
static const vector Zero
Definition EnConvert.c:110
proto native CGame GetGame()
const int COMP_TYPE_BODY_STAGING
Definition Component.c:10
const int COMP_TYPE_COUNT
Definition Component.c:12
const int COMP_TYPE_ENERGY_MANAGER
Definition Component.c:9
const int COMP_TYPE_ETITY_DEBUG
Definition Component.c:8
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto void DumpStack()
Prints current call stack (stack trace)
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
bool IsPendingDeletion()
Get whether the Effect is queued up for being cleaned up.
Definition Effect.c:249
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
const float MELEE_ITEM_DAMAGE
Definition constants.c:599
const int REFRESHER_FREQUENCY_DEFAULT
Definition constants.c:880
array< string > TStringArray
Definition EnScript.c:666
EntityFlags
Entity flags.
Definition EnEntity.c:114
const int STATE_RUINED
Definition constants.c:757
const float STATE_DAMP
Definition constants.c:784
const float STATE_SOAKING_WET
Definition constants.c:782
const float STATE_DRENCHED
Definition constants.c:781
const float STATE_WET
Definition constants.c:783
const float LIQUID_THROUGHPUT_DEFAULT
Definition constants.c:524
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:233
const string CFG_VEHICLESPATH
Definition constants.c:209
const string CFG_WEAPONSPATH
Definition constants.c:210
const string CFG_MAGAZINESPATH
Definition constants.c:211
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native bool dBodyIsActive(notnull IEntity ent)
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)
const int SAT_DEBUG_ACTION
Definition constants.c:424
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:389