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

◆ EEDelete()

override void SpawnItemOnLocation::EEDelete ( EntityAI parent)
private

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

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