DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
EntityAI.c
См. документацию.
9
10enum SurfaceAnimationBone
11{
15 RightBackLimb
16}
17
18enum PlantType
19{
20 TREE_HARD = 1000,
21 TREE_SOFT = 1001,
22 BUSH_HARD = 1002,
23 BUSH_SOFT = 1003,
24}
25
26enum WeightUpdateType
27{
28 FULL = 0,
32 RECURSIVE_REMOVE
33}
34
35enum EItemManipulationContext
36{
37 UPDATE, //generic operation
40}
41
43enum EInventoryIconVisibility
44{
45 ALWAYS = 0,
47 //further values yet unused, but nice to have anyway
50}
51
53enum EAttExclusions
54{
55 OCCUPANCY_INVALID = -1,
56 //Legacy relations
57 LEGACY_EYEWEAR_HEADGEAR,
58 LEGACY_EYEWEAR_MASK,
59 LEGACY_HEADSTRAP_HEADGEAR,
60 LEGACY_HEADSTRAP_MASK,
61 LEGACY_HEADGEAR_MASK,
62 LEGACY_HEADGEAR_EYEWEWEAR,
63 LEGACY_HEADGEAR_HEADSTRAP,
64 LEGACY_MASK_HEADGEAR,
65 LEGACY_MASK_EYEWEWEAR,
66 LEGACY_MASK_HEADSTRAP,
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.
70 EXCLUSION_HEADSTRAP_0,
71 EXCLUSION_MASK_0,
72 EXCLUSION_MASK_1,
73 EXCLUSION_MASK_2, //Mostly Gasmasks
74 EXCLUSION_MASK_3, //bandana mask special behavior
75 EXCLUSION_GLASSES_REGULAR_0,
76 EXCLUSION_GLASSES_TIGHT_0,
77 //values to solve the edge-cases with shaving action
78 SHAVING_MASK_ATT_0,
79 SHAVING_HEADGEAR_ATT_0,
80 SHAVING_EYEWEAR_ATT_0,
81}
82
83class DebugSpawnParams
84{
85 Man m_Player;
86
87 static DebugSpawnParams WithPlayer(Man player)
88 {
89 DebugSpawnParams params = new DebugSpawnParams();
90 params.m_Player = player;
91 return params;
92 }
93};
94
95class TSelectableActionInfoArrayEx extends array<ref Param> {}
97typedef Param4<int, int, string, int> TSelectableActionInfoWithColor;
98
99class EntityAI extends Entity
100{
103 bool m_PreparedToDelete = false;
104 bool m_RefresherViable = false;
106 protected bool m_RoofAbove = false;
107 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
108 private ref set<int> m_AttachmentExclusionMaskGlobal; //additional mask values and simple item values. Independent of slot-specific behavior!
109 private ref set<int> m_AttachmentExclusionMaskChildren; //additional mask values and simple item values
110
112
115
116 const int DEAD_REPLACE_DELAY = 250;
117 const int DELETE_CHECK_DELAY = 100;
118
122
124 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
125
126 float m_Weight;
128 float m_ConfigWeight = ConfigGetInt("weight");
129 protected bool m_CanDisplayWeight;
130 private float m_LastUpdatedTime; //CE update time
131 protected float m_ElapsedSinceLastUpdate; //CE update time
132 protected float m_PreviousRoofTestTime = 0;
133
134 protected UTemperatureSource m_UniversalTemperatureSource;
135
136 bool m_PendingDelete = false;
137 bool m_Initialized = false;
140
141 // ============================================
142 // Variable Manipulation System
143 // ============================================
144 int m_VariablesMask;//this holds information about which vars have been changed from their default values
145
146 // Temperature
157
159
160 protected bool m_IsFrozen;
161 protected bool m_IsFrozenLocal;
162 protected float m_FreezeThawProgress;
163
164 protected float m_OverheatProgress;
165
166 //---------------------------------------------
167
168 //Called on item attached to this item (EntityAI item, string slot, EntityAI parent)
170 //Called on item detached from this item (EntityAI item, string slot, EntityAI parent)
172 //Called when an item is added to the cargo of this item (EntityAI item, EntityAI parent)
174 //Called when an item is removed from the cargo of this item (EntityAI item, EntityAI parent)
176 //Called when an item is moved around in the cargo of this item (EntityAI item, EntityAI parent)
178 //Called when an item is flipped around in cargo (bool flip)
180 //Called when an items view index is changed
182 //Called when an location in this item is reserved (EntityAI item) - cargo
184 //Called when this item is unreserved (EntityAI item) - cargo
186 //Called when an location in this item is reserved (EntityAI item) - attachment
188 //Called when this item is unreserved (EntityAI item) - attachment
190 //Called when this entity is hit
192 //Called when this entity is killed
194
196
197 #ifdef DEVELOPER
198 float m_LastFTChangeTime;;
199 float m_PresumedTimeRemaining;
200 #endif
201
202 void EntityAI()
203 {
204 // Set up the Energy Manager
205 string type = GetType();
206 string param_access_energy_sys = "CfgVehicles " + type + " EnergyManager ";
207 bool is_electic_device = GetGame().ConfigIsExisting(param_access_energy_sys);
208
209 if (is_electic_device) // TO DO: Check if this instance is a hologram (advanced placement). If Yes, then do not create Energy Manager component.
210 {
212 RegisterNetSyncVariableBool("m_EM.m_IsSwichedOn");
213 RegisterNetSyncVariableBool("m_EM.m_CanWork");
214 RegisterNetSyncVariableBool("m_EM.m_IsPlugged");
215 RegisterNetSyncVariableInt("m_EM.m_EnergySourceNetworkIDLow");
216 RegisterNetSyncVariableInt("m_EM.m_EnergySourceNetworkIDHigh");
217 RegisterNetSyncVariableFloat("m_EM.m_Energy");
218 }
219
220 // Item preview index
221 RegisterNetSyncVariableInt( "m_ViewIndex", 0, 99 );
222 // Refresher signalization
223 RegisterNetSyncVariableBool("m_RefresherViable");
224
227 m_LastUpdatedTime = 0.0;
229
230 m_CanDisplayWeight = ConfigGetBool("displayWeight");
231
235
237
239
241 }
242
244 {
245
246 }
247
249 {
250 m_VarTemperatureInit = ConfigGetFloat("varTemperatureInit");
251 m_VarTemperatureMin = ConfigGetFloat("varTemperatureMin");
252 m_VarTemperatureMax = ConfigGetFloat("varTemperatureMax");
253
254 if (ConfigIsExisting("varTemperatureFreezePoint"))
255 m_VarTemperatureFreezeThreshold = ConfigGetFloat("varTemperatureFreezePoint");
256 else
257 m_VarTemperatureFreezeThreshold = float.LOWEST;
258
259 if (ConfigIsExisting("varTemperatureThawPoint"))
260 m_VarTemperatureThawThreshold = ConfigGetFloat("varTemperatureThawPoint");
261 else
262 m_VarTemperatureThawThreshold = float.LOWEST;
263
264 m_VarTemperatureFreezeTime = Math.Clamp(ConfigGetFloat("varTemperatureFreezeTime"),1,float.MAX);
265 m_VarTemperatureThawTime = Math.Clamp(ConfigGetFloat("varTemperatureThawTime"),1,float.MAX);
266 if (ConfigIsExisting("varTemperatureOverheatTime"))
267 m_VarTemperatureOverheatTime = ConfigGetFloat("varTemperatureOverheatTime");
268 else
270
271 if (ConfigIsExisting("varHeatPermeabilityCoef"))
272 m_VarHeatPermeabilityCoef = ConfigGetFloat("varHeatPermeabilityCoef");
273 else
275
276 if (CanHaveTemperature())
277 {
279 RegisterNetSyncVariableBool("m_IsFrozen");
280
281 if (GetGame().IsServer())
283
284 if (!GetGame().IsMultiplayer() || GetGame().IsClient())
286 }
287 }
288
290 {
291 m_Initialized = true;
292 }
293
295 {
296 return m_Initialized;
297 }
298
301 {
302 return EInventoryIconVisibility.ALWAYS;
303 }
304
306 ComponentEnergyManager m_EM; // This reference is necesarry due to synchronization, since it's impossible to synchronize values from a component :(
307
309 Component CreateComponent(int comp_type, string extended_class_name="")
310 {
311 return GetComponent(comp_type, extended_class_name);
312 }
313
315 Component GetComponent(int comp_type, string extended_class_name="")
316 {
317 if ( m_ComponentsBank == NULL )
319
320 return m_ComponentsBank.GetComponent(comp_type, extended_class_name);
321 }
322
324 bool DeleteComponent(int comp_type)
325 {
326 return m_ComponentsBank.DeleteComponent(comp_type);
327 }
328
330 {
331 return "";
332 }
333
335 {
336 return false;
337 }
338
340 bool HasComponent(int comp_type)
341 {
342 if ( m_ComponentsBank )
343 return m_ComponentsBank.IsComponentAlreadyExist(comp_type);
344
345 return false;
346 }
347
350 {
351 if ( (!GetGame().IsMultiplayer() || GetGame().IsServer()) && GetEconomyProfile() )
352 {
353 float lifetime = GetEconomyProfile().GetLifetime();
354 int frequency = GetCEApi().GetCEGlobalInt("FlagRefreshFrequency");
355 if ( frequency <= 0 )
356 {
358 }
359
360 if ( frequency <= lifetime )
361 {
362 m_RefresherViable = true;
364 }
365 }
366 }
367
369 {
370 if (IsRuined())
371 {
372 return false;
373 }
374 return m_RefresherViable;
375 }
376
377 #ifdef DEVELOPER
378 override void SetDebugItem()
379 {
380 super.SetDebugItem();
381 _item = this;
382 }
383 #endif
384
385
388 {
390 DamageSystem.GetDamageZoneMap(this,m_DamageZoneMap);
391 }
392
395 {
396 string path_base;
397 string path;
398 string component_name;
399
400 if ( IsWeapon() )
401 {
402 path_base = CFG_WEAPONSPATH;
403 }
404 else if ( IsMagazine() )
405 {
406 path_base = CFG_MAGAZINESPATH;
407 }
408 else
409 {
410 path_base = CFG_VEHICLESPATH;
411 }
412
413 path_base = string.Format( "%1 %2 DamageSystem DamageZones", path_base, GetType() );
414
415 if ( !GetGame().ConfigIsExisting(path_base) )
416 {
417 component_name = GetDisplayName();
418 GetGame().FormatRawConfigStringKeys(component_name);
419 m_DamageDisplayNameMap.Insert( "".Hash(), component_name );
420 }
421 else
422 {
423 TStringArray zone_names = new TStringArray;
424 GetDamageZones( zone_names );
425
426 for ( int i = 0; i < zone_names.Count(); i++ )
427 {
428 path = string.Format( "%1 %2 displayName", path_base, zone_names[i] );
429
430 if (GetGame().ConfigIsExisting(path) && GetGame().ConfigGetTextRaw(path,component_name))
431 {
432 GetGame().FormatRawConfigStringKeys(component_name);
433 m_DamageDisplayNameMap.Insert( zone_names[i].Hash(), component_name );
434 }
435 }
436 }
437 }
438
439 protected float ConvertNonlethalDamage(float damage, DamageType damageType)
440 {
441 return 0.0;
442 }
443
445 float ConvertNonlethalDamage(float damage)
446 {
447 return 0.0;
448 }
449
454
459
462 {
463 return m_CanDisplayWeight;
464 }
465
467 void Log(string msg, string fnc_name = "n/a")
468 {
469 Debug.Log(msg, "Object", "n/a", fnc_name, this.GetType());
470 }
471
473 void LogWarning(string msg, string fnc_name = "n/a")
474 {
475 Debug.LogWarning(msg, "Object", "n/a", fnc_name, this.GetType());
476 }
477
479 void LogError(string msg, string fnc_name = "n/a")
480 {
481 Debug.LogError(msg, "Object", "n/a", fnc_name, this.GetType());
482 }
483
486 {
487 return GetCompBS() && GetCompBS().IsSkinned();
488 }
489
491 {
492 if (GetCompBS())
493 GetCompBS().SetAsSkinned();
494 }
495
497 {
498 if ( !IsSkinned() && tool )
499 if ( !IsAlive() )
500 return true;
501 return false;
502 }
503
505 {
506 float value = 0.0;
507 if (m_BloodInfectionChanceCached.Find(type, value))
508 return value;
509
510 return value;
511 }
512
514 {
515 string basePath = string.Format("cfgVehicles %1 Skinning BloodInfectionSettings", GetType());
516 if (g_Game.ConfigIsExisting(basePath))
517 {
518 string agentName = EnumTools.EnumToString(eAgents, type);
519 agentName.ToLower();
520 float value = g_Game.ConfigGetFloat(string.Format("%1 %2 chance", basePath, agentName));
521 m_BloodInfectionChanceCached.Set(type, value);
522 }
523 }
524
525
526 // ITEM TO ITEM FIRE DISTRIBUTION
529 {
530 return false;
531 }
532
534 bool CanBeIgnitedBy(EntityAI igniter = NULL)
535 {
536 return false;
537 }
538
540 bool CanIgniteItem(EntityAI ignite_target = NULL)
541 {
542 return false;
543 }
544
547 {
548 if (m_EM)
549 return m_EM.IsWorking();
550 return false;
551 }
552
553 // Change return value to true if last detached item cause disassemble of item - different handlig some inventory operations
555 {
556 return false;
557 }
558
560 {
561 return false;
562 }
563
565 {
566 return false;
567 }
568
571 {
572 return true;
573 }
574
576 void OnIgnitedTarget( EntityAI target_item)
577 {
578
579 }
580
582 void OnIgnitedThis( EntityAI fire_source)
583 {
584
585 }
586
589 {
590
591 }
592
594 void OnIgnitedThisFailed( EntityAI fire_source)
595 {
596
597 }
598
601 {
602 return true;
603 }
604
606 bool IsThisIgnitionSuccessful(EntityAI item_source = NULL)
607 {
608 return true;
609 }
610 // End of fire distribution ^
611
612 // ADVANCED PLACEMENT EVENTS
613 void OnPlacementStarted(Man player);
615 void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0");
617
618 bool CanBePlaced(Man player, vector position)
619 {
620 return true;
621 }
622
624 string CanBePlacedFailMessage( Man player, vector position )
625 {
626 return "";
627 }
628
631 {
632 return false;
633 }
634
637 {
638 return 0.0;
639 }
640
643 {
644 return 0.0;
645 }
646
648 bool IsEmpty()
649 {
650 return (!HasAnyCargo() && GetInventory().AttachmentCount() == 0);
651 }
652
655 {
656 return false;
657 }
658
661 {
662 return false;
663 }
664
667 {
668 CargoBase cargo = GetInventory().GetCargo();
669
670 if(!cargo) return false;//this is not a cargo container
671
672 if( cargo.GetItemCount() > 0 )
673 {
674 return true;
675 }
676 else
677 {
678 return false;
679 }
680 }
681
686
691
692 //is there any roof above
694 {
695 return m_RoofAbove;
696 }
697
698 void SetRoofAbove(bool state)
699 {
700 m_RoofAbove = state;
701 }
702
704 void CheckForRoofLimited(float timeTresholdMS = 3000);
705
706 int GetAgents() { return 0; }
707 void RemoveAgent(int agent_id);
709 void RemoveAllAgentsExcept(int agent_to_keep);
710 void InsertAgent(int agent, float count = 1);
711
712 override bool IsEntityAI() { return true; }
713
715 {
716 return !( GetParent() || GetHierarchyParent() );
717 }
718
719 bool IsPlayer()
720 {
721 return false;
722 }
723
724 bool IsAnimal()
725 {
726 return false;
727 }
728
729 bool IsZombie()
730 {
731 return false;
732 }
733
735 {
736 return false;
737 }
738
740 {
741 return IsDamageDestroyed();
742 }
743
745 {
746 if (ai && ai.IsBeingBackstabbed())
747 {
748 return false;
749 }
750
751 if ( !dBodyIsActive( this ) && !IsMan() )
752 return false;
753 return !IsDamageDestroyed();
754 }
755
757 {
758 return false;
759 }
760
769 override void Delete()
770 {
771 m_PendingDelete = true;
772 super.Delete();
773 }
774
776 {
777 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().ObjectDeleteOnClient, this);
778 }
779
780 // delete synchronized between server and client
782 {
783 if (GetHierarchyRootPlayer() == null || (GetHierarchyRootPlayer() && !GetHierarchyRootPlayer().IsAlive()))
784 {
785 Delete();
786 }
787 else
788 {
789 if (GetGame().IsServer() && GetGame().IsMultiplayer())
790 GetHierarchyRootPlayer().JunctureDeleteItem(this);
791 else
792 GetHierarchyRootPlayer().AddItemToDelete(this);
793 }
794 }
795
796 //legacy, wrong name, use 'DeleteSafe()' instead
798 {
799 DeleteSafe();
800 }
801
803 {
804 return IsPreparedToDelete() || m_PendingDelete || ToDelete() || IsPendingDeletion();
805 }
806
807 override bool CanBeActionTarget()
808 {
809 if (super.CanBeActionTarget())
810 {
811 return !IsSetForDeletion();
812 }
813 else
814 {
815 return false;
816 }
817 }
818
820 {
821 m_PreparedToDelete = true;
822 }
823
825 {
826 return m_PreparedToDelete;
827 }
828
829
837
839 {
840 return false;
841 }
842
844 {
845 if (!IsPrepareToDelete())
846 {
847 Debug.Log("TryDelete - not ready for deletion");
848 return false;
849 }
850
851 if (GetGame().HasInventoryJunctureItem(this))
852 {
853 Debug.Log("TryDelete - deferred call");
855 return false;
856 }
857
859 Debug.Log("TryDelete - OnBeforeTryDelete end");
860 DeleteSafe();
861 Debug.Log("TryDelete - DeleteSafe end");
862
863 return true;
864 }
865
867
870
873
876
879
880 // !returns the number of levels bellow the hierarchy root this entity is at
881 int GetHierarchyLevel(int lvl = 0)
882 {
883 if (!GetHierarchyParent())
884 return lvl;
885
886 return GetHierarchyParent().GetHierarchyLevel(lvl+1);
887 }
888
893
895 void EEInit()
896 {
897 if (GetInventory())
898 {
899 GetInventory().EEInit();
902 for ( int i = 0; i < GetInventory().AttachmentCount(); i++ )
903 {
904 EntityAI attachment = GetInventory().GetAttachmentFromIndex( i );
905 if ( attachment )
906 {
907 if ( attachment.GetInventory().GetCargo() )
908 {
909 m_AttachmentsWithCargo.Insert( attachment );
910 }
911
912 if ( attachment.GetInventory().GetAttachmentSlotsCount() > 0 )
913 {
914 m_AttachmentsWithAttachments.Insert( attachment );
915 }
916 }
917 }
918 }
919
921
922 if (CanHaveTemperature() && GetGame().IsServer())
924 }
925
927 void EEDelete(EntityAI parent)
928 {
929 m_PendingDelete = true;
930 GetInventory().EEDelete(parent);
931
932 if (m_EM)
933 m_EM.OnDeviceDestroyed();
934 }
935
936 override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
937 {
938 super.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
939 #ifndef SERVER
940 g_Game.GetWorld().AddEnvShootingSource(pos, 1.0);
941 #endif
942 if (m_DestructionBehaviourObj && m_DestructionBehaviourObj.HasExplosionDamage())
943 {
944 m_DestructionBehaviourObj.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
945 }
946 }
947
948
949 void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner) { }
952
953 void OnItemAttachmentSlotChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc) {}
954
955 void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
956 {
957 EntityAI old_owner = oldLoc.GetParent();
958 EntityAI new_owner = newLoc.GetParent();
959 OnItemLocationChanged(old_owner, new_owner);
960
961 if (oldLoc.GetType() == InventoryLocationType.ATTACHMENT && newLoc.GetType() == InventoryLocationType.ATTACHMENT)
962 {
963 OnItemAttachmentSlotChanged(oldLoc,newLoc);
964 }
965
966 if (oldLoc.GetType() == InventoryLocationType.ATTACHMENT)
967 {
968 if (old_owner)
969 OnWasDetached(old_owner, oldLoc.GetSlot());
970 else
971 Error("EntityAI::EEItemLocationChanged - detached, but old_owner is null");
972 }
973
974 if (newLoc.GetType() == InventoryLocationType.ATTACHMENT)
975 {
976 if (new_owner)
977 OnWasAttached(newLoc.GetParent(), newLoc.GetSlot());
978 else
979 Error("EntityAI::EEItemLocationChanged - attached, but new_owner is null");
980 }
981
982 if (oldLoc.GetType() == InventoryLocationType.HANDS)
983 {
984 Man.Cast(oldLoc.GetParent()).OnItemInHandsChanged();
985 }
986
987 if (newLoc.GetType() == InventoryLocationType.HANDS)
988 {
989 Man.Cast(newLoc.GetParent()).OnItemInHandsChanged();
990 }
991 }
992
995 {
996 }
997
1000 {
1001 }
1002
1003 void EEInventoryIn (Man newParentMan, EntityAI diz, EntityAI newParent)
1004 {
1005 }
1006 void EEInventoryOut (Man oldParentMan, EntityAI diz, EntityAI newParent)
1007 {
1009
1010 if (GetInventory() && newParent == null)
1011 {
1012 GetInventory().ResetFlipCargo();
1013 }
1014 }
1015
1017 {
1019 }
1020
1021 void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
1022 {
1023 // Notify potential parent that this item was ruined
1024 EntityAI parent = GetHierarchyParent();
1025
1026 if (newLevel == GameConstants.STATE_RUINED)
1027 {
1028 if (parent)
1029 {
1030 parent.OnAttachmentRuined(this);
1031 }
1032 if (!zone)
1033 {
1034 OnDamageDestroyed(oldLevel);
1035 }
1036 AttemptDestructionBehaviour(oldLevel,newLevel, zone);
1037 }
1038 }
1039
1041 void OnDamageDestroyed(int oldLevel);
1042
1043 void AttemptDestructionBehaviour(int oldLevel, int newLevel, string zone)
1044 {
1046 {
1047 typename destType = GetDestructionBehaviour().ToType();
1048
1049 if (destType)
1050 {
1052 {
1053 m_DestructionBehaviourObj = DestructionEffectBase.Cast(destType.Spawn());
1054 }
1055
1057 {
1058 m_DestructionBehaviourObj.OnHealthLevelChanged(this, oldLevel, newLevel, zone);
1059 }
1060 }
1061 else
1062 {
1063 ErrorEx("Incorrect destruction behaviour type, make sure the class returned in 'GetDestructionBehaviour()' is a valid type inheriting from 'DestructionEffectBase'");
1064 }
1065 }
1066 }
1067
1068
1069 void SetTakeable(bool pState);
1070
1072 void EEKilled(Object killer)
1073 {
1075 m_OnKilledInvoker.Invoke(this, killer);
1076
1077 GetGame().GetAnalyticsServer().OnEntityKilled(killer, this);
1078
1079 if (ReplaceOnDeath())
1081 }
1082
1084 {
1085 return false;
1086 }
1087
1089 {
1090 return "";
1091 }
1092
1094 {
1095 return false;
1096 }
1097
1099 {
1100 EntityAI dead_entity = EntityAI.Cast( GetGame().CreateObjectEx( GetDeadItemName(), GetPosition(), ECE_OBJECT_SWAP, RF_ORIGINAL ) );
1101 dead_entity.SetOrientation(GetOrientation());
1102 if (KeepHealthOnReplace())
1103 dead_entity.SetHealth(GetHealth());
1104
1105 DeleteSafe();
1106 }
1107
1110
1111 void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
1112 {
1113 if (m_OnHitByInvoker)
1114 m_OnHitByInvoker.Invoke(this, damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
1115 #ifdef DEVELOPER
1116 //Print("EEHitBy: " + this + "; damageResult:"+ damageResult.GetDamage("","") +"; damageType: "+ damageType +"; source: "+ source +"; component: "+ component +"; dmgZone: "+ dmgZone +"; ammo: "+ ammo +"; modelPos: "+ modelPos);
1117 #endif
1118 }
1119
1120 // called only on the client who caused the hit
1121 void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
1122 {
1123
1124 }
1125
1126 // !Called on PARENT when a child is attached to it.
1127 void EEItemAttached(EntityAI item, string slot_name)
1128 {
1129 int slotId = InventorySlots.GetSlotIdFromString(slot_name);
1130 PropagateExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId),slotId); //Performed from parent to avoid event order issues on swap
1132
1133 if ( m_ComponentsBank != NULL )
1134 {
1135 for ( int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key )
1136 {
1137 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
1138 {
1139 m_ComponentsBank.GetComponent(comp_key).Event_OnItemAttached(item, slot_name);
1140 }
1141 }
1142 }
1143
1144 // Energy Manager
1145 if ( m_EM && item.GetCompEM())
1146 m_EM.OnAttachmentAdded(item);
1147
1148 if ( item.GetInventory().GetCargo() )
1149 m_AttachmentsWithCargo.Insert( item );
1150
1151 if ( item.GetInventory().GetAttachmentSlotsCount() > 0 )
1152 m_AttachmentsWithAttachments.Insert( item );
1153
1154 if ( m_OnItemAttached )
1155 m_OnItemAttached.Invoke( item, slot_name, this );
1156 }
1157
1158 void SwitchItemSelectionTexture(EntityAI item, string slot_name);
1159 void SwitchItemSelectionTextureEx(EItemManipulationContext context, Param par = null);
1160
1161 // !Called on PARENT when a child is detached from it.
1162 void EEItemDetached(EntityAI item, string slot_name)
1163 {
1164 int slotId = InventorySlots.GetSlotIdFromString(slot_name);
1165 ClearExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId),slotId); //Performed from parent to avoid event order issues on swap
1167
1168 if ( m_ComponentsBank != NULL )
1169 {
1170 for ( int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key )
1171 {
1172 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
1173 {
1174 m_ComponentsBank.GetComponent(comp_key).Event_OnItemDetached(item, slot_name);
1175 }
1176 }
1177 }
1178
1179 // Energy Manager
1180 if (m_EM && item.GetCompEM())
1181 m_EM.OnAttachmentRemoved(item);
1182
1183 if ( m_AttachmentsWithCargo.Find( item ) > -1 )
1184 m_AttachmentsWithCargo.RemoveItem( item );
1185
1186 if ( m_AttachmentsWithAttachments.Find( item ) > -1 )
1187 m_AttachmentsWithAttachments.RemoveItem( item );
1188
1189
1190 if ( m_OnItemDetached )
1191 m_OnItemDetached.Invoke( item, slot_name, this );
1192 }
1193
1195 {
1197
1199 m_OnItemAddedIntoCargo.Invoke( item, this );
1200
1201 item.OnMovedInsideCargo(this);
1202 }
1203
1205 {
1207
1209 m_OnItemRemovedFromCargo.Invoke( item, this );
1210
1211 item.OnRemovedFromCargo(this);
1212 }
1213
1215 {
1217 m_OnItemMovedInCargo.Invoke( item, this );
1218 item.OnMovedWithinCargo(this);
1219 }
1220
1227
1234
1241
1248
1255
1262
1269
1271 {
1272 if( !m_OnSetLock )
1274 return m_OnSetLock;
1275 }
1276
1283
1290
1297
1304
1311
1312
1315 {
1316 if (m_EM)
1317 m_EM.HandleMoveInsideCargo(container);
1318 }
1319
1322 {
1323
1324 }
1325
1328 {
1329
1330 }
1331
1334 {
1335 // ENERGY MANAGER
1336 // Restore connections between devices which were connected before server restart
1337 if ( m_EM && m_EM.GetRestorePlugState() )
1338 {
1339 int b1 = m_EM.GetEnergySourceStorageIDb1();
1340 int b2 = m_EM.GetEnergySourceStorageIDb2();
1341 int b3 = m_EM.GetEnergySourceStorageIDb3();
1342 int b4 = m_EM.GetEnergySourceStorageIDb4();
1343
1344 // get pointer to EntityAI based on this ID
1345 EntityAI potential_energy_source = GetGame().GetEntityByPersitentID(b1, b2, b3, b4); // This function is available only in this event!
1346
1347 // IMPORTANT!
1348 // 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)
1349 // 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.
1350 // Therefore their plug state is being restored withing the EEItemAttached() event while being excluded by the following 'if' conditions...
1351
1352 bool is_attachment = false;
1353
1354 if (potential_energy_source)
1355 is_attachment = GetInventory().HasAttachment(potential_energy_source);
1356
1357 if ( !is_attachment && potential_energy_source )
1358 is_attachment = potential_energy_source.GetInventory().HasAttachment(this);
1359
1360 if ( potential_energy_source && potential_energy_source.GetCompEM() /*&& potential_energy_source.HasEnergyManager()*/ && !is_attachment )
1361 m_EM.PlugThisInto(potential_energy_source); // restore connection
1362 }
1363 }
1364
1367 {
1368 }
1369
1372 {
1373 }
1374
1377 {
1379 GetHierarchyRootPlayer().SetProcessUIWarning(true);
1380 }
1381
1384 {
1385 string cfg_path = "cfgVehicles " + GetType() + " AnimationSources";
1386
1387 if ( GetGame().ConfigIsExisting(cfg_path) )
1388 {
1389 int selections = GetGame().ConfigGetChildrenCount(cfg_path);
1390
1391 for (int i = 0; i < selections; i++)
1392 {
1393 string selection_name;
1394 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1395 HideSelection(selection_name);
1396 }
1397 }
1398 }
1399
1402 {
1403 string cfg_path = "cfgVehicles " + GetType() + " AnimationSources";
1404
1405 if ( GetGame().ConfigIsExisting(cfg_path) )
1406 {
1407 int selections = GetGame().ConfigGetChildrenCount(cfg_path);
1408
1409 for (int i = 0; i < selections; i++)
1410 {
1411 string selection_name;
1412 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1413 ShowSelection(selection_name);
1414 }
1415 }
1416 }
1417
1424 bool CanReceiveAttachment (EntityAI attachment, int slotId)
1425 {
1426 //generic occupancy check
1427 return CheckAttachmentReceiveExclusion(attachment,slotId);
1428 }
1429
1437 {
1438 return true;
1439 }
1440
1449 {
1450 return !IsHologram();
1451 }
1452
1453 //If return true, item can be attached even from parent to this. Item will be switched during proccess. (only hands)
1455 {
1456 return false;
1457 }
1458
1465 {
1466 if( attachment && attachment.GetInventory() && GetInventory() )
1467 {
1469 attachment.GetInventory().GetCurrentInventoryLocation( il );
1470 if( il.IsValid() )
1471 {
1472 int slot = il.GetSlot();
1473 return !GetInventory().GetSlotLock( slot );
1474 }
1475 }
1476 return true;
1477 }
1478
1485 {
1486 return true;
1487 }
1488
1490 {
1491 return true;
1492 }
1493
1494 bool CanCombineAttachment(notnull EntityAI e, int slot, bool stack_max_limit = false)
1495 {
1496 EntityAI att = GetInventory().FindAttachment(slot);
1497 if(att)
1498 return att.CanBeCombined(e, true, stack_max_limit);
1499 return false;
1500 }
1501
1502 bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false )
1503 {
1504 return false;
1505 }
1506
1507 void CombineItemsEx(EntityAI entity2, bool use_stack_max = false );
1508
1509 void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id);
1510
1511 void CombineItemsClient(EntityAI entity2, bool use_stack_max = false )
1512 {}
1513
1514 void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id);
1515
1523 {
1524 if (GetInventory() && GetInventory().GetCargo())
1525 return GetInventory().GetCargo().CanReceiveItemIntoCargo(item));
1526
1527 return true;
1528 }
1529
1537 {
1538 return true;
1539 }
1540
1548 {
1549 return !IsHologram();
1550 }
1551
1558 bool CanSwapItemInCargo (EntityAI child_entity, EntityAI new_entity)
1559 {
1560 if (GetInventory() && GetInventory().GetCargo())
1561 return GetInventory().GetCargo().CanSwapItemInCargo(child_entity, new_entity));
1562
1563 return true;
1564 }
1565
1573 {
1574 return true;
1575 }
1576
1584 {
1585 return true;
1586 }
1587
1594 /*bool CanReceiveItemIntoInventory (EntityAI entity_ai)
1595 {
1596 return true;
1597 }*/
1598
1605 /*bool CanPutInInventory (EntityAI parent)
1606 {
1607 return true;
1608 }*/
1609
1617 {
1618 return true;
1619 }
1620
1622 {
1624 EntityAI ent = this;
1625 int attachmentDepth = 0;
1626 while (ent)
1627 {
1628 if (ent.GetInventory().GetCurrentInventoryLocation(lcn) && lcn.IsValid())
1629 {
1630 if (lcn.GetType() == InventoryLocationType.CARGO || lcn.GetType() == InventoryLocationType.PROXYCARGO)
1631 {
1632 return false;
1633 }
1634
1635 //hands treated as regular attachment here
1636 if (lcn.GetType() == InventoryLocationType.ATTACHMENT || lcn.GetType() == InventoryLocationType.HANDS)
1637 {
1638 attachmentDepth++;
1639 }
1640 }
1641
1642 ent = ent.GetHierarchyParent();
1643 }
1644
1645 return attachmentDepth <= GameConstants.INVENTORY_MAX_REACHABLE_DEPTH_ATT;
1646 }
1647
1649 {
1650 return false;
1651 }
1652
1653 override bool IsHologram()
1654 {
1655 return false;
1656 }
1657
1658 bool CanSaveItemInHands (EntityAI item_in_hands)
1659 {
1660 return true;
1661 }
1662
1670 {
1671 return !IsHologram();
1672 }
1673
1681 {
1682 return true;
1683 }
1684
1692 {
1693 return true;
1694 }
1695
1700 bool CanDisplayAttachmentSlot( string slot_name )
1701 {
1702 Debug.LogWarning("Obsolete function - use CanDisplayAttachmentSlot with slot id parameter");
1704 }
1705
1710 bool CanDisplayAttachmentSlot( int slot_id )
1711 {
1712 return InventorySlots.GetShowForSlotId(slot_id);
1713 }
1714
1719 {
1720 int count = GetInventory().GetAttachmentSlotsCount();
1721 int slotID;
1722 for (int i = 0; i < count; i++)
1723 {
1724 slotID = GetInventory().GetAttachmentSlotId(i);
1725 if (CanDisplayAttachmentSlot(slotID))
1726 {
1727 return true;
1728 }
1729 }
1730
1731 return false;
1732 }
1733
1738 bool CanDisplayAttachmentCategory( string category_name )
1739 {
1740 return true;
1741 }
1742
1747 {
1748 return GetInventory().GetCargo() != null;
1749 }
1750
1755 {
1756 return true;
1757 }
1758
1763 {
1764 return true;
1765 }
1766
1771 {
1773 }
1774
1775 // !Called on CHILD when it's attached to parent.
1776 void OnWasAttached( EntityAI parent, int slot_id );
1777
1778 // !Called on CHILD when it's detached from parent.
1779 void OnWasDetached( EntityAI parent, int slot_id )
1780 {
1781 if (!IsFlagSet(EntityFlags.VISIBLE))
1782 {
1783 SetInvisible(false);
1784 OnInvisibleSet(false);
1785 SetInvisibleRecursive(false,parent);
1786 }
1787 }
1788
1790
1792 {
1793 return false;
1794 }
1795
1797 proto native void CreateAndInitInventory();
1798 proto native void DestroyInventory();
1799
1801 {
1802 if (GetInventory())
1803 return GetInventory().GetAttachmentSlotsCount();
1804 else
1805 return -1;
1806 }
1807
1809 {
1810 if ( GetGame() )
1811 {
1812 int slot_id = InventorySlots.GetSlotIdFromString(slot_name);
1813 if (slot_id != InventorySlots.INVALID)
1814 return GetInventory().FindAttachment(slot_id);
1815 }
1816 return null;
1817 }
1818
1819 // Check whether attachmnent slot is reserved
1820 bool IsSlotReserved(int slotID)
1821 {
1822 Man player = GetHierarchyRootPlayer();
1823 if (!player)
1824 return false;
1825
1826 HumanInventory inv = player.GetHumanInventory();
1827 if (!inv || inv.GetUserReservedLocationCount() == 0)
1828 return false;
1829
1832 if (id == -1)
1833 return false;
1834
1835 inv.GetUserReservedLocation(id, loc);
1836
1837 if (loc.GetSlot() != slotID)
1838 return false;
1839
1840 return true;
1841 }
1842
1847 {
1848 EntityAI parent = GetHierarchyParent();
1849 if ( parent )
1850 {
1851 InventoryLocation inventory_location = new InventoryLocation();
1852 GetInventory().GetCurrentInventoryLocation( inventory_location );
1853
1854 return parent.GetInventory().GetSlotLock( inventory_location.GetSlot() );
1855 }
1856
1857 return false;
1858 }
1859
1864 {
1865 if ( GetGame().IsMultiplayer() )
1866 return GetInventory().TakeEntityToInventory(InventoryMode.JUNCTURE, flags, item);
1867 else
1868 return GetInventory().TakeEntityToInventory(InventoryMode.PREDICTIVE, flags, item);
1869 }
1871 {
1872 return GetInventory().TakeEntityToInventory(InventoryMode.LOCAL, flags, item);
1873 }
1875 {
1876 return GetInventory().TakeEntityToInventory(InventoryMode.SERVER, flags, item);
1877 }
1879 {
1880 if ( GetGame().IsMultiplayer() )
1881 return GetInventory().TakeEntityToTargetInventory(InventoryMode.JUNCTURE, target, flags, item);
1882 else
1883 return GetInventory().TakeEntityToTargetInventory(InventoryMode.PREDICTIVE, target, flags, item);
1884 }
1886 {
1887 return GetInventory().TakeEntityToTargetInventory(InventoryMode.LOCAL, target, flags, item);
1888 }
1890 {
1891 return GetInventory().TakeEntityToTargetInventory(InventoryMode.SERVER, target, flags, item);
1892 }
1893
1897 {
1898 if ( GetGame().IsMultiplayer() )
1899 return GetInventory().TakeEntityToCargo(InventoryMode.JUNCTURE, item);
1900 else
1901 return GetInventory().TakeEntityToCargo(InventoryMode.PREDICTIVE, item);
1902 }
1904 {
1905 return GetInventory().TakeEntityToCargo(InventoryMode.LOCAL, item);
1906 }
1908 {
1909 return GetInventory().TakeEntityToCargo(InventoryMode.SERVER, item);
1910 }
1911
1912 bool PredictiveTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
1913 {
1914 if ( GetGame().IsMultiplayer() )
1915 return GetInventory().TakeEntityToTargetCargo(InventoryMode.JUNCTURE, target, item);
1916 else
1917 return GetInventory().TakeEntityToTargetCargo(InventoryMode.PREDICTIVE, target, item);
1918 }
1919 bool LocalTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
1920 {
1921 return GetInventory().TakeEntityToTargetCargo(InventoryMode.LOCAL, target, item);
1922 }
1923 bool ServerTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
1924 {
1925 return GetInventory().TakeEntityToTargetCargo(InventoryMode.SERVER, target, item);
1926 }
1927
1930 bool PredictiveTakeEntityToCargoEx (notnull EntityAI item, int idx, int row, int col)
1931 {
1932 if ( GetGame().IsMultiplayer() )
1933 return GetInventory().TakeEntityToCargoEx(InventoryMode.JUNCTURE, item, idx, row, col);
1934 else
1935 return GetInventory().TakeEntityToCargoEx(InventoryMode.PREDICTIVE, item, idx, row, col);
1936 }
1937 bool LocalTakeEntityToCargoEx (notnull EntityAI item, int idx, int row, int col)
1938 {
1939 return GetInventory().TakeEntityToCargoEx(InventoryMode.LOCAL, item, idx, row, col);
1940 }
1941
1942 bool PredictiveTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
1943 {
1944 if ( GetGame().IsMultiplayer() )
1945 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.JUNCTURE, cargo, item, row, col);
1946 else
1947 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.PREDICTIVE, cargo, item, row, col);
1948 }
1949 bool LocalTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
1950 {
1951 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.LOCAL, cargo, item, row, col);
1952 }
1953 bool ServerTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
1954 {
1955 return GetInventory().TakeEntityToTargetCargoEx(InventoryMode.SERVER, cargo, item, row, col);
1956 }
1957
1960 bool PredictiveTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
1961 {
1962 if ( GetGame().IsMultiplayer() )
1963 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.JUNCTURE, item, slot);
1964 else
1965 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.PREDICTIVE, item, slot);
1966 }
1967 bool LocalTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
1968 {
1969 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.LOCAL, item, slot);
1970 }
1971 bool ServerTakeEntityAsAttachmentEx (notnull EntityAI item, int slot)
1972 {
1973 return GetInventory().TakeEntityAsAttachmentEx(InventoryMode.SERVER, item, slot);
1974 }
1975
1976 bool PredictiveTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
1977 {
1978 if ( GetGame().IsMultiplayer() )
1979 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.JUNCTURE, target, item, slot);
1980 else
1981 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.PREDICTIVE, target, item, slot);
1982 }
1983 bool LocalTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
1984 {
1985 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.LOCAL, target, item, slot);
1986 }
1987 bool ServerTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
1988 {
1989 return GetInventory().TakeEntityAsTargetAttachmentEx(InventoryMode.SERVER, target, item, slot);
1990 }
1991
1993 {
1994 if ( GetGame().IsMultiplayer() )
1995 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.JUNCTURE, target, item);
1996 else
1997 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.PREDICTIVE, target, item);
1998 }
1999 bool LocalTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
2000 {
2001 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.LOCAL, target, item);
2002 }
2003 bool ServerTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
2004 {
2005 return GetInventory().TakeEntityAsTargetAttachment(InventoryMode.SERVER, target, item);
2006 }
2007
2009 {
2010 if ( GetGame().IsMultiplayer() )
2011 return GetInventory().TakeToDst(InventoryMode.JUNCTURE, src, dst);
2012 else
2013 return GetInventory().TakeToDst(InventoryMode.PREDICTIVE, src, dst);
2014 }
2016 {
2017 return GetInventory().TakeToDst(InventoryMode.LOCAL, src, dst);
2018 }
2020 {
2021 return GetInventory().TakeToDst(InventoryMode.SERVER, src, dst);
2022 }
2023
2028 {
2029 if (GetGame().IsMultiplayer())
2030 return GetInventory().TakeEntityAsAttachment(InventoryMode.JUNCTURE, item);
2031 else
2032 return GetInventory().TakeEntityAsAttachment(InventoryMode.PREDICTIVE, item);
2033 }
2035 {
2036 return GetInventory().TakeEntityAsAttachment(InventoryMode.LOCAL, item);
2037 }
2039 {
2040 return GetInventory().TakeEntityAsAttachment(InventoryMode.SERVER, item);
2041 }
2042
2044 {
2045 return false;
2046 }
2047
2048 bool LocalDropEntity(notnull EntityAI item)
2049 {
2050 return false;
2051 }
2052
2053 bool ServerDropEntity(notnull EntityAI item)
2054 {
2055 return false;
2056 }
2057
2062 {
2063 for ( int i = 0; i < GetInventory().AttachmentCount(); i++ )
2064 {
2065 EntityAI attachment = GetInventory().GetAttachmentFromIndex( i );
2066 if ( attachment && attachment.IsInherited( type ) )
2067 return attachment;
2068 }
2069 return NULL;
2070 }
2071
2076 {
2077 for ( int i = 0; i < GetInventory().AttachmentCount(); i++ )
2078 {
2079 EntityAI attachment = GetInventory().GetAttachmentFromIndex ( i );
2080 if ( attachment.IsKindOf ( type ) )
2081 return attachment;
2082 }
2083 return NULL;
2084 }
2085
2088 bool CanDropEntity(notnull EntityAI item)
2089 {
2090 return true;
2091 }
2092
2094 {
2095 if (inv)
2096 {
2097 EntityAI res = inv.CreateInInventory(object_name);
2098 if (res)
2099 {
2100 return res;
2101 }
2102 }
2103
2104 return SpawnEntityOnGroundPos(object_name, pos);
2105 }
2106
2109 EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
2110 {
2112 vector mat[4];
2114 mat[3] = pos;
2115 il.SetGround(NULL, mat);
2116 return SpawnEntity(object_name, il,ECE_PLACE_ON_SURFACE,RF_DEFAULT);
2117 }
2118
2120 EntityAI SpawnEntityOnGround(string object_name, vector mat[4])
2121 {
2123 il.SetGround(NULL, mat);
2124 return SpawnEntity(object_name, il,ECE_PLACE_ON_SURFACE,RF_DEFAULT);
2125 }
2126
2127 //----------------------------------------------------------------
2128
2129 bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
2130 {
2131 return true;
2132 }
2133
2134 // Forward declarations to allow lower modules to access properties that are modified from higher modules
2135 // These are mainly used within the ItemBase
2136 void SetWet(float value, bool allow_client = false);
2137 void AddWet(float value);
2139
2140 float GetWet()
2141 {
2142 return 0;
2143 }
2144
2146 {
2147 return 0;
2148 }
2149
2151 {
2152 return 0;
2153 }
2154
2156 {
2157 return 0;
2158 }
2159
2161 {
2162 return GetWetMax() - GetWetMin() != 0;
2163 }
2164
2165 void OnWetChanged(float newVal, float oldVal);
2166
2168 // ! Returns current wet level of the entity
2170
2171 // ! Calculates wet level from a given wetness, to get level of an entity, use 'GetWetLevel()' instead
2173 {
2174 if (wetness < GameConstants.STATE_DAMP)
2175 {
2176 return EWetnessLevel.DRY;
2177 }
2178 else if (wetness < GameConstants.STATE_WET)
2179 {
2180 return EWetnessLevel.DAMP;
2181 }
2182 else if (wetness < GameConstants.STATE_SOAKING_WET)
2183 {
2184 return EWetnessLevel.WET;
2185 }
2186 else if (wetness < GameConstants.STATE_DRENCHED)
2187 {
2188 return EWetnessLevel.SOAKING;
2189 }
2190 return EWetnessLevel.DRENCHED;
2191 }
2192 //----------------------------------------------------------------
2194 {
2195 return false;
2196 }
2197
2198 bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true);
2199
2201 {
2202 return 0;
2203 }
2204
2206 {
2207 return 0;
2208 }
2209
2211 {
2212 return 0;
2213 }
2214
2216 {
2217 return 0;
2218 }
2219
2221
2222 int GetTargetQuantityMax(int attSlotID = -1)
2223 {
2224 return 0;
2225 }
2226
2228 {
2229 return 0;
2230 }
2231
2232 //----------------------------------------------------------------
2233
2235 {
2236 return (IsMan() || IsAnimal() || IsZombie()) && IsAlive() || IsCorpse();
2237 }
2238
2239 protected void InitTemperature()
2240 {
2241 EntityAI rootParent = GetHierarchyRoot();
2242 bool isParentAliveOrganism = false;
2243 if (rootParent && rootParent != this)
2244 isParentAliveOrganism = (rootParent.IsMan() || rootParent.IsAnimal() || rootParent.IsZombie()) && rootParent.IsAlive();
2245
2247 {
2249 }
2250 else if (isParentAliveOrganism) //living player's inventory etc.
2251 {
2252 SetTemperatureDirect(rootParent.GetTemperature());
2253 }
2254 else
2255 {
2256 SetTemperatureDirect(g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this));
2257 }
2258
2260 }
2261
2262 void SetTemperatureDirect(float value, bool allow_client = false)
2263 {
2264 if (!IsServerCheck(allow_client))
2265 return;
2266
2267 float min = GetTemperatureMin();
2268 float max = GetTemperatureMax();
2269 float previousValue = m_VarTemperature;
2270 m_VarTemperature = Math.Clamp(value, min, max);
2271
2272 if (previousValue != m_VarTemperature)
2274 }
2275
2277 void SetTemperature(float value, bool allow_client = false)
2278 {
2279 /*#ifdef DEVELOPER
2280 ErrorEx("Obsolete 'SetTemperature' called! Metadata will be extrapolated from base values.");
2281 #endif*/
2282
2283 if (!IsServerCheck(allow_client))
2284 return;
2285
2287 }
2288
2289 void AddTemperature(float value)
2290 {
2291 SetTemperature(value + GetTemperature());
2292 }
2293
2297 {
2298 #ifdef DEVELOPER
2299 m_LastFTChangeTime = -1;
2300 m_PresumedTimeRemaining = -1;
2301 #endif
2302
2303 if (!CanHaveTemperature())
2304 {
2305 Debug.Log("SetTemperatureEx | entity " + this + " does not have temperature range defined!");
2306 return;
2307 }
2308
2309 if (!m_TAC.TryAccessSource(data))
2310 return;
2311
2312 if (!IsServerCheck(false))
2313 return;
2314
2315 InterpolateTempData(TemperatureDataInterpolated.Cast(data));
2317 float delta;
2318 //overheating
2319 if (CanItemOverheat())
2320 {
2322 delta = data.m_AdjustedTarget - GetTemperature();
2323 else
2325
2326 HandleItemOverheating(delta,data);
2327 }
2328
2329 //freezing, can obstruct temperature change
2330 if (CanFreeze())
2331 {
2332 if (!m_IsFrozen)
2333 {
2334 delta = target - GetTemperatureFreezeThreshold();
2335 if (target < GetTemperatureFreezeThreshold())
2336 {
2337 //first crossing the threshold
2338 if (m_VarTemperature >= GetTemperatureFreezeThreshold()) //going DOWN or STAYING AT THRESHOLD, FREEZING;
2339 {
2341 }
2342 else //going UP, still FREEZING
2343 {
2344 SetTemperatureDirect(target);
2345 }
2346 HandleFreezingProgression(delta,data);
2347 }
2348 else
2349 {
2350 SetTemperatureDirect(target);
2351 if (target > GetTemperatureFreezeThreshold())
2352 HandleFreezingProgression(delta,data);
2353 }
2354 }
2355 else
2356 {
2357 delta = target - GetTemperatureThawThreshold();
2358 if (target > GetTemperatureThawThreshold())
2359 {
2360 //first crossing the threshold
2361 if (m_VarTemperature <= GetTemperatureThawThreshold()) //going UP, THAWING
2362 {
2364 }
2365 else //going DOWN, still THAWING
2366 {
2367 SetTemperatureDirect(target);
2368 }
2369 HandleFreezingProgression(delta,data);
2370 }
2371 else
2372 {
2373 SetTemperatureDirect(target);
2374 if (target < GetTemperatureThawThreshold())
2375 HandleFreezingProgression(delta,data);
2376 }
2377 }
2378 }
2379 else
2380 {
2381 SetTemperatureDirect(target);
2382 }
2383 }
2384
2387 {
2388 if (!CanHaveTemperature())
2389 {
2390 Debug.Log("RefreshTemperatureAccess | entity " + this + " does not have temperature range defined!");
2391 return;
2392 }
2393
2394 m_TAC.TryAccessSource(data);
2395 }
2396
2397 void InterpolateTempData(TemperatureDataInterpolated data)
2398 {
2399 if (data)
2400 data.InterpolateTemperatureDelta(GetTemperature());
2401 }
2402
2403
2410
2412 {
2413 return m_VarTemperature;
2414 }
2415
2417 {
2418 return m_VarTemperatureInit;
2419 }
2420
2422 {
2423 return m_VarTemperatureMin;
2424 }
2425
2427 {
2428 return m_VarTemperatureMax;
2429 }
2430
2432 bool GetCookingTargetTemperature(out float temperature)
2433 {
2434 return false;
2435 }
2436
2442 {
2444 }
2445
2450
2455
2457 {
2459 }
2460
2462 {
2464 }
2465
2468 {
2469 return m_FreezeThawProgress;
2470 }
2471
2474 {
2475 return m_FreezeThawProgress <= 0.0 || m_FreezeThawProgress >= 1.0;
2476 }
2477
2479 protected void SetFreezeThawProgress(float val)
2480 {
2482 }
2483
2488
2490 {
2491 return m_IsFrozen;
2492 }
2493
2494 void SetFrozen(bool frozen)
2495 {
2496 if (!CanFreeze() && frozen)
2497 return;
2498
2499 bool previous = m_IsFrozen;
2500 m_IsFrozen = frozen;
2501 SetFreezeThawProgress(frozen);
2502
2503 if (previous != frozen)
2504 {
2505 SetSynchDirty();
2507 }
2508 }
2509
2510 protected void HandleFreezingProgression(float deltaHeat, TemperatureData data)
2511 {
2512 float progressVal = m_FreezeThawProgress;
2513 float progressDelta = 1;
2514
2515 if (deltaHeat > 0)
2516 progressDelta = -1;
2517
2518 if (data.m_UpdateTimeInfo == -1)
2519 progressDelta = (-deltaHeat / GameConstants.TEMPERATURE_RATE_AVERAGE_ABS) * GameConstants.TEMPERATURE_FREEZETHAW_LEGACY_COEF; //reverse-calculate the progress if actual time is not available
2520 else
2521 progressDelta *= data.m_UpdateTimeInfo;
2522
2523 if (progressDelta == 0)
2524 return;
2525
2526 float changeTimeDefault;
2527 float changeTimeMin;
2528 float changeTime;
2529
2530 if (!m_IsFrozen)
2531 {
2532 changeTimeDefault = GetTemperatureFreezeTime();
2534 }
2535 else
2536 {
2537 changeTimeDefault = GetTemperatureThawTime();
2539 }
2540
2541 float coef = data.m_UpdateTimeCoef;
2542 if (deltaHeat < 0) //use cooling coef when freezing (mostly just to make sure)
2544
2545 if (coef != 0)
2546 changeTimeDefault *= 1/coef;
2547
2548 changeTime = Math.Lerp(Math.Max(changeTimeDefault,changeTimeMin),changeTimeMin,data.m_InterpolatedFraction);
2549 progressVal = progressVal + progressDelta / changeTime;
2550
2551 float remnantTemp = 0;
2552 if (!m_IsFrozen && progressVal >= 1)
2553 {
2554 SetFrozen(true);
2555 if (progressVal > 1.0)
2556 {
2557 if (data.m_UpdateTimeInfo == -1)
2558 remnantTemp = (progressVal - 1) * changeTime * GameConstants.TEMPERATURE_RATE_AVERAGE_ABS * -1;
2559 else
2560 remnantTemp = (((progressVal - 1) * changeTime) / progressDelta) * deltaHeat;
2561 }
2562 }
2563 else if (m_IsFrozen && progressVal <= 0)
2564 {
2565 SetFrozen(false);
2566 if (progressVal < 0.0)
2567 {
2568 if (data.m_UpdateTimeInfo == -1)
2569 remnantTemp = -progressVal * changeTime * GameConstants.TEMPERATURE_RATE_AVERAGE_ABS;
2570 else
2571 remnantTemp = ((-progressVal * changeTime) / progressDelta) * deltaHeat;
2572 }
2573 }
2574 else
2575 {
2576 if ((progressDelta < 0 && !m_IsFrozen) || (progressDelta > 0 && m_IsFrozen))
2577 progressVal = (progressDelta * GameConstants.TEMPERATURE_FREEZETHAW_ACCELERATION_COEF) / changeTime + m_FreezeThawProgress;
2578
2579 SetFreezeThawProgress(Math.Clamp(progressVal,0,1));
2580 }
2581
2582 if (remnantTemp >= GameConstants.TEMPERATURE_SENSITIVITY_THRESHOLD)//discards tiny values
2583 SetTemperatureDirect(GetTemperature() + remnantTemp);
2584
2585 #ifdef DEVELOPER
2586 if (progressVal > 0 && progressVal < 1)
2587 {
2588 m_LastFTChangeTime = changeTime;
2589 if (!m_IsFrozen)
2590 m_PresumedTimeRemaining = (1 - progressVal) * changeTime;
2591 else
2592 m_PresumedTimeRemaining = progressVal * changeTime;
2593 }
2594 #endif
2595 }
2596
2599
2600 //----------------------------------------------------------------
2603 {
2604 return GetItemOverheatTime() >= 0;
2605 }
2606
2609 {
2610 return GetTemperatureMax();
2611 }
2612
2615 {
2617 }
2618
2620 {
2621 return m_OverheatProgress >= 1;
2622 }
2623
2625 {
2626 return m_OverheatProgress;
2627 }
2628
2629 void SetItemOverheatProgress(float val, float deltaTime = 0)
2630 {
2631 float previous = m_OverheatProgress;
2632 m_OverheatProgress = Math.Clamp(val,0,1);
2633
2634 if (m_OverheatProgress >= 1)
2635 {
2636 if (previous < 1)
2638
2639 OnItemOverheat(deltaTime);
2640 }
2641 else if (previous >= 1)
2642 {
2644 }
2645 }
2646
2648 protected void OnItemOverheatStart();
2649 protected void OnItemOverheat(float deltaTime);
2650 protected void OnItemOverheatEnd();
2651
2652 protected void HandleItemOverheating(float deltaHeat, TemperatureData data)
2653 {
2654 float deltaTime = 1;
2655 float progressVal = m_OverheatProgress;
2656
2657 if (deltaHeat < 0)
2658 deltaTime = -1;
2659
2660 if (data.m_UpdateTimeInfo == -1)
2661 deltaTime = deltaHeat / GameConstants.TEMPERATURE_RATE_AVERAGE_ABS; //reverse-calculate the progress if actual time is not available
2662 else
2663 deltaTime *= data.m_UpdateTimeInfo;
2664
2665 if (GetItemOverheatTime() > 0)
2666 {
2668 progressVal += deltaTime / changeTime;
2669 }
2670 else
2671 {
2672 if (deltaHeat < 0)
2673 progressVal = 0;
2674 else if (deltaHeat > 0)
2675 progressVal = 1;
2676 }
2677
2678 SetItemOverheatProgress(Math.Clamp(progressVal,0,1),deltaTime);
2679 }
2680 //----------------------------------------------------------------
2681
2682 void SetLiquidType(int value, bool allow_client = false);
2684 {
2685 return 0;
2686 }
2687
2688 //----------------------------------------------------------------
2689 void SetColor(int r, int g, int b, int a);
2690 void GetColor(out int r,out int g,out int b,out int a)
2691 {
2692 r = -1;
2693 g = -1;
2694 b = -1;
2695 a = -1;
2696 }
2697
2698 //----------------------------------------------------------------
2699
2700 void SetStoreLoad(bool value);
2702 {
2703 return false;
2704 }
2705
2706 void SetStoreLoadedQuantity(float value);
2708 {
2709 return 0.0;
2710 }
2711
2712 //----------------------------------------------------------------
2713
2714 void SetCleanness(int value, bool allow_client = false);
2716 {
2717 return 0;
2718 }
2719
2720 //----------------------------------------------------------------
2721
2722 bool IsServerCheck(bool allow_client)
2723 {
2724 if (g_Game.IsServer())
2725 return true;
2726
2727 if (allow_client)
2728 return true;
2729
2730 if (GetGame().IsClient() && GetGame().IsMultiplayer())
2731 {
2732 Error("Attempting to change variable client side, variables are supposed to be changed on server only !!");
2733 return false;
2734 }
2735
2736 return true;
2737 }
2738
2739 //----------------------------------------------------------------
2740
2745
2747 int GetHiddenSelectionIndex( string selection )
2748 {
2750 return m_HiddenSelectionsData.GetHiddenSelectionIndex( selection );
2751
2752 return -1;
2753 }
2754
2757 {
2759 return m_HiddenSelectionsData.m_HiddenSelections;
2760 else
2761 return super.GetHiddenSelections();
2762 }
2763
2766 {
2768 return m_HiddenSelectionsData.m_HiddenSelectionsTextures;
2769 else
2770 return super.GetHiddenSelectionsTextures();
2771 }
2772
2775 {
2777 return m_HiddenSelectionsData.m_HiddenSelectionsMaterials;
2778 else
2779 return super.GetHiddenSelectionsMaterials();
2780 }
2781
2793 proto native void PlaceOnSurfaceRotated(out vector trans[4], vector pos, float dx = 0, float dz = 0, float fAngle = 0, bool align = false);
2794
2801 proto native void RegisterNetSyncVariableBool(string variableName);
2802
2809 proto native void RegisterNetSyncVariableBoolSignal(string variableName);
2810
2819 proto native void RegisterNetSyncVariableInt(string variableName, int minValue = 0, int maxValue = 0);
2820
2830 proto native void RegisterNetSyncVariableFloat(string variableName, float minValue = 0, float maxValue = 0, int precision = 1);
2831
2838 proto native void RegisterNetSyncVariableObject(string variableName);
2839
2840 proto native void UpdateNetSyncVariableInt(string variableName, float minValue = 0, float maxValue = 0);
2841 proto native void UpdateNetSyncVariableFloat(string variableName, float minValue = 0, float maxValue = 0, int precision = 1);
2842
2843 proto native void SwitchLight(bool isOn);
2844
2846 proto native void SetSimpleHiddenSelectionState(int index, bool state);
2847 proto native bool IsSimpleHiddenSelectionVisible(int index);
2848
2850 proto native void SetObjectTexture(int index, string texture_name);
2851 proto native owned string GetObjectTexture(int index);
2853 proto native void SetObjectMaterial(int index, string mat_name);
2854 proto native owned string GetObjectMaterial(int index);
2855
2856 proto native bool IsPilotLight();
2857 proto native void SetPilotLight(bool isOn);
2858
2877 {
2878 // Saving of energy related states
2879 if ( m_EM )
2880 {
2881 // Save energy amount
2882 ctx.Write( m_EM.GetEnergy() );
2883
2884 // Save passive/active state
2885 ctx.Write( m_EM.IsPassive() );
2886
2887 // Save ON/OFF state
2888 ctx.Write( m_EM.IsSwitchedOn() );
2889
2890 // Save plugged/unplugged state
2891 ctx.Write( m_EM.IsPlugged() );
2892
2893 // ENERGY SOURCE
2894 // Save energy source IDs
2895 EntityAI energy_source = m_EM.GetEnergySource();
2896 int b1 = 0;
2897 int b2 = 0;
2898 int b3 = 0;
2899 int b4 = 0;
2900
2901 if (energy_source)
2902 {
2903 energy_source.GetPersistentID(b1, b2, b3, b4);
2904 }
2905
2906 ctx.Write( b1 ); // Save energy source block 1
2907 ctx.Write( b2 ); // Save energy source block 2
2908 ctx.Write( b3 ); // Save energy source block 3
2909 ctx.Write( b4 ); // Save energy source block 4
2910 }
2911
2912 // variable management system
2913 SaveVariables(ctx);
2914 }
2915
2939
2940 bool OnStoreLoad (ParamsReadContext ctx, int version)
2941 {
2942 // Restoring of energy related states
2943 if ( m_EM )
2944 {
2945 // Load energy amount
2946 float f_energy = 0;
2947 if ( !ctx.Read( f_energy ) )
2948 f_energy = 0;
2949 m_EM.SetEnergy(f_energy);
2950
2951 // Load passive/active state
2952 bool b_is_passive = false;
2953 if ( !ctx.Read( b_is_passive ) )
2954 return false;
2955 m_EM.SetPassiveState(b_is_passive);
2956
2957 // Load ON/OFF state
2958 bool b_is_on = false;
2959 if ( !ctx.Read( b_is_on ) )
2960 {
2961 m_EM.SwitchOn();
2962 return false;
2963 }
2964
2965 // Load plugged/unplugged state
2966 bool b_is_plugged = false;
2967 if ( !ctx.Read( b_is_plugged ) )
2968 return false;
2969
2970 // ENERGY SOURCE
2971 if ( version <= 103 )
2972 {
2973 // Load energy source ID low
2974 int i_energy_source_ID_low = 0; // Even 0 can be valid ID!
2975 if ( !ctx.Read( i_energy_source_ID_low ) )
2976 return false;
2977
2978 // Load energy source ID high
2979 int i_energy_source_ID_high = 0; // Even 0 can be valid ID!
2980 if ( !ctx.Read( i_energy_source_ID_high ) )
2981 return false;
2982 }
2983 else
2984 {
2985 int b1 = 0;
2986 int b2 = 0;
2987 int b3 = 0;
2988 int b4 = 0;
2989
2990 if ( !ctx.Read(b1) ) return false;
2991 if ( !ctx.Read(b2) ) return false;
2992 if ( !ctx.Read(b3) ) return false;
2993 if ( !ctx.Read(b4) ) return false;
2994
2995 if ( b_is_plugged )
2996 {
2997 // Because function GetEntityByPersitentID() cannot be called here, ID values must be stored and used later.
2998 m_EM.StoreEnergySourceIDs( b1, b2, b3, b4 );
2999 m_EM.RestorePlugState(true);
3000 }
3001 }
3002
3003 if (b_is_on)
3004 {
3005 m_EM.SwitchOn();
3006 }
3007 }
3008
3009 if (version >= 140)
3010 {
3011 // variable management system
3012 if (!LoadVariables(ctx, version))
3013 return false;
3014 }
3015
3016 return true;
3017 }
3018
3020 proto native void SetSynchDirty();
3021
3026 {
3027 if ( m_EM )
3028 {
3029 if ( GetGame().IsMultiplayer() )
3030 {
3031 bool is_on = m_EM.IsSwitchedOn();
3032
3033 if (is_on != m_EM.GetPreviousSwitchState())
3034 {
3035 if (is_on)
3036 m_EM.SwitchOn();
3037 else
3038 m_EM.SwitchOff();
3039 }
3040
3041 int id_low = m_EM.GetEnergySourceNetworkIDLow();
3042 int id_High = m_EM.GetEnergySourceNetworkIDHigh();
3043
3044 EntityAI energy_source = EntityAI.Cast( GetGame().GetObjectByNetworkId(id_low, id_High) );
3045
3046 if (energy_source)
3047 {
3048 ComponentEnergyManager esem = energy_source.GetCompEM();
3049
3050 if ( !esem )
3051 {
3052 string object = energy_source.GetType();
3053 Error("Synchronization error! Object " + object + " has no instance of the Energy Manager component!");
3054 }
3055
3056 m_EM.PlugThisInto(energy_source);
3057
3058 }
3059 else
3060 {
3061 m_EM.UnplugThis();
3062 }
3063
3064 m_EM.DeviceUpdate();
3065 m_EM.StartUpdates();
3066 }
3067 }
3068
3069 if (m_IsFrozen != m_IsFrozenLocal && !GetGame().IsDedicatedServer())
3070 {
3073 }
3074 }
3075
3076 //-----------------------------
3077 // VARIABLE MANIPULATION SYSTEM
3078 //-----------------------------
3080 bool IsVariableSet(int variable)
3081 {
3082 return (variable & m_VariablesMask);
3083 }
3084
3085 void SetVariableMask(int variable)
3086 {
3087 m_VariablesMask = variable | m_VariablesMask;
3088 if (GetGame().IsServer())
3089 {
3090 SetSynchDirty();
3091 }
3092 }
3093
3095 void RemoveItemVariable(int variable)
3096 {
3097 m_VariablesMask = ~variable & m_VariablesMask;
3098 }
3099
3101 {
3102 DeSerializeNumericalVars(float_vars);
3103 }
3104
3111
3113 {
3114 //first set the flags
3115 int varFlags = 0;
3116
3117 if (m_VariablesMask)
3118 varFlags = ItemVariableFlags.FLOAT;
3119
3120 ctx.Write(varFlags);
3121 //-------------------
3122 //now serialize the variables
3123
3124 //floats
3125 if (m_VariablesMask)
3126 WriteVarsToCTX(ctx);
3127 }
3128
3129 //----------------------------------------------------------------
3130 bool LoadVariables(ParamsReadContext ctx, int version = -1)
3131 {
3132 int varFlags;
3133
3134 //read the flags
3135 if (!ctx.Read(varFlags))
3136 {
3137 return false;
3138 }
3139
3140 //--------------
3141 if (varFlags & ItemVariableFlags.FLOAT)
3142 {
3143 if (!ReadVarsFromCTX(ctx, version))
3144 return false;
3145 }
3146 return true;
3147 }
3148
3151 {
3153
3154 //--------------------------------------------
3156 {
3157 ctx.Write(GetTemperature());
3158 ctx.Write((int)GetIsFrozen());
3159 }
3160 }
3161
3163 bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
3164 {
3165 if (version < 140)
3166 return true;
3167
3168 int intValue;
3169 float value;
3170
3171 if (!ctx.Read(intValue))
3172 return false;
3173
3174 m_VariablesMask = intValue; //necessary for higher implement overrides. Hope it does not bork some init somewhere.
3175
3176 //--------------------------------------------
3178 {
3179 if (!ctx.Read(value))
3180 return false;
3181 SetTemperatureDirect(value);
3182
3183 if (!ctx.Read(intValue))
3184 return false;
3185 SetFrozen(intValue);
3186 }
3187
3188 return true;
3189 }
3190
3192 {
3193 // the order of serialization must be the same as the order of de-serialization
3194 floats_out.Insert(m_VariablesMask);
3195
3196 //--------------------------------------------
3198 {
3199 floats_out.Insert(m_VarTemperature);
3200 floats_out.Insert((float)GetIsFrozen());
3201 floats_out.Insert((float)GetFreezeThawProgress());
3202 }
3203 }
3204
3206 {
3207 // the order of serialization must be the same as the order of de-serialization
3208 int index = 0;
3209 int mask = Math.Round(floats.Get(index));
3210
3211 index++;
3212 //--------------------------------------------
3213 if (mask & VARIABLE_TEMPERATURE)
3214 {
3215 float temperature = floats.Get(index);
3216 SetTemperatureDirect(temperature);
3217 floats.RemoveOrdered(index);
3218
3219 bool frozen = Math.Round(floats.Get(index));
3220 SetFrozen(frozen);
3221 floats.RemoveOrdered(index);
3222
3223 float FTProgress = floats.Get(index);
3224 SetFreezeThawProgress(FTProgress);
3225 floats.RemoveOrdered(index);
3226 }
3227 }
3228
3229 //----------------------------------------------------------------
3230
3232
3233 override void EOnFrame(IEntity other, float timeSlice)
3234 {
3235 if ( m_ComponentsBank != NULL )
3236 {
3237 for ( int comp_key = 0; comp_key < COMP_TYPE_COUNT; ++comp_key )
3238 {
3239 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
3240 {
3241 m_ComponentsBank.GetComponent(comp_key).Event_OnFrame(other, timeSlice);
3242 }
3243 }
3244 }
3245 }
3246
3248 {
3249 string text = string.Empty;
3250
3251 text += "Weight: " + GetWeightEx() + "\n";
3252 text += "Disabled: " + GetIsSimulationDisabled() + "\n";
3253 #ifdef SERVER
3254 if (GetEconomyProfile())
3255 text += "CE Lifetime default: " + (int)GetEconomyProfile().GetLifetime() + "\n";
3256 text += "CE Lifetime remaining: " + (int)GetLifetime() + "\n";
3257 #endif
3258
3260 if (compEM)
3261 {
3262 text += "Energy Source: " + Object.GetDebugName(compEM.GetEnergySource()) + "\n";
3263 text += "Switched On: " + compEM.IsSwitchedOn() + "\n";
3264 text += "Is Working: " + compEM.IsWorking() + "\n";
3265 }
3266
3267 return text;
3268 }
3269
3270
3271 void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4){}//DEPRICATED, USE GetDebugActions / OnAction
3272 void OnDebugButtonPressClient(int button_index){}//DEPRICATED, USE GetDebugActions / OnAction
3273 void OnDebugButtonPressServer(int button_index){}//DEPRICATED, USE GetDebugActions / OnAction
3274
3275
3277 {
3278 return GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxDraw();
3279 }
3280
3281 void DebugBBoxSetColor(int color)
3282 {
3283 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxSetColor(color);
3284 }
3285
3287 {
3288 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugBBoxDelete();
3289 }
3290
3291 Shape DebugDirectionDraw(float distance = 1)
3292 {
3293 return GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionDraw(distance);
3294 }
3295
3297 {
3298 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionSetColor(color);
3299 }
3300
3302 {
3303 GetComponent(COMP_TYPE_ETITY_DEBUG).DebugDirectionDelete();
3304 }
3305
3307 void HideSelection( string selection_name )
3308 {
3309 if ( !ToDelete() )
3310 {
3311 SetAnimationPhase ( selection_name, 1 ); // 1 = hide, 0 = unhide!
3312 }
3313 }
3314
3316 void ShowSelection( string selection_name )
3317 {
3318 if ( !ToDelete() )
3319 {
3320 SetAnimationPhase ( selection_name, 0 ); // 1 = hide, 0 = unhide!
3321 }
3322 }
3323
3326 proto void GetPersistentID( out int b1, out int b2, out int b3, out int b4 );
3327
3329 proto native void SetLifetime( float fLifeTime );
3331 proto native float GetLifetime();
3333 proto native void IncreaseLifetime();
3334
3336 proto native void SetLifetimeMax( float fLifeTime );
3338 proto native float GetLifetimeMax();
3339
3342 {
3344 if (GetHierarchyParent())
3345 GetHierarchyParent().IncreaseLifetimeUp();
3346 }
3347
3348
3349 // BODY STAGING
3357
3362 {
3363 if (m_EM)
3364 return m_EM;
3365
3368 return NULL;
3369 }
3370
3373 {
3375 }
3376
3377 // ------ Public Events for Energy manager component. Overwrite these and put your own functionality into them. ------
3378
3380 void OnWorkStart() {}
3381
3383 void OnWork( float consumed_energy ) {}
3384
3386 void OnWorkStop() {}
3387
3389 void OnSwitchOn() {}
3390
3392 void OnSwitchOff() {}
3393
3395 void OnIsPlugged(EntityAI source_device) {}
3396
3398 void OnIsUnplugged( EntityAI last_energy_source ) {}
3399
3401 void OnOwnSocketTaken( EntityAI device ) {}
3402
3405
3408
3411
3415
3416 override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
3417 {
3418 super.OnRPC(sender, rpc_type, ctx);
3419
3420 if ( GetGame().IsClient() )
3421 {
3422 switch (rpc_type)
3423 {
3424 // BODY STAGING - server => client synchronization of skinned state.
3425 case ERPCs.RPC_BS_SKINNED_STATE:
3426 {
3427 Param1<bool> p_skinned_state= new Param1<bool>(false);
3428 if (ctx.Read(p_skinned_state))
3429 {
3430 float state = p_skinned_state.param1;
3431 if (state && GetCompBS())
3432 GetCompBS().SetAsSkinnedClient();
3433 }
3434 break;
3435 }
3436
3437 case ERPCs.RPC_EXPLODE_EVENT:
3438 {
3439 OnExplodeClient();
3440 break;
3441 }
3442 }
3443 }
3444 }
3445
3446 #ifdef DIAG_DEVELOPER
3447 void FixEntity()
3448 {
3449 if (!(GetGame().IsServer()))
3450 return;
3451 SetFullHealth();
3452
3453 if (GetInventory())
3454 {
3455 int i = 0;
3456 int AttachmentsCount = GetInventory().AttachmentCount();
3457 if (AttachmentsCount > 0)
3458 {
3459 for (i = 0; i < AttachmentsCount; i++)
3460 {
3461 GetInventory().GetAttachmentFromIndex(i).FixEntity();
3462 }
3463 }
3464
3465 CargoBase cargo = GetInventory().GetCargo();
3466 if (cargo)
3467 {
3468 int cargoCount = cargo.GetItemCount();
3469 for (i = 0; i < cargoCount; i++)
3470 {
3471 cargo.GetItem(i).FixEntity();
3472 }
3473 }
3474 }
3475 }
3476 #endif
3477
3482
3484 {
3486 }
3487
3488 #ifdef DEVELOPER
3489 string GetConfigWeightModifiedDebugText()
3490 {
3491 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3492 {
3493 return "(" + m_ConfigWeight + "(config weight) * " + GetWetWeightModifier() + "(Wetness Modifier))";
3494 }
3495 return string.Empty;
3496 }
3497 #endif
3498
3499
3500 //Obsolete, use GetWeightEx()
3502 {
3503 return GetWeightEx();
3504 }
3505
3507 {
3508 //Print("ent:" + this + " - ClearWeightDirty");
3509 m_WeightDirty = 0;
3510 }
3511
3513 {
3514 #ifdef DEVELOPER
3515 if (WeightDebug.m_VerbosityFlags & WeightDebugType.SET_DIRTY_FLAG)
3516 {
3517 Print("---------------------------------------");
3518 Print("ent:" + this + " - SetWeightDirty");
3519 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
3520 {
3521 DumpStack();
3522 }
3523 Print("---------------------------------------");
3524 }
3525 #endif
3526 m_WeightDirty = 1;
3527 if (GetHierarchyParent())
3528 {
3529 GetHierarchyParent().SetWeightDirty();
3530 }
3531 }
3532 // returns weight of all cargo and attachments
3533 float GetInventoryAndCargoWeight(bool forceRecalc = false)
3534 {
3535 float totalWeight;
3536 if (GetInventory())
3537 {
3538 int i = 0;
3539 int AttachmentsCount = GetInventory().AttachmentCount();
3540 if (AttachmentsCount > 0)
3541 {
3542 for (i = 0; i < AttachmentsCount; i++)
3543 {
3544 totalWeight += GetInventory().GetAttachmentFromIndex(i).GetWeightEx(forceRecalc);
3545 }
3546 }
3547
3548 CargoBase cargo = GetInventory().GetCargo();
3549 if (cargo)
3550 {
3551 int cargoCount = cargo.GetItemCount();
3552 for (i = 0; i < cargoCount; i++)
3553 {
3554 totalWeight += cargo.GetItem(i).GetWeightEx(forceRecalc);
3555 }
3556 }
3557 }
3558 return totalWeight;
3559 }
3560
3561 protected float GetWeightSpecialized(bool forceRecalc = false)
3562 {
3563 return GetInventoryAndCargoWeight(forceRecalc);
3564 }
3565
3567 //this method is not meant to be overriden, to adjust weight calculation for specific item type, override 'GetWeightSpecialized(bool forceRecalc = false)' instead
3568 float GetWeightEx(bool forceRecalc = false)
3569 {
3570 if (m_WeightDirty || forceRecalc)//recalculate
3571 {
3572 m_WeightEx = GetWeightSpecialized(forceRecalc);
3574
3575 #ifdef DEVELOPER
3576 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3577 {
3578 WeightDebug.GetWeightDebug(this).SetWeight(m_WeightEx);
3579 }
3580 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_DIRTY)
3581 {
3582 Print("ent:" + this + " - Dirty Recalc");
3583 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
3584 {
3585 DumpStack();
3586 }
3587 }
3588 #endif
3589 }
3590
3591 return m_WeightEx;
3592 }
3593
3594 void UpdateWeight(WeightUpdateType updateType = WeightUpdateType.FULL, float weightAdjustment = 0);
3595
3597
3598 void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3599 {
3600 //fix entity
3601 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FIX_ENTITY, "Fix Entity", FadeColors.LIGHT_GREY));
3602
3603 //weight
3604 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_TOTAL_WEIGHT, "Print Weight", FadeColors.LIGHT_GREY));
3605 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_TOTAL_WEIGHT_RECALC, "Print Weight Verbose", FadeColors.LIGHT_GREY));
3606 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_PLAYER_WEIGHT, "Print Player Weight", FadeColors.LIGHT_GREY));
3607 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GET_PLAYER_WEIGHT_RECALC, "Print Player Weight Verbose", FadeColors.LIGHT_GREY));
3608 }
3609 bool OnAction(int action_id, Man player, ParamsReadContext ctx)
3610 {
3611 if (action_id == EActions.FIX_ENTITY)
3612 {
3613 #ifdef DIAG_DEVELOPER
3614 FixEntity();
3615 #endif
3616 }
3617 else if (action_id == EActions.GET_TOTAL_WEIGHT) //Prints total weight of item + its contents
3618 {
3619 WeightDebug.ClearWeightDebug();
3620 #ifndef SERVER
3621 Debug.Log("======================== "+ GetType() +" =================================");
3622 #endif
3623 Debug.Log("Weight:" + GetWeightEx().ToString());
3624 Debug.Log("Weight excluding cargo and attachments:" + GetSingleInventoryItemWeightEx());
3625 Debug.Log("----------------------------------------------------------------------------------------------");
3626 }
3627 else if (action_id == EActions.GET_TOTAL_WEIGHT_RECALC) //Prints total weight of item + its contents
3628 {
3629 WeightDebug.ClearWeightDebug();
3630 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
3631 #ifndef SERVER
3632 Debug.Log("======================== "+ GetType() +" RECALC ===========================");
3633 #endif
3634 Debug.Log("Weight:" + GetWeightEx(true).ToString());
3635 Debug.Log("Weight excluding cargo and attachments:" + GetSingleInventoryItemWeightEx());
3636 WeightDebug.PrintAll(this);
3637 Debug.Log("----------------------------------------------------------------------------------------------");
3638 WeightDebug.SetVerbosityFlags(0);
3639 }
3640 else if (action_id == EActions.GET_PLAYER_WEIGHT) //Prints total weight of item + its contents
3641 {
3642 WeightDebug.ClearWeightDebug();
3643 #ifndef SERVER
3644 Debug.Log("======================== PLAYER: "+player+" ===========================");
3645 #endif
3646 Debug.Log("New overall weight Player:"+player.GetWeightEx().ToString());
3647
3648 Debug.Log("----------------------------------------------------------------------------------------------");
3649 }
3650 else if (action_id == EActions.GET_PLAYER_WEIGHT_RECALC) //Prints total weight of item + its contents
3651 {
3652 WeightDebug.ClearWeightDebug();
3653 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
3654 #ifndef SERVER
3655 Debug.Log("======================== PLAYER RECALC: "+player+" ===========================");
3656 #endif
3657 Debug.Log("New overall weight Player:"+player.GetWeightEx(true).ToString());
3658 WeightDebug.PrintAll(player);
3659 Debug.Log("----------------------------------------------------------------------------------------------");
3660 WeightDebug.SetVerbosityFlags(0);
3661 }
3662 return false;
3663 }
3664
3669
3671 void SetViewIndex( int index )
3672 {
3673 m_ViewIndex = index;
3674
3675 if( GetGame().IsServer() )
3676 {
3677 SetSynchDirty();
3678 }
3679 }
3680
3683 {
3684 if ( MemoryPointExists( "invView2" ) )
3685 {
3686 #ifdef PLATFORM_WINDOWS
3688 GetInventory().GetCurrentInventoryLocation( il );
3689 InventoryLocationType type = il.GetType();
3690 switch ( type )
3691 {
3692 case InventoryLocationType.CARGO:
3693 {
3694 return 0;
3695 }
3696 case InventoryLocationType.ATTACHMENT:
3697 {
3698 return 1;
3699 }
3700 case InventoryLocationType.HANDS:
3701 {
3702 return 0;
3703 }
3704 case InventoryLocationType.GROUND:
3705 {
3706 return 1;
3707 }
3708 case InventoryLocationType.PROXYCARGO:
3709 {
3710 return 0;
3711 }
3712 default:
3713 {
3714 return 0;
3715 }
3716 }
3717 #endif
3718
3719 #ifdef PLATFORM_CONSOLE
3720 return 1;
3721 #endif
3722 }
3723 return 0;
3724 }
3725
3726
3729 {
3730 Debug.LogError("EntityAI: HitComponentForAI not set properly for that entity (" + GetType() + ")");
3732 return "";
3733 }
3734
3737 {
3738 Debug.LogError("EntityAI: DefaultHitComponent not set properly for that entity (" + GetType() + ")");
3740 return "";
3741 }
3742
3745 {
3746 Debug.LogError("EntityAI: DefaultHitPositionComponent not set for that entity (" + GetType() + ")");
3747 return "";
3748 }
3749
3751 {
3752 Debug.LogError("EntityAI: SuitableFinisherHitComponents not set for that entity (" + GetType() + ")");
3753 return null;
3754 }
3755
3757 {
3758 Debug.LogError("EntityAI: DefaultHitPosition not set for that entity (" + GetType() + ")");
3759 return vector.Zero;
3760 }
3761
3764 {
3765 return EMeleeTargetType.ALIGNABLE;
3766 }
3767
3770 {
3771 return "None";
3772 }
3773
3776 {
3777 return false;
3778 }
3779
3782 {
3783 return false;
3784 }
3785
3788 {
3789 return false;
3790 }
3791
3792 string ChangeIntoOnAttach(string slot) {}
3794
3797 {
3799 }
3800
3802 {
3803 return false;
3804 }
3805
3819 {
3820 float currentTime = GetGame().GetTickTime();
3821 if (m_LastUpdatedTime == 0)
3822 m_LastUpdatedTime = currentTime;
3823
3825 m_LastUpdatedTime = currentTime;
3826
3828 }
3829
3831 {
3832 //currently only temperature on EntityAI
3833 if (g_Game.IsWorldWetTempUpdateEnabled())
3834 {
3836 {
3837 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
3838 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
3839 {
3840 float heatPermCoef = 1.0;
3841 EntityAI ent = this;
3842 while (ent)
3843 {
3844 heatPermCoef *= ent.GetHeatPermeabilityCoef();
3845 ent = ent.GetHierarchyParent();
3846 }
3847
3848 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,m_ElapsedSinceLastUpdate,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
3849 }
3850 }
3851 }
3852 }
3853
3854 void OnDebugSpawnEx(DebugSpawnParams params)
3855 {
3856 OnDebugSpawn();
3857 }
3858
3860 {
3861 array<string> slots = new array<string>;
3862 ConfigGetTextArray("Attachments", slots);
3863
3864 array<string> mags = new array<string>;
3865 ConfigGetTextArray("magazines", mags);
3866
3867 //-------
3868
3869 TStringArray all_paths = new TStringArray;
3870
3871 all_paths.Insert(CFG_VEHICLESPATH);
3872 all_paths.Insert(CFG_MAGAZINESPATH);
3873 all_paths.Insert(CFG_WEAPONSPATH);
3874
3875 string config_path;
3876 string child_name;
3877 int scope;
3878 string path;
3879 int consumable_count;
3880
3881 for (int i = 0; i < all_paths.Count(); i++)
3882 {
3883 config_path = all_paths.Get(i);
3884 int children_count = GetGame().ConfigGetChildrenCount(config_path);
3885
3886 for (int x = 0; x < children_count; x++)
3887 {
3888 GetGame().ConfigGetChildName(config_path, x, child_name);
3889 path = config_path + " " + child_name;
3890 scope = GetGame().ConfigGetInt( config_path + " " + child_name + " scope" );
3891 bool should_check = 1;
3892 if ( config_path == "CfgVehicles" && scope == 0)
3893 {
3894 should_check = 0;
3895 }
3896
3897 if ( should_check )
3898 {
3899 string inv_slot;
3900 GetGame().ConfigGetText( config_path + " " + child_name + " inventorySlot",inv_slot );
3901 for (int z = 0; z < slots.Count(); z++)
3902 {
3903 if (slots.Get(z) == inv_slot)
3904 {
3905 this.GetInventory().CreateInInventory( child_name );
3906 continue;
3907 //Print("matching attachment: " + child_name + " for inv. slot name:" +inv_slot);
3908 }
3909 }
3910 }
3911 }
3912 }
3913 };
3914
3915 override EntityAI ProcessMeleeItemDamage(int mode = 0)
3916 {
3917 if (GetGame().IsServer())
3918 AddHealth("","Health",-MELEE_ITEM_DAMAGE);
3919 return this;
3920 }
3921
3924 {
3926 }
3927
3929 {
3930 return "";
3931 }
3932
3933 void ProcessInvulnerabilityCheck(string servercfg_param)
3934 {
3935 if ( GetGame() && GetGame().IsMultiplayer() && GetGame().IsServer() )
3936 {
3937 int invulnerability;
3938 switch (servercfg_param)
3939 {
3940 case "disableContainerDamage":
3942 break;
3943
3944 case "disableBaseDamage":
3945 invulnerability = CfgGameplayHandler.GetDisableBaseDamage();
3946 break;
3947 }
3948
3949 if (invulnerability > 0)
3950 {
3951 SetAllowDamage(false);
3952 }
3953 }
3954 }
3955
3956 void SetBayonetAttached(bool pState, int slot_idx = -1) {};
3959
3960 void SetButtstockAttached(bool pState, int slot_idx = -1) {};
3963
3964 void SetInvisibleRecursive(bool invisible, EntityAI parent = null, array<int> attachments = null)
3965 {
3966 array<int> childrenAtt = new array<int>;
3967 array<int> attachmentsArray = new array<int>;
3968 if (attachments)
3969 attachmentsArray.Copy(attachments);
3970 else
3971 {
3972 for (int i = 0; i < GetInventory().GetAttachmentSlotsCount(); i++)
3973 {
3974 attachmentsArray.Insert(GetInventory().GetAttachmentSlotId(i));
3975 }
3976 }
3977
3978 EntityAI item;
3979
3980 foreach( int slot : attachmentsArray )
3981 {
3982 if( parent )
3983 item = parent.GetInventory().FindAttachment(slot);
3984 else
3985 item = this;//GetInventory().FindAttachment(slot);
3986
3987 if( item )
3988 {
3989 if( item.GetInventory().AttachmentCount() > 0 )
3990 {
3991 for(i = 0; i < item.GetInventory().GetAttachmentSlotsCount(); i++)
3992 {
3993 childrenAtt.Insert(item.GetInventory().GetAttachmentSlotId(i));
3994 }
3995
3996 SetInvisibleRecursive(invisible,item,childrenAtt);
3997 }
3998
3999 item.SetInvisible(invisible);
4000 item.OnInvisibleSet(invisible);
4001 }
4002 }
4003 }
4004
4006 {
4007 EffectSound sound = SEffectManager.PlaySound( "hardTreeFall_SoundSet", GetPosition() );
4008 sound.SetAutodestroy( true );
4009 }
4010
4012 {
4013 EffectSound sound = SEffectManager.PlaySound( "softTreeFall_SoundSet", GetPosition() );
4014 sound.SetAutodestroy( true );
4015 }
4016
4018 {
4019 EffectSound sound = SEffectManager.PlaySound( "hardBushFall_SoundSet", GetPosition() );
4020 sound.SetAutodestroy( true );
4021 }
4022
4024 {
4025 EffectSound sound = SEffectManager.PlaySound( "softBushFall_SoundSet", GetPosition() );
4026 sound.SetAutodestroy( true );
4027 }
4028
4030 {
4032 {
4035 Car car;
4036 Boat boat;
4037 float damage;
4038 vector impulse;
4039
4040 // a different attempt to solve hits from "standing" car to the players
4041 if (Car.CastTo(car, transport))
4042 {
4043 if (car.GetSpeedometerAbsolute() > 2 )
4044 {
4045 damage = m_TransportHitVelocity.Length();
4046 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4047 }
4048 else
4049 {
4051 }
4052
4053 // compute impulse and apply only if the body dies
4054 if (IsDamageDestroyed() && car.GetSpeedometerAbsolute() > 3)
4055 {
4056 impulse = 40 * m_TransportHitVelocity;
4057 impulse[1] = 40 * 1.5;
4058 dBodyApplyImpulse(this, impulse);
4059 }
4060 }
4061 else if (Boat.CastTo(boat, transport))
4062 {
4063 Human player = Human.Cast(this);
4064 if (player && player.PhysicsGetLinkedEntity() == boat) // standing on boat
4065 {
4067 return;
4068 }
4069
4070 if (m_TransportHitVelocity.Normalize() > 5) // 5 m/s
4071 {
4072 damage = m_TransportHitVelocity.Length() * 0.5;
4073 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4074 }
4075 else
4077 }
4078 else //old solution just in case if somebody use it
4079 {
4080 // avoid damage because of small movements
4081 if (m_TransportHitVelocity.Length() > 0.1)
4082 {
4083 damage = m_TransportHitVelocity.Length();
4084 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4085 }
4086 else
4087 {
4089 }
4090
4091 // compute impulse and apply only if the body dies
4092 if (IsDamageDestroyed() && m_TransportHitVelocity.Length() > 0.3)
4093 {
4094 impulse = 40 * m_TransportHitVelocity;
4095 impulse[1] = 40 * 1.5;
4096 dBodyApplyImpulse(this, impulse);
4097 }
4098 }
4099 }
4100 }
4101
4102 bool GetInventoryHandAnimation(notnull InventoryLocation loc, out int value)
4103 {
4104 value = -1;
4105 return false;
4106 }
4107
4108 bool TranslateSlotFromSelection(string selection_name, out int slot_id)
4109 {
4110 return false;
4111 }
4112
4115 {
4116 return GetUniversalTemperatureSource() != null && GetUniversalTemperatureSource().IsActive();
4117 }
4118
4120 {
4122 }
4123
4124 void SetUniversalTemperatureSource(UTemperatureSource uts)
4125 {
4127 }
4128
4133
4136
4137 void PairRemote(notnull EntityAI trigger);
4138
4140
4142
4144 {
4146 if (raib)
4147 {
4148 raib.SetPersistentPairID(id);
4149 }
4150 }
4151
4154 bool IsValveTurnable(int pValveIndex);
4155 int GetTurnableValveIndex(int pComponentIndex);
4156 void ExecuteActionsConnectedToValve(int pValveIndex);
4157
4159// attachment exclusion section //
4162 {
4164 m_AttachmentExclusionMaskGlobal = new set<int>;
4165 m_AttachmentExclusionMaskChildren = new set<int>();
4166
4167 int count = GetInventory().GetSlotIdCount();
4168 //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)
4169 if (count == 0)
4170 return;
4171
4175 }
4176
4179 {
4180 int count = GetInventory().GetSlotIdCount();
4181 //starting with the INVALID slot, so it is always in the map of attachable items
4183
4184 int slotId;
4185 for (int i = 0; i < count; i++)
4186 {
4187 slotId = GetInventory().GetSlotId(i);
4189 }
4190 }
4191
4193 protected set<int> GetAttachmentExclusionInitSlotValue(int slotId)
4194 {
4195 set<int> dflt = new set<int>;
4196 return dflt;
4197 }
4198
4199 //Initiated last, and only for items that do not have others defined already
4201 {
4202 bool performLegacyInit = InitLegacyExclusionCheck();
4203
4204 //adding implicit slot info AFTER the check is performed
4206
4207 if (performLegacyInit)
4209 }
4210
4211 //returns 'false' if the script initialization
4213 {
4214 //first check the globals
4215 if (m_AttachmentExclusionMaskGlobal.Count() > 0)
4216 return false;
4217
4218 //now the map
4219 int count = m_AttachmentExclusionSlotMap.Count();
4220 if (count > 1) //more than InventorySlots.INVALID
4221 {
4222 for (int i = 0; i < count; i++)
4223 {
4224 int countSet = m_AttachmentExclusionSlotMap.GetElement(i).Count();
4225 if (countSet > 0) //SOMETHING is defined
4226 {
4227 return false;
4228 }
4229 }
4230 }
4231
4232 return true;
4233 }
4234
4241 {
4242 int slotId;
4243 int slotCount = GetInventory().GetSlotIdCount();
4244 for (int i = 0; i < slotCount; i++)
4245 {
4246 slotId = GetInventory().GetSlotId(i);
4247 set<int> tmp;
4248 switch (slotId)
4249 {
4250 case InventorySlots.HEADGEAR:
4251 {
4252 tmp = new set<int>;
4253 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
4254 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
4255 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
4256 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
4258 break;
4259 }
4260
4261 case InventorySlots.MASK:
4262 {
4263 tmp = new set<int>;
4264 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
4265 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
4266 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
4267 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
4269 break;
4270 }
4271
4272 case InventorySlots.EYEWEAR:
4273 {
4274 tmp = new set<int>;
4275 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
4276 if (ConfigGetBool("isStrap"))
4277 {
4278 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
4279 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
4280 }
4281 else
4282 {
4283 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
4284 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
4285 }
4287 break;
4288 }
4289 }
4290 }
4291 }
4292
4294 {
4295 int slotId;
4296 int slotCount = GetInventory().GetSlotIdCount();
4297 for (int i = 0; i < slotCount; i++)
4298 {
4299 slotId = GetInventory().GetSlotId(i);
4300 set<int> tmp;
4301 switch (slotId)
4302 {
4303 case InventorySlots.HEADGEAR:
4304 {
4305 tmp = new set<int>;
4306 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
4307 if (ConfigGetBool("noNVStrap"))
4308 {
4309 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
4310 }
4311 if (ConfigGetBool("noMask"))
4312 {
4313 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
4314 }
4315 if (ConfigGetBool("noEyewear"))
4316 {
4317 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
4318 }
4320 break;
4321 }
4322
4323 case InventorySlots.MASK:
4324 {
4325 tmp = new set<int>;
4326 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
4327 if (ConfigGetBool("noNVStrap"))
4328 {
4329 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
4330 }
4331 if (ConfigGetBool("noHelmet"))
4332 {
4333 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
4334 }
4335 if (ConfigGetBool("noEyewear"))
4336 {
4337 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
4338 }
4340 break;
4341 }
4342
4343 case InventorySlots.EYEWEAR:
4344 {
4345 tmp = new set<int>;
4346 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
4347 if (ConfigGetBool("isStrap"))
4348 {
4349 if (ConfigGetBool("noHelmet"))
4350 {
4351 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
4352 }
4353 if (ConfigGetBool("noMask"))
4354 {
4355 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
4356 }
4357 }
4358 else
4359 {
4360 if (ConfigGetBool("noHelmet"))
4361 {
4362 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
4363 }
4364 if (ConfigGetBool("noMask"))
4365 {
4366 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
4367 }
4368 }
4370 break;
4371 }
4372 }
4373 }
4374 }
4375
4378
4380 protected void AddSingleExclusionValueGlobal(EAttExclusions value)
4381 {
4382 if (m_AttachmentExclusionMaskGlobal.Find(value) == -1)
4383 m_AttachmentExclusionMaskGlobal.Insert(value);
4384 }
4385
4387 protected void ClearSingleExclusionValueGlobal(EAttExclusions value)
4388 {
4389 int idx = m_AttachmentExclusionMaskGlobal.Find(value);
4390 if (idx != -1)
4392 }
4393
4394 protected void SetAttachmentExclusionMaskGlobal(set<int> values)
4395 {
4398 }
4399
4401 protected void SetAttachmentExclusionMaskSlot(int slotId, set<int> values)
4402 {
4404 {
4405 m_AttachmentExclusionSlotMap.Set(slotId,values);
4406 }
4407 else
4408 ErrorEx("m_AttachmentExclusionSlotMap not available! Fill the 'inventorySlot[]' in the " + this + " config file.");
4409 }
4410
4411 private void PropagateExclusionValueRecursive(set<int> values, int slotId)
4412 {
4413 if (values && values.Count() != 0)
4414 {
4415 set<int> passThis;
4417 GetInventory().GetCurrentInventoryLocation(lcn);
4418 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
4419 {
4420 m_AttachmentExclusionMaskChildren.InsertSet(passThis);
4421 EntityAI parent = GetHierarchyParent();
4422 if (parent)
4423 parent.PropagateExclusionValueRecursive(passThis,lcn.GetSlot());
4424 }
4425 }
4426 }
4427
4428 private void ClearExclusionValueRecursive(set<int> values, int slotId)
4429 {
4430 if (values && values.Count() != 0)
4431 {
4432 set<int> passThis;
4434 GetInventory().GetCurrentInventoryLocation(lcn);
4435 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
4436 {
4437 int count = passThis.Count();
4438 for (int i = 0; i < count; i++)
4439 {
4440 m_AttachmentExclusionMaskChildren.RemoveItem(passThis[i]);
4441 }
4442 EntityAI parent = GetHierarchyParent();
4443 if (parent)
4444 parent.ClearExclusionValueRecursive(passThis,lcn.GetSlot());
4445 }
4446 }
4447 }
4448
4451 {
4452 set<int> values = new set<int>();
4453 set<int> slotValues = GetAttachmentExclusionMaskSlot(slotId);
4454 if (slotValues)
4455 values.InsertSet(slotValues);
4456 values.InsertSet(m_AttachmentExclusionMaskGlobal);
4457 values.InsertSet(m_AttachmentExclusionMaskChildren);
4458
4459 return values;
4460 }
4461
4464 {
4465 return m_AttachmentExclusionSlotMap.Get(slotId);
4466 }
4467
4473
4479
4481 private bool HasInternalExclusionConflicts(int targetSlot)
4482 {
4483 set<int> targetSlotValues = GetAttachmentExclusionMaskSlot(targetSlot);
4484 if (targetSlotValues) //can be null, if so, no conflict
4485 {
4486 set<int> additionalValues = new set<int>(); //NOT slot values
4487 additionalValues.InsertSet(GetAttachmentExclusionMaskGlobal());
4488 additionalValues.InsertSet(GetAttachmentExclusionMaskChildren());
4489
4490 if (additionalValues.Count() > 0)
4491 {
4492 int countTarget = targetSlotValues.Count();
4493 for (int i = 0; i < countTarget; i++)
4494 {
4495 if (additionalValues.Find(targetSlotValues[i]) != -1)
4496 {
4497 return true;
4498 }
4499 }
4500 }
4501 }
4502 return false;
4503 }
4504
4506 protected bool IsExclusionFlagPresent(set<int> values)
4507 {
4508 int slotId;
4509 string slotName;
4510 GetInventory().GetCurrentAttachmentSlotInfo(slotId,slotName); //if currently attached, treat it accordingly
4511
4512 set<int> currentSlotValuesAll = GetAttachmentExclusionMaskAll(slotId);
4513 int count = values.Count();
4514 for (int i = 0; i < count; i++)
4515 {
4516 if (currentSlotValuesAll.Find(values[i]) != -1)
4517 return true;
4518 }
4519 return false;
4520 }
4521
4523 protected bool IsExclusionFlagPresentRecursive(set<int> values, int targetSlot)
4524 {
4525 if (values && values.Count() != 0)
4526 {
4528 GetInventory().GetCurrentInventoryLocation(lcn);
4529 EntityAI parent = GetHierarchyParent();
4530 set<int> passThis;
4531 if (CheckExclusionAccessCondition(lcn.GetSlot(),targetSlot, values, passThis))
4532 {
4533 if (parent && parent != this) //we reached root if false
4534 {
4535 return parent.IsExclusionFlagPresentRecursive(passThis,lcn.GetSlot());
4536 }
4537 }
4538 return IsExclusionFlagPresent(passThis);
4539 }
4540
4541 return false;
4542 }
4543
4545 protected bool CheckExclusionAccessCondition(int occupiedSlot, int targetSlot, set<int> value, inout set<int> adjustedValue)
4546 {
4547 bool occupiedException = occupiedSlot == InventorySlots.HANDS || occupiedSlot == InventorySlots.SHOULDER || occupiedSlot == InventorySlots.MELEE || occupiedSlot == InventorySlots.LEFTHAND;
4548 bool targetException = targetSlot == InventorySlots.HANDS || targetSlot == InventorySlots.SHOULDER || targetSlot == InventorySlots.MELEE || targetSlot == InventorySlots.LEFTHAND;
4549
4550 if (occupiedException)
4551 {
4552 adjustedValue = value;
4553 return false;
4554 }
4555
4556 if (targetException)
4557 {
4558 adjustedValue = null;
4559 return false;
4560 }
4561
4562 AdjustExclusionAccessCondition(occupiedSlot,targetSlot,value,adjustedValue);
4563 return adjustedValue.Count() != 0;
4564 }
4565
4567 protected void AdjustExclusionAccessCondition(int occupiedSlot, int testedSlot, set<int> value, inout set<int> adjustedValue)
4568 {
4569 adjustedValue = value;
4570 }
4571
4573 protected bool CheckExclusionAccessPropagation(int occupiedSlot, int targetSlot, set<int> value, inout set<int> adjustedValue)
4574 {
4575 bool occupiedException = occupiedSlot == InventorySlots.HANDS || occupiedSlot == InventorySlots.SHOULDER || occupiedSlot == InventorySlots.MELEE || occupiedSlot == InventorySlots.LEFTHAND;
4576 bool targetException = targetSlot == InventorySlots.HANDS || targetSlot == InventorySlots.SHOULDER || targetSlot == InventorySlots.MELEE || targetSlot == InventorySlots.LEFTHAND || targetSlot == InventorySlots.INVALID;
4577
4578 if (targetException)
4579 {
4580 adjustedValue = null;
4581 return false;
4582 }
4583
4584 AdjustExclusionAccessPropagation(occupiedSlot,targetSlot,value,adjustedValue);
4585 return adjustedValue.Count() != 0;
4586 }
4587
4589 protected void AdjustExclusionAccessPropagation(int occupiedSlot, int testedSlot, set<int> value, inout set<int> adjustedValue)
4590 {
4591 AdjustExclusionAccessCondition(occupiedSlot,testedSlot,value,adjustedValue);
4592 }
4593
4595 bool CheckAttachmentReceiveExclusion(EntityAI attachment, int slotId)
4596 {
4597 EntityAI currentAtt = GetInventory().FindAttachment(slotId);
4598 bool hasInternalConflict = attachment.HasInternalExclusionConflicts(slotId);
4599 set<int> diff;
4600 InventoryLocation curLoc = new InventoryLocation();
4601 if (currentAtt) //probably a swap or same-type swap
4602 {
4603 diff = attachment.GetAttachmentExclusionMaskAll(slotId);
4604 diff.RemoveItems(currentAtt.GetAttachmentExclusionMaskAll(slotId));
4605 if (diff.Count() == 0)
4606 {
4607 return !hasInternalConflict;
4608 }
4609 else
4610 {
4611 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(diff,slotId);
4612 }
4613 }
4614 else if (attachment.GetInventory().GetCurrentInventoryLocation(curLoc) && curLoc.GetType() == InventoryLocationType.ATTACHMENT)
4615 {
4616 EntityAI rootOwner = attachment.GetHierarchyRoot();
4617 if (rootOwner && rootOwner == this.GetHierarchyRoot()) //attachment within the same exclusion hierarchy context
4618 {
4619 diff = attachment.GetAttachmentExclusionMaskAll(slotId);
4620 diff.RemoveItems(attachment.GetAttachmentExclusionMaskAll(curLoc.GetSlot()));
4621 if (diff.Count() == 0)
4622 {
4623 return !hasInternalConflict;
4624 }
4625 else
4626 {
4627 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(diff,slotId);
4628 }
4629 }
4630 }
4631 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(attachment.GetAttachmentExclusionMaskAll(slotId),slotId);
4632 }
4633
4635 {
4636 return false;
4637 }
4638
4640 {
4641 return null;
4642 }
4643
4647
4649};
4650
4651#ifdef DEVELOPER
4652void 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
4653{
4654 if (entity)
4655 entity.SetDebugItem();
4656
4657}
4658Object _item;//watched item goes here(LCTRL+RMB->Watch)
4659#endif
enum EWetnessLevel BUSH_SOFT
enum EWetnessLevel FULL
enum EWetnessLevel HIDE_HANDS_SLOT
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 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
Определения EntityAI.c:2
@ DAMP
Определения EntityAI.c:4
@ DRENCHED
Определения EntityAI.c:7
@ WET
Определения EntityAI.c:5
@ DRY
Определения EntityAI.c:3
@ SOAKING
Определения EntityAI.c:6
enum EWetnessLevel ADD
enum EWetnessLevel ATTACHING
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
eBleedingSourceType GetType()
Определения BleedingSource.c:63
override bool IsDestructionBehaviour()
Определения AnimalBase.c:126
override bool IsSelfAdjustingTemperature()
Определения AnimalBase.c:59
override bool ReplaceOnDeath()
Определения AnimalBase.c:260
override string GetDeadItemName()
Определения AnimalBase.c:270
class Animal_CapraHircus extends AnimalBase GetDestructionBehaviour()
Определения AnimalBase.c:121
override void OnDamageDestroyed(int oldLevel)
Определения AnimalBase.c:145
override bool KeepHealthOnReplace()
Определения AnimalBase.c:275
vector GetOrientation()
Определения AreaDamageManager.c:306
override void OnFreezeStateChangeServer()
Определения Bottle_Base.c:73
proto native CEApi GetCEApi()
Get the CE API.
const int ECE_OBJECT_SWAP
Определения CentralEconomy.c:38
const int RF_ORIGINAL
Определения CentralEconomy.c:63
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
map< string, ref array< string > > DamageZoneMap
Определения DamageSystem.c:157
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
EActions
Определения EActions.c:2
eAgents
Определения EAgents.c:3
EMeleeTargetType
Определения EMeleeTargetType.c:2
ERPCs
Определения ERPCs.c:2
override bool CanItemOverheat()
Определения Edible_Base.c:1286
override bool IsCorpse()
Определения Edible_Base.c:1479
const int MAX
Определения EnConvert.c:27
proto string ToString()
override bool IsPrepareToDelete()
Определения FireplaceBase.c:639
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
DayZPlayer m_Player
Определения Hand_Events.c:42
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Определения Hatchback_02.c:403
Icon x
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override void InitItemVariables()
Определения ItemBase.c:4957
override void ProcessVariables()
Определения ItemBase.c:9338
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
override float GetWetMax()
Определения ItemBase.c:8379
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения ItemBase.c:5983
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
override bool IsHologram()
Определения ItemBase.c:5753
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void OnWasAttached(EntityAI parent, int slot_id)
Определения ItemBase.c:6147
override float GetWetMin()
Определения ItemBase.c:8384
static string GetDisplayName(int liquid_type)
Определения Liquid.c:382
string path
Определения OptionSelectorMultistate.c:142
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
override void OnWasDetached(EntityAI parent, int slot_id)
Определения RemoteDetonator.c:237
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
void TemperatureData(float val, ETemperatureAccessTypes accessType=ETemperatureAccessTypes.ACCESS_UNKNOWN, float time=-1, float timeCoef=1, float heatPermCoef=1)
Определения TemperatureData.c:47
override bool CanDisplayAttachmentSlot(int slot_id)
Определения Trap_TripWire.c:226
void OnEntityKilled(Object killer, EntityAI target)
Определения AnalyticsManagerServer.c:48
Определения CentralEconomy.c:749
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float GetTickTime()
Returns current time from start of the game.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
bool FormatRawConfigStringKeys(inout string value)
Changes localization key format to script-friendly format.
Определения Game.c:475
proto native bool ConfigIsExisting(string path)
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native DayZPlayer GetPlayer()
AnalyticsManagerServer GetAnalyticsServer()
Определения Game.c:1508
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native EntityAI GetEntityByPersitentID(int b1, int b2, int b3, int b4)
static ref TFloatArray ARRAY_FLOAT
Определения UtilityClasses.c:50
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
static bool GetDisableBaseDamage()
Определения CfgGameplayHandler.c:162
static bool GetDisableContainerDamage()
Определения CfgGameplayHandler.c:168
static array< float > GetWetnessWeightModifiers()
Определения CfgGameplayHandler.c:155
bool IsWorking()
Energy manager: Returns true if this device is working right now.
Определения ComponentEnergyManager.c:900
EntityAI GetEnergySource()
Energy manager: Returns the energy source this device is plugged into.
Определения ComponentEnergyManager.c:1292
bool IsSwitchedOn()
Energy manager: Returns state of the switch. Whenever the device is working or not does not matter....
Определения ComponentEnergyManager.c:866
Определения Component.c:16
Определения ComponentsBank.c:2
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.
Определения Debug.c:230
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.
Определения Debug.c:245
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.
Определения Debug.c:122
Определения Debug.c:2
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
bool PredictiveDropEntity(notnull EntityAI item)
Определения EntityAI.c:2043
bool CanLoadAttachment(EntityAI attachment)
Определения EntityAI.c:1436
void LogError(string msg, string fnc_name="n/a")
LogError.
Определения EntityAI.c:479
void OnSwitchOff()
Energy manager event: Called when the device is switched OFF.
Определения EntityAI.c:3392
void InitLegacySlotExclusionValuesImplicit()
adding base one-directional relations between headgear, masks, eyewear, and headstraps (exception)
Определения EntityAI.c:4240
bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:1992
float GetWetWeightModifier()
Определения EntityAI.c:3478
void SetStoreLoadedQuantity(float value)
void OnEnergyConsumed()
Energy manager event: Called when energy was consumed on this device. ALWAYS CALL super....
Определения EntityAI.c:3410
proto native EntityAI GetHierarchyParent()
Returns direct parent of current entity.
bool IsZombie()
Определения EntityAI.c:729
void TransferVariablesFloat(array< float > float_vars)
Определения EntityAI.c:3100
proto native Man GetHierarchyRootPlayer()
Returns root of current hierarchy cast to Man.
EntityAI GetAttachmentByType(typename type)
Get attached entity by type.
Определения EntityAI.c:2061
bool m_RoofAbove
Определения EntityAI.c:106
bool IsEmpty()
is this container empty or not, checks both cargo and attachments
Определения EntityAI.c:648
vector GetUniversalTemperatureSourcePosition()
Определения EntityAI.c:4129
void InterpolateTempData(TemperatureDataInterpolated data)
Определения EntityAI.c:2397
float GetQuantity()
Определения EntityAI.c:2200
void SoundSoftBushFallingPlay()
Определения EntityAI.c:4023
bool ServerTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:2003
bool CanCombineAttachment(notnull EntityAI e, int slot, bool stack_max_limit=false)
Определения EntityAI.c:1494
void HideSelection(string selection_name)
Hides selection of the given name. Must be configed in config.cpp and models.cfg.
Определения EntityAI.c:3307
bool CanDetachAttachment(EntityAI parent)
calls this->CanDetachAttachment(parent)
Определения EntityAI.c:1484
int GetHideIconMask()
should the item's icon be hidden in any part of the inventory?
Определения EntityAI.c:300
float m_Weight
Определения EntityAI.c:126
void ClearWeightDirty()
Определения EntityAI.c:3506
bool CanAssignToQuickbar()
Определения EntityAI.c:1754
bool CanReceiveAttachment(EntityAI attachment, int slotId)
calls this->CanReceiveAttachment(attachment)
Определения EntityAI.c:1424
float GetTemperatureFreezeTime()
Определения EntityAI.c:2456
bool CanBeTargetedByAI(EntityAI ai)
Определения EntityAI.c:744
int GetTurnableValveIndex(int pComponentIndex)
bool UseConfigInitTemperature()
Определения EntityAI.c:2234
bool CanBePlaced(Man player, vector position)
Определения EntityAI.c:618
void EEDelete(EntityAI parent)
Called right before object deleting.
Определения EntityAI.c:927
proto native float GetLifetimeMax()
Get max economy lifetime per instance - default is from DB (seconds)
int GetQuantityMax()
Определения EntityAI.c:2210
bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Определения EntityAI.c:2008
ArrowManagerBase GetArrowManager()
Определения EntityAI.c:4639
float GetTemperatureInit()
Определения EntityAI.c:2416
void GetColor(out int r, out int g, out int b, out int a)
Определения EntityAI.c:2690
float m_VarTemperatureFreezeTime
Определения EntityAI.c:153
void ProcessInvulnerabilityCheck(string servercfg_param)
Определения EntityAI.c:3933
bool CanDisplayAttachmentSlot(string slot_name)
Определения EntityAI.c:1700
void DeleteOnClient()
Определения EntityAI.c:775
void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void ClearExclusionValueRecursive(set< int > values, int slotId)
Определения EntityAI.c:4428
void OnOwnSocketReleased(EntityAI device)
Energy manager event: When something is UNPLUGGED from this device.
Определения EntityAI.c:3404
void SetColor(int r, int g, int b, int a)
bool LocalTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Определения EntityAI.c:1949
ref TemperatureAccessComponent m_TAC
Определения EntityAI.c:158
float GetItemOverheatProgress()
Определения EntityAI.c:2624
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...
Определения EntityAI.c:3561
void SoundHardBushFallingPlay()
Определения EntityAI.c:4017
bool ServerTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Определения EntityAI.c:1987
float ConvertNonlethalDamage(float damage)
DEPRECATED - for legacy purposes.
Определения EntityAI.c:445
const int DEAD_REPLACE_DELAY
Определения EntityAI.c:116
void DeathUpdate()
Определения EntityAI.c:1098
void EEInventoryIn(Man newParentMan, EntityAI diz, EntityAI newParent)
Определения EntityAI.c:1003
string GetAttachmentSoundType()
returns sound type of attachment (used for clothing and weapons on DayZPlayerImplement,...
Определения EntityAI.c:3769
float GetWetMin()
Определения EntityAI.c:2150
float GetTemperatureFreezeThreshold()
Определения EntityAI.c:2446
bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:1912
proto native bool IsPilotLight()
void OnChildItemRemoved(InventoryItem item)
Определения EntityAI.c:950
bool IsSetForDeletion()
Определения EntityAI.c:802
EntityAI SpawnEntityOnGround(string object_name, vector mat[4])
Определения EntityAI.c:2120
void CacheSkinningBloodInfectionChance(eAgents type)
Определения EntityAI.c:513
void SwitchItemSelectionTexture(EntityAI item, string slot_name)
void EEParentedFrom(EntityAI parent)
Called from 'IEntity.RemoveChild' or 'IEntity.AddChild' when hierarchy changes.
Определения EntityAI.c:999
bool GetInventoryHandAnimation(notnull InventoryLocation loc, out int value)
Определения EntityAI.c:4102
ScriptInvoker GetOnItemRemovedFromCargo()
Определения EntityAI.c:1242
void AfterStoreLoad()
Called when entity is being loaded from DB or Storage (after all children loaded)
Определения EntityAI.c:1371
void SetFrozen(bool frozen)
Определения EntityAI.c:2494
bool CanBeBackstabbed()
Определения EntityAI.c:756
void RegisterTransportHit(Transport transport)
Определения EntityAI.c:4029
bool OnStoreLoad(ParamsReadContext ctx, int version)
Called when data is loaded from persistence (on server side).
Определения EntityAI.c:2940
float GetItemOverheatThreshold()
if undefined, max temperature used as default
Определения EntityAI.c:2608
EntityAI GetPairDevice()
void SetPersistentPairID(int id)
Определения EntityAI.c:4143
void OnIsUnplugged(EntityAI last_energy_source)
Energy manager event: Called when this device is UNPLUGGED from the energy source.
Определения EntityAI.c:3398
array< EntityAI > GetAttachmentsWithAttachments()
Определения EntityAI.c:687
bool HasAnyCargo()
is this container empty or not, checks only cargo
Определения EntityAI.c:666
ScriptInvoker GetOnSetLock()
Определения EntityAI.c:1270
void SetFreezeThawProgress(float val)
0->1 when freezing, 1->0 when thawing
Определения EntityAI.c:2479
bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
Определения EntityAI.c:2129
void OnBinLoadItemsDropped()
Called when an item fails to get loaded into the inventory of an entity and gets dropped.
Определения EntityAI.c:1376
int GetWeight()
Определения EntityAI.c:3501
float m_WeightEx
Определения EntityAI.c:127
void OnDebugSpawnEx(DebugSpawnParams params)
Определения EntityAI.c:3854
bool CanLoadItemIntoCargo(EntityAI item)
calls this->CanLoadItemIntoCargo(item), is called on server start when loading in the storage
Определения EntityAI.c:1536
bool m_CanDisplayWeight
Определения EntityAI.c:129
ref ScriptInvoker m_OnAttachmentSetLock
Определения EntityAI.c:187
EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
Определения EntityAI.c:2109
override TStringArray GetHiddenSelectionsMaterials()
Returns the hiddenSelectionsMaterials array from the object's config.
Определения EntityAI.c:2774
ref array< EntityAI > m_AttachmentsWithCargo
Определения EntityAI.c:119
override TStringArray GetHiddenSelections()
Returns the hiddenSelectionsTextures array from the object's config.
Определения EntityAI.c:2756
ref InventoryLocation m_OldLocation
Определения EntityAI.c:121
float GetHeatPermeabilityCoef()
Returns temperature change speed multiplier for this item and all its children (multiplicative intera...
Определения EntityAI.c:2441
bool IsIgnoredByConstruction()
Определения EntityAI.c:739
float m_VarTemperatureThawThreshold
Определения EntityAI.c:152
void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения EntityAI.c:1111
float HeightCheckOverride()
used as script-side override of distance for specific height checks
Определения EntityAI.c:636
Shape DebugBBoxDraw()
Определения EntityAI.c:3276
set< int > GetAttachmentExclusionMaskSlot(int slotId)
Specific slot behavior.
Определения EntityAI.c:4463
proto native void PlaceOnSurfaceRotated(out vector trans[4], vector pos, float dx=0, float dz=0, float fAngle=0, bool align=false)
void SerializeNumericalVars(array< float > floats_out)
Определения EntityAI.c:3191
int GetCleanness()
Определения EntityAI.c:2715
void SetAttachmentExclusionMaskSlot(int slotId, set< int > values)
sets values for specific slot
Определения EntityAI.c:4401
float m_PreviousRoofTestTime
Определения EntityAI.c:132
void InitTemperature()
Определения EntityAI.c:2239
bool IsRefresherSignalingViable()
Определения EntityAI.c:368
ScriptInvoker GetOnKilledInvoker()
Определения EntityAI.c:1305
EntityAI SpawnInInventoryOrGroundPos(string object_name, GameInventory inv, vector pos)
Определения EntityAI.c:2093
void SetStoreLoad(bool value)
ScriptInvoker GetOnAttachmentReleaseLock()
Определения EntityAI.c:1291
void SetBayonetAttached(bool pState, int slot_idx=-1)
Определения EntityAI.c:3956
bool CanReleaseFromHands(EntityAI handheld)
calls this->CanReleaseFromHands(handheld)
Определения EntityAI.c:1680
bool TranslateSlotFromSelection(string selection_name, out int slot_id)
Определения EntityAI.c:4108
override TStringArray GetHiddenSelectionsTextures()
Returns the hiddenSelectionsTextures array from the object's config.
Определения EntityAI.c:2765
bool IsPrepareToDelete()
Определения EntityAI.c:838
bool m_Initialized
Определения EntityAI.c:137
bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения EntityAI.c:3609
float GetInventoryAndCargoWeight(bool forceRecalc=false)
Определения EntityAI.c:3533
bool m_WeightDirty
Определения EntityAI.c:105
proto native void RegisterNetSyncVariableFloat(string variableName, float minValue=0, float maxValue=0, int precision=1)
registers float variable synchronized over network
ref map< eAgents, float > m_BloodInfectionChanceCached
Определения EntityAI.c:195
ref array< EntityAI > m_AttachmentsWithAttachments
Определения EntityAI.c:120
bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity)
calls this->CanSwapItemInCargo(child_entity, new_entity)
Определения EntityAI.c:1558
override EntityAI ProcessMeleeItemDamage(int mode=0)
Определения EntityAI.c:3915
void RemoveItemVariable(int variable)
Removes variable from variable mask, making it appear as though the variable has never been changed f...
Определения EntityAI.c:3095
void IncreaseLifetimeUp()
Reset economy lifetime to default across entity hierarchy all the way to the topmost entity.
Определения EntityAI.c:3341
void EEAmmoChanged()
Определения EntityAI.c:1016
void OnIgnitedThisFailed(EntityAI fire_source)
Executed on Server when some item failed to ignite this one.
Определения EntityAI.c:594
float GetWeightEx(bool forceRecalc=false)
returns overall weight of the entity, 'forceRecalc = true' is meant to be used only when debugging,...
Определения EntityAI.c:3568
void EEItemDetached(EntityAI item, string slot_name)
Определения EntityAI.c:1162
bool IsValveTurnable(int pValveIndex)
void OnDebugButtonPressServer(int button_index)
Определения EntityAI.c:3273
bool GetIsFrozen()
Определения EntityAI.c:2489
proto native GameInventory GetInventory()
bool GetCookingTargetTemperature(out float temperature)
specifically for cooking system, to get heat source target temperatures
Определения EntityAI.c:2432
float m_VarHeatPermeabilityCoef
Определения EntityAI.c:156
ref map< int, ref set< int > > m_AttachmentExclusionSlotMap
Определения EntityAI.c:107
void SetTemperatureMax()
presumably for debug purposes?
Определения EntityAI.c:2405
ref ScriptInvoker m_OnKilledInvoker
Определения EntityAI.c:193
void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения EntityAI.c:949
bool LocalTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:1919
bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Определения EntityAI.c:2015
void OnInitEnergy()
Energy manager event: Object's initialization. Energy Manager is fully initialized by this point.
Определения EntityAI.c:3407
bool IsTwoHandedBehaviour()
returns item behaviour of item (more in ItemBase)
Определения EntityAI.c:3787
void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
bool LocalTakeEntityToCargo(notnull EntityAI item)
Определения EntityAI.c:1903
string ChangeIntoOnAttach(string slot)
Определения EntityAI.c:3792
bool m_DeathSyncSent
Определения EntityAI.c:101
bool CanReleaseCargo(EntityAI cargo)
calls this->CanReleaseCargo(cargo)
Определения EntityAI.c:1572
void OnStoreSave(ParamsWriteContext ctx)
Engine calls this function to collect data from entity to store for persistence (on server side).
Определения EntityAI.c:2876
float GetStoreLoadedQuantity()
Определения EntityAI.c:2707
ref ScriptInvoker m_OnSetLock
Определения EntityAI.c:183
void UnpairRemote()
bool IsPlayer()
Определения EntityAI.c:719
void InitDamageZoneMapping()
Initializes script-side map of damage zones and their components (named selections in models)
Определения EntityAI.c:387
ref ScriptInvoker m_OnItemDetached
Определения EntityAI.c:171
bool m_PreparedToDelete
Определения EntityAI.c:103
void OnPlacementCancelled(Man player)
void RemoveAllAgents()
bool DoPlacingHeightCheck()
Do the roof check when placing this?
Определения EntityAI.c:630
proto native void CreateAndInitInventory()
void OnDebugSpawn()
Определения EntityAI.c:3859
void OnWorkStart()
Energy manager event: Called only once when this device starts doing its work.
Определения EntityAI.c:3380
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.
Определения EntityAI.c:1930
bool PredictiveTakeEntityToCargo(notnull EntityAI item)
Put item into into cargo.
Определения EntityAI.c:1896
ScriptInvoker GetOnItemMovedInCargo()
Определения EntityAI.c:1249
void EECargoMove(EntityAI item)
Определения EntityAI.c:1214
bool IsUniversalTemperatureSource()
Universal Temperature Sources Helpers.
Определения EntityAI.c:4114
void SetTemperatureEx(TemperatureData data)
sets temperature, handles base overheating and freezing state progression logics
Определения EntityAI.c:2296
set< int > GetAttachmentExclusionMaskGlobal()
Global mask value, independent of slot-specific behavior!
Определения EntityAI.c:4469
bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Определения EntityAI.c:1976
bool LocalTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Определения EntityAI.c:1885
void SetFromProjectile(ProjectileStoppedInfo info)
Определения EntityAI.c:4644
float m_LastUpdatedTime
Определения EntityAI.c:130
string GetDestructionBehaviour()
Определения EntityAI.c:329
proto native void RegisterNetSyncVariableBoolSignal(string variableName)
when bool variable is true, it's sent to clients and become false again
proto native owned string GetObjectMaterial(int index)
void SetWetMax()
bool m_IsFrozen
Определения EntityAI.c:160
bool IsManagingArrows()
Определения EntityAI.c:4634
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
override this to modify slot behavior for specific items, or just set 'm_AttachmentExclusionMaskGloba...
Определения EntityAI.c:4193
void OnWork(float consumed_energy)
Energy manager event: Called every device update if its supposed to do some work. The update can be e...
Определения EntityAI.c:3383
void CombineItemsClient(EntityAI entity2, bool use_stack_max=false)
Определения EntityAI.c:1511
void EntityAI()
cache blood infection chance (cfgVehicles-><entity>->Skinning->BloodInfectionSettings)
Определения EntityAI.c:202
void DebugDirectionDelete()
Определения EntityAI.c:3301
bool IsSkinned()
Skinning.
Определения EntityAI.c:485
static EWetnessLevel GetWetLevelInternal(float wetness)
Определения EntityAI.c:2172
void OnIsPlugged(EntityAI source_device)
Energy manager event: Called when this device is plugged into some energy source.
Определения EntityAI.c:3395
proto native void RegisterNetSyncVariableBool(string variableName)
registers bool variable synchronized over network
ref ScriptInvoker m_OnViewIndexChanged
Определения EntityAI.c:181
proto native void SetObjectMaterial(int index, string mat_name)
Change material in hiddenSelections.
Shape DebugDirectionDraw(float distance=1)
Определения EntityAI.c:3291
UTemperatureSource GetUniversalTemperatureSource()
Определения EntityAI.c:4119
int GetAgents()
Определения EntityAI.c:706
int GetQuantityMin()
Определения EntityAI.c:2215
bool CanBeFSwaped()
Определения EntityAI.c:1489
void DeleteSafe()
Определения EntityAI.c:781
void RefreshTemperatureAccess(TemperatureData data)
refreshes access without setting temperature, keeps the source locked in
Определения EntityAI.c:2386
bool HasWetness()
Определения EntityAI.c:2160
bool DisassembleOnLastDetach()
Определения EntityAI.c:554
float m_VarTemperatureInit
Определения EntityAI.c:148
void OnItemOverheatStart()
override to implement desired overheat behavior on entity
bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
Определения EntityAI.c:2019
void EEItemAttached(EntityAI item, string slot_name)
Определения EntityAI.c:1127
void EEOnAfterLoad()
Called when entity is part of "connected system" and being restored after load.
Определения EntityAI.c:1333
int GetButtstockAttachmentIdx()
Определения EntityAI.c:3962
bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения EntityAI.c:1502
proto native void UpdateNetSyncVariableFloat(string variableName, float minValue=0, float maxValue=0, int precision=1)
void OnWasDetached(EntityAI parent, int slot_id)
Определения EntityAI.c:1779
proto native void SetSimpleHiddenSelectionState(int index, bool state)
Simple hidden selection state; 0 == hidden.
void ExecuteActionsConnectedToValve(int pValveIndex)
bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
void DeleteSave()
Определения EntityAI.c:797
string CanBePlacedFailMessage(Man player, vector position)
Method which returns message why object can't be placed at given position.
Определения EntityAI.c:624
void OnIgnitedTarget(EntityAI target_item)
Executed on Server when this item ignites some target item.
Определения EntityAI.c:576
bool CanBeSkinnedWith(EntityAI tool)
Определения EntityAI.c:496
bool CanReceiveItemIntoHands(EntityAI item_to_hands)
calls this->CanReceiveItemIntoHands(item_to_hands)
Определения EntityAI.c:1616
void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения EntityAI.c:1366
bool CanDisplayAttachmentSlot(int slot_id)
Определения EntityAI.c:1710
bool IgnoreOutOfReachCondition()
Определения EntityAI.c:1770
int m_ViewIndex
Определения EntityAI.c:3668
bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Определения EntityAI.c:2034
bool IsOneHandedBehaviour()
returns item behaviour of item (more in ItemBase)
Определения EntityAI.c:3781
ref ScriptInvoker m_OnItemMovedInCargo
Определения EntityAI.c:177
void OnBeforeTryDelete()
void EECargoIn(EntityAI item)
Определения EntityAI.c:1194
void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
int GetMeleeTargetType()
value is related to EMeleeTargetType
Определения EntityAI.c:3763
ref HiddenSelectionsData m_HiddenSelectionsData
Определения EntityAI.c:114
array< float > GetVariablesFloat()
Определения EntityAI.c:3105
void OnIgnitedTargetFailed(EntityAI target_item)
Executed on Server when this item failed to ignite target item.
Определения EntityAI.c:588
bool IsSplitable()
returns just the configured 'canBeSplit' bool
Определения EntityAI.c:654
bool HasButtstockAttached()
Определения EntityAI.c:3961
proto native void UpdateNetSyncVariableInt(string variableName, float minValue=0, float maxValue=0)
array< EntityAI > GetAttachmentsWithCargo()
Определения EntityAI.c:682
ref map< int, string > m_DamageDisplayNameMap
Определения EntityAI.c:124
void DeSerializeNumericalVars(array< float > floats)
Определения EntityAI.c:3205
int GetViewIndex()
Returns item preview index !!!! IF OVERRIDING with more dynamic events call GetOnViewIndexChanged() i...
Определения EntityAI.c:3682
void OnOwnSocketTaken(EntityAI device)
Energy manager event: When something is plugged into this device.
Определения EntityAI.c:3401
bool IsPreparedToDelete()
Определения EntityAI.c:824
bool ServerTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:1923
string GetDefaultHitPositionComponent()
returns default hit position component name for the Entity (overriden by type if needed - used mainly...
Определения EntityAI.c:3744
bool CanReleaseAttachment(EntityAI attachment)
calls this->CanReleaseAttachment(attachment)
Определения EntityAI.c:1464
bool LocalTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Определения EntityAI.c:1870
override bool IsHologram()
Определения EntityAI.c:1653
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.
Определения EntityAI.c:4589
void GetDebugButtonNames(out string button1, out string button2, out string button3, out string button4)
Определения EntityAI.c:3271
void EEKilled(Object killer)
called on server when the entity is killed
Определения EntityAI.c:1072
EntityAI GetAttachmentByConfigTypeName(string type)
Get attached entity by config type name.
Определения EntityAI.c:2075
float GetTemperatureThawTime()
Определения EntityAI.c:2461
void ClearInventory()
ref set< int > m_AttachmentExclusionMaskGlobal
Определения EntityAI.c:108
bool IsTargetIgnitionSuccessful(EntityAI item_target)
Final evaluation just before the target item is actually ignited. Evaluated on Server.
Определения EntityAI.c:600
ref ComponentsBank m_ComponentsBank
Определения EntityAI.c:305
proto native void IncreaseLifetime()
Reset economy lifetime to default (seconds)
bool KeepHealthOnReplace()
Определения EntityAI.c:1093
bool TryDelete()
Определения EntityAI.c:843
bool CanAssignAttachmentsToQuickbar()
Определения EntityAI.c:1762
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)
Определения EntityAI.c:936
void InsertAgent(int agent, float count=1)
ref ScriptInvoker m_OnItemAddedIntoCargo
Определения EntityAI.c:173
void AddTemperature(float value)
Определения EntityAI.c:2289
void OnRemovedFromCargo(EntityAI container)
Called when this item exits cargo of some container.
Определения EntityAI.c:1321
void OnFreezeStateChangeServer()
proto native float GetLifetime()
Get remaining economy lifetime (seconds)
int m_VariablesMask
Определения EntityAI.c:144
proto native owned string GetObjectTexture(int index)
bool IsHeavyBehaviour()
returns item behaviour of item (more in ItemBase)
Определения EntityAI.c:3775
bool IsZombieMilitary()
Определения EntityAI.c:734
float GetSkinningBloodInfectionChance(eAgents type)
Определения EntityAI.c:504
void OnIgnitedThis(EntityAI fire_source)
Executed on Server when some item ignited this one.
Определения EntityAI.c:582
bool IsCookware()
Определения EntityAI.c:564
float m_VarTemperatureMax
Определения EntityAI.c:150
void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения EntityAI.c:1021
void SetVariableMask(int variable)
Определения EntityAI.c:3085
void OnSwitchOn()
Energy manager event: Called when the device is switched on.
Определения EntityAI.c:3389
bool IsAnimal()
Определения EntityAI.c:724
bool CanDropEntity(notnull EntityAI item)
Returns if item can be dropped out from this entity.
Определения EntityAI.c:2088
bool IsTakeable()
Определения EntityAI.c:1791
float GetTemperatureMin()
Определения EntityAI.c:2421
void SetItemOverheatProgress(float val, float deltaTime=0)
Определения EntityAI.c:2629
bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Reads from storage CTX.
Определения EntityAI.c:3163
bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Определения EntityAI.c:1878
ScriptInvoker GetOnItemAttached()
Определения EntityAI.c:1221
void OnDamageDestroyed(int oldLevel)
Called when the health gets to the min value, 'oldLevel' is previous health level,...
float m_ElapsedSinceLastUpdate
Определения EntityAI.c:131
void OnWorkStop()
Energy manager event: Called when the device stops working (was switched OFF or ran out of energy)
Определения EntityAI.c:3386
bool CanIgniteItem(EntityAI ignite_target=NULL)
Override this method and check if the given item can be ignited right now by this one....
Определения EntityAI.c:540
ScriptInvoker GetOnItemAddedIntoCargo()
Определения EntityAI.c:1235
bool HasQuantity()
Определения EntityAI.c:2193
ref ScriptInvoker m_OnItemAttached
Определения EntityAI.c:169
RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Remotely controlled devices helpers.
float m_VarTemperature
Определения EntityAI.c:147
float GetWetInit()
Определения EntityAI.c:2155
bool ServerTakeEntityToCargo(notnull EntityAI item)
Определения EntityAI.c:1907
ref ScriptInvoker m_OnItemFlipped
Определения EntityAI.c:179
bool CanSaveItemInHands(EntityAI item_in_hands)
Определения EntityAI.c:1658
UTemperatureSource m_UniversalTemperatureSource
Определения EntityAI.c:134
bool CanBeIgnitedBy(EntityAI igniter=NULL)
Override this method so it checks whenever this item can be ignited right now or not....
Определения EntityAI.c:534
override void EOnFrame(IEntity other, float timeSlice)
Определения EntityAI.c:3233
ScriptInvoker GetOnHitByInvoker()
Определения EntityAI.c:1298
void MaxLifetimeRefreshCalc()
Calculates if the max lifetime is higher than refresher frequency (i.e. gets kept alive by refresher)
Определения EntityAI.c:349
bool ServerDropEntity(notnull EntityAI item)
Определения EntityAI.c:2053
proto native void DestroyInventory()
bool LocalTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
Определения EntityAI.c:1983
void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения EntityAI.c:955
void SetViewIndex(int index)
Sets item preview index.
Определения EntityAI.c:3671
void ShowSelection(string selection_name)
Shows selection of the given name. Must be configed in config.hpp and models.cfg.
Определения EntityAI.c:3316
string GetDebugText()
Определения EntityAI.c:3247
void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
array< string > GetSuitableFinisherHitComponents()
Определения EntityAI.c:3750
void OnCEUpdate()
Central economy calls this function whenever going over all the entities.
Определения EntityAI.c:3818
bool IsBeingPlaced()
Определения EntityAI.c:1648
bool ReplaceOnDeath()
Определения EntityAI.c:1083
void SetAsSkinned()
Определения EntityAI.c:490
float GetWet()
Определения EntityAI.c:2140
ref KillerData m_KillerData
Определения EntityAI.c:113
void HandleFreezingProgression(float deltaHeat, TemperatureData data)
Определения EntityAI.c:2510
proto native void SetLifetimeMax(float fLifeTime)
Set (override) max economy lifetime per entity instance (seconds)
void OnHologramBeingPlaced(Man player)
DamageZoneMap GetEntityDamageZoneMap()
Определения EntityAI.c:450
void CheckForDestroy()
Определения EntityAI.c:830
bool ServerTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Определения EntityAI.c:1953
void SetTemperature(float value, bool allow_client=false)
not really deprecated, but missing context info from TemperatureData. Default values used instead.
Определения EntityAI.c:2277
void OnEnergyAdded()
Energy manager event: Called when energy was added on this device. ALWAYS CALL super....
Определения EntityAI.c:3413
bool IsItemOverheated()
Определения EntityAI.c:2619
ref ScriptInvoker m_OnHitByInvoker
Определения EntityAI.c:191
void OnItemOverheat(float deltaTime)
string GetInvulnerabilityTypeString()
Определения EntityAI.c:3928
bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Определения EntityAI.c:1942
bool CheckAttachmentReceiveExclusion(EntityAI attachment, int slotId)
checks specifically for att. exclusion conflicts before att. receive
Определения EntityAI.c:4595
proto native CEItemProfile GetEconomyProfile()
Get economy item profile (if assigned, otherwise null)
float m_ConfigWeight
Определения EntityAI.c:128
bool CheckExclusionAccessCondition(int occupiedSlot, int targetSlot, set< int > value, inout set< int > adjustedValue)
Определения EntityAI.c:4545
bool HasInternalExclusionConflicts(int targetSlot)
checks if any attachment or item state would interfere with this being attached into a different slot...
Определения EntityAI.c:4481
void DebugDirectionSetColor(int color)
Определения EntityAI.c:3296
bool LocalTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
Определения EntityAI.c:1999
const int DELETE_CHECK_DELAY
Определения EntityAI.c:117
ComponentEnergyManager m_EM
Определения EntityAI.c:306
proto native bool IsSimpleHiddenSelectionVisible(int index)
float GetTemperature()
Определения EntityAI.c:2411
void SaveVariables(ParamsWriteContext ctx)
Определения EntityAI.c:3112
void SetCleanness(int value, bool allow_client=false)
bool LocalTakeEntityToCargoEx(notnull EntityAI item, int idx, int row, int col)
Определения EntityAI.c:1937
bool CanHaveTemperature()
returns true used on selected items that have a temperature effect and can processes temperature chan...
Определения EntityAI.c:3796
void Man()
Определения Man.c:39
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
bool ServerTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Определения EntityAI.c:1971
void UpdateWeight(WeightUpdateType updateType=WeightUpdateType.FULL, float weightAdjustment=0)
float m_VarTemperatureThawTime
Определения EntityAI.c:154
float ConvertNonlethalDamage(float damage, DamageType damageType)
Определения EntityAI.c:439
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
Определения EntityAI.c:642
bool HasFlammableMaterial()
Override this method to return TRUE when this item has or can provide fire. Evaluated on server and c...
Определения EntityAI.c:528
bool IsExclusionFlagPresentRecursive(set< int > values, int targetSlot)
Gets flag from what is effectively an owner.
Определения EntityAI.c:4523
ComponentBodyStaging GetCompBS()
Use this to access Body Staging component on dead character. Returns NULL if the given object lacks s...
Определения EntityAI.c:3351
HiddenSelectionsData GetHiddenSelectionsData()
Определения EntityAI.c:2741
void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void DebugBBoxSetColor(int color)
Определения EntityAI.c:3281
void AdjustExclusionAccessCondition(int occupiedSlot, int testedSlot, set< int > value, inout set< int > adjustedValue)
if we want to filter
Определения EntityAI.c:4567
string GetHitComponentForAI()
Returns hit component for the Entity (overriden for each Type - PlayerBase, DayZInfected,...
Определения EntityAI.c:3728
bool HasComponent(int comp_type)
IsComponentExist.
Определения EntityAI.c:340
void LogWarning(string msg, string fnc_name="n/a")
LogWarning.
Определения EntityAI.c:473
string GetDeadItemName()
Определения EntityAI.c:1088
void SetWeightDirty()
Определения EntityAI.c:3512
ScriptInvoker GetOnViewIndexChanged()
Определения EntityAI.c:1263
void SoundHardTreeFallingPlay()
Определения EntityAI.c:4005
void AttemptDestructionBehaviour(int oldLevel, int newLevel, string zone)
Определения EntityAI.c:1043
void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения EntityAI.c:953
bool m_IsFrozenLocal
Определения EntityAI.c:161
proto native void RegisterNetSyncVariableInt(string variableName, int minValue=0, int maxValue=0)
registers int variable synchronized over network
void SetUniversalTemperatureSource(UTemperatureSource uts)
Определения EntityAI.c:4124
float GetConfigWeightModified()
Определения EntityAI.c:3483
bool IsInitialized()
Определения EntityAI.c:294
bool CanItemOverheat()
Overheat time CAN be 0, GameConstants.TEMPERATURE_TIME_OVERHEAT_MIN is ignored if so.
Определения EntityAI.c:2602
void OnCargoChanged()
Определения EntityAI.c:1789
int GetBayonetAttachmentIdx()
Определения EntityAI.c:3958
ComponentEnergyManager GetCompEM()
Определения EntityAI.c:3361
void RemoveAllAgentsExcept(int agent_to_keep)
void SetTakeable(bool pState)
bool IsDestructionBehaviour()
Определения EntityAI.c:334
bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Put item anywhere into this entity (as attachment or into cargo, recursively)
Определения EntityAI.c:1863
proto native void SetObjectTexture(int index, string texture_name)
Change texture in hiddenSelections.
bool ServerTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
Определения EntityAI.c:1874
set< int > GetAttachmentExclusionMaskAll(int slotId)
Slot-specific, children (attachments), and additional (state etc.) masks combined.
Определения EntityAI.c:4450
bool CanDisplayAnyAttachmentSlot()
Определения EntityAI.c:1718
float m_OverheatProgress
Определения EntityAI.c:164
void SetButtstockAttached(bool pState, int slot_idx=-1)
Определения EntityAI.c:3960
int GetTargetQuantityMax(int attSlotID=-1)
Определения EntityAI.c:2222
bool CanPutIntoHands(EntityAI parent)
calls this->CanPutIntoHands(parent)
Определения EntityAI.c:1669
bool IsSlotReserved(int slotID)
Определения EntityAI.c:1820
float m_VarTemperatureOverheatTime
Определения EntityAI.c:155
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения EntityAI.c:3416
int GetQuickBarBonus()
Определения EntityAI.c:2227
bool IsSelfAdjustingTemperature()
Определения EntityAI.c:3801
override void Delete()
Delete this object in next frame.
Определения EntityAI.c:769
bool CanDisplayWeight()
'displayWeight' in item config
Определения EntityAI.c:461
proto void GetPersistentID(out int b1, out int b2, out int b3, out int b4)
void SoundSoftTreeFallingPlay()
Определения EntityAI.c:4011
bool InitLegacyExclusionCheck()
Определения EntityAI.c:4212
bool IsVariableSet(int variable)
'true' if this variable has ever been changed from default
Определения EntityAI.c:3080
float GetSingleInventoryItemWeightEx()
Определения EntityAI.c:3596
bool CanReceiveItemIntoCargo(EntityAI item)
calls this->CanReceiveItemIntoCargo(item)
Определения EntityAI.c:1522
void PropagateExclusionValueRecursive(set< int > values, int slotId)
Определения EntityAI.c:4411
void ProcessVariables()
Определения EntityAI.c:3830
proto native void SwitchLight(bool isOn)
bool CanFreeze()
Определения EntityAI.c:2484
bool LoadVariables(ParamsReadContext ctx, int version=-1)
Определения EntityAI.c:3130
float GetWetMax()
Определения EntityAI.c:2145
EWetnessLevel GetWetLevel()
bool HasEnergyManager()
If this item has class EnergyManager in its config then it returns true. Otherwise returns false.
Определения EntityAI.c:3372
void ShowAllSelections()
Sets all animation values to 0, making them VISIBLE if they are configured in models....
Определения EntityAI.c:1401
bool CanSwitchDuringAttach(EntityAI parent)
Определения EntityAI.c:1454
bool CanBeSplit()
returns current splitability
Определения EntityAI.c:660
ScriptInvoker GetOnItemFlipped()
Определения EntityAI.c:1256
void HideAllSelections()
Sets all animation values to 1, making them INVISIBLE if they are configured in models....
Определения EntityAI.c:1383
void OnItemOverheatEnd()
note, that the deltaTime could be reverse-calculated and not totally accurate
void InitGlobalExclusionValues()
override to init part of the mask, independent of slot-specific behavior
bool IsBasebuildingKit()
Определения EntityAI.c:559
float GetFreezeThawProgress()
on server only
Определения EntityAI.c:2467
void SetPrepareToDelete()
Определения EntityAI.c:819
override bool IsEntityAI()
Определения EntityAI.c:712
void ~EntityAI()
Определения EntityAI.c:243
void SetWet(float value, bool allow_client=false)
void InitItemVariables()
Определения EntityAI.c:248
bool AreChildrenAccessible()
Определения EntityAI.c:1621
bool LocalDropEntity(notnull EntityAI item)
Определения EntityAI.c:2048
void OnInventoryInit()
Определения EntityAI.c:889
float GetQuantityNormalized()
Определения EntityAI.c:2205
void SetLiquidType(int value, bool allow_client=false)
bool CanRemoveFromHands(EntityAI parent)
calls this->CanRemoveFromHands(parent)
Определения EntityAI.c:1691
void OnChildItemReceived(InventoryItem item)
Определения EntityAI.c:951
bool IsInventoryVisible()
Определения EntityAI.c:714
void OnPlacementStarted(Man player)
bool PlacementCanBeRotated()
Should return false if you want to disable hologram rotation.
Определения EntityAI.c:570
float GetItemOverheatTime()
any configured value >= 0 will simulate overheating
Определения EntityAI.c:2614
Component GetComponent(int comp_type, string extended_class_name="")
GetComponent.
Определения EntityAI.c:315
ScriptInvoker GetOnAttachmentSetLock()
Определения EntityAI.c:1284
bool CanDisplayAttachmentCategory(string category_name)
Определения EntityAI.c:1738
void EEInventoryOut(Man oldParentMan, EntityAI diz, EntityAI newParent)
Определения EntityAI.c:1006
proto native void SetAITargetCallbacks(AbstractAITargetCallbacks callbacks)
void InitDamageZoneDisplayNameMapping()
Initialize map of damage zone display names for more optimized retrieval.
Определения EntityAI.c:394
ref DestructionEffectBase m_DestructionBehaviourObj
Определения EntityAI.c:111
void OnFreezeStateChangeClient()
Component CreateComponent(int comp_type, string extended_class_name="")
CreateComponent.
Определения EntityAI.c:309
bool m_RefresherViable
Определения EntityAI.c:104
void OnWasAttached(EntityAI parent, int slot_id)
ref ScriptInvoker m_OnItemRemovedFromCargo
Определения EntityAI.c:175
void SetRoofAbove(bool state)
Определения EntityAI.c:698
float m_VarTemperatureMin
Определения EntityAI.c:149
void EECargoOut(EntityAI item)
Определения EntityAI.c:1204
void InitLegacySlotExclusionValuesDerived()
Определения EntityAI.c:4293
void InitLegacyConfigExclusionValues()
Определения EntityAI.c:4200
proto native void SetLifetime(float fLifeTime)
Set (override) remaining economy lifetime (seconds)
int GetHierarchyLevel(int lvl=0)
Определения EntityAI.c:881
EntityAI FindAttachmentBySlotName(string slot_name)
Определения EntityAI.c:1808
bool CanPutInCargo(EntityAI parent)
calls this->CanPutInCargo(parent)
Определения EntityAI.c:1547
bool IsFreezeThawProgressFinished()
on server only
Определения EntityAI.c:2473
void SetQuantityToMinimum()
bool IsThisIgnitionSuccessful(EntityAI item_source=NULL)
Final evaluation just before this item is actually ignited from fire source. Evaluated on Server.
Определения EntityAI.c:606
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!...
Определения EntityAI.c:1960
void RemoveAgent(int agent_id)
bool IsRoofAbove()
Определения EntityAI.c:693
bool DeleteComponent(int comp_type)
DeleteComponent.
Определения EntityAI.c:324
bool IsExclusionFlagPresent(set< int > values)
checks 'this' if the incoming flag is present for the current state (slot behavior and others)
Определения EntityAI.c:4506
void SetAttachmentExclusionMaskGlobal(set< int > values)
Определения EntityAI.c:4394
void SetInvisibleRecursive(bool invisible, EntityAI parent=null, array< int > attachments=null)
Определения EntityAI.c:3964
bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Определения EntityAI.c:1967
void Log(string msg, string fnc_name="n/a")
Log.
Определения EntityAI.c:467
proto native void SetSynchDirty()
Sets object synchronization dirty flag, which signalize that object wants to be synchronized (take ef...
bool m_TransportHitRegistered
Определения EntityAI.c:138
void EEInit()
Called upon object creation.
Определения EntityAI.c:895
float m_VarTemperatureFreezeThreshold
Определения EntityAI.c:151
vector GetDefaultHitPosition()
Определения EntityAI.c:3756
bool m_PendingDelete
Определения EntityAI.c:136
bool PredictiveTakeEntityAsAttachment(notnull EntityAI item)
Put item into as attachment.
Определения EntityAI.c:2027
int GetHiddenSelectionIndex(string selection)
Returns index of the string found in cfg array 'hiddenSelections'. If it's not found then it returns ...
Определения EntityAI.c:2747
float m_FreezeThawProgress
Определения EntityAI.c:162
bool HasBayonetAttached()
Определения EntityAI.c:3957
void InitInherentSlotExclusionMap()
map stored on instance to better respond to various state changes
Определения EntityAI.c:4178
bool IsLockedInSlot()
Определения EntityAI.c:1846
int GetLiquidType()
Определения EntityAI.c:2683
void DebugBBoxDelete()
Определения EntityAI.c:3286
void SetTemperatureDirect(float value, bool allow_client=false)
Определения EntityAI.c:2262
float GetLiquidThroughputCoef()
Returns liquid throughput coeficient.
Определения EntityAI.c:3923
void WriteVarsToCTX(ParamsWriteContext ctx)
Writes to storage CTX.
Определения EntityAI.c:3150
ref ScriptInvoker m_OnAttachmentReleaseLock
Определения EntityAI.c:189
float GetTemperatureThawThreshold()
Определения EntityAI.c:2451
void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения EntityAI.c:3598
ref ScriptInvoker m_OnReleaseLock
Определения EntityAI.c:185
void EEParentedTo(EntityAI parent)
Called from 'IEntity.AddChild'.
Определения EntityAI.c:994
map< int, string > GetEntityDamageDisplayNameMap()
Определения EntityAI.c:455
void OnMovedInsideCargo(EntityAI container)
Called when this item enters cargo of some container.
Определения EntityAI.c:1314
void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
Определения EntityAI.c:1121
bool CanDisplayCargo()
Определения EntityAI.c:1746
void ClearSingleExclusionValueGlobal(EAttExclusions value)
to help with item staging exclusions
Определения EntityAI.c:4387
void OnVariablesSynchronized()
Called on clients after receiving synchronization data from server.
Определения EntityAI.c:3025
void OnAttachmentRuined(EntityAI attachment)
Called when some attachment of this parent is ruined. Called on server and client side.
void OnDebugButtonPressClient(int button_index)
Определения EntityAI.c:3272
proto native void SetPilotLight(bool isOn)
set< int > GetAttachmentExclusionMaskChildren()
Mask value coming from the item's attachments.
Определения EntityAI.c:4475
void AddSingleExclusionValueGlobal(EAttExclusions value)
to help with item staging exclusions
Определения EntityAI.c:4380
bool CanRemoveFromCargo(EntityAI parent)
calls this->CanRemoveFromCargo(parent)
Определения EntityAI.c:1583
void CombineItemsEx(EntityAI entity2, bool use_stack_max=false)
proto native void RegisterNetSyncVariableObject(string variableName)
registers object variable synchronized over network, only synchronizes if network id is assigned....
void OnMovedWithinCargo(EntityAI container)
Called when this item moves within cargo of some container.
Определения EntityAI.c:1327
void DeferredInit()
Определения EntityAI.c:289
override bool CanBeActionTarget()
Определения EntityAI.c:807
bool ServerTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
Определения EntityAI.c:1889
vector m_TransportHitVelocity
Определения EntityAI.c:139
void PairRemote(notnull EntityAI trigger)
void OnWetChanged(float newVal, float oldVal)
bool IsStoreLoad()
Определения EntityAI.c:2701
string GetDefaultHitComponent()
returns default hit component for the Entity (overriden for each Type - PlayerBase,...
Определения EntityAI.c:3736
ref DamageZoneMap m_DamageZoneMap
Определения EntityAI.c:123
bool IsIgnited()
Override this method and make it so it returns whenever this item is on fire right now or not....
Определения EntityAI.c:546
bool IsServerCheck(bool allow_client)
Определения EntityAI.c:2722
bool CheckExclusionAccessPropagation(int occupiedSlot, int targetSlot, set< int > value, inout set< int > adjustedValue)
special propagation contition
Определения EntityAI.c:4573
ScriptInvoker GetOnReleaseLock()
Определения EntityAI.c:1277
ref set< int > m_AttachmentExclusionMaskChildren
Определения EntityAI.c:109
void HandleItemOverheating(float deltaHeat, TemperatureData data)
Определения EntityAI.c:2652
float GetTemperatureMax()
Определения EntityAI.c:2426
bool m_KilledByHeadshot
Определения EntityAI.c:102
bool ServerTakeEntityAsAttachment(notnull EntityAI item)
Определения EntityAI.c:2038
bool CanPutAsAttachment(EntityAI parent)
calls this->CanPutAsAttachment(parent)
Определения EntityAI.c:1448
string ChangeIntoOnDetach()
Определения EntityAI.c:3793
ScriptInvoker GetOnItemDetached()
Определения EntityAI.c:1228
void InitAttachmentExclusionValues()
Определения EntityAI.c:4161
int GetSlotsCountCorrect()
Определения EntityAI.c:1800
Определения Camera.c:2
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Определения EnConvert.c:601
Определения EnConvert.c:590
Определения constants.c:659
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
Определения Inventory.c:874
script counterpart to engine's class Inventory
Определения Inventory.c:79
proto native int GetUserReservedLocationCount()
proto native int FindFirstUserReservedLocationIndexForContainer(notnull EntityAI e)
proto native void GetUserReservedLocation(int index, out notnull InventoryLocation dst)
inventory for plain man/human
Определения HumanInventory.c:10
Определения EnEntity.c:165
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native int GetType()
returns type of InventoryLocation
InventoryLocation.
Определения InventoryLocation.c:29
const int INVALID
Invalid slot (-1)
Определения InventorySlots.c:17
static proto native bool GetShowForSlotId(int slot_Id)
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
Определения InventorySlots.c:6
static const int FLOAT
Определения UtilityClasses.c:4
Определения KillerData.c:2
Определения EnMath3D.c:28
Определения EnMath.c:7
Определения ObjectTyped.c:2
Определения EntityAI.c:95
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
The class that will be instanced (moddable)
Определения gameplay.c:389
Определения DayZGame.c:18
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.
Определения EffectManager.c:169
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto void Call(func fn, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
ScriptInvoker Class provide list of callbacks usage:
Определения tools.c:116
proto bool Write(void value_out)
proto bool Read(void value_in)
float m_AdjustedTarget
Определения TemperatureData.c:6
float m_InterpolatedFraction
Определения TemperatureData.c:12
float m_UpdateTimeInfo
Определения TemperatureData.c:7
float m_UpdateTimeCoef
Определения TemperatureData.c:8
Определения TemperatureData.c:2
Определения DamageSystem.c:2
Base native class for all motorized wheeled vehicles.
Определения Boat.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int COMP_TYPE_BODY_STAGING
Определения Component.c:10
const int COMP_TYPE_COUNT
Определения Component.c:12
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
const int COMP_TYPE_ETITY_DEBUG
Определения Component.c:8
void Error(string err)
Messagebox with error message.
Определения 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.
Определения Effect.c:258
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
const int INVENTORY_MAX_REACHABLE_DEPTH_ATT
Inventory visibility depth, also governs default direct access for most cases. Actual inventory depth...
Определения constants.c:1057
const float MELEE_ITEM_DAMAGE
Определения constants.c:646
const int REFRESHER_FREQUENCY_DEFAULT
Определения constants.c:1022
array< string > TStringArray
Определения EnScript.c:685
EntityFlags
Entity flags.
Определения EnEntity.c:115
const float TEMP_COEF_COOLING_GLOBAL
Определения constants.c:947
static const float TEMPERATURE_SENSITIVITY_THRESHOLD
Определения constants.c:938
static const float TEMPERATURE_FREEZETHAW_ACCELERATION_COEF
Определения constants.c:927
static const float TEMPERATURE_TIME_OVERHEAT_MIN
Определения constants.c:929
const float TEMP_COEF_WORLD
Определения constants.c:940
static const float TEMPERATURE_TIME_THAW_MIN
Определения constants.c:931
static const float TEMPERATURE_RATE_AVERAGE_ABS
Определения constants.c:920
static const float TEMPERATURE_FREEZETHAW_LEGACY_COEF
Определения constants.c:926
static const float TEMPERATURE_TIME_FREEZE_MIN
Определения constants.c:930
const int STATE_RUINED
Определения constants.c:846
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const float STATE_DAMP
Определения constants.c:873
const float STATE_SOAKING_WET
Определения constants.c:871
const float STATE_DRENCHED
Определения constants.c:870
const float STATE_WET
Определения constants.c:872
const float LIQUID_THROUGHPUT_DEFAULT
Определения constants.c:568
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Определения EnMath3D.c:256
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
const string CFG_VEHICLESPATH
Определения constants.c:220
const string CFG_WEAPONSPATH
Определения constants.c:221
const string CFG_MAGAZINESPATH
Определения constants.c:222
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
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static const string Empty
Определения EnString.c:7
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.
proto int ToLower()
Changes string to lowercase. Returns length.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407