DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnCreatePhysics()

override void SpawnItemOnLocation::OnCreatePhysics ( )
private

См. определение в файле ItemBase.c строка 5973

5977{
5978 override bool CanPutAsAttachment(EntityAI parent)
5979 {
5980 return true;
5981 }
5982};
5983
5984//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5985
5986class ItemBase extends InventoryItem
5987{
5991
5993
5994 static int m_DebugActionsMask;
5996 // ============================================
5997 // Variable Manipulation System
5998 // ============================================
5999 // Quantity
6000
6001 float m_VarQuantity;
6002 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
6004 int m_VarQuantityMin;
6005 int m_VarQuantityMax;
6006 int m_Count;
6007 float m_VarStackMax;
6008 float m_StoreLoadedQuantity = float.LOWEST;
6009 // Wet
6010 float m_VarWet;
6011 float m_VarWetPrev;//for client to know wetness changed during synchronization
6012 float m_VarWetInit;
6013 float m_VarWetMin;
6014 float m_VarWetMax;
6015 // Cleanness
6016 int m_Cleanness;
6017 int m_CleannessInit;
6018 int m_CleannessMin;
6019 int m_CleannessMax;
6020 // impact sounds
6022 bool m_CanPlayImpactSound = true;
6023 float m_ImpactSpeed;
6025 //
6026 float m_HeatIsolation;
6027 float m_ItemModelLength;
6028 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
6030 int m_VarLiquidType;
6031 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
6032 int m_QuickBarBonus;
6033 bool m_IsBeingPlaced;
6034 bool m_IsHologram;
6035 bool m_IsTakeable;
6036 bool m_ThrowItemOnDrop;
6039 bool m_FixDamageSystemInit = false; //can be changed on storage version check
6040 bool can_this_be_combined; //Check if item can be combined
6041 bool m_CanThisBeSplit; //Check if item can be split
6042 bool m_IsStoreLoad = false;
6043 bool m_CanShowQuantity;
6044 bool m_HasQuantityBar;
6045 protected bool m_CanBeDigged;
6046 protected bool m_IsResultOfSplit
6047
6048 string m_SoundAttType;
6049 // items color variables
6054 //-------------------------------------------------------
6055
6056 // light source managing
6058
6062
6063 //==============================================
6064 // agent system
6065 private int m_AttachedAgents;
6066
6068 void TransferModifiers(PlayerBase reciever);
6069
6070
6071 // Weapons & suppressors particle effects
6076 static int m_LastRegisteredWeaponID = 0;
6077
6078 // Overheating effects
6080 float m_OverheatingShots;
6081 ref Timer m_CheckOverheating;
6082 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
6083 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
6084 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
6085 ref array <ref OverheatingParticle> m_OverheatingParticles;
6086
6088 protected bool m_HideSelectionsBySlot;
6089
6090 // Admin Log
6091 PluginAdminLog m_AdminLog;
6092
6093 // misc
6094 ref Timer m_PhysDropTimer;
6095
6096 // Attachment Locking variables
6097 ref array<int> m_CompatibleLocks;
6098 protected int m_LockType;
6099 protected ref EffectSound m_LockingSound;
6100 protected string m_LockSoundSet;
6101
6102 // ItemSoundHandler
6103 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
6104 protected int m_SoundSyncPlay; // id for sound to play
6105 protected int m_SoundSyncStop; // id for sound to stop
6107
6108 //temperature
6109 private float m_TemperaturePerQuantityWeight;
6110
6111 // -------------------------------------------------------------------------
6112 void ItemBase()
6113 {
6114 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
6118
6119 if (!GetGame().IsDedicatedServer())
6120 {
6121 if (HasMuzzle())
6122 {
6124
6126 {
6128 }
6129 }
6130
6132 m_ActionsInitialize = false;
6133 }
6134
6135 m_OldLocation = null;
6136
6137 if (GetGame().IsServer())
6138 {
6139 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
6140 }
6141
6142 if (ConfigIsExisting("headSelectionsToHide"))
6143 {
6145 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
6146 }
6147
6148 m_HideSelectionsBySlot = false;
6149 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6150 {
6151 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
6152 }
6153
6154 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
6155
6156 m_IsResultOfSplit = false;
6157
6159 }
6160
6161 override void InitItemVariables()
6162 {
6163 super.InitItemVariables();
6164
6165 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
6166 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
6167 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
6168 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
6169 m_VarStackMax = ConfigGetFloat("varStackMax");
6170 m_Count = ConfigGetInt("count");
6171
6172 m_CanShowQuantity = ConfigGetBool("quantityShow");
6173 m_HasQuantityBar = ConfigGetBool("quantityBar");
6174
6175 m_CleannessInit = ConfigGetInt("varCleannessInit");
6177 m_CleannessMin = ConfigGetInt("varCleannessMin");
6178 m_CleannessMax = ConfigGetInt("varCleannessMax");
6179
6180 m_WantPlayImpactSound = false;
6181 m_ImpactSpeed = 0.0;
6182
6183 m_VarWetInit = ConfigGetFloat("varWetInit");
6185 m_VarWetMin = ConfigGetFloat("varWetMin");
6186 m_VarWetMax = ConfigGetFloat("varWetMax");
6187
6188 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
6189 if (IsLiquidContainer() && GetQuantity() != 0)
6191 m_IsBeingPlaced = false;
6192 m_IsHologram = false;
6193 m_IsTakeable = true;
6194 m_CanBeMovedOverride = false;
6198 m_CanBeDigged = ConfigGetBool("canBeDigged");
6199
6200 m_CompatibleLocks = new array<int>();
6201 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
6202 m_LockType = ConfigGetInt("lockType");
6203
6204 //Define if item can be split and set ability to be combined accordingly
6205 m_CanThisBeSplit = false;
6206 can_this_be_combined = false;
6207 if (ConfigIsExisting("canBeSplit"))
6208 {
6209 can_this_be_combined = ConfigGetBool("canBeSplit");
6211 }
6212
6213 m_ItemBehaviour = -1;
6214 if (ConfigIsExisting("itemBehaviour"))
6215 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
6216
6217 //RegisterNetSyncVariableInt("m_VariablesMask");
6218 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6219 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
6220 RegisterNetSyncVariableInt("m_VarLiquidType");
6221 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6222
6223 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6224 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6225 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6226
6227 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6228 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6229 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6230 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6231
6232 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6233 RegisterNetSyncVariableBool("m_IsTakeable");
6234 RegisterNetSyncVariableBool("m_IsHologram");
6235
6236 InitItemSounds();
6238 {
6239 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
6240 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
6241 }
6242
6243 m_LockSoundSet = ConfigGetString("lockSoundSet");
6244
6246 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6247 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
6248
6249 }
6250
6251 override int GetQuickBarBonus()
6252 {
6253 return m_QuickBarBonus;
6254 }
6255
6256 void InitializeActions()
6257 {
6259 if (!m_InputActionMap)
6260 {
6262 m_InputActionMap = iam;
6263 SetActions();
6265 }
6266 }
6267
6268 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
6269 {
6271 {
6272 m_ActionsInitialize = true;
6274 }
6275
6276 actions = m_InputActionMap.Get(action_input_type);
6277 }
6278
6279 void SetActions()
6280 {
6281 AddAction(ActionTakeItem);
6282 AddAction(ActionTakeItemToHands);
6283 AddAction(ActionWorldCraft);
6285 AddAction(ActionAttachWithSwitch);
6286 }
6287
6288 void SetActionAnimOverrides(); // Override action animation for specific item
6289
6290 void AddAction(typename actionName)
6291 {
6292 ActionBase action = ActionManagerBase.GetAction(actionName);
6293
6294 if (!action)
6295 {
6296 Debug.LogError("Action " + actionName + " dosn't exist!");
6297 return;
6298 }
6299
6300 typename ai = action.GetInputType();
6301 if (!ai)
6302 {
6303 m_ActionsInitialize = false;
6304 return;
6305 }
6306
6307 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6308 if (!action_array)
6309 {
6310 action_array = new array<ActionBase_Basic>;
6311 m_InputActionMap.Insert(ai, action_array);
6312 }
6313 if (LogManager.IsActionLogEnable())
6314 {
6315 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
6316 }
6317
6318 if (action_array.Find(action) != -1)
6319 {
6320 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
6321 }
6322 else
6323 {
6324 action_array.Insert(action);
6325 }
6326 }
6327
6328 void RemoveAction(typename actionName)
6329 {
6330 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6331 ActionBase action = player.GetActionManager().GetAction(actionName);
6332 typename ai = action.GetInputType();
6333 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6334
6335 if (action_array)
6336 {
6337 action_array.RemoveItem(action);
6338 }
6339 }
6340
6341 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
6342 // Set -1 for params which should stay in default state
6343 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
6344 {
6345 ActionOverrideData overrideData = new ActionOverrideData();
6346 overrideData.m_CommandUID = commandUID;
6347 overrideData.m_CommandUIDProne = commandUIDProne;
6348 overrideData.m_StanceMask = stanceMask;
6349
6350 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
6351 if (!actionMap) // create new map of action > overidables map
6352 {
6353 actionMap = new TActionAnimOverrideMap();
6354 m_ItemActionOverrides.Insert(action, actionMap);
6355 }
6356
6357 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
6358
6359 }
6360
6361 void OnItemInHandsPlayerSwimStart(PlayerBase player);
6362
6363 ScriptedLightBase GetLight();
6364
6365 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6366 void LoadParticleConfigOnFire(int id)
6367 {
6368 if (!m_OnFireEffect)
6370
6373
6374 string config_to_search = "CfgVehicles";
6375 string muzzle_owner_config;
6376
6377 if (!m_OnFireEffect.Contains(id))
6378 {
6379 if (IsInherited(Weapon))
6380 config_to_search = "CfgWeapons";
6381
6382 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6383
6384 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6385
6386 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
6387
6388 if (config_OnFire_subclass_count > 0)
6389 {
6390 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6391
6392 for (int i = 0; i < config_OnFire_subclass_count; i++)
6393 {
6394 string particle_class = "";
6395 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
6396 string config_OnFire_entry = config_OnFire_class + particle_class;
6397 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6398 WPOF_array.Insert(WPOF);
6399 }
6400
6401
6402 m_OnFireEffect.Insert(id, WPOF_array);
6403 }
6404 }
6405
6406 if (!m_OnBulletCasingEjectEffect.Contains(id))
6407 {
6408 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
6409 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6410
6411 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6412
6413 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6414
6415 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6416 {
6417 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6418
6419 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6420 {
6421 string particle_class2 = "";
6422 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6423 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6424 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6425 WPOBE_array.Insert(WPOBE);
6426 }
6427
6428
6429 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6430 }
6431 }
6432 }
6433
6434 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6436 {
6439
6440 if (!m_OnOverheatingEffect.Contains(id))
6441 {
6442 string config_to_search = "CfgVehicles";
6443
6444 if (IsInherited(Weapon))
6445 config_to_search = "CfgWeapons";
6446
6447 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6448 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6449
6450 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6451 {
6452
6453 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6454
6456 {
6457 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6458 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6459 Error(error);
6460 return;
6461 }
6462
6463 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6464 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6465
6466
6467
6468 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6469 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6470
6471 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6472 {
6473 string particle_class = "";
6474 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6475 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6476 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6477
6478 if (entry_type == CT_CLASS)
6479 {
6480 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6481 WPOOH_array.Insert(WPOF);
6482 }
6483 }
6484
6485
6486 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6487 }
6488 }
6489 }
6490
6491 float GetOverheatingValue()
6492 {
6493 return m_OverheatingShots;
6494 }
6495
6496 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6497 {
6498 if (m_MaxOverheatingValue > 0)
6499 {
6501
6502 if (!m_CheckOverheating)
6504
6506 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6507
6508 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6509 }
6510 }
6511
6512 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6513 {
6515 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6516
6518 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6519
6521 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6522
6524 {
6526 }
6527 }
6528
6530 {
6532 }
6533
6534 void OnOverheatingDecay()
6535 {
6536 if (m_MaxOverheatingValue > 0)
6537 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6538 else
6540
6541 if (m_OverheatingShots <= 0)
6542 {
6545 }
6546 else
6547 {
6548 if (!m_CheckOverheating)
6550
6552 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6553 }
6554
6555 CheckOverheating(this, "", this);
6556 }
6557
6558 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6559 {
6561 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6562 }
6563
6564 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6565 {
6567 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6569 }
6570
6571 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6572 {
6574 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6575 }
6576
6577 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6578 {
6580 m_OverheatingParticles = new array<ref OverheatingParticle>;
6581
6582 OverheatingParticle OP = new OverheatingParticle();
6583 OP.RegisterParticle(p);
6584 OP.SetOverheatingLimitMin(min_heat_coef);
6585 OP.SetOverheatingLimitMax(max_heat_coef);
6586 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6587
6588 m_OverheatingParticles.Insert(OP);
6589 }
6590
6591 float GetOverheatingCoef()
6592 {
6593 if (m_MaxOverheatingValue > 0)
6595
6596 return -1;
6597 }
6598
6600 {
6602 {
6603 float overheat_coef = GetOverheatingCoef();
6604 int count = m_OverheatingParticles.Count();
6605
6606 for (int i = count; i > 0; --i)
6607 {
6608 int id = i - 1;
6609 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6610 Particle p = OP.GetParticle();
6611
6612 float overheat_min = OP.GetOverheatingLimitMin();
6613 float overheat_max = OP.GetOverheatingLimitMax();
6614
6615 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6616 {
6617 if (p)
6618 {
6619 p.Stop();
6620 OP.RegisterParticle(null);
6621 }
6622 }
6623 }
6624 }
6625 }
6626
6628 {
6630 {
6631 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6632 {
6633 int id = i - 1;
6634 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6635
6636 if (OP)
6637 {
6638 Particle p = OP.GetParticle();
6639
6640 if (p)
6641 {
6642 p.Stop();
6643 }
6644
6645 delete OP;
6646 }
6647 }
6648
6649 m_OverheatingParticles.Clear();
6651 }
6652 }
6653
6655 float GetInfectionChance(int system = 0, Param param = null)
6656 {
6657 return 0.0;
6658 }
6659
6660
6661 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6662 {
6663 return 250;//default value
6664 }
6665
6666 float GetFilterDamageRatio()
6667 {
6668 return 0;
6669 }
6670
6672 bool HasMuzzle()
6673 {
6674 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6675 return true;
6676
6677 return false;
6678 }
6679
6681 int GetMuzzleID()
6682 {
6683 if (!m_WeaponTypeToID)
6685
6686 if (m_WeaponTypeToID.Contains(GetType()))
6687 {
6688 return m_WeaponTypeToID.Get(GetType());
6689 }
6690 else
6691 {
6692 // Register new weapon ID
6694 }
6695
6697 }
6698
6705 {
6706 return -1;
6707 }
6708
6709
6710
6711 // -------------------------------------------------------------------------
6712 void ~ItemBase()
6713 {
6714 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6715 {
6716 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6717 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6718
6719 if (r_index >= 0)
6720 {
6721 InventoryLocation r_il = new InventoryLocation;
6722 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6723
6724 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6725 int r_type = r_il.GetType();
6726 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6727 {
6728 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6729 }
6730 else if (r_type == InventoryLocationType.ATTACHMENT)
6731 {
6732 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6733 }
6734
6735 }
6736
6737 player.GetHumanInventory().ClearUserReservedLocation(this);
6738 }
6739
6740 if (m_LockingSound)
6741 SEffectManager.DestroyEffect(m_LockingSound);
6742 }
6743
6744
6745
6746 // -------------------------------------------------------------------------
6747 static int GetDebugActionsMask()
6748 {
6749 return ItemBase.m_DebugActionsMask;
6750 }
6751
6752 static bool HasDebugActionsMask(int mask)
6753 {
6754 return ItemBase.m_DebugActionsMask & mask;
6755 }
6756
6757 static void SetDebugActionsMask(int mask)
6758 {
6759 ItemBase.m_DebugActionsMask = mask;
6760 }
6761
6762 static void AddDebugActionsMask(int mask)
6763 {
6764 ItemBase.m_DebugActionsMask |= mask;
6765 }
6766
6767 static void RemoveDebugActionsMask(int mask)
6768 {
6769 ItemBase.m_DebugActionsMask &= ~mask;
6770 }
6771
6772 static void ToggleDebugActionsMask(int mask)
6773 {
6774 if (HasDebugActionsMask(mask))
6775 {
6777 }
6778 else
6779 {
6780 AddDebugActionsMask(mask);
6781 }
6782 }
6783
6784 // -------------------------------------------------------------------------
6785 void SetCEBasedQuantity()
6786 {
6787 if (GetEconomyProfile())
6788 {
6789 float q_max = GetEconomyProfile().GetQuantityMax();
6790 if (q_max > 0)
6791 {
6792 float q_min = GetEconomyProfile().GetQuantityMin();
6793 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6794
6795 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6796 {
6797 ComponentEnergyManager comp = GetCompEM();
6798 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
6799 {
6800 comp.SetEnergy0To1(quantity_randomized);
6801 }
6802 }
6803 else if (HasQuantity())
6804 {
6805 SetQuantityNormalized(quantity_randomized, false);
6806 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6807 }
6808
6809 }
6810 }
6811 }
6812
6814 void LockToParent()
6815 {
6816 EntityAI parent = GetHierarchyParent();
6817
6818 if (parent)
6819 {
6820 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6821 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6822 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6823 }
6824 }
6825
6827 void UnlockFromParent()
6828 {
6829 EntityAI parent = GetHierarchyParent();
6830
6831 if (parent)
6832 {
6833 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6834 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6835 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6836 }
6837 }
6838
6839 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6840 {
6841 /*
6842 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6843 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6844 */
6845 ItemBase item2 = ItemBase.Cast(entity2);
6846
6847 if (GetGame().IsClient())
6848 {
6849 if (ScriptInputUserData.CanStoreInputUserData())
6850 {
6851 ScriptInputUserData ctx = new ScriptInputUserData;
6853 ctx.Write(-1);
6854 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6855 ctx.Write(i1);
6856 ctx.Write(item2);
6857 ctx.Write(use_stack_max);
6858 ctx.Write(-1);
6859 ctx.Send();
6860
6861 if (IsCombineAll(item2, use_stack_max))
6862 {
6863 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6864 }
6865 }
6866 }
6867 else if (!GetGame().IsMultiplayer())
6868 {
6869 CombineItems(item2, use_stack_max);
6870 }
6871 }
6872
6873 bool IsLiquidPresent()
6874 {
6875 return (GetLiquidType() != 0 && HasQuantity());
6876 }
6877
6878 bool IsLiquidContainer()
6879 {
6880 return m_LiquidContainerMask != 0;
6881 }
6882
6884 {
6885 return m_LiquidContainerMask;
6886 }
6887
6888 bool IsBloodContainer()
6889 {
6890 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6891 return false;
6892 }
6893
6894 bool IsNVG()
6895 {
6896 return false;
6897 }
6898
6901 bool IsExplosive()
6902 {
6903 return false;
6904 }
6905
6907 {
6908 return "";
6909 }
6910
6912
6913 bool IsLightSource()
6914 {
6915 return false;
6916 }
6917
6919 {
6920 return true;
6921 }
6922
6923 //--- ACTION CONDITIONS
6924 //direction
6925 bool IsFacingPlayer(PlayerBase player, string selection)
6926 {
6927 return true;
6928 }
6929
6930 bool IsPlayerInside(PlayerBase player, string selection)
6931 {
6932 return true;
6933 }
6934
6935 override bool CanObstruct()
6936 {
6937 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6938 return !player || !IsPlayerInside(player, "");
6939 }
6940
6941 override bool IsBeingPlaced()
6942 {
6943 return m_IsBeingPlaced;
6944 }
6945
6946 void SetIsBeingPlaced(bool is_being_placed)
6947 {
6948 m_IsBeingPlaced = is_being_placed;
6949 if (!is_being_placed)
6951 SetSynchDirty();
6952 }
6953
6954 //server-side
6955 void OnEndPlacement() {}
6956
6957 override bool IsHologram()
6958 {
6959 return m_IsHologram;
6960 }
6961
6962 bool CanBeDigged()
6963 {
6964 return m_CanBeDigged;
6965 }
6966
6968 {
6969 return 1;
6970 }
6971
6972 bool CanMakeGardenplot()
6973 {
6974 return false;
6975 }
6976
6977 void SetIsHologram(bool is_hologram)
6978 {
6979 m_IsHologram = is_hologram;
6980 SetSynchDirty();
6981 }
6982 /*
6983 protected float GetNutritionalEnergy()
6984 {
6985 Edible_Base edible = Edible_Base.Cast(this);
6986 return edible.GetFoodEnergy();
6987 }
6988
6989 protected float GetNutritionalWaterContent()
6990 {
6991 Edible_Base edible = Edible_Base.Cast(this);
6992 return edible.GetFoodWater();
6993 }
6994
6995 protected float GetNutritionalIndex()
6996 {
6997 Edible_Base edible = Edible_Base.Cast(this);
6998 return edible.GetFoodNutritionalIndex();
6999 }
7000
7001 protected float GetNutritionalFullnessIndex()
7002 {
7003 Edible_Base edible = Edible_Base.Cast(this);
7004 return edible.GetFoodTotalVolume();
7005 }
7006
7007 protected float GetNutritionalToxicity()
7008 {
7009 Edible_Base edible = Edible_Base.Cast(this);
7010 return edible.GetFoodToxicity();
7011
7012 }
7013 */
7014
7015
7016 // -------------------------------------------------------------------------
7017 override void OnMovedInsideCargo(EntityAI container)
7018 {
7019 super.OnMovedInsideCargo(container);
7020
7021 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7022 }
7023
7024 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7025 {
7026 super.EEItemLocationChanged(oldLoc,newLoc);
7027
7028 PlayerBase new_player = null;
7029 PlayerBase old_player = null;
7030
7031 if (newLoc.GetParent())
7032 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7033
7034 if (oldLoc.GetParent())
7035 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7036
7037 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
7038 {
7039 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7040
7041 if (r_index >= 0)
7042 {
7043 InventoryLocation r_il = new InventoryLocation;
7044 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7045
7046 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7047 int r_type = r_il.GetType();
7048 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7049 {
7050 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7051 }
7052 else if (r_type == InventoryLocationType.ATTACHMENT)
7053 {
7054 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7055 }
7056
7057 }
7058 }
7059
7060 if (newLoc.GetType() == InventoryLocationType.HANDS)
7061 {
7062 if (new_player)
7063 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7064
7065 if (new_player == old_player)
7066 {
7067
7068 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7069 {
7070 if (oldLoc.GetType() == InventoryLocationType.CARGO)
7071 {
7072 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7073 {
7074 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7075 }
7076 }
7077 else
7078 {
7079 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7080 }
7081 }
7082
7083 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7084 {
7085 int type = oldLoc.GetType();
7086 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
7087 {
7088 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7089 }
7090 else if (type == InventoryLocationType.ATTACHMENT)
7091 {
7092 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7093 }
7094 }
7095 if (!m_OldLocation)
7096 {
7097 m_OldLocation = new InventoryLocation;
7098 }
7099 m_OldLocation.Copy(oldLoc);
7100 }
7101 else
7102 {
7103 if (m_OldLocation)
7104 {
7105 m_OldLocation.Reset();
7106 }
7107 }
7108
7110 }
7111 else
7112 {
7113 if (new_player)
7114 {
7115 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7116 if (res_index >= 0)
7117 {
7118 InventoryLocation il = new InventoryLocation;
7119 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7120 ItemBase it = ItemBase.Cast(il.GetItem());
7121 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7122 int rel_type = il.GetType();
7123 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
7124 {
7125 il.GetParent().GetOnReleaseLock().Invoke(it);
7126 }
7127 else if (rel_type == InventoryLocationType.ATTACHMENT)
7128 {
7129 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
7130 }
7131 //it.GetOnReleaseLock().Invoke(it);
7132 }
7133 }
7134 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
7135 {
7136 //ThrowPhysically(old_player, vector.Zero);
7137 m_ThrowItemOnDrop = false;
7138 }
7139
7140 if (m_OldLocation)
7141 {
7142 m_OldLocation.Reset();
7143 }
7144 }
7145 }
7146
7147 override void EOnContact(IEntity other, Contact extra)
7148 {
7150 {
7151 int liquidType = -1;
7152 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
7153 if (impactSpeed > 0.0)
7154 {
7155 m_ImpactSpeed = impactSpeed;
7156 #ifndef SERVER
7157 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
7158 #else
7159 m_WantPlayImpactSound = true;
7160 SetSynchDirty();
7161 #endif
7162 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
7163 }
7164 }
7165
7166 #ifdef SERVER
7167 if (GetCompEM() && GetCompEM().IsPlugged())
7168 {
7169 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
7170 GetCompEM().UnplugThis();
7171 }
7172 #endif
7173 }
7174
7175 void RefreshPhysics();
7176
7177 override void OnCreatePhysics()
7178 {
7180 }
7181
7182 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7183 {
7184
7185 }
7186 // -------------------------------------------------------------------------
7187 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
7188 {
7189 super.OnItemLocationChanged(old_owner, new_owner);
7190
7191 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7192 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7193
7194 if (!relatedPlayer && playerNew)
7195 relatedPlayer = playerNew;
7196
7197 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7198 {
7199 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
7200 if (actionMgr)
7201 {
7202 ActionBase currentAction = actionMgr.GetRunningAction();
7203 if (currentAction)
7204 currentAction.OnItemLocationChanged(this);
7205 }
7206 }
7207
7208 Man ownerPlayerOld = null;
7209 Man ownerPlayerNew = null;
7210
7211 if (old_owner)
7212 {
7213 if (old_owner.IsMan())
7214 {
7215 ownerPlayerOld = Man.Cast(old_owner);
7216 }
7217 else
7218 {
7219 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7220 }
7221 }
7222 else
7223 {
7224 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
7225 {
7226 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
7227
7228 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
7229 {
7230 GetCompEM().UnplugThis();
7231 }
7232 }
7233 }
7234
7235 if (new_owner)
7236 {
7237 if (new_owner.IsMan())
7238 {
7239 ownerPlayerNew = Man.Cast(new_owner);
7240 }
7241 else
7242 {
7243 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7244 }
7245 }
7246
7247 if (ownerPlayerOld != ownerPlayerNew)
7248 {
7249 if (ownerPlayerOld)
7250 {
7251 array<EntityAI> subItemsExit = new array<EntityAI>;
7252 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
7253 for (int i = 0; i < subItemsExit.Count(); i++)
7254 {
7255 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
7256 itemExit.OnInventoryExit(ownerPlayerOld);
7257 }
7258 }
7259
7260 if (ownerPlayerNew)
7261 {
7262 array<EntityAI> subItemsEnter = new array<EntityAI>;
7263 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
7264 for (int j = 0; j < subItemsEnter.Count(); j++)
7265 {
7266 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
7267 itemEnter.OnInventoryEnter(ownerPlayerNew);
7268 }
7269 }
7270 }
7271 else if (ownerPlayerNew != null)
7272 {
7273 PlayerBase nplayer;
7274 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7275 {
7276 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7277 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
7278 for (int k = 0; k < subItemsUpdate.Count(); k++)
7279 {
7280 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
7281 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7282 }
7283 }
7284 }
7285
7286 if (old_owner)
7287 old_owner.OnChildItemRemoved(this);
7288 if (new_owner)
7289 new_owner.OnChildItemReceived(this);
7290 }
7291
7292 // -------------------------------------------------------------------------------
7293 override void EEDelete(EntityAI parent)
7294 {
7295 super.EEDelete(parent);
7296 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7297 if (player)
7298 {
7299 OnInventoryExit(player);
7300
7301 if (player.IsAlive())
7302 {
7303 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7304 if (r_index >= 0)
7305 {
7306 InventoryLocation r_il = new InventoryLocation;
7307 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7308
7309 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7310 int r_type = r_il.GetType();
7311 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7312 {
7313 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7314 }
7315 else if (r_type == InventoryLocationType.ATTACHMENT)
7316 {
7317 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7318 }
7319
7320 }
7321
7322 player.RemoveQuickBarEntityShortcut(this);
7323 }
7324 }
7325 }
7326 // -------------------------------------------------------------------------------
7327 override void EEKilled(Object killer)
7328 {
7329 super.EEKilled(killer);
7330
7332 if (killer && killer.IsFireplace() && CanExplodeInFire())
7333 {
7334 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7335 {
7336 if (IsMagazine())
7337 {
7338 if (Magazine.Cast(this).GetAmmoCount() > 0)
7339 {
7340 ExplodeAmmo();
7341 }
7342 }
7343 else
7344 {
7345 Explode(DamageType.EXPLOSION);
7346 }
7347 }
7348 }
7349 }
7350
7351 override void OnWasAttached(EntityAI parent, int slot_id)
7352 {
7353 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7354
7355 super.OnWasAttached(parent, slot_id);
7356
7357 if (HasQuantity())
7358 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7359
7360 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
7361 }
7362
7363 override void OnWasDetached(EntityAI parent, int slot_id)
7364 {
7365 super.OnWasDetached(parent, slot_id);
7366
7367 if (HasQuantity())
7368 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7369 }
7370
7371 override string ChangeIntoOnAttach(string slot)
7372 {
7373 int idx;
7374 TStringArray inventory_slots = new TStringArray;
7375 TStringArray attach_types = new TStringArray;
7376
7377 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7378 if (inventory_slots.Count() < 1) //is string
7379 {
7380 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7381 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7382 }
7383 else //is array
7384 {
7385 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7386 }
7387
7388 idx = inventory_slots.Find(slot);
7389 if (idx < 0)
7390 return "";
7391
7392 return attach_types.Get(idx);
7393 }
7394
7395 override string ChangeIntoOnDetach()
7396 {
7397 int idx = -1;
7398 string slot;
7399
7400 TStringArray inventory_slots = new TStringArray;
7401 TStringArray detach_types = new TStringArray;
7402
7403 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7404 if (inventory_slots.Count() < 1) //is string
7405 {
7406 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7407 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7408 }
7409 else //is array
7410 {
7411 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7412 if (detach_types.Count() < 1)
7413 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7414 }
7415
7416 for (int i = 0; i < inventory_slots.Count(); i++)
7417 {
7418 slot = inventory_slots.Get(i);
7419 }
7420
7421 if (slot != "")
7422 {
7423 if (detach_types.Count() == 1)
7424 idx = 0;
7425 else
7426 idx = inventory_slots.Find(slot);
7427 }
7428 if (idx < 0)
7429 return "";
7430
7431 return detach_types.Get(idx);
7432 }
7433
7434 void ExplodeAmmo()
7435 {
7436 //timer
7437 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7438
7439 //min/max time
7440 float min_time = 1;
7441 float max_time = 3;
7442 float delay = Math.RandomFloat(min_time, max_time);
7443
7444 explode_timer.Run(delay, this, "DoAmmoExplosion");
7445 }
7446
7447 void DoAmmoExplosion()
7448 {
7449 Magazine magazine = Magazine.Cast(this);
7450 int pop_sounds_count = 6;
7451 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7452
7453 //play sound
7454 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7455 string sound_name = pop_sounds[ sound_idx ];
7456 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7457
7458 //remove ammo count
7459 magazine.ServerAddAmmoCount(-1);
7460
7461 //if condition then repeat -> ExplodeAmmo
7462 float min_temp_to_explode = 100; //min temperature for item to explode
7463
7464 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7465 {
7466 ExplodeAmmo();
7467 }
7468 }
7469
7470 // -------------------------------------------------------------------------------
7471 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7472 {
7473 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7474
7475 const int CHANCE_DAMAGE_CARGO = 4;
7476 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7477 const int CHANCE_DAMAGE_NOTHING = 2;
7478
7479 if (IsClothing() || IsContainer() || IsItemTent())
7480 {
7481 float dmg = damageResult.GetDamage("","Health") * -0.5;
7482 int chances;
7483 int rnd;
7484
7485 if (GetInventory().GetCargo())
7486 {
7487 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7488 rnd = Math.RandomInt(0,chances);
7489
7490 if (rnd < CHANCE_DAMAGE_CARGO)
7491 {
7492 DamageItemInCargo(dmg);
7493 }
7494 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7495 {
7497 }
7498 }
7499 else
7500 {
7501 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7502 rnd = Math.RandomInt(0,chances);
7503
7504 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7505 {
7507 }
7508 }
7509 }
7510 }
7511
7512 bool DamageItemInCargo(float damage)
7513 {
7514 if (GetInventory().GetCargo())
7515 {
7516 int item_count = GetInventory().GetCargo().GetItemCount();
7517 if (item_count > 0)
7518 {
7519 int random_pick = Math.RandomInt(0, item_count);
7520 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7521 if (!item.IsExplosive())
7522 {
7523 item.AddHealth("","",damage);
7524 return true;
7525 }
7526 }
7527 }
7528 return false;
7529 }
7530
7531 bool DamageItemAttachments(float damage)
7532 {
7533 int attachment_count = GetInventory().AttachmentCount();
7534 if (attachment_count > 0)
7535 {
7536 int random_pick = Math.RandomInt(0, attachment_count);
7537 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7538 if (!attachment.IsExplosive())
7539 {
7540 attachment.AddHealth("","",damage);
7541 return true;
7542 }
7543 }
7544 return false;
7545 }
7546
7547 override bool IsSplitable()
7548 {
7549 return m_CanThisBeSplit;
7550 }
7551 //----------------
7552 override bool CanBeSplit()
7553 {
7554 if (IsSplitable() && (GetQuantity() > 1))
7555 return GetInventory().CanRemoveEntity();
7556
7557 return false;
7558 }
7559
7560 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7561 {
7562 if (!CanBeSplit())
7563 return;
7564
7565 if (GetGame().IsClient())
7566 {
7567 if (ScriptInputUserData.CanStoreInputUserData())
7568 {
7569 ScriptInputUserData ctx = new ScriptInputUserData;
7571 ctx.Write(1);
7572 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7573 ctx.Write(i1);
7574 ctx.Write(destination_entity);
7575 ctx.Write(true);
7576 ctx.Write(slot_id);
7577 ctx.Send();
7578 }
7579 }
7580 else if (!GetGame().IsMultiplayer())
7581 {
7582 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7583 }
7584 }
7585
7586 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7587 {
7588 if (!CanBeSplit())
7589 return;
7590
7591 float split_quantity_new;
7592 ref ItemBase new_item;
7593 float quantity = GetQuantity();
7594 float stack_max = GetTargetQuantityMax(slot_id);
7595 InventoryLocation loc = new InventoryLocation;
7596
7597 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7598 {
7599 if (stack_max <= GetQuantity())
7600 split_quantity_new = stack_max;
7601 else
7602 split_quantity_new = GetQuantity();
7603
7604 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7605 if (new_item)
7606 {
7607 new_item.SetResultOfSplit(true);
7608 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7609 AddQuantity(-split_quantity_new);
7610 new_item.SetQuantity(split_quantity_new);
7611 }
7612 }
7613 else if (destination_entity && slot_id == -1)
7614 {
7615 if (quantity > stack_max)
7616 split_quantity_new = stack_max;
7617 else
7618 split_quantity_new = quantity;
7619
7620 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7621 {
7622 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7623 new_item = ItemBase.Cast(o);
7624 }
7625
7626 if (new_item)
7627 {
7628 new_item.SetResultOfSplit(true);
7629 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7630 AddQuantity(-split_quantity_new);
7631 new_item.SetQuantity(split_quantity_new);
7632 }
7633 }
7634 else
7635 {
7636 if (stack_max != 0)
7637 {
7638 if (stack_max < GetQuantity())
7639 {
7640 split_quantity_new = GetQuantity() - stack_max;
7641 }
7642
7643 if (split_quantity_new == 0)
7644 {
7645 if (!GetGame().IsMultiplayer())
7646 player.PhysicalPredictiveDropItem(this);
7647 else
7648 player.ServerDropEntity(this);
7649 return;
7650 }
7651
7652 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7653
7654 if (new_item)
7655 {
7656 new_item.SetResultOfSplit(true);
7657 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7658 SetQuantity(split_quantity_new);
7659 new_item.SetQuantity(stack_max);
7660 new_item.PlaceOnSurface();
7661 }
7662 }
7663 }
7664 }
7665
7666 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7667 {
7668 if (!CanBeSplit())
7669 return;
7670
7671 float split_quantity_new;
7672 ref ItemBase new_item;
7673 float quantity = GetQuantity();
7674 float stack_max = GetTargetQuantityMax(slot_id);
7675 InventoryLocation loc = new InventoryLocation;
7676
7677 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7678 {
7679 if (stack_max <= GetQuantity())
7680 split_quantity_new = stack_max;
7681 else
7682 split_quantity_new = GetQuantity();
7683
7684 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7685 if (new_item)
7686 {
7687 new_item.SetResultOfSplit(true);
7688 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7689 AddQuantity(-split_quantity_new);
7690 new_item.SetQuantity(split_quantity_new);
7691 }
7692 }
7693 else if (destination_entity && slot_id == -1)
7694 {
7695 if (quantity > stack_max)
7696 split_quantity_new = stack_max;
7697 else
7698 split_quantity_new = quantity;
7699
7700 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7701 {
7702 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7703 new_item = ItemBase.Cast(o);
7704 }
7705
7706 if (new_item)
7707 {
7708 new_item.SetResultOfSplit(true);
7709 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7710 AddQuantity(-split_quantity_new);
7711 new_item.SetQuantity(split_quantity_new);
7712 }
7713 }
7714 else
7715 {
7716 if (stack_max != 0)
7717 {
7718 if (stack_max < GetQuantity())
7719 {
7720 split_quantity_new = GetQuantity() - stack_max;
7721 }
7722
7723 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7724
7725 if (new_item)
7726 {
7727 new_item.SetResultOfSplit(true);
7728 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7729 SetQuantity(split_quantity_new);
7730 new_item.SetQuantity(stack_max);
7731 new_item.PlaceOnSurface();
7732 }
7733 }
7734 }
7735 }
7736
7737 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7738 {
7739 if (!CanBeSplit())
7740 return;
7741
7742 if (GetGame().IsClient())
7743 {
7744 if (ScriptInputUserData.CanStoreInputUserData())
7745 {
7746 ScriptInputUserData ctx = new ScriptInputUserData;
7748 ctx.Write(4);
7749 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7750 ctx.Write(thiz);
7751 dst.WriteToContext(ctx);
7752 ctx.Send();
7753 }
7754 }
7755 else if (!GetGame().IsMultiplayer())
7756 {
7758 }
7759 }
7760
7761 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7762 {
7763 if (!CanBeSplit())
7764 return;
7765
7766 if (GetGame().IsClient())
7767 {
7768 if (ScriptInputUserData.CanStoreInputUserData())
7769 {
7770 ScriptInputUserData ctx = new ScriptInputUserData;
7772 ctx.Write(2);
7773 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7774 ctx.Write(dummy);
7775 ctx.Write(destination_entity);
7776 ctx.Write(true);
7777 ctx.Write(idx);
7778 ctx.Write(row);
7779 ctx.Write(col);
7780 ctx.Send();
7781 }
7782 }
7783 else if (!GetGame().IsMultiplayer())
7784 {
7785 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7786 }
7787 }
7788
7789 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7790 {
7792 }
7793
7794 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7795 {
7796 if (!CanBeSplit())
7797 return this;
7798
7799 float quantity = GetQuantity();
7800 float split_quantity_new;
7801 ItemBase new_item;
7802 if (dst.IsValid())
7803 {
7804 int slot_id = dst.GetSlot();
7805 float stack_max = GetTargetQuantityMax(slot_id);
7806
7807 if (quantity > stack_max)
7808 split_quantity_new = stack_max;
7809 else
7810 split_quantity_new = quantity;
7811
7812 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7813
7814 if (new_item)
7815 {
7816 new_item.SetResultOfSplit(true);
7817 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7818 AddQuantity(-split_quantity_new);
7819 new_item.SetQuantity(split_quantity_new);
7820 }
7821
7822 return new_item;
7823 }
7824
7825 return null;
7826 }
7827
7828 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7829 {
7830 if (!CanBeSplit())
7831 return;
7832
7833 float quantity = GetQuantity();
7834 float split_quantity_new;
7835 ref ItemBase new_item;
7836 if (destination_entity)
7837 {
7838 float stackable = GetTargetQuantityMax();
7839 if (quantity > stackable)
7840 split_quantity_new = stackable;
7841 else
7842 split_quantity_new = quantity;
7843
7844 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7845 if (new_item)
7846 {
7847 new_item.SetResultOfSplit(true);
7848 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7849 AddQuantity(-split_quantity_new);
7850 new_item.SetQuantity(split_quantity_new);
7851 }
7852 }
7853 }
7854
7855 void SplitIntoStackMaxHandsClient(PlayerBase player)
7856 {
7857 if (!CanBeSplit())
7858 return;
7859
7860 if (GetGame().IsClient())
7861 {
7862 if (ScriptInputUserData.CanStoreInputUserData())
7863 {
7864 ScriptInputUserData ctx = new ScriptInputUserData;
7866 ctx.Write(3);
7867 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7868 ctx.Write(i1);
7869 ItemBase destination_entity = this;
7870 ctx.Write(destination_entity);
7871 ctx.Write(true);
7872 ctx.Write(0);
7873 ctx.Send();
7874 }
7875 }
7876 else if (!GetGame().IsMultiplayer())
7877 {
7878 SplitIntoStackMaxHands(player);
7879 }
7880 }
7881
7882 void SplitIntoStackMaxHands(PlayerBase player)
7883 {
7884 if (!CanBeSplit())
7885 return;
7886
7887 float quantity = GetQuantity();
7888 float split_quantity_new;
7889 ref ItemBase new_item;
7890 if (player)
7891 {
7892 float stackable = GetTargetQuantityMax();
7893 if (quantity > stackable)
7894 split_quantity_new = stackable;
7895 else
7896 split_quantity_new = quantity;
7897
7898 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7899 new_item = ItemBase.Cast(in_hands);
7900 if (new_item)
7901 {
7902 new_item.SetResultOfSplit(true);
7903 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7904 AddQuantity(-split_quantity_new);
7905 new_item.SetQuantity(split_quantity_new);
7906 }
7907 }
7908 }
7909
7910 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7911 {
7912 if (!CanBeSplit())
7913 return;
7914
7915 float quantity = GetQuantity();
7916 float split_quantity_new = Math.Floor(quantity * 0.5);
7917
7918 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7919
7920 if (new_item)
7921 {
7922 if (new_item.GetQuantityMax() < split_quantity_new)
7923 {
7924 split_quantity_new = new_item.GetQuantityMax();
7925 }
7926
7927 new_item.SetResultOfSplit(true);
7928 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7929
7930 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7931 {
7932 AddQuantity(-1);
7933 new_item.SetQuantity(1);
7934 }
7935 else
7936 {
7937 AddQuantity(-split_quantity_new);
7938 new_item.SetQuantity(split_quantity_new);
7939 }
7940 }
7941 }
7942
7943 void SplitItem(PlayerBase player)
7944 {
7945 if (!CanBeSplit())
7946 return;
7947
7948 float quantity = GetQuantity();
7949 float split_quantity_new = Math.Floor(quantity / 2);
7950
7951 InventoryLocation invloc = new InventoryLocation;
7952 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7953
7954 ItemBase new_item;
7955 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7956
7957 if (new_item)
7958 {
7959 if (new_item.GetQuantityMax() < split_quantity_new)
7960 {
7961 split_quantity_new = new_item.GetQuantityMax();
7962 }
7963 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7964 {
7965 AddQuantity(-1);
7966 new_item.SetQuantity(1);
7967 }
7968 else
7969 {
7970 AddQuantity(-split_quantity_new);
7971 new_item.SetQuantity(split_quantity_new);
7972 }
7973 }
7974 }
7975
7977 void OnQuantityChanged(float delta)
7978 {
7979 SetWeightDirty();
7980 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7981
7982 if (parent)
7983 parent.OnAttachmentQuantityChangedEx(this, delta);
7984
7985 if (IsLiquidContainer())
7986 {
7987 if (GetQuantityNormalized() <= 0.0)
7988 {
7990 }
7991 else if (GetLiquidType() == LIQUID_NONE)
7992 {
7993 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7995 }
7996 }
7997
7998 }
7999
8002 {
8003 // insert code here
8004 }
8005
8007 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
8008 {
8010 }
8011
8012 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
8013 {
8014 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8015
8016 if (GetGame().IsServer())
8017 {
8018 if (newLevel == GameConstants.STATE_RUINED)
8019 {
8021 EntityAI parent = GetHierarchyParent();
8022 if (parent && parent.IsFireplace())
8023 {
8024 CargoBase cargo = GetInventory().GetCargo();
8025 if (cargo)
8026 {
8027 for (int i = 0; i < cargo.GetItemCount(); ++i)
8028 {
8029 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
8030 }
8031 }
8032 }
8033 }
8034
8035 if (IsResultOfSplit())
8036 {
8037 // reset the splitting result flag, return to normal item behavior
8038 SetResultOfSplit(false);
8039 return;
8040 }
8041
8042 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8043 {
8044 SetCleanness(0);//unclean the item upon damage dealt
8045 }
8046 }
8047 }
8048
8049 // just the split? TODO: verify
8050 override void OnRightClick()
8051 {
8052 super.OnRightClick();
8053
8054 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
8055 {
8056 if (GetGame().IsClient())
8057 {
8058 if (ScriptInputUserData.CanStoreInputUserData())
8059 {
8060 vector m4[4];
8061 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8062
8063 EntityAI root = GetHierarchyRoot();
8064
8065 InventoryLocation dst = new InventoryLocation;
8066 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
8067 {
8068 if (root)
8069 {
8070 root.GetTransform(m4);
8071 dst.SetGround(this, m4);
8072 }
8073 else
8074 GetInventory().GetCurrentInventoryLocation(dst);
8075 }
8076 else
8077 {
8078 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
8079 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
8080 this shouldnt cause issues within this scope*/
8081 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
8082 {
8083 if (root)
8084 {
8085 root.GetTransform(m4);
8086 dst.SetGround(this, m4);
8087 }
8088 else
8089 GetInventory().GetCurrentInventoryLocation(dst);
8090 }
8091 else
8092 {
8093 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8094 }
8095 }
8096
8097 ScriptInputUserData ctx = new ScriptInputUserData;
8099 ctx.Write(4);
8100 ItemBase thiz = this; // @NOTE: workaround for correct serialization
8101 ctx.Write(thiz);
8102 dst.WriteToContext(ctx);
8103 ctx.Write(true); // dummy
8104 ctx.Send();
8105 }
8106 }
8107 else if (!GetGame().IsMultiplayer())
8108 {
8109 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
8110 }
8111 }
8112 }
8113
8114 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
8115 {
8116 //TODO: delete check zero quantity check after fix double posts hands fsm events
8117 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
8118 return false;
8119
8120 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8121 return false;
8122
8123 //can_this_be_combined = ConfigGetBool("canBeSplit");
8125 return false;
8126
8127
8128 Magazine mag = Magazine.Cast(this);
8129 if (mag)
8130 {
8131 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8132 return false;
8133
8134 if (stack_max_limit)
8135 {
8136 Magazine other_mag = Magazine.Cast(other_item);
8137 if (other_item)
8138 {
8139 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8140 return false;
8141 }
8142
8143 }
8144 }
8145 else
8146 {
8147 //TODO: delete check zero quantity check after fix double posts hands fsm events
8148 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
8149 return false;
8150
8151 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
8152 return false;
8153 }
8154
8155 PlayerBase player = null;
8156 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
8157 {
8158 if (player.GetInventory().HasAttachment(this))
8159 return false;
8160
8161 if (player.IsItemsToDelete())
8162 return false;
8163 }
8164
8165 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8166 return false;
8167
8168 int slotID;
8169 string slotName;
8170 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8171 return false;
8172
8173 return true;
8174 }
8175
8176 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
8177 {
8178 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
8179 }
8180
8181 bool IsResultOfSplit()
8182 {
8183 return m_IsResultOfSplit;
8184 }
8185
8186 void SetResultOfSplit(bool value)
8187 {
8188 m_IsResultOfSplit = value;
8189 }
8190
8191 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
8192 {
8193 return ComputeQuantityUsedEx(other_item, use_stack_max);
8194 }
8195
8196 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
8197 {
8198 float other_item_quantity = other_item.GetQuantity();
8199 float this_free_space;
8200
8201 float stack_max = GetQuantityMax();
8202
8203 this_free_space = stack_max - GetQuantity();
8204
8205 if (other_item_quantity > this_free_space)
8206 {
8207 return this_free_space;
8208 }
8209 else
8210 {
8211 return other_item_quantity;
8212 }
8213 }
8214
8215 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
8216 {
8217 CombineItems(ItemBase.Cast(entity2),use_stack_max);
8218 }
8219
8220 void CombineItems(ItemBase other_item, bool use_stack_max = true)
8221 {
8222 if (!CanBeCombined(other_item, false))
8223 return;
8224
8225 if (!IsMagazine() && other_item)
8226 {
8227 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
8228 if (quantity_used != 0)
8229 {
8230 float hp1 = GetHealth01("","");
8231 float hp2 = other_item.GetHealth01("","");
8232 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
8233 hpResult = hpResult / (GetQuantity() + quantity_used);
8234
8235 hpResult *= GetMaxHealth();
8236 Math.Round(hpResult);
8237 SetHealth("", "Health", hpResult);
8238
8239 AddQuantity(quantity_used);
8240 other_item.AddQuantity(-quantity_used);
8241 }
8242 }
8243 OnCombine(other_item);
8244 }
8245
8246 void OnCombine(ItemBase other_item)
8247 {
8248 #ifdef SERVER
8249 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8250 GetHierarchyParent().IncreaseLifetimeUp();
8251 #endif
8252 };
8253
8254 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
8255 {
8256 PlayerBase p = PlayerBase.Cast(player);
8257
8258 array<int> recipesIds = p.m_Recipes;
8259 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8260 if (moduleRecipesManager)
8261 {
8262 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8263 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
8264 }
8265
8266 for (int i = 0;i < recipesIds.Count(); i++)
8267 {
8268 int key = recipesIds.Get(i);
8269 string recipeName = moduleRecipesManager.GetRecipeName(key);
8270 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
8271 }
8272 }
8273
8274 // -------------------------------------------------------------------------
8275 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8276 {
8277 super.GetDebugActions(outputList);
8278
8279 //quantity
8280 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
8281 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
8282 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
8283 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
8284
8285 //health
8286 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
8287 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
8288 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
8289 //temperature
8290 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
8291 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
8292 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
8293
8294 //wet
8295 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
8296 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
8297
8298 //liquidtype
8299 if (IsLiquidContainer())
8300 {
8301 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
8302 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
8303 }
8304
8305 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
8306 // watch
8307 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
8308 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
8309
8310 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8311 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
8312 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
8313 }
8314
8315 // -------------------------------------------------------------------------
8316 // -------------------------------------------------------------------------
8317 // -------------------------------------------------------------------------
8318 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
8319 {
8320 super.OnAction(action_id, player, ctx);
8321 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
8322 {
8323 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8324 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
8325 PlayerBase p = PlayerBase.Cast(player);
8326 if (EActions.RECIPES_RANGE_START < 1000)
8327 {
8328 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8329 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8330 }
8331 }
8332 #ifndef SERVER
8333 else if (action_id == EActions.WATCH_PLAYER)
8334 {
8335 PluginDeveloper.SetDeveloperItemClientEx(player);
8336 }
8337 #endif
8338 if (GetGame().IsServer())
8339 {
8340 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8341 {
8342 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8343 OnDebugButtonPressServer(id + 1);
8344 }
8345
8346 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8347 {
8348 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8349 InsertAgent(agent_id,100);
8350 }
8351
8352 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8353 {
8354 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8355 RemoveAgent(agent_id2);
8356 }
8357
8358 else if (action_id == EActions.ADD_QUANTITY)
8359 {
8360 if (IsMagazine())
8361 {
8362 Magazine mag = Magazine.Cast(this);
8363 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8364 }
8365 else
8366 {
8367 AddQuantity(GetQuantityMax() * 0.2);
8368 }
8369
8370 if (m_EM)
8371 {
8372 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8373 }
8374 //PrintVariables();
8375 }
8376
8377 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
8378 {
8379 if (IsMagazine())
8380 {
8381 Magazine mag2 = Magazine.Cast(this);
8382 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8383 }
8384 else
8385 {
8386 AddQuantity(- GetQuantityMax() * 0.2);
8387 }
8388 if (m_EM)
8389 {
8390 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8391 }
8392 //PrintVariables();
8393 }
8394
8395 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
8396 {
8397 SetQuantity(0);
8398
8399 if (m_EM)
8400 {
8401 m_EM.SetEnergy(0);
8402 }
8403 }
8404
8405 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
8406 {
8408
8409 if (m_EM)
8410 {
8411 m_EM.SetEnergy(m_EM.GetEnergyMax());
8412 }
8413 }
8414
8415 else if (action_id == EActions.ADD_HEALTH)
8416 {
8417 AddHealth("","",GetMaxHealth("","Health")/5);
8418 }
8419 else if (action_id == EActions.REMOVE_HEALTH)
8420 {
8421 AddHealth("","",-GetMaxHealth("","Health")/5);
8422 }
8423 else if (action_id == EActions.DESTROY_HEALTH)
8424 {
8425 SetHealth01("","",0);
8426 }
8427 else if (action_id == EActions.WATCH_ITEM)
8428 {
8430 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8431 #ifdef DEVELOPER
8432 SetDebugDeveloper_item(this);
8433 #endif
8434 }
8435
8436 else if (action_id == EActions.ADD_TEMPERATURE)
8437 {
8438 AddTemperature(20);
8439 //PrintVariables();
8440 }
8441
8442 else if (action_id == EActions.REMOVE_TEMPERATURE)
8443 {
8444 AddTemperature(-20);
8445 //PrintVariables();
8446 }
8447
8448 else if (action_id == EActions.FLIP_FROZEN)
8449 {
8450 SetFrozen(!GetIsFrozen());
8451 //PrintVariables();
8452 }
8453
8454 else if (action_id == EActions.ADD_WETNESS)
8455 {
8456 AddWet(GetWetMax()/5);
8457 //PrintVariables();
8458 }
8459
8460 else if (action_id == EActions.REMOVE_WETNESS)
8461 {
8462 AddWet(-GetWetMax()/5);
8463 //PrintVariables();
8464 }
8465
8466 else if (action_id == EActions.LIQUIDTYPE_UP)
8467 {
8468 int curr_type = GetLiquidType();
8469 SetLiquidType(curr_type * 2);
8470 //AddWet(1);
8471 //PrintVariables();
8472 }
8473
8474 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8475 {
8476 int curr_type2 = GetLiquidType();
8477 SetLiquidType(curr_type2 / 2);
8478 }
8479
8480 else if (action_id == EActions.MAKE_SPECIAL)
8481 {
8482 auto debugParams = DebugSpawnParams.WithPlayer(player);
8483 OnDebugSpawnEx(debugParams);
8484 }
8485
8486 else if (action_id == EActions.DELETE)
8487 {
8488 Delete();
8489 }
8490
8491 }
8492
8493
8494 return false;
8495 }
8496
8497 // -------------------------------------------------------------------------
8498
8499
8502 void OnActivatedByTripWire();
8503
8505 void OnActivatedByItem(notnull ItemBase item);
8506
8507 //----------------------------------------------------------------
8508 //returns true if item is able to explode when put in fire
8509 bool CanExplodeInFire()
8510 {
8511 return false;
8512 }
8513
8514 //----------------------------------------------------------------
8515 bool CanEat()
8516 {
8517 return true;
8518 }
8519
8520 //----------------------------------------------------------------
8521 override bool IsIgnoredByConstruction()
8522 {
8523 return true;
8524 }
8525
8526 //----------------------------------------------------------------
8527 //has FoodStages in config?
8528 bool HasFoodStage()
8529 {
8530 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8531 return GetGame().ConfigIsExisting(config_path);
8532 }
8533
8535 FoodStage GetFoodStage()
8536 {
8537 return null;
8538 }
8539
8540 bool CanBeCooked()
8541 {
8542 return false;
8543 }
8544
8545 bool CanBeCookedOnStick()
8546 {
8547 return false;
8548 }
8549
8551 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8553
8554 //----------------------------------------------------------------
8555 bool CanRepair(ItemBase item_repair_kit)
8556 {
8557 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8558 return module_repairing.CanRepair(this, item_repair_kit);
8559 }
8560
8561 //----------------------------------------------------------------
8562 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8563 {
8564 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8565 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8566 }
8567
8568 //----------------------------------------------------------------
8569 int GetItemSize()
8570 {
8571 /*
8572 vector v_size = this.ConfigGetVector("itemSize");
8573 int v_size_x = v_size[0];
8574 int v_size_y = v_size[1];
8575 int size = v_size_x * v_size_y;
8576 return size;
8577 */
8578
8579 return 1;
8580 }
8581
8582 //----------------------------------------------------------------
8583 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8584 bool CanBeMovedOverride()
8585 {
8586 return m_CanBeMovedOverride;
8587 }
8588
8589 //----------------------------------------------------------------
8590 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8591 void SetCanBeMovedOverride(bool setting)
8592 {
8593 m_CanBeMovedOverride = setting;
8594 }
8595
8596 //----------------------------------------------------------------
8604 void MessageToOwnerStatus(string text)
8605 {
8606 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8607
8608 if (player)
8609 {
8610 player.MessageStatus(text);
8611 }
8612 }
8613
8614 //----------------------------------------------------------------
8622 void MessageToOwnerAction(string text)
8623 {
8624 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8625
8626 if (player)
8627 {
8628 player.MessageAction(text);
8629 }
8630 }
8631
8632 //----------------------------------------------------------------
8640 void MessageToOwnerFriendly(string text)
8641 {
8642 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8643
8644 if (player)
8645 {
8646 player.MessageFriendly(text);
8647 }
8648 }
8649
8650 //----------------------------------------------------------------
8658 void MessageToOwnerImportant(string text)
8659 {
8660 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8661
8662 if (player)
8663 {
8664 player.MessageImportant(text);
8665 }
8666 }
8667
8668 override bool IsItemBase()
8669 {
8670 return true;
8671 }
8672
8673 // Checks if item is of questioned kind
8674 override bool KindOf(string tag)
8675 {
8676 bool found = false;
8677 string item_name = this.GetType();
8678 ref TStringArray item_tag_array = new TStringArray;
8679 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8680
8681 int array_size = item_tag_array.Count();
8682 for (int i = 0; i < array_size; i++)
8683 {
8684 if (item_tag_array.Get(i) == tag)
8685 {
8686 found = true;
8687 break;
8688 }
8689 }
8690 return found;
8691 }
8692
8693
8694 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8695 {
8696 //Debug.Log("OnRPC called");
8697 super.OnRPC(sender, rpc_type,ctx);
8698
8699 //Play soundset for attachment locking (ActionLockAttachment.c)
8700 switch (rpc_type)
8701 {
8702 #ifndef SERVER
8703 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8704 Param2<bool, string> p = new Param2<bool, string>(false, "");
8705
8706 if (!ctx.Read(p))
8707 return;
8708
8709 bool play = p.param1;
8710 string soundSet = p.param2;
8711
8712 if (play)
8713 {
8714 if (m_LockingSound)
8715 {
8717 {
8718 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8719 }
8720 }
8721 else
8722 {
8723 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8724 }
8725 }
8726 else
8727 {
8728 SEffectManager.DestroyEffect(m_LockingSound);
8729 }
8730
8731 break;
8732 #endif
8733
8734 }
8735
8736 if (GetWrittenNoteData())
8737 {
8738 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8739 }
8740 }
8741
8742 //-----------------------------
8743 // VARIABLE MANIPULATION SYSTEM
8744 //-----------------------------
8745 int NameToID(string name)
8746 {
8747 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8748 return plugin.GetID(name);
8749 }
8750
8751 string IDToName(int id)
8752 {
8753 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8754 return plugin.GetName(id);
8755 }
8756
8758 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8759 {
8760 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8761 //read the flags
8762 int varFlags;
8763 if (!ctx.Read(varFlags))
8764 return;
8765
8766 if (varFlags & ItemVariableFlags.FLOAT)
8767 {
8768 ReadVarsFromCTX(ctx);
8769 }
8770 }
8771
8772 override void SerializeNumericalVars(array<float> floats_out)
8773 {
8774 //some variables handled on EntityAI level already!
8775 super.SerializeNumericalVars(floats_out);
8776
8777 // the order of serialization must be the same as the order of de-serialization
8778 //--------------------------------------------
8779 if (IsVariableSet(VARIABLE_QUANTITY))
8780 {
8781 floats_out.Insert(m_VarQuantity);
8782 }
8783 //--------------------------------------------
8784 if (IsVariableSet(VARIABLE_WET))
8785 {
8786 floats_out.Insert(m_VarWet);
8787 }
8788 //--------------------------------------------
8789 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8790 {
8791 floats_out.Insert(m_VarLiquidType);
8792 }
8793 //--------------------------------------------
8794 if (IsVariableSet(VARIABLE_COLOR))
8795 {
8796 floats_out.Insert(m_ColorComponentR);
8797 floats_out.Insert(m_ColorComponentG);
8798 floats_out.Insert(m_ColorComponentB);
8799 floats_out.Insert(m_ColorComponentA);
8800 }
8801 //--------------------------------------------
8802 if (IsVariableSet(VARIABLE_CLEANNESS))
8803 {
8804 floats_out.Insert(m_Cleanness);
8805 }
8806 }
8807
8808 override void DeSerializeNumericalVars(array<float> floats)
8809 {
8810 //some variables handled on EntityAI level already!
8811 super.DeSerializeNumericalVars(floats);
8812
8813 // the order of serialization must be the same as the order of de-serialization
8814 int index = 0;
8815 int mask = Math.Round(floats.Get(index));
8816
8817 index++;
8818 //--------------------------------------------
8819 if (mask & VARIABLE_QUANTITY)
8820 {
8821 if (m_IsStoreLoad)
8822 {
8823 SetStoreLoadedQuantity(floats.Get(index));
8824 }
8825 else
8826 {
8827 float quantity = floats.Get(index);
8828 SetQuantity(quantity, true, false, false, false);
8829 }
8830 index++;
8831 }
8832 //--------------------------------------------
8833 if (mask & VARIABLE_WET)
8834 {
8835 float wet = floats.Get(index);
8836 SetWet(wet);
8837 index++;
8838 }
8839 //--------------------------------------------
8840 if (mask & VARIABLE_LIQUIDTYPE)
8841 {
8842 int liquidtype = Math.Round(floats.Get(index));
8843 SetLiquidType(liquidtype);
8844 index++;
8845 }
8846 //--------------------------------------------
8847 if (mask & VARIABLE_COLOR)
8848 {
8849 m_ColorComponentR = Math.Round(floats.Get(index));
8850 index++;
8851 m_ColorComponentG = Math.Round(floats.Get(index));
8852 index++;
8853 m_ColorComponentB = Math.Round(floats.Get(index));
8854 index++;
8855 m_ColorComponentA = Math.Round(floats.Get(index));
8856 index++;
8857 }
8858 //--------------------------------------------
8859 if (mask & VARIABLE_CLEANNESS)
8860 {
8861 int cleanness = Math.Round(floats.Get(index));
8862 SetCleanness(cleanness);
8863 index++;
8864 }
8865 }
8866
8867 override void WriteVarsToCTX(ParamsWriteContext ctx)
8868 {
8869 super.WriteVarsToCTX(ctx);
8870
8871 //--------------------------------------------
8872 if (IsVariableSet(VARIABLE_QUANTITY))
8873 {
8874 ctx.Write(GetQuantity());
8875 }
8876 //--------------------------------------------
8877 if (IsVariableSet(VARIABLE_WET))
8878 {
8879 ctx.Write(GetWet());
8880 }
8881 //--------------------------------------------
8882 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8883 {
8884 ctx.Write(GetLiquidType());
8885 }
8886 //--------------------------------------------
8887 if (IsVariableSet(VARIABLE_COLOR))
8888 {
8889 int r,g,b,a;
8890 GetColor(r,g,b,a);
8891 ctx.Write(r);
8892 ctx.Write(g);
8893 ctx.Write(b);
8894 ctx.Write(a);
8895 }
8896 //--------------------------------------------
8897 if (IsVariableSet(VARIABLE_CLEANNESS))
8898 {
8899 ctx.Write(GetCleanness());
8900 }
8901 }
8902
8903 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8904 {
8905 if (!super.ReadVarsFromCTX(ctx,version))
8906 return false;
8907
8908 int intValue;
8909 float value;
8910
8911 if (version < 140)
8912 {
8913 if (!ctx.Read(intValue))
8914 return false;
8915
8916 m_VariablesMask = intValue;
8917 }
8918
8919 if (m_VariablesMask & VARIABLE_QUANTITY)
8920 {
8921 if (!ctx.Read(value))
8922 return false;
8923
8924 if (IsStoreLoad())
8925 {
8927 }
8928 else
8929 {
8930 SetQuantity(value, true, false, false, false);
8931 }
8932 }
8933 //--------------------------------------------
8934 if (version < 140)
8935 {
8936 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8937 {
8938 if (!ctx.Read(value))
8939 return false;
8940 SetTemperatureDirect(value);
8941 }
8942 }
8943 //--------------------------------------------
8944 if (m_VariablesMask & VARIABLE_WET)
8945 {
8946 if (!ctx.Read(value))
8947 return false;
8948 SetWet(value);
8949 }
8950 //--------------------------------------------
8951 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8952 {
8953 if (!ctx.Read(intValue))
8954 return false;
8955 SetLiquidType(intValue);
8956 }
8957 //--------------------------------------------
8958 if (m_VariablesMask & VARIABLE_COLOR)
8959 {
8960 int r,g,b,a;
8961 if (!ctx.Read(r))
8962 return false;
8963 if (!ctx.Read(g))
8964 return false;
8965 if (!ctx.Read(b))
8966 return false;
8967 if (!ctx.Read(a))
8968 return false;
8969
8970 SetColor(r,g,b,a);
8971 }
8972 //--------------------------------------------
8973 if (m_VariablesMask & VARIABLE_CLEANNESS)
8974 {
8975 if (!ctx.Read(intValue))
8976 return false;
8977 SetCleanness(intValue);
8978 }
8979 //--------------------------------------------
8980 if (version >= 138 && version < 140)
8981 {
8982 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8983 {
8984 if (!ctx.Read(intValue))
8985 return false;
8986 SetFrozen(intValue);
8987 }
8988 }
8989
8990 return true;
8991 }
8992
8993 //----------------------------------------------------------------
8994 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8995 {
8996 m_IsStoreLoad = true;
8998 {
8999 m_FixDamageSystemInit = true;
9000 }
9001
9002 if (!super.OnStoreLoad(ctx, version))
9003 {
9004 m_IsStoreLoad = false;
9005 return false;
9006 }
9007
9008 if (version >= 114)
9009 {
9010 bool hasQuickBarIndexSaved;
9011
9012 if (!ctx.Read(hasQuickBarIndexSaved))
9013 {
9014 m_IsStoreLoad = false;
9015 return false;
9016 }
9017
9018 if (hasQuickBarIndexSaved)
9019 {
9020 int itmQBIndex;
9021
9022 //Load quickbar item bind
9023 if (!ctx.Read(itmQBIndex))
9024 {
9025 m_IsStoreLoad = false;
9026 return false;
9027 }
9028
9029 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9030 if (itmQBIndex != -1 && parentPlayer)
9031 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9032 }
9033 }
9034 else
9035 {
9036 // Backup of how it used to be
9037 PlayerBase player;
9038 int itemQBIndex;
9039 if (version == int.MAX)
9040 {
9041 if (!ctx.Read(itemQBIndex))
9042 {
9043 m_IsStoreLoad = false;
9044 return false;
9045 }
9046 }
9047 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9048 {
9049 //Load quickbar item bind
9050 if (!ctx.Read(itemQBIndex))
9051 {
9052 m_IsStoreLoad = false;
9053 return false;
9054 }
9055 if (itemQBIndex != -1 && player)
9056 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9057 }
9058 }
9059
9060 if (version < 140)
9061 {
9062 // variable management system
9063 if (!LoadVariables(ctx, version))
9064 {
9065 m_IsStoreLoad = false;
9066 return false;
9067 }
9068 }
9069
9070 //agent trasmission system
9071 if (!LoadAgents(ctx, version))
9072 {
9073 m_IsStoreLoad = false;
9074 return false;
9075 }
9076 if (version >= 132)
9077 {
9078 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9079 if (raib)
9080 {
9081 if (!raib.OnStoreLoad(ctx,version))
9082 {
9083 m_IsStoreLoad = false;
9084 return false;
9085 }
9086 }
9087 }
9088
9089 m_IsStoreLoad = false;
9090 return true;
9091 }
9092
9093 //----------------------------------------------------------------
9094
9095 override void OnStoreSave(ParamsWriteContext ctx)
9096 {
9097 super.OnStoreSave(ctx);
9098
9099 PlayerBase player;
9100 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9101 {
9102 ctx.Write(true); // Keep track of if we should actually read this in or not
9103 //Save quickbar item bind
9104 int itemQBIndex = -1;
9105 itemQBIndex = player.FindQuickBarEntityIndex(this);
9106 ctx.Write(itemQBIndex);
9107 }
9108 else
9109 {
9110 ctx.Write(false); // Keep track of if we should actually read this in or not
9111 }
9112
9113 SaveAgents(ctx);//agent trasmission system
9114
9115 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9116 if (raib)
9117 {
9118 raib.OnStoreSave(ctx);
9119 }
9120 }
9121 //----------------------------------------------------------------
9122
9123 override void AfterStoreLoad()
9124 {
9125 super.AfterStoreLoad();
9126
9128 {
9130 }
9131
9132 if (GetStoreLoadedQuantity() != float.LOWEST)
9133 {
9135 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
9136 }
9137 }
9138
9139 override void EEOnAfterLoad()
9140 {
9141 super.EEOnAfterLoad();
9142
9144 {
9145 m_FixDamageSystemInit = false;
9146 }
9147
9150 }
9151
9152 bool CanBeDisinfected()
9153 {
9154 return false;
9155 }
9156
9157
9158 //----------------------------------------------------------------
9159 override void OnVariablesSynchronized()
9160 {
9161 if (m_Initialized)
9162 {
9163 #ifdef PLATFORM_CONSOLE
9164 //bruteforce it is
9165 if (IsSplitable())
9166 {
9167 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
9168 if (menu)
9169 {
9170 menu.Refresh();
9171 }
9172 }
9173 #endif
9174 }
9175
9177 {
9178 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9179 m_WantPlayImpactSound = false;
9180 }
9181
9183 {
9184 SetWeightDirty();
9186 }
9187 if (m_VarWet != m_VarWetPrev)
9188 {
9191 }
9192
9193 if (m_SoundSyncPlay != 0)
9194 {
9195 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
9196 m_SoundSyncPlay = 0;
9197 }
9198 if (m_SoundSyncStop != 0)
9199 {
9200 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
9201 m_SoundSyncStop = 0;
9202 }
9203
9204 super.OnVariablesSynchronized();
9205 }
9206
9207 //------------------------- Quantity
9208 //----------------------------------------------------------------
9210 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
9211 {
9212 if (!IsServerCheck(allow_client))
9213 return false;
9214
9215 if (!HasQuantity())
9216 return false;
9217
9218 float min = GetQuantityMin();
9219 float max = GetQuantityMax();
9220
9221 if (value <= (min + 0.001))
9222 value = min;
9223
9224 if (value == min)
9225 {
9226 if (destroy_config)
9227 {
9228 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9229 if (dstr)
9230 {
9231 m_VarQuantity = Math.Clamp(value, min, max);
9232 this.Delete();
9233 return true;
9234 }
9235 }
9236 else if (destroy_forced)
9237 {
9238 m_VarQuantity = Math.Clamp(value, min, max);
9239 this.Delete();
9240 return true;
9241 }
9242 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
9243 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
9244 }
9245
9246 float delta = m_VarQuantity;
9247 m_VarQuantity = Math.Clamp(value, min, max);
9248
9249 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
9250 {
9251 delta = m_VarQuantity - delta;
9252
9253 if (delta)
9254 OnQuantityChanged(delta);
9255 }
9256
9257 SetVariableMask(VARIABLE_QUANTITY);
9258
9259 return false;
9260 }
9261
9262 //----------------------------------------------------------------
9264 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
9265 {
9266 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
9267 }
9268 //----------------------------------------------------------------
9269 void SetQuantityMax()
9270 {
9271 float max = GetQuantityMax();
9272 SetQuantity(max);
9273 }
9274
9275 override void SetQuantityToMinimum()
9276 {
9277 float min = GetQuantityMin();
9278 SetQuantity(min);
9279 }
9280 //----------------------------------------------------------------
9282 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
9283 {
9284 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
9285 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
9286 SetQuantity(result, destroy_config, destroy_forced);
9287 }
9288
9289 //----------------------------------------------------------------
9291 override float GetQuantityNormalized()
9292 {
9293 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
9294 }
9295
9297 {
9298 return GetQuantityNormalized();
9299 }
9300
9301 /*void SetAmmoNormalized(float value)
9302 {
9303 float value_clamped = Math.Clamp(value, 0, 1);
9304 Magazine this_mag = Magazine.Cast(this);
9305 int max_rounds = this_mag.GetAmmoMax();
9306 int result = value * max_rounds;//can the rounded if higher precision is required
9307 this_mag.SetAmmoCount(result);
9308 }*/
9309 //----------------------------------------------------------------
9310 override int GetQuantityMax()
9311 {
9312 int slot = -1;
9313 if (GetInventory())
9314 {
9315 InventoryLocation il = new InventoryLocation;
9316 GetInventory().GetCurrentInventoryLocation(il);
9317 slot = il.GetSlot();
9318 }
9319
9320 return GetTargetQuantityMax(slot);
9321 }
9322
9323 override int GetTargetQuantityMax(int attSlotID = -1)
9324 {
9325 float quantity_max = 0;
9326
9327 if (IsSplitable()) //only stackable/splitable items can check for stack size
9328 {
9329 if (attSlotID != -1)
9330 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9331
9332 if (quantity_max <= 0)
9333 quantity_max = m_VarStackMax;
9334 }
9335
9336 if (quantity_max <= 0)
9337 quantity_max = m_VarQuantityMax;
9338
9339 return quantity_max;
9340 }
9341 //----------------------------------------------------------------
9342 override int GetQuantityMin()
9343 {
9344 return m_VarQuantityMin;
9345 }
9346 //----------------------------------------------------------------
9347 int GetQuantityInit()
9348 {
9349 return m_VarQuantityInit;
9350 }
9351
9352 //----------------------------------------------------------------
9353 override bool HasQuantity()
9354 {
9355 return !(GetQuantityMax() - GetQuantityMin() == 0);
9356 }
9357
9358 override float GetQuantity()
9359 {
9360 return m_VarQuantity;
9361 }
9362
9363 bool IsFullQuantity()
9364 {
9365 return GetQuantity() >= GetQuantityMax();
9366 }
9367
9368 //Calculates weight of single item without attachments and cargo
9369 override float GetSingleInventoryItemWeightEx()
9370 {
9371 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
9372 float weightEx = GetWeightEx();//overall weight of the item
9373 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
9374 return weightEx - special;
9375 }
9376
9377 // Obsolete, use GetSingleInventoryItemWeightEx() instead
9379 {
9381 }
9382
9383 override protected float GetWeightSpecialized(bool forceRecalc = false)
9384 {
9385 if (IsSplitable()) //quantity determines size of the stack
9386 {
9387 #ifdef DEVELOPER
9388 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9389 {
9390 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9391 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
9392 }
9393 #endif
9394
9395 return GetQuantity() * GetConfigWeightModified();
9396 }
9397 else if (HasEnergyManager())// items with energy manager
9398 {
9399 #ifdef DEVELOPER
9400 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9401 {
9402 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9403 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
9404 }
9405 #endif
9406 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9407 }
9408 else//everything else
9409 {
9410 #ifdef DEVELOPER
9411 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9412 {
9413 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9414 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9415 }
9416 #endif
9417 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9418 }
9419 }
9420
9422 int GetNumberOfItems()
9423 {
9424 int item_count = 0;
9425 ItemBase item;
9426
9427 if (GetInventory().GetCargo() != NULL)
9428 {
9429 item_count = GetInventory().GetCargo().GetItemCount();
9430 }
9431
9432 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9433 {
9434 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9435 if (item)
9436 item_count += item.GetNumberOfItems();
9437 }
9438 return item_count;
9439 }
9440
9442 float GetUnitWeight(bool include_wetness = true)
9443 {
9444 float weight = 0;
9445 float wetness = 1;
9446 if (include_wetness)
9447 wetness += GetWet();
9448 if (IsSplitable()) //quantity determines size of the stack
9449 {
9450 weight = wetness * m_ConfigWeight;
9451 }
9452 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9453 {
9454 weight = 1;
9455 }
9456 return weight;
9457 }
9458
9459 //-----------------------------------------------------------------
9460
9461 override void ClearInventory()
9462 {
9463 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9464 {
9465 GameInventory inv = GetInventory();
9466 array<EntityAI> items = new array<EntityAI>;
9467 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9468 for (int i = 0; i < items.Count(); i++)
9469 {
9470 ItemBase item = ItemBase.Cast(items.Get(i));
9471 if (item)
9472 {
9473 GetGame().ObjectDelete(item);
9474 }
9475 }
9476 }
9477 }
9478
9479 //------------------------- Energy
9480
9481 //----------------------------------------------------------------
9482 float GetEnergy()
9483 {
9484 float energy = 0;
9485 if (HasEnergyManager())
9486 {
9487 energy = GetCompEM().GetEnergy();
9488 }
9489 return energy;
9490 }
9491
9492
9493 override void OnEnergyConsumed()
9494 {
9495 super.OnEnergyConsumed();
9496
9498 }
9499
9500 override void OnEnergyAdded()
9501 {
9502 super.OnEnergyAdded();
9503
9505 }
9506
9507 // Converts energy (from Energy Manager) to quantity, if enabled.
9509 {
9510 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9511 {
9512 if (HasQuantity())
9513 {
9514 float energy_0to1 = GetCompEM().GetEnergy0To1();
9515 SetQuantityNormalized(energy_0to1);
9516 }
9517 }
9518 }
9519
9520 //----------------------------------------------------------------
9521 float GetHeatIsolationInit()
9522 {
9523 return ConfigGetFloat("heatIsolation");
9524 }
9525
9526 float GetHeatIsolation()
9527 {
9528 return m_HeatIsolation;
9529 }
9530
9531 float GetDryingIncrement(string pIncrementName)
9532 {
9533 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9534 if (GetGame().ConfigIsExisting(paramPath))
9535 return GetGame().ConfigGetFloat(paramPath);
9536
9537 return 0.0;
9538 }
9539
9540 float GetSoakingIncrement(string pIncrementName)
9541 {
9542 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9543 if (GetGame().ConfigIsExisting(paramPath))
9544 return GetGame().ConfigGetFloat(paramPath);
9545
9546 return 0.0;
9547 }
9548 //----------------------------------------------------------------
9549 override void SetWet(float value, bool allow_client = false)
9550 {
9551 if (!IsServerCheck(allow_client))
9552 return;
9553
9554 float min = GetWetMin();
9555 float max = GetWetMax();
9556
9557 float previousValue = m_VarWet;
9558
9559 m_VarWet = Math.Clamp(value, min, max);
9560
9561 if (previousValue != m_VarWet)
9562 {
9563 SetVariableMask(VARIABLE_WET);
9564 OnWetChanged(m_VarWet, previousValue);
9565 }
9566 }
9567 //----------------------------------------------------------------
9568 override void AddWet(float value)
9569 {
9570 SetWet(GetWet() + value);
9571 }
9572 //----------------------------------------------------------------
9573 override void SetWetMax()
9574 {
9576 }
9577 //----------------------------------------------------------------
9578 override float GetWet()
9579 {
9580 return m_VarWet;
9581 }
9582 //----------------------------------------------------------------
9583 override float GetWetMax()
9584 {
9585 return m_VarWetMax;
9586 }
9587 //----------------------------------------------------------------
9588 override float GetWetMin()
9589 {
9590 return m_VarWetMin;
9591 }
9592 //----------------------------------------------------------------
9593 override float GetWetInit()
9594 {
9595 return m_VarWetInit;
9596 }
9597 //----------------------------------------------------------------
9598 override void OnWetChanged(float newVal, float oldVal)
9599 {
9600 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9601 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9602 if (newLevel != oldLevel)
9603 {
9604 OnWetLevelChanged(newLevel,oldLevel);
9605 }
9606 }
9607
9608 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9609 {
9610 SetWeightDirty();
9611 }
9612
9613 override EWetnessLevel GetWetLevel()
9614 {
9615 return GetWetLevelInternal(m_VarWet);
9616 }
9617
9618 //----------------------------------------------------------------
9619
9620 override void SetStoreLoad(bool value)
9621 {
9622 m_IsStoreLoad = value;
9623 }
9624
9625 override bool IsStoreLoad()
9626 {
9627 return m_IsStoreLoad;
9628 }
9629
9630 override void SetStoreLoadedQuantity(float value)
9631 {
9632 m_StoreLoadedQuantity = value;
9633 }
9634
9635 override float GetStoreLoadedQuantity()
9636 {
9637 return m_StoreLoadedQuantity;
9638 }
9639
9640 //----------------------------------------------------------------
9641
9642 float GetItemModelLength()
9643 {
9644 if (ConfigIsExisting("itemModelLength"))
9645 {
9646 return ConfigGetFloat("itemModelLength");
9647 }
9648 return 0;
9649 }
9650
9651 float GetItemAttachOffset()
9652 {
9653 if (ConfigIsExisting("itemAttachOffset"))
9654 {
9655 return ConfigGetFloat("itemAttachOffset");
9656 }
9657 return 0;
9658 }
9659
9660 override void SetCleanness(int value, bool allow_client = false)
9661 {
9662 if (!IsServerCheck(allow_client))
9663 return;
9664
9665 int previousValue = m_Cleanness;
9666
9667 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9668
9669 if (previousValue != m_Cleanness)
9670 SetVariableMask(VARIABLE_CLEANNESS);
9671 }
9672
9673 override int GetCleanness()
9674 {
9675 return m_Cleanness;
9676 }
9677
9679 {
9680 return true;
9681 }
9682
9683 //----------------------------------------------------------------
9684 // ATTACHMENT LOCKING
9685 // Getters relevant to generic ActionLockAttachment
9686 int GetLockType()
9687 {
9688 return m_LockType;
9689 }
9690
9691 string GetLockSoundSet()
9692 {
9693 return m_LockSoundSet;
9694 }
9695
9696 //----------------------------------------------------------------
9697 //------------------------- Color
9698 // sets items color variable given color components
9699 override void SetColor(int r, int g, int b, int a)
9700 {
9705 SetVariableMask(VARIABLE_COLOR);
9706 }
9708 override void GetColor(out int r,out int g,out int b,out int a)
9709 {
9714 }
9715
9716 bool IsColorSet()
9717 {
9718 return IsVariableSet(VARIABLE_COLOR);
9719 }
9720
9722 string GetColorString()
9723 {
9724 int r,g,b,a;
9725 GetColor(r,g,b,a);
9726 r = r/255;
9727 g = g/255;
9728 b = b/255;
9729 a = a/255;
9730 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9731 }
9732 //----------------------------------------------------------------
9733 //------------------------- LiquidType
9734
9735 override void SetLiquidType(int value, bool allow_client = false)
9736 {
9737 if (!IsServerCheck(allow_client))
9738 return;
9739
9740 int old = m_VarLiquidType;
9741 m_VarLiquidType = value;
9742 OnLiquidTypeChanged(old,value);
9743 SetVariableMask(VARIABLE_LIQUIDTYPE);
9744 }
9745
9746 int GetLiquidTypeInit()
9747 {
9748 return ConfigGetInt("varLiquidTypeInit");
9749 }
9750
9751 override int GetLiquidType()
9752 {
9753 return m_VarLiquidType;
9754 }
9755
9756 protected void OnLiquidTypeChanged(int oldType, int newType)
9757 {
9758 if (newType == LIQUID_NONE && GetIsFrozen())
9759 SetFrozen(false);
9760 }
9761
9763 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9764 {
9765 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9766 }
9767
9768 // -------------------------------------------------------------------------
9770 void OnInventoryEnter(Man player)
9771 {
9772 PlayerBase nplayer;
9773 if (PlayerBase.CastTo(nplayer, player))
9774 {
9775 m_CanPlayImpactSound = true;
9776 //nplayer.OnItemInventoryEnter(this);
9777 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9778 }
9779 }
9780
9781 // -------------------------------------------------------------------------
9783 void OnInventoryExit(Man player)
9784 {
9785 PlayerBase nplayer;
9786 if (PlayerBase.CastTo(nplayer,player))
9787 {
9788 //nplayer.OnItemInventoryExit(this);
9789 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9790
9791 }
9792
9793 //if (!GetGame().IsDedicatedServer())
9794 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9795
9796
9797 if (HasEnergyManager())
9798 {
9799 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9800 }
9801 }
9802
9803 // ADVANCED PLACEMENT EVENTS
9804 override void OnPlacementStarted(Man player)
9805 {
9806 super.OnPlacementStarted(player);
9807
9808 SetTakeable(false);
9809 }
9810
9811 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9812 {
9813 if (m_AdminLog)
9814 {
9815 m_AdminLog.OnPlacementComplete(player, this);
9816 }
9817
9818 super.OnPlacementComplete(player, position, orientation);
9819 }
9820
9821 //-----------------------------
9822 // AGENT SYSTEM
9823 //-----------------------------
9824 //--------------------------------------------------------------------------
9825 bool ContainsAgent(int agent_id)
9826 {
9827 if (agent_id & m_AttachedAgents)
9828 {
9829 return true;
9830 }
9831 else
9832 {
9833 return false;
9834 }
9835 }
9836
9837 //--------------------------------------------------------------------------
9838 override void RemoveAgent(int agent_id)
9839 {
9840 if (ContainsAgent(agent_id))
9841 {
9842 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9843 }
9844 }
9845
9846 //--------------------------------------------------------------------------
9847 override void RemoveAllAgents()
9848 {
9849 m_AttachedAgents = 0;
9850 }
9851 //--------------------------------------------------------------------------
9852 override void RemoveAllAgentsExcept(int agent_to_keep)
9853 {
9854 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9855 }
9856 // -------------------------------------------------------------------------
9857 override void InsertAgent(int agent, float count = 1)
9858 {
9859 if (count < 1)
9860 return;
9861 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9863 }
9864
9866 void TransferAgents(int agents)
9867 {
9869 }
9870
9871 // -------------------------------------------------------------------------
9872 override int GetAgents()
9873 {
9874 return m_AttachedAgents;
9875 }
9876 //----------------------------------------------------------------------
9877
9878 /*int GetContaminationType()
9879 {
9880 int contamination_type;
9881
9882 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9883 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9884 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9885 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9886
9887 Edible_Base edible = Edible_Base.Cast(this);
9888 int agents = GetAgents();
9889 if (edible)
9890 {
9891 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9892 if (profile)
9893 {
9894 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9895 }
9896 }
9897 if (agents & CONTAMINATED_MASK)
9898 {
9899 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9900 }
9901 if (agents & POISONED_MASK)
9902 {
9903 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9904 }
9905 if (agents & NERVE_GAS_MASK)
9906 {
9907 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9908 }
9909 if (agents & DIRTY_MASK)
9910 {
9911 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9912 }
9913
9914 return agents;
9915 }*/
9916
9917 // -------------------------------------------------------------------------
9918 bool LoadAgents(ParamsReadContext ctx, int version)
9919 {
9920 if (!ctx.Read(m_AttachedAgents))
9921 return false;
9922 return true;
9923 }
9924 // -------------------------------------------------------------------------
9926 {
9927
9929 }
9930 // -------------------------------------------------------------------------
9931
9933 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9934 {
9935 super.CheckForRoofLimited(timeTresholdMS);
9936
9937 float time = GetGame().GetTime();
9938 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9939 {
9940 m_PreviousRoofTestTime = time;
9941 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9942 }
9943 }
9944
9945 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9946 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9947 {
9948 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9949 {
9950 return 0;
9951 }
9952
9953 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9954 {
9955 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9956 if (filter)
9957 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9958 else
9959 return 0;//otherwise return 0 when no filter attached
9960 }
9961
9962 string subclassPath, entryName;
9963
9964 switch (type)
9965 {
9966 case DEF_BIOLOGICAL:
9967 entryName = "biological";
9968 break;
9969 case DEF_CHEMICAL:
9970 entryName = "chemical";
9971 break;
9972 default:
9973 entryName = "biological";
9974 break;
9975 }
9976
9977 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9978
9979 return GetGame().ConfigGetFloat(subclassPath + entryName);
9980 }
9981
9982
9983
9985 override void EEOnCECreate()
9986 {
9987 if (!IsMagazine())
9989
9991 }
9992
9993
9994 //-------------------------
9995 // OPEN/CLOSE USER ACTIONS
9996 //-------------------------
9998 void Open();
9999 void Close();
10000 bool IsOpen()
10001 {
10002 return true;
10003 }
10004
10005 override bool CanDisplayCargo()
10006 {
10007 return IsOpen();
10008 }
10009
10010
10011 // ------------------------------------------------------------
10012 // CONDITIONS
10013 // ------------------------------------------------------------
10014 override bool CanPutInCargo(EntityAI parent)
10015 {
10016 if (parent)
10017 {
10018 if (parent.IsInherited(DayZInfected))
10019 return true;
10020
10021 if (!parent.IsRuined())
10022 return true;
10023 }
10024
10025 return true;
10026 }
10027
10028 override bool CanPutAsAttachment(EntityAI parent)
10029 {
10030 if (!super.CanPutAsAttachment(parent))
10031 {
10032 return false;
10033 }
10034
10035 if (!IsRuined() && !parent.IsRuined())
10036 {
10037 return true;
10038 }
10039
10040 return false;
10041 }
10042
10043 override bool CanReceiveItemIntoCargo(EntityAI item)
10044 {
10045 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10046 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10047 // return false;
10048
10049 return super.CanReceiveItemIntoCargo(item);
10050 }
10051
10052 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
10053 {
10054 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10055 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10056 // return false;
10057
10058 GameInventory attachmentInv = attachment.GetInventory();
10059 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10060 {
10061 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10062 return false;
10063 }
10064
10065 InventoryLocation loc = new InventoryLocation();
10066 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10067 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
10068 return false;
10069
10070 return super.CanReceiveAttachment(attachment, slotId);
10071 }
10072
10073 override bool CanReleaseAttachment(EntityAI attachment)
10074 {
10075 if (!super.CanReleaseAttachment(attachment))
10076 return false;
10077
10078 return GetInventory().AreChildrenAccessible();
10079 }
10080
10081 /*override bool CanLoadAttachment(EntityAI attachment)
10082 {
10083 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10084 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10085 // return false;
10086
10087 GameInventory attachmentInv = attachment.GetInventory();
10088 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10089 {
10090 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
10091 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
10092
10093 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10094 return false;
10095 }
10096
10097 return super.CanLoadAttachment(attachment);
10098 }*/
10099
10100 // Plays muzzle flash particle effects
10101 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10102 {
10103 int id = muzzle_owner.GetMuzzleID();
10104 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
10105
10106 if (WPOF_array)
10107 {
10108 for (int i = 0; i < WPOF_array.Count(); i++)
10109 {
10110 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10111
10112 if (WPOF)
10113 {
10114 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10115 }
10116 }
10117 }
10118 }
10119
10120 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
10121 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10122 {
10123 int id = muzzle_owner.GetMuzzleID();
10124 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
10125
10126 if (WPOBE_array)
10127 {
10128 for (int i = 0; i < WPOBE_array.Count(); i++)
10129 {
10130 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10131
10132 if (WPOBE)
10133 {
10134 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10135 }
10136 }
10137 }
10138 }
10139
10140 // Plays all weapon overheating particles
10141 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10142 {
10143 int id = muzzle_owner.GetMuzzleID();
10144 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10145
10146 if (WPOOH_array)
10147 {
10148 for (int i = 0; i < WPOOH_array.Count(); i++)
10149 {
10150 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10151
10152 if (WPOOH)
10153 {
10154 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10155 }
10156 }
10157 }
10158 }
10159
10160 // Updates all weapon overheating particles
10161 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10162 {
10163 int id = muzzle_owner.GetMuzzleID();
10164 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10165
10166 if (WPOOH_array)
10167 {
10168 for (int i = 0; i < WPOOH_array.Count(); i++)
10169 {
10170 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10171
10172 if (WPOOH)
10173 {
10174 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10175 }
10176 }
10177 }
10178 }
10179
10180 // Stops overheating particles
10181 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10182 {
10183 int id = muzzle_owner.GetMuzzleID();
10184 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10185
10186 if (WPOOH_array)
10187 {
10188 for (int i = 0; i < WPOOH_array.Count(); i++)
10189 {
10190 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10191
10192 if (WPOOH)
10193 {
10194 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10195 }
10196 }
10197 }
10198 }
10199
10200 //----------------------------------------------------------------
10201 //Item Behaviour - unified approach
10202 override bool IsHeavyBehaviour()
10203 {
10204 if (m_ItemBehaviour == 0)
10205 {
10206 return true;
10207 }
10208
10209 return false;
10210 }
10211
10212 override bool IsOneHandedBehaviour()
10213 {
10214 if (m_ItemBehaviour == 1)
10215 {
10216 return true;
10217 }
10218
10219 return false;
10220 }
10221
10222 override bool IsTwoHandedBehaviour()
10223 {
10224 if (m_ItemBehaviour == 2)
10225 {
10226 return true;
10227 }
10228
10229 return false;
10230 }
10231
10232 bool IsDeployable()
10233 {
10234 return false;
10235 }
10236
10238 float GetDeployTime()
10239 {
10240 return UATimeSpent.DEFAULT_DEPLOY;
10241 }
10242
10243
10244 //----------------------------------------------------------------
10245 // Item Targeting (User Actions)
10246 override void SetTakeable(bool pState)
10247 {
10248 m_IsTakeable = pState;
10249 SetSynchDirty();
10250 }
10251
10252 override bool IsTakeable()
10253 {
10254 return m_IsTakeable;
10255 }
10256
10257 // For cases where we want to show object widget which cant be taken to hands
10259 {
10260 return false;
10261 }
10262
10264 protected void PreLoadSoundAttachmentType()
10265 {
10266 string att_type = "None";
10267
10268 if (ConfigIsExisting("soundAttType"))
10269 {
10270 att_type = ConfigGetString("soundAttType");
10271 }
10272
10273 m_SoundAttType = att_type;
10274 }
10275
10276 override string GetAttachmentSoundType()
10277 {
10278 return m_SoundAttType;
10279 }
10280
10281 //----------------------------------------------------------------
10282 //SOUNDS - ItemSoundHandler
10283 //----------------------------------------------------------------
10284
10285 string GetPlaceSoundset(); // played when deploy starts
10286 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
10287 string GetDeploySoundset(); // played when deploy sucessfully finishes
10288
10290 {
10291 if (!m_ItemSoundHandler)
10293
10294 return m_ItemSoundHandler;
10295 }
10296
10297 // override to initialize sounds
10298 protected void InitItemSounds()
10299 {
10300 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
10301 return;
10302
10304
10305 if (GetPlaceSoundset() != string.Empty)
10306 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
10307
10308 if (GetDeploySoundset() != string.Empty)
10309 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
10310
10311 SoundParameters params = new SoundParameters();
10312 params.m_Loop = true;
10313 if (GetLoopDeploySoundset() != string.Empty)
10314 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
10315 }
10316
10317 // Start sound using ItemSoundHandler
10318 void StartItemSoundServer(int id)
10319 {
10320 if (!GetGame().IsServer())
10321 return;
10322
10323 m_SoundSyncPlay = id;
10324 SetSynchDirty();
10325
10326 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
10328 }
10329
10330 // Stop sound using ItemSoundHandler
10331 void StopItemSoundServer(int id)
10332 {
10333 if (!GetGame().IsServer())
10334 return;
10335
10336 m_SoundSyncStop = id;
10337 SetSynchDirty();
10338
10339 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
10341 }
10342
10343 protected void ClearStartItemSoundServer()
10344 {
10345 m_SoundSyncPlay = 0;
10346 }
10347
10348 protected void ClearStopItemSoundServer()
10349 {
10350 m_SoundSyncStop = 0;
10351 }
10352
10354 void PlayAttachSound(string slot_type)
10355 {
10356 if (!GetGame().IsDedicatedServer())
10357 {
10358 if (ConfigIsExisting("attachSoundSet"))
10359 {
10360 string cfg_path = "";
10361 string soundset = "";
10362 string type_name = GetType();
10363
10364 TStringArray cfg_soundset_array = new TStringArray;
10365 TStringArray cfg_slot_array = new TStringArray;
10366 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10367 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10368
10369 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10370 {
10371 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10372 {
10373 if (cfg_slot_array[i] == slot_type)
10374 {
10375 soundset = cfg_soundset_array[i];
10376 break;
10377 }
10378 }
10379 }
10380
10381 if (soundset != "")
10382 {
10383 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
10384 sound.SetAutodestroy(true);
10385 }
10386 }
10387 }
10388 }
10389
10390 void PlayDetachSound(string slot_type)
10391 {
10392 //TODO - evaluate if needed and devise universal config structure if so
10393 }
10394
10395 void OnApply(PlayerBase player);
10396
10398 {
10399 return 1.0;
10400 };
10401 //returns applicable selection
10402 array<string> GetHeadHidingSelection()
10403 {
10405 }
10406
10408 {
10410 }
10411
10412 WrittenNoteData GetWrittenNoteData() {};
10413
10415 {
10416 SetDynamicPhysicsLifeTime(0.01);
10417 m_ItemBeingDroppedPhys = false;
10418 }
10419
10421 {
10422 array<string> zone_names = new array<string>;
10423 GetDamageZones(zone_names);
10424 for (int i = 0; i < zone_names.Count(); i++)
10425 {
10426 SetHealthMax(zone_names.Get(i),"Health");
10427 }
10428 SetHealthMax("","Health");
10429 }
10430
10432 void SetZoneDamageCEInit()
10433 {
10434 float global_health = GetHealth01("","Health");
10435 array<string> zones = new array<string>;
10436 GetDamageZones(zones);
10437 //set damage of all zones to match global health level
10438 for (int i = 0; i < zones.Count(); i++)
10439 {
10440 SetHealth01(zones.Get(i),"Health",global_health);
10441 }
10442 }
10443
10445 bool IsCoverFaceForShave(string slot_name)
10446 {
10447 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10448 }
10449
10450 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10451 {
10452 if (!hasRootAsPlayer)
10453 {
10454 if (refParentIB)
10455 {
10456 // parent is wet
10457 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10458 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10459 // parent has liquid inside
10460 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10461 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10462 // drying
10463 else if (m_VarWet > m_VarWetMin)
10464 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10465 }
10466 else
10467 {
10468 // drying on ground or inside non-itembase (car, ...)
10469 if (m_VarWet > m_VarWetMin)
10470 AddWet(-1 * delta * GetDryingIncrement("ground"));
10471 }
10472 }
10473 }
10474
10475 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10476 {
10478 {
10479 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10480 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10481 {
10482 float heatPermCoef = 1.0;
10483 EntityAI ent = this;
10484 while (ent)
10485 {
10486 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10487 ent = ent.GetHierarchyParent();
10488 }
10489
10490 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10491 }
10492 }
10493 }
10494
10495 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10496 {
10497 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10498 EntityAI parent = GetHierarchyParent();
10499 if (!parent)
10500 {
10501 hasParent = false;
10502 hasRootAsPlayer = false;
10503 }
10504 else
10505 {
10506 hasParent = true;
10507 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10508 refParentIB = ItemBase.Cast(parent);
10509 }
10510 }
10511
10512 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10513 {
10514 // this is stub, implemented on Edible_Base
10515 }
10516
10517 bool CanDecay()
10518 {
10519 // return true used on selected food clases so they can decay
10520 return false;
10521 }
10522
10523 protected bool CanProcessDecay()
10524 {
10525 // this is stub, implemented on Edible_Base class
10526 // used to determine whether it is still necessary for the food to decay
10527 return false;
10528 }
10529
10530 protected bool CanHaveWetness()
10531 {
10532 // return true used on selected items that have a wetness effect
10533 return false;
10534 }
10535
10537 bool CanBeConsumed(ConsumeConditionData data = null)
10538 {
10539 return !GetIsFrozen() && IsOpen();
10540 }
10541
10542 override void ProcessVariables()
10543 {
10544 bool hasParent = false, hasRootAsPlayer = false;
10545 ItemBase refParentIB;
10546
10547 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10548 bool foodDecay = g_Game.IsFoodDecayEnabled();
10549
10550 if (wwtu || foodDecay)
10551 {
10552 bool processWetness = wwtu && CanHaveWetness();
10553 bool processTemperature = wwtu && CanHaveTemperature();
10554 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10555
10556 if (processWetness || processTemperature || processDecay)
10557 {
10558 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10559
10560 if (processWetness)
10561 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10562
10563 if (processTemperature)
10564 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10565
10566 if (processDecay)
10567 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10568 }
10569 }
10570 }
10571
10574 {
10575 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10576 }
10577
10578 override float GetTemperatureFreezeThreshold()
10579 {
10581 return Liquid.GetFreezeThreshold(GetLiquidType());
10582
10583 return super.GetTemperatureFreezeThreshold();
10584 }
10585
10586 override float GetTemperatureThawThreshold()
10587 {
10589 return Liquid.GetThawThreshold(GetLiquidType());
10590
10591 return super.GetTemperatureThawThreshold();
10592 }
10593
10594 override float GetItemOverheatThreshold()
10595 {
10597 return Liquid.GetBoilThreshold(GetLiquidType());
10598
10599 return super.GetItemOverheatThreshold();
10600 }
10601
10602 override float GetTemperatureFreezeTime()
10603 {
10604 if (HasQuantity())
10605 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10606
10607 return super.GetTemperatureFreezeTime();
10608 }
10609
10610 override float GetTemperatureThawTime()
10611 {
10612 if (HasQuantity())
10613 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10614
10615 return super.GetTemperatureThawTime();
10616 }
10617
10619 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10621 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10622
10623 bool IsCargoException4x3(EntityAI item)
10624 {
10625 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10626 }
10627
10629 {
10630 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10631 }
10632
10634 void AddLightSourceItem(ItemBase lightsource)
10635 {
10636 m_LightSourceItem = lightsource;
10637 }
10638
10640 {
10641 m_LightSourceItem = null;
10642 }
10643
10645 {
10646 return m_LightSourceItem;
10647 }
10648
10650 array<int> GetValidFinishers()
10651 {
10652 return null;
10653 }
10654
10656 bool GetActionWidgetOverride(out typename name)
10657 {
10658 return false;
10659 }
10660
10661 bool PairWithDevice(notnull ItemBase otherDevice)
10662 {
10663 if (GetGame().IsServer())
10664 {
10665 ItemBase explosive = otherDevice;
10667 if (!trg)
10668 {
10669 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10670 explosive = this;
10671 }
10672
10673 explosive.PairRemote(trg);
10674 trg.SetControlledDevice(explosive);
10675
10676 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10677 trg.SetPersistentPairID(persistentID);
10678 explosive.SetPersistentPairID(persistentID);
10679
10680 return true;
10681 }
10682 return false;
10683 }
10684
10686 float GetBaitEffectivity()
10687 {
10688 float ret = 1.0;
10689 if (HasQuantity())
10690 ret *= GetQuantityNormalized();
10691 ret *= GetHealth01();
10692
10693 return ret;
10694 }
10695
10696 #ifdef DEVELOPER
10697 override void SetDebugItem()
10698 {
10699 super.SetDebugItem();
10700 _itemBase = this;
10701 }
10702
10703 override string GetDebugText()
10704 {
10705 string text = super.GetDebugText();
10706
10707 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10708 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10709
10710 return text;
10711 }
10712 #endif
10713
10714 bool CanBeUsedForSuicide()
10715 {
10716 return true;
10717 }
10718
10720 //DEPRECATED BELOW
10722 // Backwards compatibility
10723 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10724 {
10725 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10726 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10727 }
10728
10729 // replaced by ItemSoundHandler
10730 protected EffectSound m_SoundDeployFinish;
10731 protected EffectSound m_SoundPlace;
10732 protected EffectSound m_DeployLoopSoundEx;
10733 protected EffectSound m_SoundDeploy;
10734 bool m_IsPlaceSound;
10735 bool m_IsDeploySound;
10737
10738 string GetDeployFinishSoundset();
10739 void PlayDeploySound();
10740 void PlayDeployFinishSound();
10741 void PlayPlaceSound();
10742 void PlayDeployLoopSoundEx();
10743 void StopDeployLoopSoundEx();
10744 void SoundSynchRemoteReset();
10745 void SoundSynchRemote();
10746 bool UsesGlobalDeploy(){return false;}
10747 bool CanPlayDeployLoopSound(){return false;}
10749 bool IsPlaceSound(){return m_IsPlaceSound;}
10750 bool IsDeploySound(){return m_IsDeploySound;}
10751 void SetIsPlaceSound(bool is_place_sound);
10752 void SetIsDeploySound(bool is_deploy_sound);
10753}
10754
10755EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10756{
10757 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10758 if (entity)
10759 {
10760 bool is_item = entity.IsInherited(ItemBase);
10761 if (is_item && full_quantity)
10762 {
10763 ItemBase item = ItemBase.Cast(entity);
10764 item.SetQuantity(item.GetQuantityInit());
10765 }
10766 }
10767 else
10768 {
10769 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10770 return NULL;
10771 }
10772 return entity;
10773}
10774
10775void SetupSpawnedItem(ItemBase item, float health, float quantity)
10776{
10777 if (item)
10778 {
10779 if (health > 0)
10780 item.SetHealth("", "", health);
10781
10782 if (item.CanHaveTemperature())
10783 {
10784 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10785 if (item.CanFreeze())
10786 item.SetFrozen(false);
10787 }
10788
10789 if (item.HasEnergyManager())
10790 {
10791 if (quantity >= 0)
10792 {
10793 item.GetCompEM().SetEnergy0To1(quantity);
10794 }
10795 else
10796 {
10797 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10798 }
10799 }
10800 else if (item.IsMagazine())
10801 {
10802 Magazine mag = Magazine.Cast(item);
10803 if (quantity >= 0)
10804 {
10805 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10806 }
10807 else
10808 {
10809 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10810 }
10811
10812 }
10813 else
10814 {
10815 if (quantity >= 0)
10816 {
10817 item.SetQuantityNormalized(quantity, false);
10818 }
10819 else
10820 {
10821 item.SetQuantity(Math.AbsFloat(quantity));
10822 }
10823
10824 }
10825 }
10826}
10827
10828#ifdef DEVELOPER
10829ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10830#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
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 ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
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 ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()