10 enum SurfaceAnimationBone
35 enum EItemManipulationContext
43 enum EInventoryIconVisibility
55 OCCUPANCY_INVALID = -1,
57 LEGACY_EYEWEAR_HEADGEAR,
59 LEGACY_HEADSTRAP_HEADGEAR,
60 LEGACY_HEADSTRAP_MASK,
62 LEGACY_HEADGEAR_EYEWEWEAR,
63 LEGACY_HEADGEAR_HEADSTRAP,
65 LEGACY_MASK_EYEWEWEAR,
66 LEGACY_MASK_HEADSTRAP,
68 EXCLUSION_HEADGEAR_HELMET_0,
70 EXCLUSION_HEADSTRAP_0,
75 EXCLUSION_GLASSES_REGULAR_0,
76 EXCLUSION_GLASSES_TIGHT_0,
79 SHAVING_HEADGEAR_ATT_0,
80 SHAVING_EYEWEAR_ATT_0,
83 class DebugSpawnParams
87 static DebugSpawnParams WithPlayer(Man player)
89 DebugSpawnParams params =
new DebugSpawnParams();
90 params.m_Player = player;
95 class TSelectableActionInfoArrayEx
extends array<ref Param> {}
101 bool m_DeathSyncSent;
102 bool m_KilledByHeadshot;
103 bool m_PreparedToDelete =
false;
104 bool m_RefresherViable =
false;
105 bool m_WeightDirty = 1;
107 private ref set<int> m_AttachmentExclusionMaskGlobal;
108 private ref set<int> m_AttachmentExclusionMaskChildren;
115 const int DEAD_REPLACE_DELAY = 2000;
116 const int DELETE_CHECK_DELAY = 100;
127 float m_ConfigWeight = ConfigGetInt(
"weight");
128 protected bool m_CanDisplayWeight;
129 private float m_LastUpdatedTime;
130 protected float m_ElapsedSinceLastUpdate;
132 protected UTemperatureSource m_UniversalTemperatureSource;
134 bool m_PendingDelete =
false;
136 bool m_TransportHitRegistered =
false;
137 vector m_TransportHitVelocity;
170 string param_access_energy_sys =
"CfgVehicles " + type +
" EnergyManager ";
171 bool is_electic_device =
GetGame().ConfigIsExisting(param_access_energy_sys);
173 if (is_electic_device)
176 RegisterNetSyncVariableBool(
"m_EM.m_IsSwichedOn");
177 RegisterNetSyncVariableBool(
"m_EM.m_CanWork");
178 RegisterNetSyncVariableBool(
"m_EM.m_IsPlugged");
179 RegisterNetSyncVariableInt(
"m_EM.m_EnergySourceNetworkIDLow");
180 RegisterNetSyncVariableInt(
"m_EM.m_EnergySourceNetworkIDHigh");
181 RegisterNetSyncVariableFloat(
"m_EM.m_Energy");
185 RegisterNetSyncVariableInt(
"m_ViewIndex", 0, 99 );
187 RegisterNetSyncVariableBool(
"m_RefresherViable");
191 m_LastUpdatedTime = 0.0;
192 m_ElapsedSinceLastUpdate = 0.0;
194 m_CanDisplayWeight = ConfigGetBool(
"displayWeight");
196 InitDamageZoneMapping();
197 InitDamageZoneDisplayNameMapping();
222 return EInventoryIconVisibility.ALWAYS;
229 Component CreateComponent(
int comp_type,
string extended_class_name=
"")
231 return GetComponent(comp_type, extended_class_name);
235 Component GetComponent(
int comp_type,
string extended_class_name=
"")
237 if ( m_ComponentsBank == NULL )
240 return m_ComponentsBank.GetComponent(comp_type, extended_class_name);
244 bool DeleteComponent(
int comp_type)
246 return m_ComponentsBank.DeleteComponent(comp_type);
260 bool HasComponent(
int comp_type)
262 if ( m_ComponentsBank )
263 return m_ComponentsBank.IsComponentAlreadyExist(comp_type);
269 void MaxLifetimeRefreshCalc()
271 if ( (!
GetGame().IsMultiplayer() ||
GetGame().IsServer()) && GetEconomyProfile() )
273 float lifetime = GetEconomyProfile().GetLifetime();
274 int frequency =
GetCEApi().GetCEGlobalInt(
"FlagRefreshFrequency");
275 if ( frequency <= 0 )
280 if ( frequency <= lifetime )
282 m_RefresherViable =
true;
294 return m_RefresherViable;
298 override void SetDebugItem()
300 super.SetDebugItem();
307 void InitDamageZoneMapping()
310 DamageSystem.GetDamageZoneMap(
this,m_DamageZoneMap);
314 void InitDamageZoneDisplayNameMapping()
318 string component_name;
324 else if ( IsMagazine() )
333 path_base =
string.Format(
"%1 %2 DamageSystem DamageZones", path_base,
GetType() );
335 if ( !
GetGame().ConfigIsExisting(path_base) )
337 component_name = GetDisplayName();
338 GetGame().FormatRawConfigStringKeys(component_name);
339 m_DamageDisplayNameMap.Insert(
"".Hash(), component_name );
344 GetDamageZones( zone_names );
346 for (
int i = 0; i < zone_names.Count(); i++ )
348 path =
string.Format(
"%1 %2 displayName", path_base, zone_names[i] );
352 GetGame().FormatRawConfigStringKeys(component_name);
353 m_DamageDisplayNameMap.Insert( zone_names[i].Hash(), component_name );
359 protected float ConvertNonlethalDamage(
float damage,
DamageType damageType)
365 float ConvertNonlethalDamage(
float damage)
372 return m_DamageZoneMap;
377 return m_DamageDisplayNameMap;
381 bool CanDisplayWeight()
383 return m_CanDisplayWeight;
387 void Log(
string msg,
string fnc_name =
"n/a")
389 Debug.Log(msg,
"Object",
"n/a", fnc_name, this.
GetType());
393 void LogWarning(
string msg,
string fnc_name =
"n/a")
395 Debug.LogWarning(msg,
"Object",
"n/a", fnc_name, this.
GetType());
399 void LogError(
string msg,
string fnc_name =
"n/a")
401 Debug.LogError(msg,
"Object",
"n/a", fnc_name, this.
GetType());
407 return GetCompBS() && GetCompBS().IsSkinned();
413 GetCompBS().SetAsSkinned();
416 bool CanBeSkinnedWith(
EntityAI tool)
418 if ( !IsSkinned() && tool )
439 bool CanIgniteItem(
EntityAI ignite_target = NULL)
448 return m_EM.IsWorking();
458 bool IsBasebuildingKit()
464 bool PlacementCanBeRotated()
470 void OnIgnitedTarget(
EntityAI target_item)
482 void OnIgnitedTargetFailed(
EntityAI target_item)
488 void OnIgnitedThisFailed(
EntityAI fire_source)
494 bool IsTargetIgnitionSuccessful(
EntityAI item_target)
500 bool IsThisIgnitionSuccessful(
EntityAI item_source = NULL)
508 void OnHologramBeingPlaced(Man player);
518 string CanBePlacedFailMessage( Man player,
vector position )
530 float HeightCheckOverride()
536 float HeightStartCheckOverride()
544 return (!HasAnyCargo() && GetInventory().AttachmentCount() == 0);
555 CargoBase cargo = GetInventory().GetCargo();
557 if(!cargo)
return false;
559 if( cargo.GetItemCount() > 0 )
571 return m_AttachmentsWithCargo;
576 return m_AttachmentsWithAttachments;
585 override bool IsEntityAI() {
return true; }
587 bool IsInventoryVisible()
589 return !(
GetParent() || GetHierarchyParent() );
607 bool IsZombieMilitary()
612 bool IsIgnoredByConstruction()
619 if (ai && ai.IsBeingBackstabbed())
629 bool CanBeBackstabbed()
642 override void Delete()
644 m_PendingDelete =
true;
648 void DeleteOnClient()
656 if (GetHierarchyRootPlayer() ==
null)
663 GetHierarchyRootPlayer().JunctureDeleteItem(
this);
665 GetHierarchyRootPlayer().AddItemToDelete(
this);
675 bool IsSetForDeletion()
677 return IsPreparedToDelete() || m_PendingDelete || ToDelete() ||
IsPendingDeletion();
682 if (super.CanBeActionTarget())
684 return !IsSetForDeletion();
692 void SetPrepareToDelete()
694 m_PreparedToDelete =
true;
697 bool IsPreparedToDelete()
699 return m_PreparedToDelete;
703 void CheckForDestroy()
720 Debug.Log(
"TryDelete - not ready for deletion");
724 if (
GetGame().HasInventoryJunctureItem(
this))
726 Debug.Log(
"TryDelete - deferred call");
732 Debug.Log(
"TryDelete - OnBeforeTryDelete end");
734 Debug.Log(
"TryDelete - DeleteSafe end");
739 void OnBeforeTryDelete();
742 proto native
EntityAI GetHierarchyRoot();
745 proto native Man GetHierarchyRootPlayer();
748 proto native
EntityAI GetHierarchyParent();
754 int GetHierarchyLevel(
int lvl = 0)
756 if (!GetHierarchyParent())
759 return GetHierarchyParent().GetHierarchyLevel(lvl+1);
762 void OnInventoryInit()
764 InitAttachmentExclusionValues();
772 GetInventory().EEInit();
773 m_AttachmentsWithCargo.Clear();
774 m_AttachmentsWithAttachments.Clear();
775 for (
int i = 0; i < GetInventory().AttachmentCount(); i++ )
777 EntityAI attachment = GetInventory().GetAttachmentFromIndex( i );
780 if ( attachment.GetInventory().GetCargo() )
782 m_AttachmentsWithCargo.Insert( attachment );
785 if ( attachment.GetInventory().GetAttachmentSlotsCount() > 0 )
787 m_AttachmentsWithAttachments.Insert( attachment );
793 MaxLifetimeRefreshCalc();
799 m_PendingDelete =
true;
800 GetInventory().EEDelete(parent);
803 m_EM.OnDeviceDestroyed();
806 override void OnExplosionEffects(
Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
float energyFactor,
float explosionFactor,
bool isWater,
string ammoType)
808 super.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
810 g_Game.GetWorld().AddEnvShootingSource(pos, 1.0);
812 if (m_DestructionBehaviourObj && m_DestructionBehaviourObj.HasExplosionDamage())
814 m_DestructionBehaviourObj.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
825 EntityAI old_owner = oldLoc.GetParent();
826 EntityAI new_owner = newLoc.GetParent();
839 Error(
"EntityAI::EEItemLocationChanged - detached, but old_owner is null");
847 Error(
"EntityAI::EEItemLocationChanged - attached, but new_owner is null");
866 m_LastUpdatedTime = 0.0;
868 if (GetInventory() && newParent ==
null)
870 GetInventory().ResetFlipCargo();
882 EntityAI parent = GetHierarchyParent();
888 parent.OnAttachmentRuined(
this);
894 AttemptDestructionBehaviour(oldLevel,newLevel, zone);
901 void AttemptDestructionBehaviour(
int oldLevel,
int newLevel,
string zone)
909 if (!m_DestructionBehaviourObj)
914 if (m_DestructionBehaviourObj)
916 m_DestructionBehaviourObj.OnHealthLevelChanged(
this, oldLevel, newLevel, zone);
921 ErrorEx(
"Incorrect destruction behaviour type, make sure the class returned in 'GetDestructionBehaviour()' is a valid type inheriting from 'DestructionEffectBase'");
932 if (m_OnKilledInvoker)
933 m_OnKilledInvoker.Invoke(
this, killer);
935 GetGame().GetAnalyticsServer().OnEntityKilled( killer,
this );
961 dead_entity.SetHealth(GetHealth());
973 if (m_OnHitByInvoker)
974 m_OnHitByInvoker.Invoke(
this, damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
990 PropagateExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId),slotId);
993 if ( m_ComponentsBank != NULL )
997 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
999 m_ComponentsBank.GetComponent(comp_key).Event_OnItemAttached(item, slot_name);
1005 if ( m_EM && item.GetCompEM())
1006 m_EM.OnAttachmentAdded(item);
1008 if ( item.GetInventory().GetCargo() )
1009 m_AttachmentsWithCargo.Insert( item );
1011 if ( item.GetInventory().GetAttachmentSlotsCount() > 0 )
1012 m_AttachmentsWithAttachments.Insert( item );
1014 if ( m_OnItemAttached )
1015 m_OnItemAttached.Invoke( item, slot_name,
this );
1018 void SwitchItemSelectionTexture(
EntityAI item,
string slot_name);
1019 void SwitchItemSelectionTextureEx(EItemManipulationContext context,
Param par =
null);
1025 ClearExclusionValueRecursive(item.GetAttachmentExclusionMaskAll(slotId),slotId);
1028 if ( m_ComponentsBank != NULL )
1032 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
1034 m_ComponentsBank.GetComponent(comp_key).Event_OnItemDetached(item, slot_name);
1040 if (m_EM && item.GetCompEM())
1041 m_EM.OnAttachmentRemoved(item);
1043 if ( m_AttachmentsWithCargo.Find( item ) > -1 )
1044 m_AttachmentsWithCargo.RemoveItem( item );
1046 if ( m_AttachmentsWithAttachments.Find( item ) > -1 )
1047 m_AttachmentsWithAttachments.RemoveItem( item );
1050 if ( m_OnItemDetached )
1051 m_OnItemDetached.Invoke( item, slot_name,
this );
1058 if( m_OnItemAddedIntoCargo )
1059 m_OnItemAddedIntoCargo.Invoke( item,
this );
1061 item.OnMovedInsideCargo(
this);
1068 if( m_OnItemRemovedFromCargo )
1069 m_OnItemRemovedFromCargo.Invoke( item,
this );
1071 item.OnRemovedFromCargo(
this);
1076 if( m_OnItemMovedInCargo )
1077 m_OnItemMovedInCargo.Invoke( item,
this );
1078 item.OnMovedWithinCargo(
this);
1083 if( !m_OnItemAttached )
1085 return m_OnItemAttached;
1090 if( !m_OnItemDetached )
1092 return m_OnItemDetached;
1097 if( !m_OnItemAddedIntoCargo )
1099 return m_OnItemAddedIntoCargo;
1104 if( !m_OnItemRemovedFromCargo )
1106 return m_OnItemRemovedFromCargo;
1111 if( !m_OnItemMovedInCargo )
1113 return m_OnItemMovedInCargo;
1118 if( !m_OnItemFlipped )
1120 return m_OnItemFlipped;
1125 if( !m_OnViewIndexChanged )
1127 return m_OnViewIndexChanged;
1139 if( !m_OnReleaseLock )
1141 return m_OnReleaseLock;
1146 if( !m_OnAttachmentSetLock )
1148 return m_OnAttachmentSetLock;
1153 if( !m_OnAttachmentReleaseLock )
1155 return m_OnAttachmentReleaseLock;
1160 if ( !m_OnHitByInvoker )
1162 return m_OnHitByInvoker;
1167 if ( !m_OnKilledInvoker )
1169 return m_OnKilledInvoker;
1177 m_EM.HandleMoveInsideCargo(container);
1181 void OnRemovedFromCargo(
EntityAI container)
1187 void OnMovedWithinCargo(
EntityAI container)
1197 if ( m_EM && m_EM.GetRestorePlugState() )
1199 int b1 = m_EM.GetEnergySourceStorageIDb1();
1200 int b2 = m_EM.GetEnergySourceStorageIDb2();
1201 int b3 = m_EM.GetEnergySourceStorageIDb3();
1202 int b4 = m_EM.GetEnergySourceStorageIDb4();
1205 EntityAI potential_energy_source =
GetGame().GetEntityByPersitentID(b1, b2, b3, b4);
1212 bool is_attachment =
false;
1214 if (potential_energy_source)
1215 is_attachment = GetInventory().HasAttachment(potential_energy_source);
1217 if ( !is_attachment && potential_energy_source )
1218 is_attachment = potential_energy_source.GetInventory().HasAttachment(
this);
1220 if ( potential_energy_source && potential_energy_source.GetCompEM() && !is_attachment )
1221 m_EM.PlugThisInto(potential_energy_source);
1236 void OnBinLoadItemsDropped()
1238 if (GetHierarchyRootPlayer())
1239 GetHierarchyRootPlayer().SetProcessUIWarning(
true);
1243 void HideAllSelections()
1245 string cfg_path =
"cfgVehicles " +
GetType() +
" AnimationSources";
1247 if (
GetGame().ConfigIsExisting(cfg_path) )
1249 int selections =
GetGame().ConfigGetChildrenCount(cfg_path);
1251 for (
int i = 0; i < selections; i++)
1253 string selection_name;
1254 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1255 HideSelection(selection_name);
1261 void ShowAllSelections()
1263 string cfg_path =
"cfgVehicles " +
GetType() +
" AnimationSources";
1265 if (
GetGame().ConfigIsExisting(cfg_path) )
1267 int selections =
GetGame().ConfigGetChildrenCount(cfg_path);
1269 for (
int i = 0; i < selections; i++)
1271 string selection_name;
1272 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
1273 ShowSelection(selection_name);
1287 EntityAI currentAtt = GetInventory().FindAttachment(slotId);
1288 bool hasInternalConflict = attachment.HasInternalExclusionConflicts(slotId);
1291 set<int> diff = attachment.GetAttachmentExclusionMaskAll(slotId);
1292 diff.RemoveItems(currentAtt.GetAttachmentExclusionMaskAll(slotId));
1293 if (diff.Count() == 0)
1295 return !hasInternalConflict;
1299 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(diff,slotId);
1302 return !hasInternalConflict && !IsExclusionFlagPresentRecursive(attachment.GetAttachmentExclusionMaskAll(slotId),slotId);
1329 bool CanSwitchDuringAttach(
EntityAI parent)
1341 if( attachment && attachment.GetInventory() && GetInventory() )
1344 attachment.GetInventory().GetCurrentInventoryLocation( il );
1347 int slot = il.GetSlot();
1348 return !GetInventory().GetSlotLock( slot );
1359 bool CanDetachAttachment (
EntityAI parent)
1369 bool CanCombineAttachment(notnull
EntityAI e,
int slot,
bool stack_max_limit =
false)
1371 EntityAI att = GetInventory().FindAttachment(slot);
1373 return att.CanBeCombined(e,
true, stack_max_limit);
1377 bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false )
1393 if (GetInventory() && GetInventory().GetCargo())
1394 return GetInventory().GetCargo().CanReceiveItemIntoCargo(item));
1429 if (GetInventory() && GetInventory().GetCargo())
1430 return GetInventory().GetCargo().CanSwapItemInCargo(child_entity, new_entity));
1441 bool CanReleaseCargo (
EntityAI cargo)
1485 bool CanReceiveItemIntoHands (
EntityAI item_to_hands)
1500 bool CanSaveItemInHands (
EntityAI item_in_hands)
1522 bool CanReleaseFromHands (
EntityAI handheld)
1544 Debug.LogWarning(
"Obsolete function - use CanDisplayAttachmentSlot with slot id parameter");
1560 bool CanDisplayAnyAttachmentSlot()
1562 int count = GetInventory().GetAttachmentSlotsCount();
1564 for (
int i = 0; i < count; i++)
1566 slotID = GetInventory().GetAttachmentSlotId(i);
1590 return GetInventory().GetCargo() !=
null;
1604 bool CanAssignAttachmentsToQuickbar()
1614 return GetHierarchyRootPlayer() ==
GetGame().GetPlayer();
1625 SetInvisible(
false);
1626 OnInvisibleSet(
false);
1627 SetInvisibleRecursive(
false,parent);
1631 void OnCargoChanged() { }
1639 proto native
void CreateAndInitInventory();
1640 proto native
void DestroyInventory();
1642 int GetSlotsCountCorrect()
1645 return GetInventory().GetAttachmentSlotsCount();
1650 EntityAI FindAttachmentBySlotName(
string slot_name)
1656 return GetInventory().FindAttachment(slot_id);
1664 bool IsLockedInSlot()
1666 EntityAI parent = GetHierarchyParent();
1670 GetInventory().GetCurrentInventoryLocation( inventory_location );
1672 return parent.GetInventory().GetSlotLock( inventory_location.GetSlot() );
1683 if (
GetGame().IsMultiplayer() )
1684 return GetInventory().TakeEntityToInventory(
InventoryMode.JUNCTURE, flags, item);
1686 return GetInventory().TakeEntityToInventory(
InventoryMode.PREDICTIVE, flags, item);
1690 return GetInventory().TakeEntityToInventory(
InventoryMode.LOCAL, flags, item);
1694 return GetInventory().TakeEntityToInventory(
InventoryMode.SERVER, flags, item);
1698 if (
GetGame().IsMultiplayer() )
1699 return GetInventory().TakeEntityToTargetInventory(
InventoryMode.JUNCTURE, target, flags, item);
1701 return GetInventory().TakeEntityToTargetInventory(
InventoryMode.PREDICTIVE, target, flags, item);
1705 return GetInventory().TakeEntityToTargetInventory(
InventoryMode.LOCAL, target, flags, item);
1709 return GetInventory().TakeEntityToTargetInventory(
InventoryMode.SERVER, target, flags, item);
1714 bool PredictiveTakeEntityToCargo (notnull
EntityAI item)
1716 if (
GetGame().IsMultiplayer() )
1717 return GetInventory().TakeEntityToCargo(
InventoryMode.JUNCTURE, item);
1719 return GetInventory().TakeEntityToCargo(
InventoryMode.PREDICTIVE, item);
1721 bool LocalTakeEntityToCargo (notnull
EntityAI item)
1723 return GetInventory().TakeEntityToCargo(
InventoryMode.LOCAL, item);
1725 bool ServerTakeEntityToCargo (notnull
EntityAI item)
1727 return GetInventory().TakeEntityToCargo(
InventoryMode.SERVER, item);
1730 bool PredictiveTakeEntityToTargetCargo (notnull
EntityAI target, notnull
EntityAI item)
1732 if (
GetGame().IsMultiplayer() )
1733 return GetInventory().TakeEntityToTargetCargo(
InventoryMode.JUNCTURE, target, item);
1735 return GetInventory().TakeEntityToTargetCargo(
InventoryMode.PREDICTIVE, target, item);
1737 bool LocalTakeEntityToTargetCargo (notnull
EntityAI target, notnull
EntityAI item)
1739 return GetInventory().TakeEntityToTargetCargo(
InventoryMode.LOCAL, target, item);
1741 bool ServerTakeEntityToTargetCargo (notnull
EntityAI target, notnull
EntityAI item)
1743 return GetInventory().TakeEntityToTargetCargo(
InventoryMode.SERVER, target, item);
1748 bool PredictiveTakeEntityToCargoEx (notnull
EntityAI item,
int idx,
int row,
int col)
1750 if (
GetGame().IsMultiplayer() )
1751 return GetInventory().TakeEntityToCargoEx(
InventoryMode.JUNCTURE, item, idx, row, col);
1753 return GetInventory().TakeEntityToCargoEx(
InventoryMode.PREDICTIVE, item, idx, row, col);
1755 bool LocalTakeEntityToCargoEx (notnull
EntityAI item,
int idx,
int row,
int col)
1757 return GetInventory().TakeEntityToCargoEx(
InventoryMode.LOCAL, item, idx, row, col);
1760 bool PredictiveTakeEntityToTargetCargoEx (notnull
CargoBase cargo, notnull
EntityAI item,
int row,
int col)
1762 if (
GetGame().IsMultiplayer() )
1763 return GetInventory().TakeEntityToTargetCargoEx(
InventoryMode.JUNCTURE, cargo, item, row, col);
1765 return GetInventory().TakeEntityToTargetCargoEx(
InventoryMode.PREDICTIVE, cargo, item, row, col);
1767 bool LocalTakeEntityToTargetCargoEx (notnull
CargoBase cargo, notnull
EntityAI item,
int row,
int col)
1769 return GetInventory().TakeEntityToTargetCargoEx(
InventoryMode.LOCAL, cargo, item, row, col);
1771 bool ServerTakeEntityToTargetCargoEx (notnull
CargoBase cargo, notnull
EntityAI item,
int row,
int col)
1773 return GetInventory().TakeEntityToTargetCargoEx(
InventoryMode.SERVER, cargo, item, row, col);
1778 bool PredictiveTakeEntityAsAttachmentEx (notnull
EntityAI item,
int slot)
1780 if (
GetGame().IsMultiplayer() )
1781 return GetInventory().TakeEntityAsAttachmentEx(
InventoryMode.JUNCTURE, item, slot);
1783 return GetInventory().TakeEntityAsAttachmentEx(
InventoryMode.PREDICTIVE, item, slot);
1785 bool LocalTakeEntityAsAttachmentEx (notnull
EntityAI item,
int slot)
1787 return GetInventory().TakeEntityAsAttachmentEx(
InventoryMode.LOCAL, item, slot);
1789 bool ServerTakeEntityAsAttachmentEx (notnull
EntityAI item,
int slot)
1791 return GetInventory().TakeEntityAsAttachmentEx(
InventoryMode.SERVER, item, slot);
1794 bool PredictiveTakeEntityToTargetAttachmentEx (notnull
EntityAI target, notnull
EntityAI item,
int slot)
1796 if (
GetGame().IsMultiplayer() )
1797 return GetInventory().TakeEntityAsTargetAttachmentEx(
InventoryMode.JUNCTURE, target, item, slot);
1799 return GetInventory().TakeEntityAsTargetAttachmentEx(
InventoryMode.PREDICTIVE, target, item, slot);
1801 bool LocalTakeEntityToTargetAttachmentEx (notnull
EntityAI target, notnull
EntityAI item,
int slot)
1803 return GetInventory().TakeEntityAsTargetAttachmentEx(
InventoryMode.LOCAL, target, item, slot);
1805 bool ServerTakeEntityToTargetAttachmentEx (notnull
EntityAI target, notnull
EntityAI item,
int slot)
1807 return GetInventory().TakeEntityAsTargetAttachmentEx(
InventoryMode.SERVER, target, item, slot);
1810 bool PredictiveTakeEntityToTargetAttachment (notnull
EntityAI target, notnull
EntityAI item)
1812 if (
GetGame().IsMultiplayer() )
1813 return GetInventory().TakeEntityAsTargetAttachment(
InventoryMode.JUNCTURE, target, item);
1815 return GetInventory().TakeEntityAsTargetAttachment(
InventoryMode.PREDICTIVE, target, item);
1817 bool LocalTakeEntityToTargetAttachment (notnull
EntityAI target, notnull
EntityAI item)
1819 return GetInventory().TakeEntityAsTargetAttachment(
InventoryMode.LOCAL, target, item);
1821 bool ServerTakeEntityToTargetAttachment (notnull
EntityAI target, notnull
EntityAI item)
1823 return GetInventory().TakeEntityAsTargetAttachment(
InventoryMode.SERVER, target, item);
1828 if (
GetGame().IsMultiplayer() )
1829 return GetInventory().TakeToDst(
InventoryMode.JUNCTURE, src, dst);
1831 return GetInventory().TakeToDst(
InventoryMode.PREDICTIVE, src, dst);
1835 return GetInventory().TakeToDst(
InventoryMode.LOCAL, src, dst);
1839 return GetInventory().TakeToDst(
InventoryMode.SERVER, src, dst);
1845 bool PredictiveTakeEntityAsAttachment(notnull
EntityAI item)
1847 if (
GetGame().IsMultiplayer())
1848 return GetInventory().TakeEntityAsAttachment(
InventoryMode.JUNCTURE, item);
1850 return GetInventory().TakeEntityAsAttachment(
InventoryMode.PREDICTIVE, item);
1852 bool LocalTakeEntityAsAttachment (notnull
EntityAI item)
1854 return GetInventory().TakeEntityAsAttachment(
InventoryMode.LOCAL, item);
1856 bool ServerTakeEntityAsAttachment (notnull
EntityAI item)
1858 return GetInventory().TakeEntityAsAttachment(
InventoryMode.SERVER, item);
1861 bool PredictiveDropEntity(notnull
EntityAI item)
1866 bool LocalDropEntity(notnull
EntityAI item)
1871 bool ServerDropEntity(notnull
EntityAI item)
1879 EntityAI GetAttachmentByType(
typename type)
1881 for (
int i = 0; i < GetInventory().AttachmentCount(); i++ )
1883 EntityAI attachment = GetInventory().GetAttachmentFromIndex( i );
1884 if ( attachment && attachment.IsInherited( type ) )
1893 EntityAI GetAttachmentByConfigTypeName(
string type)
1895 for (
int i = 0; i < GetInventory().AttachmentCount(); i++ )
1897 EntityAI attachment = GetInventory().GetAttachmentFromIndex ( i );
1898 if ( attachment.IsKindOf ( type ) )
1906 bool CanDropEntity(notnull
EntityAI item)
1915 EntityAI res = inv.CreateInInventory(object_name);
1922 return SpawnEntityOnGroundPos(object_name, pos);
1931 Math3D.MatrixIdentity4(mat);
1933 il.SetGround(NULL, mat);
1941 il.SetGround(NULL, mat);
1954 void SetWet(
float value,
bool allow_client =
false);
1955 void AddWet(
float value);
2064 return m_HiddenSelectionsData;
2068 int GetHiddenSelectionIndex(
string selection )
2070 if (m_HiddenSelectionsData)
2071 return m_HiddenSelectionsData.GetHiddenSelectionIndex( selection );
2079 if (m_HiddenSelectionsData)
2080 return m_HiddenSelectionsData.m_HiddenSelections;
2082 return super.GetHiddenSelections();
2088 if (m_HiddenSelectionsData)
2089 return m_HiddenSelectionsData.m_HiddenSelectionsTextures;
2091 return super.GetHiddenSelectionsTextures();
2097 if (m_HiddenSelectionsData)
2098 return m_HiddenSelectionsData.m_HiddenSelectionsMaterials;
2100 return super.GetHiddenSelectionsMaterials();
2114 proto native
void PlaceOnSurfaceRotated(out
vector trans[4],
vector pos,
float dx = 0,
float dz = 0,
float fAngle = 0,
bool align =
false);
2122 proto native
void RegisterNetSyncVariableBool(
string variableName);
2130 proto native
void RegisterNetSyncVariableBoolSignal(
string variableName);
2140 proto native
void RegisterNetSyncVariableInt(
string variableName,
int minValue = 0,
int maxValue = 0);
2151 proto native
void RegisterNetSyncVariableFloat(
string variableName,
float minValue = 0,
float maxValue = 0,
int precision = 1);
2159 proto native
void RegisterNetSyncVariableObject(
string variableName);
2161 proto native
void UpdateNetSyncVariableInt(
string variableName,
float minValue = 0,
float maxValue = 0);
2162 proto native
void UpdateNetSyncVariableFloat(
string variableName,
float minValue = 0,
float maxValue = 0,
int precision = 1);
2164 proto native
void SwitchLight(
bool isOn);
2167 proto native
void SetSimpleHiddenSelectionState(
int index,
bool state);
2168 proto native
bool IsSimpleHiddenSelectionVisible(
int index);
2171 proto native
void SetObjectTexture(
int index,
string texture_name);
2172 proto native owned
string GetObjectTexture(
int index);
2174 proto native
void SetObjectMaterial(
int index,
string mat_name);
2175 proto native owned
string GetObjectMaterial(
int index);
2177 proto native
bool IsPilotLight();
2178 proto native
void SetPilotLight(
bool isOn);
2203 ctx.Write( m_EM.GetEnergy() );
2206 ctx.Write( m_EM.IsPassive() );
2209 ctx.Write( m_EM.IsSwitchedOn() );
2212 ctx.Write( m_EM.IsPlugged() );
2216 EntityAI energy_source = m_EM.GetEnergySource();
2224 energy_source.GetPersistentID(b1, b2, b3, b4);
2266 if ( !ctx.Read( f_energy ) )
2268 m_EM.SetEnergy(f_energy);
2271 bool b_is_passive =
false;
2272 if ( !ctx.Read( b_is_passive ) )
2274 m_EM.SetPassiveState(b_is_passive);
2277 bool b_is_on =
false;
2278 if ( !ctx.Read( b_is_on ) )
2285 bool b_is_plugged =
false;
2286 if ( !ctx.Read( b_is_plugged ) )
2290 if ( version <= 103 )
2293 int i_energy_source_ID_low = 0;
2294 if ( !ctx.Read( i_energy_source_ID_low ) )
2298 int i_energy_source_ID_high = 0;
2299 if ( !ctx.Read( i_energy_source_ID_high ) )
2309 if ( !ctx.Read(b1) )
return false;
2310 if ( !ctx.Read(b2) )
return false;
2311 if ( !ctx.Read(b3) )
return false;
2312 if ( !ctx.Read(b4) )
return false;
2317 m_EM.StoreEnergySourceIDs( b1, b2, b3, b4 );
2318 m_EM.RestorePlugState(
true);
2331 proto native
void SetSynchDirty();
2340 if (
GetGame().IsMultiplayer() )
2342 bool is_on = m_EM.IsSwitchedOn();
2344 if (is_on != m_EM.GetPreviousSwitchState())
2352 int id_low = m_EM.GetEnergySourceNetworkIDLow();
2353 int id_High = m_EM.GetEnergySourceNetworkIDHigh();
2363 string object = energy_source.GetType();
2364 Error(
"Synchronization error! Object " +
object +
" has no instance of the Energy Manager component!");
2367 m_EM.PlugThisInto(energy_source);
2375 m_EM.DeviceUpdate();
2376 m_EM.StartUpdates();
2385 if ( m_ComponentsBank != NULL )
2389 if ( m_ComponentsBank.IsComponentAlreadyExist(comp_key) )
2391 m_ComponentsBank.GetComponent(comp_key).Event_OnFrame(other, timeSlice);
2399 string text =
string.Empty;
2401 text +=
"Weight: " + GetWeightEx() +
"\n";
2402 text +=
"Disabled: " + GetIsSimulationDisabled() +
"\n";
2404 if (GetEconomyProfile())
2405 text +=
"CE Lifetime default: " + (
int)GetEconomyProfile().GetLifetime() +
"\n";
2406 text +=
"CE Lifetime remaining: " + (
int)GetLifetime() +
"\n";
2412 text +=
"Energy Source: " +
Object.GetDebugName(compEM.GetEnergySource()) +
"\n";
2413 text +=
"Switched On: " + compEM.IsSwitchedOn() +
"\n";
2414 text +=
"Is Working: " + compEM.IsWorking() +
"\n";
2421 void GetDebugButtonNames(out
string button1, out
string button2, out
string button3, out
string button4){}
2422 void OnDebugButtonPressClient(
int button_index){}
2423 void OnDebugButtonPressServer(
int button_index){}
2426 Shape DebugBBoxDraw()
2431 void DebugBBoxSetColor(
int color)
2436 void DebugBBoxDelete()
2441 Shape DebugDirectionDraw(
float distance = 1)
2446 void DebugDirectionSetColor(
int color)
2451 void DebugDirectionDelete()
2457 void HideSelection(
string selection_name )
2461 SetAnimationPhase ( selection_name, 1 );
2466 void ShowSelection(
string selection_name )
2470 SetAnimationPhase ( selection_name, 0 );
2476 proto
void GetPersistentID( out
int b1, out
int b2, out
int b3, out
int b4 );
2479 proto native
void SetLifetime(
float fLifeTime );
2481 proto native
float GetLifetime();
2483 proto native
void IncreaseLifetime();
2486 proto native
void SetLifetimeMax(
float fLifeTime );
2488 proto native
float GetLifetimeMax();
2491 void IncreaseLifetimeUp()
2494 if (GetHierarchyParent())
2495 GetHierarchyParent().IncreaseLifetimeUp();
2522 bool HasEnergyManager()
2533 void OnWork(
float consumed_energy ) {}
2539 void OnSwitchOn() {}
2542 void OnSwitchOff() {}
2545 void OnIsPlugged(
EntityAI source_device) {}
2548 void OnIsUnplugged(
EntityAI last_energy_source ) {}
2551 void OnOwnSocketTaken(
EntityAI device ) {}
2554 void OnOwnSocketReleased(
EntityAI device ) {}
2557 void OnInitEnergy() {}
2568 super.OnRPC(sender, rpc_type, ctx);
2575 case ERPCs.RPC_BS_SKINNED_STATE:
2577 Param1<bool> p_skinned_state=
new Param1<bool>(
false);
2578 if (ctx.Read(p_skinned_state))
2580 float state = p_skinned_state.param1;
2581 if (state && GetCompBS())
2582 GetCompBS().SetAsSkinnedClient();
2587 case ERPCs.RPC_EXPLODE_EVENT:
2596 #ifdef DIAG_DEVELOPER
2606 int AttachmentsCount = GetInventory().AttachmentCount();
2607 if (AttachmentsCount > 0)
2609 for (i = 0; i < AttachmentsCount; i++)
2611 GetInventory().GetAttachmentFromIndex(i).FixEntity();
2615 CargoBase cargo = GetInventory().GetCargo();
2618 int cargoCount = cargo.GetItemCount();
2619 for (i = 0; i < cargoCount; i++)
2621 cargo.GetItem(i).FixEntity();
2628 float GetWetWeightModifier()
2633 float GetConfigWeightModified()
2635 return m_ConfigWeight * GetWetWeightModifier();
2639 string GetConfigWeightModifiedDebugText()
2641 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
2643 return "(" + m_ConfigWeight +
"(config weight) * " + GetWetWeightModifier() +
"(Wetness Modifier))";
2645 return string.Empty;
2653 return GetWeightEx();
2656 void ClearWeightDirty()
2662 void SetWeightDirty()
2665 if (WeightDebug.m_VerbosityFlags & WeightDebugType.SET_DIRTY_FLAG)
2667 Print(
"---------------------------------------");
2668 Print(
"ent:" +
this +
" - SetWeightDirty");
2669 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
2673 Print(
"---------------------------------------");
2677 if (GetHierarchyParent())
2679 GetHierarchyParent().SetWeightDirty();
2683 float GetInventoryAndCargoWeight(
bool forceRecalc =
false)
2689 int AttachmentsCount = GetInventory().AttachmentCount();
2690 if (AttachmentsCount > 0)
2692 for (i = 0; i < AttachmentsCount; i++)
2694 totalWeight += GetInventory().GetAttachmentFromIndex(i).GetWeightEx(forceRecalc);
2698 CargoBase cargo = GetInventory().GetCargo();
2701 int cargoCount = cargo.GetItemCount();
2702 for (i = 0; i < cargoCount; i++)
2704 totalWeight += cargo.GetItem(i).GetWeightEx(forceRecalc);
2713 return GetInventoryAndCargoWeight(forceRecalc);
2718 float GetWeightEx(
bool forceRecalc =
false)
2720 if (m_WeightDirty || forceRecalc)
2726 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
2728 WeightDebug.GetWeightDebug(
this).SetWeight(m_WeightEx);
2730 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_DIRTY)
2732 Print(
"ent:" +
this +
" - Dirty Recalc");
2733 if (WeightDebug.m_VerbosityFlags & WeightDebugType.DUMP_STACK)
2744 void UpdateWeight(WeightUpdateType updateType = WeightUpdateType.FULL,
float weightAdjustment = 0);
2748 void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2761 if (action_id ==
EActions.FIX_ENTITY)
2763 #ifdef DIAG_DEVELOPER
2767 else if (action_id ==
EActions.GET_TOTAL_WEIGHT)
2769 WeightDebug.ClearWeightDebug();
2771 Debug.Log(
"======================== "+
GetType() +
" =================================");
2775 Debug.Log(
"----------------------------------------------------------------------------------------------");
2777 else if (action_id ==
EActions.GET_TOTAL_WEIGHT_RECALC)
2779 WeightDebug.ClearWeightDebug();
2780 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2782 Debug.Log(
"======================== "+
GetType() +
" RECALC ===========================");
2786 WeightDebug.PrintAll(
this);
2787 Debug.Log(
"----------------------------------------------------------------------------------------------");
2788 WeightDebug.SetVerbosityFlags(0);
2790 else if (action_id ==
EActions.GET_PLAYER_WEIGHT)
2792 WeightDebug.ClearWeightDebug();
2794 Debug.Log(
"======================== PLAYER: "+player+
" ===========================");
2796 Debug.Log(
"New overall weight Player:"+player.GetWeightEx().ToString());
2798 Debug.Log(
"----------------------------------------------------------------------------------------------");
2800 else if (action_id ==
EActions.GET_PLAYER_WEIGHT_RECALC)
2802 WeightDebug.ClearWeightDebug();
2803 WeightDebug.SetVerbosityFlags(WeightDebugType.RECALC_FORCED);
2805 Debug.Log(
"======================== PLAYER RECALC: "+player+
" ===========================");
2807 Debug.Log(
"New overall weight Player:"+player.GetWeightEx(
true).ToString());
2808 WeightDebug.PrintAll(player);
2809 Debug.Log(
"----------------------------------------------------------------------------------------------");
2810 WeightDebug.SetVerbosityFlags(0);
2818 int m_ViewIndex = 0;
2821 void SetViewIndex(
int index )
2823 m_ViewIndex = index;
2834 if ( MemoryPointExists(
"invView2" ) )
2836 #ifdef PLATFORM_WINDOWS
2838 GetInventory().GetCurrentInventoryLocation( il );
2869 #ifdef PLATFORM_CONSOLE
2880 Debug.LogError(
"EntityAI: HitComponentForAI not set properly for that entity (" +
GetType() +
")");
2888 Debug.LogError(
"EntityAI: DefaultHitComponent not set properly for that entity (" +
GetType() +
")");
2896 Debug.LogError(
"EntityAI: DefaultHitPositionComponent not set for that entity (" +
GetType() +
")");
2902 Debug.LogError(
"EntityAI: SuitableFinisherHitComponents not set for that entity (" +
GetType() +
")");
2908 Debug.LogError(
"EntityAI: DefaultHitPosition not set for that entity (" +
GetType() +
")");
2913 int GetMeleeTargetType()
2959 float currentTime =
GetGame().GetTickTime();
2960 if (m_LastUpdatedTime == 0)
2961 m_LastUpdatedTime = currentTime;
2963 m_ElapsedSinceLastUpdate = currentTime - m_LastUpdatedTime;
2964 m_LastUpdatedTime = currentTime;
2967 void OnDebugSpawnEx(DebugSpawnParams params)
2975 ConfigGetTextArray(
"Attachments", slots);
2978 ConfigGetTextArray(
"magazines", mags);
2992 int consumable_count;
2994 for (
int i = 0; i < all_paths.Count(); i++)
2996 config_path = all_paths.Get(i);
2997 int children_count =
GetGame().ConfigGetChildrenCount(config_path);
2999 for (
int x = 0;
x < children_count;
x++)
3001 GetGame().ConfigGetChildName(config_path,
x, child_name);
3002 path = config_path +
" " + child_name;
3003 scope =
GetGame().ConfigGetInt( config_path +
" " + child_name +
" scope" );
3004 bool should_check = 1;
3005 if ( config_path ==
"CfgVehicles" && scope == 0)
3013 GetGame().ConfigGetText( config_path +
" " + child_name +
" inventorySlot",inv_slot );
3014 for (
int z = 0; z < slots.Count(); z++)
3016 if (slots.Get(z) == inv_slot)
3018 this.GetInventory().CreateInInventory( child_name );
3028 override EntityAI ProcessMeleeItemDamage(
int mode = 0)
3046 void ProcessInvulnerabilityCheck(
string servercfg_param)
3050 int invulnerability;
3051 switch (servercfg_param)
3053 case "disableContainerDamage":
3057 case "disableBaseDamage":
3062 if (invulnerability > 0)
3064 SetAllowDamage(
false);
3069 void SetBayonetAttached(
bool pState,
int slot_idx = -1) {};
3070 bool HasBayonetAttached() {};
3071 int GetBayonetAttachmentIdx() {};
3073 void SetButtstockAttached(
bool pState,
int slot_idx = -1) {};
3074 bool HasButtstockAttached() {};
3075 int GetButtstockAttachmentIdx() {};
3077 void SetInvisibleRecursive(
bool invisible,
EntityAI parent =
null,
array<int> attachments =
null)
3082 attachmentsArray.Copy(attachments);
3085 for (
int i = 0; i < GetInventory().GetAttachmentSlotsCount(); i++)
3087 attachmentsArray.Insert(GetInventory().GetAttachmentSlotId(i));
3093 foreach(
int slot : attachmentsArray )
3096 item = parent.GetInventory().FindAttachment(slot);
3102 if( item.GetInventory().AttachmentCount() > 0 )
3104 for(i = 0; i < item.GetInventory().GetAttachmentSlotsCount(); i++)
3106 childrenAtt.Insert(item.GetInventory().GetAttachmentSlotId(i));
3109 SetInvisibleRecursive(invisible,item,childrenAtt);
3112 item.SetInvisible(invisible);
3113 item.OnInvisibleSet(invisible);
3118 void SoundHardTreeFallingPlay()
3121 sound.SetAutodestroy(
true );
3124 void SoundSoftTreeFallingPlay()
3127 sound.SetAutodestroy(
true );
3130 void SoundHardBushFallingPlay()
3133 sound.SetAutodestroy(
true );
3136 void SoundSoftBushFallingPlay()
3139 sound.SetAutodestroy(
true );
3142 void RegisterTransportHit(
Transport transport)
3144 if (!m_TransportHitRegistered)
3146 m_TransportHitRegistered =
true;
3153 if (Car.CastTo(car, transport))
3155 if (car.GetSpeedometerAbsolute() > 2 )
3157 damage = m_TransportHitVelocity.Length();
3158 ProcessDirectDamage(DT_CUSTOM, transport,
"",
"TransportHit",
"0 0 0", damage);
3162 m_TransportHitRegistered =
false;
3168 impulse = 40 * m_TransportHitVelocity;
3169 impulse[1] = 40 * 1.5;
3176 if (m_TransportHitVelocity.Length() > 0.1)
3178 damage = m_TransportHitVelocity.Length();
3179 ProcessDirectDamage(DT_CUSTOM, transport,
"",
"TransportHit",
"0 0 0", damage);
3183 m_TransportHitRegistered =
false;
3189 impulse = 40 * m_TransportHitVelocity;
3190 impulse[1] = 40 * 1.5;
3203 bool TranslateSlotFromSelection(
string selection_name, out
int slot_id)
3209 bool IsUniversalTemperatureSource()
3211 return GetUniversalTemperatureSource() !=
null && GetUniversalTemperatureSource().IsActive();
3214 UTemperatureSource GetUniversalTemperatureSource()
3216 return m_UniversalTemperatureSource;
3219 void SetUniversalTemperatureSource(UTemperatureSource uts)
3221 m_UniversalTemperatureSource = uts;
3224 vector GetUniversalTemperatureSourcePosition()
3238 void SetPersistentPairID(
int id)
3243 raib.SetPersistentPairID(
id);
3251 void ExecuteActionsConnectedToValve(
int pValveIndex);
3256 private void InitAttachmentExclusionValues()
3259 m_AttachmentExclusionMaskGlobal =
new set<int>;
3260 m_AttachmentExclusionMaskChildren =
new set<int>();
3262 int count = GetInventory().GetSlotIdCount();
3267 InitInherentSlotExclusionMap();
3268 InitGlobalExclusionValues();
3269 InitLegacyConfigExclusionValues();
3273 private void InitInherentSlotExclusionMap()
3275 int count = GetInventory().GetSlotIdCount();
3280 for (
int i = 0; i < count; i++)
3282 slotId = GetInventory().GetSlotId(i);
3283 SetAttachmentExclusionMaskSlot(slotId,GetAttachmentExclusionInitSlotValue(slotId));
3288 protected set<int> GetAttachmentExclusionInitSlotValue(
int slotId)
3290 set<int> dflt =
new set<int>;
3295 protected void InitLegacyConfigExclusionValues()
3297 bool performLegacyInit = InitLegacyExclusionCheck();
3300 InitLegacySlotExclusionValuesImplicit();
3302 if (performLegacyInit)
3303 InitLegacySlotExclusionValuesDerived();
3307 protected bool InitLegacyExclusionCheck()
3310 if (m_AttachmentExclusionMaskGlobal.Count() > 0)
3314 int count = m_AttachmentExclusionSlotMap.Count();
3317 for (
int i = 0; i < count; i++)
3319 int countSet = m_AttachmentExclusionSlotMap.GetElement(i).Count();
3335 protected void InitLegacySlotExclusionValuesImplicit()
3338 int slotCount = GetInventory().GetSlotIdCount();
3339 for (
int i = 0; i < slotCount; i++)
3341 slotId = GetInventory().GetSlotId(i);
3348 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3349 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
3350 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
3351 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
3352 SetAttachmentExclusionMaskSlot(slotId,tmp);
3359 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3360 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
3361 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
3362 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
3363 SetAttachmentExclusionMaskSlot(slotId,tmp);
3370 tmp.Copy(GetAttachmentExclusionInitSlotValue(slotId));
3371 if (ConfigGetBool(
"isStrap"))
3373 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
3374 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
3378 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
3379 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
3381 SetAttachmentExclusionMaskSlot(slotId,tmp);
3388 protected void InitLegacySlotExclusionValuesDerived()
3391 int slotCount = GetInventory().GetSlotIdCount();
3392 for (
int i = 0; i < slotCount; i++)
3394 slotId = GetInventory().GetSlotId(i);
3401 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3402 if (ConfigGetBool(
"noNVStrap"))
3404 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_HEADGEAR);
3406 if (ConfigGetBool(
"noMask"))
3408 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADGEAR);
3410 if (ConfigGetBool(
"noEyewear"))
3412 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_HEADGEAR);
3414 SetAttachmentExclusionMaskSlot(slotId,tmp);
3421 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3422 if (ConfigGetBool(
"noNVStrap"))
3424 tmp.Insert(EAttExclusions.LEGACY_HEADSTRAP_MASK);
3426 if (ConfigGetBool(
"noHelmet"))
3428 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_MASK);
3430 if (ConfigGetBool(
"noEyewear"))
3432 tmp.Insert(EAttExclusions.LEGACY_EYEWEAR_MASK);
3434 SetAttachmentExclusionMaskSlot(slotId,tmp);
3441 tmp.Copy(GetAttachmentExclusionMaskSlot(slotId));
3442 if (ConfigGetBool(
"isStrap"))
3444 if (ConfigGetBool(
"noHelmet"))
3446 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_HEADSTRAP);
3448 if (ConfigGetBool(
"noMask"))
3450 tmp.Insert(EAttExclusions.LEGACY_MASK_HEADSTRAP);
3455 if (ConfigGetBool(
"noHelmet"))
3457 tmp.Insert(EAttExclusions.LEGACY_HEADGEAR_EYEWEWEAR);
3459 if (ConfigGetBool(
"noMask"))
3461 tmp.Insert(EAttExclusions.LEGACY_MASK_EYEWEWEAR);
3464 SetAttachmentExclusionMaskSlot(slotId,tmp);
3472 protected void InitGlobalExclusionValues();
3475 protected void AddSingleExclusionValueGlobal(EAttExclusions value)
3477 if (m_AttachmentExclusionMaskGlobal.Find(value) == -1)
3478 m_AttachmentExclusionMaskGlobal.Insert(value);
3482 protected void ClearSingleExclusionValueGlobal(EAttExclusions value)
3484 int idx = m_AttachmentExclusionMaskGlobal.Find(value);
3486 m_AttachmentExclusionMaskGlobal.Remove(idx);
3489 protected void SetAttachmentExclusionMaskGlobal(set<int> values)
3491 m_AttachmentExclusionMaskGlobal.Clear();
3492 m_AttachmentExclusionMaskGlobal.Copy(values);
3496 protected void SetAttachmentExclusionMaskSlot(
int slotId, set<int> values)
3498 if (m_AttachmentExclusionSlotMap)
3500 m_AttachmentExclusionSlotMap.Set(slotId,values);
3503 ErrorEx(
"m_AttachmentExclusionSlotMap not available! Fill the 'inventorySlot[]' in the " +
this +
" config file.");
3506 private void PropagateExclusionValueRecursive(set<int> values,
int slotId)
3508 if (values && values.Count() != 0)
3512 GetInventory().GetCurrentInventoryLocation(lcn);
3513 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
3515 m_AttachmentExclusionMaskChildren.InsertSet(passThis);
3516 EntityAI parent = GetHierarchyParent();
3518 parent.PropagateExclusionValueRecursive(passThis,lcn.GetSlot());
3523 private void ClearExclusionValueRecursive(set<int> values,
int slotId)
3525 if (values && values.Count() != 0)
3529 GetInventory().GetCurrentInventoryLocation(lcn);
3530 if (CheckExclusionAccessPropagation(lcn.GetSlot(), slotId, values, passThis))
3532 int count = passThis.Count();
3533 for (
int i = 0; i < count; i++)
3535 m_AttachmentExclusionMaskChildren.RemoveItem(passThis[i]);
3537 EntityAI parent = GetHierarchyParent();
3539 parent.ClearExclusionValueRecursive(passThis,lcn.GetSlot());
3545 set<int> GetAttachmentExclusionMaskAll(
int slotId)
3547 set<int> values =
new set<int>();
3548 set<int> slotValues = GetAttachmentExclusionMaskSlot(slotId);
3550 values.InsertSet(slotValues);
3551 values.InsertSet(m_AttachmentExclusionMaskGlobal);
3552 values.InsertSet(m_AttachmentExclusionMaskChildren);
3558 set<int> GetAttachmentExclusionMaskSlot(
int slotId)
3560 return m_AttachmentExclusionSlotMap.Get(slotId);
3564 set<int> GetAttachmentExclusionMaskGlobal()
3566 return m_AttachmentExclusionMaskGlobal;
3570 set<int> GetAttachmentExclusionMaskChildren()
3572 return m_AttachmentExclusionMaskChildren;
3576 private bool HasInternalExclusionConflicts(
int targetSlot)
3578 set<int> targetSlotValues = GetAttachmentExclusionMaskSlot(targetSlot);
3579 if (targetSlotValues)
3581 set<int> additionalValues =
new set<int>();
3582 additionalValues.InsertSet(GetAttachmentExclusionMaskGlobal());
3583 additionalValues.InsertSet(GetAttachmentExclusionMaskChildren());
3585 int countTarget = targetSlotValues.Count();
3586 for (
int i = 0; i < countTarget; i++)
3588 if (additionalValues.Find(targetSlotValues[i]) != -1)
3598 protected bool IsExclusionFlagPresent(set<int> values)
3602 GetInventory().GetCurrentAttachmentSlotInfo(slotId,
slotName);
3604 set<int> currentSlotValuesAll = GetAttachmentExclusionMaskAll(slotId);
3605 int count = values.Count();
3606 for (
int i = 0; i < count; i++)
3608 if (currentSlotValuesAll.Find(values[i]) != -1)
3615 protected bool IsExclusionFlagPresentRecursive(set<int> values,
int targetSlot)
3617 if (values && values.Count() != 0)
3620 GetInventory().GetCurrentInventoryLocation(lcn);
3621 EntityAI parent = GetHierarchyParent();
3623 if (CheckExclusionAccessCondition(lcn.GetSlot(),targetSlot, values, passThis))
3625 if (parent && parent !=
this)
3627 return parent.IsExclusionFlagPresentRecursive(passThis,lcn.GetSlot());
3630 return IsExclusionFlagPresent(passThis);
3637 protected bool CheckExclusionAccessCondition(
int occupiedSlot,
int targetSlot, set<int> value, inout set<int> adjustedValue)
3642 if (occupiedException)
3644 adjustedValue = value;
3648 if (targetException)
3650 adjustedValue =
null;
3654 AdjustExclusionAccessCondition(occupiedSlot,targetSlot,value,adjustedValue);
3655 return adjustedValue.Count() != 0;
3659 protected void AdjustExclusionAccessCondition(
int occupiedSlot,
int testedSlot, set<int> value, inout set<int> adjustedValue)
3661 adjustedValue = value;
3665 protected bool CheckExclusionAccessPropagation(
int occupiedSlot,
int targetSlot, set<int> value, inout set<int> adjustedValue)
3670 if (targetException)
3672 adjustedValue =
null;
3676 AdjustExclusionAccessPropagation(occupiedSlot,targetSlot,value,adjustedValue);
3677 return adjustedValue.Count() != 0;
3681 protected void AdjustExclusionAccessPropagation(
int occupiedSlot,
int testedSlot, set<int> value, inout set<int> adjustedValue)
3683 AdjustExclusionAccessCondition(occupiedSlot,testedSlot,value,adjustedValue);
3704 void SetDebugDeveloper_item(
Object entity)
3707 entity.SetDebugItem();