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

◆ PreLoadSoundAttachmentType()

void SpawnItemOnLocation::PreLoadSoundAttachmentType ( )
protected

Attachment Sound Type getting from config file.

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

9064{
9065 override bool CanPutAsAttachment(EntityAI parent)
9066 {
9067 return true;
9068 }
9069};
9070
9071//const bool QUANTITY_DEBUG_REMOVE_ME = false;
9072
9073class ItemBase extends InventoryItem
9074{
9078
9080
9081 static int m_DebugActionsMask;
9083 // ============================================
9084 // Variable Manipulation System
9085 // ============================================
9086 // Quantity
9087
9088 float m_VarQuantity;
9089 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
9091 int m_VarQuantityMin;
9092 int m_VarQuantityMax;
9093 int m_Count;
9094 float m_VarStackMax;
9095 float m_StoreLoadedQuantity = float.LOWEST;
9096 // Wet
9097 float m_VarWet;
9098 float m_VarWetPrev;//for client to know wetness changed during synchronization
9099 float m_VarWetInit;
9100 float m_VarWetMin;
9101 float m_VarWetMax;
9102 // Cleanness
9103 int m_Cleanness;
9104 int m_CleannessInit;
9105 int m_CleannessMin;
9106 int m_CleannessMax;
9107 // impact sounds
9109 bool m_CanPlayImpactSound = true;
9110 float m_ImpactSpeed;
9112 //
9113 float m_HeatIsolation;
9114 float m_ItemModelLength;
9115 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
9117 int m_VarLiquidType;
9118 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
9119 int m_QuickBarBonus;
9120 bool m_IsBeingPlaced;
9121 bool m_IsHologram;
9122 bool m_IsTakeable;
9123 bool m_ThrowItemOnDrop;
9126 bool m_FixDamageSystemInit = false; //can be changed on storage version check
9127 bool can_this_be_combined; //Check if item can be combined
9128 bool m_CanThisBeSplit; //Check if item can be split
9129 bool m_IsStoreLoad = false;
9130 bool m_CanShowQuantity;
9131 bool m_HasQuantityBar;
9132 protected bool m_CanBeDigged;
9133 protected bool m_IsResultOfSplit
9134
9135 string m_SoundAttType;
9136 // items color variables
9141 //-------------------------------------------------------
9142
9143 // light source managing
9145
9149
9150 //==============================================
9151 // agent system
9152 private int m_AttachedAgents;
9153
9155 void TransferModifiers(PlayerBase reciever);
9156
9157
9158 // Weapons & suppressors particle effects
9163 static int m_LastRegisteredWeaponID = 0;
9164
9165 // Overheating effects
9167 float m_OverheatingShots;
9168 ref Timer m_CheckOverheating;
9169 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
9170 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
9171 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
9172 ref array <ref OverheatingParticle> m_OverheatingParticles;
9173
9175 protected bool m_HideSelectionsBySlot;
9176
9177 // Admin Log
9178 PluginAdminLog m_AdminLog;
9179
9180 // misc
9181 ref Timer m_PhysDropTimer;
9182
9183 // Attachment Locking variables
9184 ref array<int> m_CompatibleLocks;
9185 protected int m_LockType;
9186 protected ref EffectSound m_LockingSound;
9187 protected string m_LockSoundSet;
9188
9189 // ItemSoundHandler
9190 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
9191 protected int m_SoundSyncPlay; // id for sound to play
9192 protected int m_SoundSyncStop; // id for sound to stop
9194
9195 //temperature
9196 private float m_TemperaturePerQuantityWeight;
9197
9198 // -------------------------------------------------------------------------
9199 void ItemBase()
9200 {
9201 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
9205
9206 if (!GetGame().IsDedicatedServer())
9207 {
9208 if (HasMuzzle())
9209 {
9211
9213 {
9215 }
9216 }
9217
9219 m_ActionsInitialize = false;
9220 }
9221
9222 m_OldLocation = null;
9223
9224 if (GetGame().IsServer())
9225 {
9226 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
9227 }
9228
9229 if (ConfigIsExisting("headSelectionsToHide"))
9230 {
9232 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
9233 }
9234
9235 m_HideSelectionsBySlot = false;
9236 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9237 {
9238 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
9239 }
9240
9241 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
9242
9243 m_IsResultOfSplit = false;
9244
9246 }
9247
9248 override void InitItemVariables()
9249 {
9250 super.InitItemVariables();
9251
9252 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
9253 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
9254 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
9255 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
9256 m_VarStackMax = ConfigGetFloat("varStackMax");
9257 m_Count = ConfigGetInt("count");
9258
9259 m_CanShowQuantity = ConfigGetBool("quantityShow");
9260 m_HasQuantityBar = ConfigGetBool("quantityBar");
9261
9262 m_CleannessInit = ConfigGetInt("varCleannessInit");
9264 m_CleannessMin = ConfigGetInt("varCleannessMin");
9265 m_CleannessMax = ConfigGetInt("varCleannessMax");
9266
9267 m_WantPlayImpactSound = false;
9268 m_ImpactSpeed = 0.0;
9269
9270 m_VarWetInit = ConfigGetFloat("varWetInit");
9272 m_VarWetMin = ConfigGetFloat("varWetMin");
9273 m_VarWetMax = ConfigGetFloat("varWetMax");
9274
9275 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
9276 if (IsLiquidContainer() && GetQuantity() != 0)
9278 m_IsBeingPlaced = false;
9279 m_IsHologram = false;
9280 m_IsTakeable = true;
9281 m_CanBeMovedOverride = false;
9285 m_CanBeDigged = ConfigGetBool("canBeDigged");
9286
9287 m_CompatibleLocks = new array<int>();
9288 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
9289 m_LockType = ConfigGetInt("lockType");
9290
9291 //Define if item can be split and set ability to be combined accordingly
9292 m_CanThisBeSplit = false;
9293 can_this_be_combined = false;
9294 if (ConfigIsExisting("canBeSplit"))
9295 {
9296 can_this_be_combined = ConfigGetBool("canBeSplit");
9298 }
9299
9300 m_ItemBehaviour = -1;
9301 if (ConfigIsExisting("itemBehaviour"))
9302 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9303
9304 //RegisterNetSyncVariableInt("m_VariablesMask");
9305 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9306 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9307 RegisterNetSyncVariableInt("m_VarLiquidType");
9308 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9309
9310 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9311 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9312 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9313
9314 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9315 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9316 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9317 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9318
9319 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9320 RegisterNetSyncVariableBool("m_IsTakeable");
9321 RegisterNetSyncVariableBool("m_IsHologram");
9322
9323 InitItemSounds();
9325 {
9326 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9327 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9328 }
9329
9330 m_LockSoundSet = ConfigGetString("lockSoundSet");
9331
9333 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9334 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9335
9336 }
9337
9338 override int GetQuickBarBonus()
9339 {
9340 return m_QuickBarBonus;
9341 }
9342
9343 void InitializeActions()
9344 {
9346 if (!m_InputActionMap)
9347 {
9349 m_InputActionMap = iam;
9350 SetActions();
9352 }
9353 }
9354
9355 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9356 {
9358 {
9359 m_ActionsInitialize = true;
9361 }
9362
9363 actions = m_InputActionMap.Get(action_input_type);
9364 }
9365
9366 void SetActions()
9367 {
9368 AddAction(ActionTakeItem);
9369 AddAction(ActionTakeItemToHands);
9370 AddAction(ActionWorldCraft);
9372 AddAction(ActionAttachWithSwitch);
9373 }
9374
9375 void SetActionAnimOverrides(); // Override action animation for specific item
9376
9377 void AddAction(typename actionName)
9378 {
9379 ActionBase action = ActionManagerBase.GetAction(actionName);
9380
9381 if (!action)
9382 {
9383 Debug.LogError("Action " + actionName + " dosn't exist!");
9384 return;
9385 }
9386
9387 typename ai = action.GetInputType();
9388 if (!ai)
9389 {
9390 m_ActionsInitialize = false;
9391 return;
9392 }
9393
9394 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9395 if (!action_array)
9396 {
9397 action_array = new array<ActionBase_Basic>;
9398 m_InputActionMap.Insert(ai, action_array);
9399 }
9400 if (LogManager.IsActionLogEnable())
9401 {
9402 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9403 }
9404
9405 if (action_array.Find(action) != -1)
9406 {
9407 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9408 }
9409 else
9410 {
9411 action_array.Insert(action);
9412 }
9413 }
9414
9415 void RemoveAction(typename actionName)
9416 {
9417 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9418 ActionBase action = player.GetActionManager().GetAction(actionName);
9419 typename ai = action.GetInputType();
9420 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9421
9422 if (action_array)
9423 {
9424 action_array.RemoveItem(action);
9425 }
9426 }
9427
9428 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9429 // Set -1 for params which should stay in default state
9430 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9431 {
9432 ActionOverrideData overrideData = new ActionOverrideData();
9433 overrideData.m_CommandUID = commandUID;
9434 overrideData.m_CommandUIDProne = commandUIDProne;
9435 overrideData.m_StanceMask = stanceMask;
9436
9437 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9438 if (!actionMap) // create new map of action > overidables map
9439 {
9440 actionMap = new TActionAnimOverrideMap();
9441 m_ItemActionOverrides.Insert(action, actionMap);
9442 }
9443
9444 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9445
9446 }
9447
9448 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9449
9450 ScriptedLightBase GetLight();
9451
9452 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9453 void LoadParticleConfigOnFire(int id)
9454 {
9455 if (!m_OnFireEffect)
9457
9460
9461 string config_to_search = "CfgVehicles";
9462 string muzzle_owner_config;
9463
9464 if (!m_OnFireEffect.Contains(id))
9465 {
9466 if (IsInherited(Weapon))
9467 config_to_search = "CfgWeapons";
9468
9469 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9470
9471 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9472
9473 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9474
9475 if (config_OnFire_subclass_count > 0)
9476 {
9477 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9478
9479 for (int i = 0; i < config_OnFire_subclass_count; i++)
9480 {
9481 string particle_class = "";
9482 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9483 string config_OnFire_entry = config_OnFire_class + particle_class;
9484 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9485 WPOF_array.Insert(WPOF);
9486 }
9487
9488
9489 m_OnFireEffect.Insert(id, WPOF_array);
9490 }
9491 }
9492
9493 if (!m_OnBulletCasingEjectEffect.Contains(id))
9494 {
9495 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9496 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9497
9498 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9499
9500 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9501
9502 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9503 {
9504 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9505
9506 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9507 {
9508 string particle_class2 = "";
9509 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9510 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9511 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9512 WPOBE_array.Insert(WPOBE);
9513 }
9514
9515
9516 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9517 }
9518 }
9519 }
9520
9521 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9523 {
9526
9527 if (!m_OnOverheatingEffect.Contains(id))
9528 {
9529 string config_to_search = "CfgVehicles";
9530
9531 if (IsInherited(Weapon))
9532 config_to_search = "CfgWeapons";
9533
9534 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9535 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9536
9537 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9538 {
9539
9540 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9541
9543 {
9544 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9545 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9546 Error(error);
9547 return;
9548 }
9549
9550 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9551 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9552
9553
9554
9555 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9556 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9557
9558 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9559 {
9560 string particle_class = "";
9561 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9562 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9563 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9564
9565 if (entry_type == CT_CLASS)
9566 {
9567 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9568 WPOOH_array.Insert(WPOF);
9569 }
9570 }
9571
9572
9573 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9574 }
9575 }
9576 }
9577
9578 float GetOverheatingValue()
9579 {
9580 return m_OverheatingShots;
9581 }
9582
9583 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9584 {
9585 if (m_MaxOverheatingValue > 0)
9586 {
9588
9589 if (!m_CheckOverheating)
9591
9593 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9594
9595 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9596 }
9597 }
9598
9599 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9600 {
9602 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9603
9605 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9606
9608 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9609
9611 {
9613 }
9614 }
9615
9617 {
9619 }
9620
9621 void OnOverheatingDecay()
9622 {
9623 if (m_MaxOverheatingValue > 0)
9624 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9625 else
9627
9628 if (m_OverheatingShots <= 0)
9629 {
9632 }
9633 else
9634 {
9635 if (!m_CheckOverheating)
9637
9639 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9640 }
9641
9642 CheckOverheating(this, "", this);
9643 }
9644
9645 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9646 {
9648 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9649 }
9650
9651 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9652 {
9654 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9656 }
9657
9658 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9659 {
9661 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9662 }
9663
9664 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9665 {
9667 m_OverheatingParticles = new array<ref OverheatingParticle>;
9668
9669 OverheatingParticle OP = new OverheatingParticle();
9670 OP.RegisterParticle(p);
9671 OP.SetOverheatingLimitMin(min_heat_coef);
9672 OP.SetOverheatingLimitMax(max_heat_coef);
9673 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9674
9675 m_OverheatingParticles.Insert(OP);
9676 }
9677
9678 float GetOverheatingCoef()
9679 {
9680 if (m_MaxOverheatingValue > 0)
9682
9683 return -1;
9684 }
9685
9687 {
9689 {
9690 float overheat_coef = GetOverheatingCoef();
9691 int count = m_OverheatingParticles.Count();
9692
9693 for (int i = count; i > 0; --i)
9694 {
9695 int id = i - 1;
9696 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9697 Particle p = OP.GetParticle();
9698
9699 float overheat_min = OP.GetOverheatingLimitMin();
9700 float overheat_max = OP.GetOverheatingLimitMax();
9701
9702 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9703 {
9704 if (p)
9705 {
9706 p.Stop();
9707 OP.RegisterParticle(null);
9708 }
9709 }
9710 }
9711 }
9712 }
9713
9715 {
9717 {
9718 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9719 {
9720 int id = i - 1;
9721 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9722
9723 if (OP)
9724 {
9725 Particle p = OP.GetParticle();
9726
9727 if (p)
9728 {
9729 p.Stop();
9730 }
9731
9732 delete OP;
9733 }
9734 }
9735
9736 m_OverheatingParticles.Clear();
9738 }
9739 }
9740
9742 float GetInfectionChance(int system = 0, Param param = null)
9743 {
9744 return 0.0;
9745 }
9746
9747
9748 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9749 {
9750 return 250;//default value
9751 }
9752
9753 float GetFilterDamageRatio()
9754 {
9755 return 0;
9756 }
9757
9759 bool HasMuzzle()
9760 {
9761 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9762 return true;
9763
9764 return false;
9765 }
9766
9768 int GetMuzzleID()
9769 {
9770 if (!m_WeaponTypeToID)
9772
9773 if (m_WeaponTypeToID.Contains(GetType()))
9774 {
9775 return m_WeaponTypeToID.Get(GetType());
9776 }
9777 else
9778 {
9779 // Register new weapon ID
9781 }
9782
9784 }
9785
9792 {
9793 return -1;
9794 }
9795
9796
9797
9798 // -------------------------------------------------------------------------
9799 void ~ItemBase()
9800 {
9801 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9802 {
9803 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9804 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9805
9806 if (r_index >= 0)
9807 {
9808 InventoryLocation r_il = new InventoryLocation;
9809 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9810
9811 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9812 int r_type = r_il.GetType();
9813 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9814 {
9815 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9816 }
9817 else if (r_type == InventoryLocationType.ATTACHMENT)
9818 {
9819 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9820 }
9821
9822 }
9823
9824 player.GetHumanInventory().ClearUserReservedLocation(this);
9825 }
9826
9827 if (m_LockingSound)
9828 SEffectManager.DestroyEffect(m_LockingSound);
9829 }
9830
9831
9832
9833 // -------------------------------------------------------------------------
9834 static int GetDebugActionsMask()
9835 {
9836 return ItemBase.m_DebugActionsMask;
9837 }
9838
9839 static bool HasDebugActionsMask(int mask)
9840 {
9841 return ItemBase.m_DebugActionsMask & mask;
9842 }
9843
9844 static void SetDebugActionsMask(int mask)
9845 {
9846 ItemBase.m_DebugActionsMask = mask;
9847 }
9848
9849 static void AddDebugActionsMask(int mask)
9850 {
9851 ItemBase.m_DebugActionsMask |= mask;
9852 }
9853
9854 static void RemoveDebugActionsMask(int mask)
9855 {
9856 ItemBase.m_DebugActionsMask &= ~mask;
9857 }
9858
9859 static void ToggleDebugActionsMask(int mask)
9860 {
9861 if (HasDebugActionsMask(mask))
9862 {
9864 }
9865 else
9866 {
9867 AddDebugActionsMask(mask);
9868 }
9869 }
9870
9871 // -------------------------------------------------------------------------
9872 void SetCEBasedQuantity()
9873 {
9874 if (GetEconomyProfile())
9875 {
9876 float q_max = GetEconomyProfile().GetQuantityMax();
9877 if (q_max > 0)
9878 {
9879 float q_min = GetEconomyProfile().GetQuantityMin();
9880 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9881
9882 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9883 {
9884 ComponentEnergyManager comp = GetCompEM();
9885 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
9886 {
9887 comp.SetEnergy0To1(quantity_randomized);
9888 }
9889 }
9890 else if (HasQuantity())
9891 {
9892 SetQuantityNormalized(quantity_randomized, false);
9893 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9894 }
9895
9896 }
9897 }
9898 }
9899
9901 void LockToParent()
9902 {
9903 EntityAI parent = GetHierarchyParent();
9904
9905 if (parent)
9906 {
9907 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9908 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9909 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9910 }
9911 }
9912
9914 void UnlockFromParent()
9915 {
9916 EntityAI parent = GetHierarchyParent();
9917
9918 if (parent)
9919 {
9920 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9921 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9922 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9923 }
9924 }
9925
9926 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9927 {
9928 /*
9929 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9930 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9931 */
9932 ItemBase item2 = ItemBase.Cast(entity2);
9933
9934 if (GetGame().IsClient())
9935 {
9936 if (ScriptInputUserData.CanStoreInputUserData())
9937 {
9938 ScriptInputUserData ctx = new ScriptInputUserData;
9940 ctx.Write(-1);
9941 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9942 ctx.Write(i1);
9943 ctx.Write(item2);
9944 ctx.Write(use_stack_max);
9945 ctx.Write(-1);
9946 ctx.Send();
9947
9948 if (IsCombineAll(item2, use_stack_max))
9949 {
9950 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9951 }
9952 }
9953 }
9954 else if (!GetGame().IsMultiplayer())
9955 {
9956 CombineItems(item2, use_stack_max);
9957 }
9958 }
9959
9960 bool IsLiquidPresent()
9961 {
9962 return (GetLiquidType() != 0 && HasQuantity());
9963 }
9964
9965 bool IsLiquidContainer()
9966 {
9967 return m_LiquidContainerMask != 0;
9968 }
9969
9971 {
9972 return m_LiquidContainerMask;
9973 }
9974
9975 bool IsBloodContainer()
9976 {
9977 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9978 return false;
9979 }
9980
9981 bool IsNVG()
9982 {
9983 return false;
9984 }
9985
9988 bool IsExplosive()
9989 {
9990 return false;
9991 }
9992
9994 {
9995 return "";
9996 }
9997
9999
10000 bool IsLightSource()
10001 {
10002 return false;
10003 }
10004
10006 {
10007 return true;
10008 }
10009
10010 //--- ACTION CONDITIONS
10011 //direction
10012 bool IsFacingPlayer(PlayerBase player, string selection)
10013 {
10014 return true;
10015 }
10016
10017 bool IsPlayerInside(PlayerBase player, string selection)
10018 {
10019 return true;
10020 }
10021
10022 override bool CanObstruct()
10023 {
10024 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
10025 return !player || !IsPlayerInside(player, "");
10026 }
10027
10028 override bool IsBeingPlaced()
10029 {
10030 return m_IsBeingPlaced;
10031 }
10032
10033 void SetIsBeingPlaced(bool is_being_placed)
10034 {
10035 m_IsBeingPlaced = is_being_placed;
10036 if (!is_being_placed)
10038 SetSynchDirty();
10039 }
10040
10041 //server-side
10042 void OnEndPlacement() {}
10043
10044 override bool IsHologram()
10045 {
10046 return m_IsHologram;
10047 }
10048
10049 bool CanBeDigged()
10050 {
10051 return m_CanBeDigged;
10052 }
10053
10055 {
10056 return 1;
10057 }
10058
10059 bool CanMakeGardenplot()
10060 {
10061 return false;
10062 }
10063
10064 void SetIsHologram(bool is_hologram)
10065 {
10066 m_IsHologram = is_hologram;
10067 SetSynchDirty();
10068 }
10069 /*
10070 protected float GetNutritionalEnergy()
10071 {
10072 Edible_Base edible = Edible_Base.Cast(this);
10073 return edible.GetFoodEnergy();
10074 }
10075
10076 protected float GetNutritionalWaterContent()
10077 {
10078 Edible_Base edible = Edible_Base.Cast(this);
10079 return edible.GetFoodWater();
10080 }
10081
10082 protected float GetNutritionalIndex()
10083 {
10084 Edible_Base edible = Edible_Base.Cast(this);
10085 return edible.GetFoodNutritionalIndex();
10086 }
10087
10088 protected float GetNutritionalFullnessIndex()
10089 {
10090 Edible_Base edible = Edible_Base.Cast(this);
10091 return edible.GetFoodTotalVolume();
10092 }
10093
10094 protected float GetNutritionalToxicity()
10095 {
10096 Edible_Base edible = Edible_Base.Cast(this);
10097 return edible.GetFoodToxicity();
10098
10099 }
10100 */
10101
10102
10103 // -------------------------------------------------------------------------
10104 override void OnMovedInsideCargo(EntityAI container)
10105 {
10106 super.OnMovedInsideCargo(container);
10107
10108 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10109 }
10110
10111 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10112 {
10113 super.EEItemLocationChanged(oldLoc,newLoc);
10114
10115 PlayerBase new_player = null;
10116 PlayerBase old_player = null;
10117
10118 if (newLoc.GetParent())
10119 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10120
10121 if (oldLoc.GetParent())
10122 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10123
10124 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
10125 {
10126 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10127
10128 if (r_index >= 0)
10129 {
10130 InventoryLocation r_il = new InventoryLocation;
10131 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10132
10133 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10134 int r_type = r_il.GetType();
10135 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10136 {
10137 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10138 }
10139 else if (r_type == InventoryLocationType.ATTACHMENT)
10140 {
10141 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10142 }
10143
10144 }
10145 }
10146
10147 if (newLoc.GetType() == InventoryLocationType.HANDS)
10148 {
10149 if (new_player)
10150 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10151
10152 if (new_player == old_player)
10153 {
10154
10155 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10156 {
10157 if (oldLoc.GetType() == InventoryLocationType.CARGO)
10158 {
10159 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10160 {
10161 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10162 }
10163 }
10164 else
10165 {
10166 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10167 }
10168 }
10169
10170 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10171 {
10172 int type = oldLoc.GetType();
10173 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
10174 {
10175 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10176 }
10177 else if (type == InventoryLocationType.ATTACHMENT)
10178 {
10179 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10180 }
10181 }
10182 if (!m_OldLocation)
10183 {
10184 m_OldLocation = new InventoryLocation;
10185 }
10186 m_OldLocation.Copy(oldLoc);
10187 }
10188 else
10189 {
10190 if (m_OldLocation)
10191 {
10192 m_OldLocation.Reset();
10193 }
10194 }
10195
10197 }
10198 else
10199 {
10200 if (new_player)
10201 {
10202 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10203 if (res_index >= 0)
10204 {
10205 InventoryLocation il = new InventoryLocation;
10206 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10207 ItemBase it = ItemBase.Cast(il.GetItem());
10208 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10209 int rel_type = il.GetType();
10210 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
10211 {
10212 il.GetParent().GetOnReleaseLock().Invoke(it);
10213 }
10214 else if (rel_type == InventoryLocationType.ATTACHMENT)
10215 {
10216 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
10217 }
10218 //it.GetOnReleaseLock().Invoke(it);
10219 }
10220 }
10221 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
10222 {
10223 //ThrowPhysically(old_player, vector.Zero);
10224 m_ThrowItemOnDrop = false;
10225 }
10226
10227 if (m_OldLocation)
10228 {
10229 m_OldLocation.Reset();
10230 }
10231 }
10232 }
10233
10234 override void EOnContact(IEntity other, Contact extra)
10235 {
10237 {
10238 int liquidType = -1;
10239 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
10240 if (impactSpeed > 0.0)
10241 {
10242 m_ImpactSpeed = impactSpeed;
10243 #ifndef SERVER
10244 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10245 #else
10246 m_WantPlayImpactSound = true;
10247 SetSynchDirty();
10248 #endif
10249 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
10250 }
10251 }
10252
10253 #ifdef SERVER
10254 if (GetCompEM() && GetCompEM().IsPlugged())
10255 {
10256 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
10257 GetCompEM().UnplugThis();
10258 }
10259 #endif
10260 }
10261
10262 void RefreshPhysics();
10263
10264 override void OnCreatePhysics()
10265 {
10267 }
10268
10269 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10270 {
10271
10272 }
10273 // -------------------------------------------------------------------------
10274 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
10275 {
10276 super.OnItemLocationChanged(old_owner, new_owner);
10277
10278 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10279 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10280
10281 if (!relatedPlayer && playerNew)
10282 relatedPlayer = playerNew;
10283
10284 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10285 {
10286 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
10287 if (actionMgr)
10288 {
10289 ActionBase currentAction = actionMgr.GetRunningAction();
10290 if (currentAction)
10291 currentAction.OnItemLocationChanged(this);
10292 }
10293 }
10294
10295 Man ownerPlayerOld = null;
10296 Man ownerPlayerNew = null;
10297
10298 if (old_owner)
10299 {
10300 if (old_owner.IsMan())
10301 {
10302 ownerPlayerOld = Man.Cast(old_owner);
10303 }
10304 else
10305 {
10306 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10307 }
10308 }
10309 else
10310 {
10311 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10312 {
10313 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10314
10315 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10316 {
10317 GetCompEM().UnplugThis();
10318 }
10319 }
10320 }
10321
10322 if (new_owner)
10323 {
10324 if (new_owner.IsMan())
10325 {
10326 ownerPlayerNew = Man.Cast(new_owner);
10327 }
10328 else
10329 {
10330 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10331 }
10332 }
10333
10334 if (ownerPlayerOld != ownerPlayerNew)
10335 {
10336 if (ownerPlayerOld)
10337 {
10338 array<EntityAI> subItemsExit = new array<EntityAI>;
10339 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10340 for (int i = 0; i < subItemsExit.Count(); i++)
10341 {
10342 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10343 itemExit.OnInventoryExit(ownerPlayerOld);
10344 }
10345 }
10346
10347 if (ownerPlayerNew)
10348 {
10349 array<EntityAI> subItemsEnter = new array<EntityAI>;
10350 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10351 for (int j = 0; j < subItemsEnter.Count(); j++)
10352 {
10353 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10354 itemEnter.OnInventoryEnter(ownerPlayerNew);
10355 }
10356 }
10357 }
10358 else if (ownerPlayerNew != null)
10359 {
10360 PlayerBase nplayer;
10361 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10362 {
10363 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10364 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10365 for (int k = 0; k < subItemsUpdate.Count(); k++)
10366 {
10367 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10368 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10369 }
10370 }
10371 }
10372
10373 if (old_owner)
10374 old_owner.OnChildItemRemoved(this);
10375 if (new_owner)
10376 new_owner.OnChildItemReceived(this);
10377 }
10378
10379 // -------------------------------------------------------------------------------
10380 override void EEDelete(EntityAI parent)
10381 {
10382 super.EEDelete(parent);
10383 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10384 if (player)
10385 {
10386 OnInventoryExit(player);
10387
10388 if (player.IsAlive())
10389 {
10390 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10391 if (r_index >= 0)
10392 {
10393 InventoryLocation r_il = new InventoryLocation;
10394 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10395
10396 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10397 int r_type = r_il.GetType();
10398 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10399 {
10400 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10401 }
10402 else if (r_type == InventoryLocationType.ATTACHMENT)
10403 {
10404 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10405 }
10406
10407 }
10408
10409 player.RemoveQuickBarEntityShortcut(this);
10410 }
10411 }
10412 }
10413 // -------------------------------------------------------------------------------
10414 override void EEKilled(Object killer)
10415 {
10416 super.EEKilled(killer);
10417
10419 if (killer && killer.IsFireplace() && CanExplodeInFire())
10420 {
10421 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10422 {
10423 if (IsMagazine())
10424 {
10425 if (Magazine.Cast(this).GetAmmoCount() > 0)
10426 {
10427 ExplodeAmmo();
10428 }
10429 }
10430 else
10431 {
10432 Explode(DamageType.EXPLOSION);
10433 }
10434 }
10435 }
10436 }
10437
10438 override void OnWasAttached(EntityAI parent, int slot_id)
10439 {
10440 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10441
10442 super.OnWasAttached(parent, slot_id);
10443
10444 if (HasQuantity())
10445 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10446
10447 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10448 }
10449
10450 override void OnWasDetached(EntityAI parent, int slot_id)
10451 {
10452 super.OnWasDetached(parent, slot_id);
10453
10454 if (HasQuantity())
10455 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10456 }
10457
10458 override string ChangeIntoOnAttach(string slot)
10459 {
10460 int idx;
10461 TStringArray inventory_slots = new TStringArray;
10462 TStringArray attach_types = new TStringArray;
10463
10464 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10465 if (inventory_slots.Count() < 1) //is string
10466 {
10467 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10468 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10469 }
10470 else //is array
10471 {
10472 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10473 }
10474
10475 idx = inventory_slots.Find(slot);
10476 if (idx < 0)
10477 return "";
10478
10479 return attach_types.Get(idx);
10480 }
10481
10482 override string ChangeIntoOnDetach()
10483 {
10484 int idx = -1;
10485 string slot;
10486
10487 TStringArray inventory_slots = new TStringArray;
10488 TStringArray detach_types = new TStringArray;
10489
10490 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10491 if (inventory_slots.Count() < 1) //is string
10492 {
10493 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10494 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10495 }
10496 else //is array
10497 {
10498 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10499 if (detach_types.Count() < 1)
10500 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10501 }
10502
10503 for (int i = 0; i < inventory_slots.Count(); i++)
10504 {
10505 slot = inventory_slots.Get(i);
10506 }
10507
10508 if (slot != "")
10509 {
10510 if (detach_types.Count() == 1)
10511 idx = 0;
10512 else
10513 idx = inventory_slots.Find(slot);
10514 }
10515 if (idx < 0)
10516 return "";
10517
10518 return detach_types.Get(idx);
10519 }
10520
10521 void ExplodeAmmo()
10522 {
10523 //timer
10524 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10525
10526 //min/max time
10527 float min_time = 1;
10528 float max_time = 3;
10529 float delay = Math.RandomFloat(min_time, max_time);
10530
10531 explode_timer.Run(delay, this, "DoAmmoExplosion");
10532 }
10533
10534 void DoAmmoExplosion()
10535 {
10536 Magazine magazine = Magazine.Cast(this);
10537 int pop_sounds_count = 6;
10538 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10539
10540 //play sound
10541 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10542 string sound_name = pop_sounds[ sound_idx ];
10543 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10544
10545 //remove ammo count
10546 magazine.ServerAddAmmoCount(-1);
10547
10548 //if condition then repeat -> ExplodeAmmo
10549 float min_temp_to_explode = 100; //min temperature for item to explode
10550
10551 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10552 {
10553 ExplodeAmmo();
10554 }
10555 }
10556
10557 // -------------------------------------------------------------------------------
10558 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10559 {
10560 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10561
10562 const int CHANCE_DAMAGE_CARGO = 4;
10563 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10564 const int CHANCE_DAMAGE_NOTHING = 2;
10565
10566 if (IsClothing() || IsContainer() || IsItemTent())
10567 {
10568 float dmg = damageResult.GetDamage("","Health") * -0.5;
10569 int chances;
10570 int rnd;
10571
10572 if (GetInventory().GetCargo())
10573 {
10574 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10575 rnd = Math.RandomInt(0,chances);
10576
10577 if (rnd < CHANCE_DAMAGE_CARGO)
10578 {
10579 DamageItemInCargo(dmg);
10580 }
10581 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10582 {
10584 }
10585 }
10586 else
10587 {
10588 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10589 rnd = Math.RandomInt(0,chances);
10590
10591 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10592 {
10594 }
10595 }
10596 }
10597 }
10598
10599 bool DamageItemInCargo(float damage)
10600 {
10601 if (GetInventory().GetCargo())
10602 {
10603 int item_count = GetInventory().GetCargo().GetItemCount();
10604 if (item_count > 0)
10605 {
10606 int random_pick = Math.RandomInt(0, item_count);
10607 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10608 if (!item.IsExplosive())
10609 {
10610 item.AddHealth("","",damage);
10611 return true;
10612 }
10613 }
10614 }
10615 return false;
10616 }
10617
10618 bool DamageItemAttachments(float damage)
10619 {
10620 int attachment_count = GetInventory().AttachmentCount();
10621 if (attachment_count > 0)
10622 {
10623 int random_pick = Math.RandomInt(0, attachment_count);
10624 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10625 if (!attachment.IsExplosive())
10626 {
10627 attachment.AddHealth("","",damage);
10628 return true;
10629 }
10630 }
10631 return false;
10632 }
10633
10634 override bool IsSplitable()
10635 {
10636 return m_CanThisBeSplit;
10637 }
10638 //----------------
10639 override bool CanBeSplit()
10640 {
10641 if (IsSplitable() && (GetQuantity() > 1))
10642 return GetInventory().CanRemoveEntity();
10643
10644 return false;
10645 }
10646
10647 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10648 {
10649 if (!CanBeSplit())
10650 return;
10651
10652 if (GetGame().IsClient())
10653 {
10654 if (ScriptInputUserData.CanStoreInputUserData())
10655 {
10656 ScriptInputUserData ctx = new ScriptInputUserData;
10658 ctx.Write(1);
10659 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10660 ctx.Write(i1);
10661 ctx.Write(destination_entity);
10662 ctx.Write(true);
10663 ctx.Write(slot_id);
10664 ctx.Send();
10665 }
10666 }
10667 else if (!GetGame().IsMultiplayer())
10668 {
10669 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10670 }
10671 }
10672
10673 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10674 {
10675 if (!CanBeSplit())
10676 return;
10677
10678 float split_quantity_new;
10679 ref ItemBase new_item;
10680 float quantity = GetQuantity();
10681 float stack_max = GetTargetQuantityMax(slot_id);
10682 InventoryLocation loc = new InventoryLocation;
10683
10684 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10685 {
10686 if (stack_max <= GetQuantity())
10687 split_quantity_new = stack_max;
10688 else
10689 split_quantity_new = GetQuantity();
10690
10691 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10692 if (new_item)
10693 {
10694 new_item.SetResultOfSplit(true);
10695 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10696 AddQuantity(-split_quantity_new);
10697 new_item.SetQuantity(split_quantity_new);
10698 }
10699 }
10700 else if (destination_entity && slot_id == -1)
10701 {
10702 if (quantity > stack_max)
10703 split_quantity_new = stack_max;
10704 else
10705 split_quantity_new = quantity;
10706
10707 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10708 {
10709 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10710 new_item = ItemBase.Cast(o);
10711 }
10712
10713 if (new_item)
10714 {
10715 new_item.SetResultOfSplit(true);
10716 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10717 AddQuantity(-split_quantity_new);
10718 new_item.SetQuantity(split_quantity_new);
10719 }
10720 }
10721 else
10722 {
10723 if (stack_max != 0)
10724 {
10725 if (stack_max < GetQuantity())
10726 {
10727 split_quantity_new = GetQuantity() - stack_max;
10728 }
10729
10730 if (split_quantity_new == 0)
10731 {
10732 if (!GetGame().IsMultiplayer())
10733 player.PhysicalPredictiveDropItem(this);
10734 else
10735 player.ServerDropEntity(this);
10736 return;
10737 }
10738
10739 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10740
10741 if (new_item)
10742 {
10743 new_item.SetResultOfSplit(true);
10744 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10745 SetQuantity(split_quantity_new);
10746 new_item.SetQuantity(stack_max);
10747 new_item.PlaceOnSurface();
10748 }
10749 }
10750 }
10751 }
10752
10753 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10754 {
10755 if (!CanBeSplit())
10756 return;
10757
10758 float split_quantity_new;
10759 ref ItemBase new_item;
10760 float quantity = GetQuantity();
10761 float stack_max = GetTargetQuantityMax(slot_id);
10762 InventoryLocation loc = new InventoryLocation;
10763
10764 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10765 {
10766 if (stack_max <= GetQuantity())
10767 split_quantity_new = stack_max;
10768 else
10769 split_quantity_new = GetQuantity();
10770
10771 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10772 if (new_item)
10773 {
10774 new_item.SetResultOfSplit(true);
10775 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10776 AddQuantity(-split_quantity_new);
10777 new_item.SetQuantity(split_quantity_new);
10778 }
10779 }
10780 else if (destination_entity && slot_id == -1)
10781 {
10782 if (quantity > stack_max)
10783 split_quantity_new = stack_max;
10784 else
10785 split_quantity_new = quantity;
10786
10787 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10788 {
10789 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10790 new_item = ItemBase.Cast(o);
10791 }
10792
10793 if (new_item)
10794 {
10795 new_item.SetResultOfSplit(true);
10796 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10797 AddQuantity(-split_quantity_new);
10798 new_item.SetQuantity(split_quantity_new);
10799 }
10800 }
10801 else
10802 {
10803 if (stack_max != 0)
10804 {
10805 if (stack_max < GetQuantity())
10806 {
10807 split_quantity_new = GetQuantity() - stack_max;
10808 }
10809
10810 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10811
10812 if (new_item)
10813 {
10814 new_item.SetResultOfSplit(true);
10815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10816 SetQuantity(split_quantity_new);
10817 new_item.SetQuantity(stack_max);
10818 new_item.PlaceOnSurface();
10819 }
10820 }
10821 }
10822 }
10823
10824 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10825 {
10826 if (!CanBeSplit())
10827 return;
10828
10829 if (GetGame().IsClient())
10830 {
10831 if (ScriptInputUserData.CanStoreInputUserData())
10832 {
10833 ScriptInputUserData ctx = new ScriptInputUserData;
10835 ctx.Write(4);
10836 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10837 ctx.Write(thiz);
10838 dst.WriteToContext(ctx);
10839 ctx.Send();
10840 }
10841 }
10842 else if (!GetGame().IsMultiplayer())
10843 {
10845 }
10846 }
10847
10848 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10849 {
10850 if (!CanBeSplit())
10851 return;
10852
10853 if (GetGame().IsClient())
10854 {
10855 if (ScriptInputUserData.CanStoreInputUserData())
10856 {
10857 ScriptInputUserData ctx = new ScriptInputUserData;
10859 ctx.Write(2);
10860 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10861 ctx.Write(dummy);
10862 ctx.Write(destination_entity);
10863 ctx.Write(true);
10864 ctx.Write(idx);
10865 ctx.Write(row);
10866 ctx.Write(col);
10867 ctx.Send();
10868 }
10869 }
10870 else if (!GetGame().IsMultiplayer())
10871 {
10872 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10873 }
10874 }
10875
10876 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10877 {
10879 }
10880
10881 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10882 {
10883 if (!CanBeSplit())
10884 return this;
10885
10886 float quantity = GetQuantity();
10887 float split_quantity_new;
10888 ItemBase new_item;
10889 if (dst.IsValid())
10890 {
10891 int slot_id = dst.GetSlot();
10892 float stack_max = GetTargetQuantityMax(slot_id);
10893
10894 if (quantity > stack_max)
10895 split_quantity_new = stack_max;
10896 else
10897 split_quantity_new = quantity;
10898
10899 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10900
10901 if (new_item)
10902 {
10903 new_item.SetResultOfSplit(true);
10904 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10905 AddQuantity(-split_quantity_new);
10906 new_item.SetQuantity(split_quantity_new);
10907 }
10908
10909 return new_item;
10910 }
10911
10912 return null;
10913 }
10914
10915 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10916 {
10917 if (!CanBeSplit())
10918 return;
10919
10920 float quantity = GetQuantity();
10921 float split_quantity_new;
10922 ref ItemBase new_item;
10923 if (destination_entity)
10924 {
10925 float stackable = GetTargetQuantityMax();
10926 if (quantity > stackable)
10927 split_quantity_new = stackable;
10928 else
10929 split_quantity_new = quantity;
10930
10931 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10932 if (new_item)
10933 {
10934 new_item.SetResultOfSplit(true);
10935 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10936 AddQuantity(-split_quantity_new);
10937 new_item.SetQuantity(split_quantity_new);
10938 }
10939 }
10940 }
10941
10942 void SplitIntoStackMaxHandsClient(PlayerBase player)
10943 {
10944 if (!CanBeSplit())
10945 return;
10946
10947 if (GetGame().IsClient())
10948 {
10949 if (ScriptInputUserData.CanStoreInputUserData())
10950 {
10951 ScriptInputUserData ctx = new ScriptInputUserData;
10953 ctx.Write(3);
10954 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10955 ctx.Write(i1);
10956 ItemBase destination_entity = this;
10957 ctx.Write(destination_entity);
10958 ctx.Write(true);
10959 ctx.Write(0);
10960 ctx.Send();
10961 }
10962 }
10963 else if (!GetGame().IsMultiplayer())
10964 {
10965 SplitIntoStackMaxHands(player);
10966 }
10967 }
10968
10969 void SplitIntoStackMaxHands(PlayerBase player)
10970 {
10971 if (!CanBeSplit())
10972 return;
10973
10974 float quantity = GetQuantity();
10975 float split_quantity_new;
10976 ref ItemBase new_item;
10977 if (player)
10978 {
10979 float stackable = GetTargetQuantityMax();
10980 if (quantity > stackable)
10981 split_quantity_new = stackable;
10982 else
10983 split_quantity_new = quantity;
10984
10985 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10986 new_item = ItemBase.Cast(in_hands);
10987 if (new_item)
10988 {
10989 new_item.SetResultOfSplit(true);
10990 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10991 AddQuantity(-split_quantity_new);
10992 new_item.SetQuantity(split_quantity_new);
10993 }
10994 }
10995 }
10996
10997 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10998 {
10999 if (!CanBeSplit())
11000 return;
11001
11002 float quantity = GetQuantity();
11003 float split_quantity_new = Math.Floor(quantity * 0.5);
11004
11005 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11006
11007 if (new_item)
11008 {
11009 if (new_item.GetQuantityMax() < split_quantity_new)
11010 {
11011 split_quantity_new = new_item.GetQuantityMax();
11012 }
11013
11014 new_item.SetResultOfSplit(true);
11015 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11016
11017 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11018 {
11019 AddQuantity(-1);
11020 new_item.SetQuantity(1);
11021 }
11022 else
11023 {
11024 AddQuantity(-split_quantity_new);
11025 new_item.SetQuantity(split_quantity_new);
11026 }
11027 }
11028 }
11029
11030 void SplitItem(PlayerBase player)
11031 {
11032 if (!CanBeSplit())
11033 return;
11034
11035 float quantity = GetQuantity();
11036 float split_quantity_new = Math.Floor(quantity / 2);
11037
11038 InventoryLocation invloc = new InventoryLocation;
11039 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
11040
11041 ItemBase new_item;
11042 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11043
11044 if (new_item)
11045 {
11046 if (new_item.GetQuantityMax() < split_quantity_new)
11047 {
11048 split_quantity_new = new_item.GetQuantityMax();
11049 }
11050 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11051 {
11052 AddQuantity(-1);
11053 new_item.SetQuantity(1);
11054 }
11055 else
11056 {
11057 AddQuantity(-split_quantity_new);
11058 new_item.SetQuantity(split_quantity_new);
11059 }
11060 }
11061 }
11062
11064 void OnQuantityChanged(float delta)
11065 {
11066 SetWeightDirty();
11067 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
11068
11069 if (parent)
11070 parent.OnAttachmentQuantityChangedEx(this, delta);
11071
11072 if (IsLiquidContainer())
11073 {
11074 if (GetQuantityNormalized() <= 0.0)
11075 {
11077 }
11078 else if (GetLiquidType() == LIQUID_NONE)
11079 {
11080 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
11082 }
11083 }
11084
11085 }
11086
11089 {
11090 // insert code here
11091 }
11092
11094 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
11095 {
11097 }
11098
11099 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
11100 {
11101 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11102
11103 if (GetGame().IsServer())
11104 {
11105 if (newLevel == GameConstants.STATE_RUINED)
11106 {
11108 EntityAI parent = GetHierarchyParent();
11109 if (parent && parent.IsFireplace())
11110 {
11111 CargoBase cargo = GetInventory().GetCargo();
11112 if (cargo)
11113 {
11114 for (int i = 0; i < cargo.GetItemCount(); ++i)
11115 {
11116 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
11117 }
11118 }
11119 }
11120 }
11121
11122 if (IsResultOfSplit())
11123 {
11124 // reset the splitting result flag, return to normal item behavior
11125 SetResultOfSplit(false);
11126 return;
11127 }
11128
11129 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11130 {
11131 SetCleanness(0);//unclean the item upon damage dealt
11132 }
11133 }
11134 }
11135
11136 // just the split? TODO: verify
11137 override void OnRightClick()
11138 {
11139 super.OnRightClick();
11140
11141 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
11142 {
11143 if (GetGame().IsClient())
11144 {
11145 if (ScriptInputUserData.CanStoreInputUserData())
11146 {
11147 vector m4[4];
11148 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
11149
11150 EntityAI root = GetHierarchyRoot();
11151
11152 InventoryLocation dst = new InventoryLocation;
11153 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
11154 {
11155 if (root)
11156 {
11157 root.GetTransform(m4);
11158 dst.SetGround(this, m4);
11159 }
11160 else
11161 GetInventory().GetCurrentInventoryLocation(dst);
11162 }
11163 else
11164 {
11165 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
11166 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
11167 this shouldnt cause issues within this scope*/
11168 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
11169 {
11170 if (root)
11171 {
11172 root.GetTransform(m4);
11173 dst.SetGround(this, m4);
11174 }
11175 else
11176 GetInventory().GetCurrentInventoryLocation(dst);
11177 }
11178 else
11179 {
11180 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11181 }
11182 }
11183
11184 ScriptInputUserData ctx = new ScriptInputUserData;
11186 ctx.Write(4);
11187 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11188 ctx.Write(thiz);
11189 dst.WriteToContext(ctx);
11190 ctx.Write(true); // dummy
11191 ctx.Send();
11192 }
11193 }
11194 else if (!GetGame().IsMultiplayer())
11195 {
11196 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
11197 }
11198 }
11199 }
11200
11201 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
11202 {
11203 //TODO: delete check zero quantity check after fix double posts hands fsm events
11204 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
11205 return false;
11206
11207 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11208 return false;
11209
11210 //can_this_be_combined = ConfigGetBool("canBeSplit");
11212 return false;
11213
11214
11215 Magazine mag = Magazine.Cast(this);
11216 if (mag)
11217 {
11218 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11219 return false;
11220
11221 if (stack_max_limit)
11222 {
11223 Magazine other_mag = Magazine.Cast(other_item);
11224 if (other_item)
11225 {
11226 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11227 return false;
11228 }
11229
11230 }
11231 }
11232 else
11233 {
11234 //TODO: delete check zero quantity check after fix double posts hands fsm events
11235 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
11236 return false;
11237
11238 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
11239 return false;
11240 }
11241
11242 PlayerBase player = null;
11243 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
11244 {
11245 if (player.GetInventory().HasAttachment(this))
11246 return false;
11247
11248 if (player.IsItemsToDelete())
11249 return false;
11250 }
11251
11252 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11253 return false;
11254
11255 int slotID;
11256 string slotName;
11257 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11258 return false;
11259
11260 return true;
11261 }
11262
11263 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11264 {
11265 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11266 }
11267
11268 bool IsResultOfSplit()
11269 {
11270 return m_IsResultOfSplit;
11271 }
11272
11273 void SetResultOfSplit(bool value)
11274 {
11275 m_IsResultOfSplit = value;
11276 }
11277
11278 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11279 {
11280 return ComputeQuantityUsedEx(other_item, use_stack_max);
11281 }
11282
11283 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11284 {
11285 float other_item_quantity = other_item.GetQuantity();
11286 float this_free_space;
11287
11288 float stack_max = GetQuantityMax();
11289
11290 this_free_space = stack_max - GetQuantity();
11291
11292 if (other_item_quantity > this_free_space)
11293 {
11294 return this_free_space;
11295 }
11296 else
11297 {
11298 return other_item_quantity;
11299 }
11300 }
11301
11302 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11303 {
11304 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11305 }
11306
11307 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11308 {
11309 if (!CanBeCombined(other_item, false))
11310 return;
11311
11312 if (!IsMagazine() && other_item)
11313 {
11314 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11315 if (quantity_used != 0)
11316 {
11317 float hp1 = GetHealth01("","");
11318 float hp2 = other_item.GetHealth01("","");
11319 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11320 hpResult = hpResult / (GetQuantity() + quantity_used);
11321
11322 hpResult *= GetMaxHealth();
11323 Math.Round(hpResult);
11324 SetHealth("", "Health", hpResult);
11325
11326 AddQuantity(quantity_used);
11327 other_item.AddQuantity(-quantity_used);
11328 }
11329 }
11330 OnCombine(other_item);
11331 }
11332
11333 void OnCombine(ItemBase other_item)
11334 {
11335 #ifdef SERVER
11336 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11337 GetHierarchyParent().IncreaseLifetimeUp();
11338 #endif
11339 };
11340
11341 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11342 {
11343 PlayerBase p = PlayerBase.Cast(player);
11344
11345 array<int> recipesIds = p.m_Recipes;
11346 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11347 if (moduleRecipesManager)
11348 {
11349 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11350 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11351 }
11352
11353 for (int i = 0;i < recipesIds.Count(); i++)
11354 {
11355 int key = recipesIds.Get(i);
11356 string recipeName = moduleRecipesManager.GetRecipeName(key);
11357 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11358 }
11359 }
11360
11361 // -------------------------------------------------------------------------
11362 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11363 {
11364 super.GetDebugActions(outputList);
11365
11366 //quantity
11367 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11368 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11369 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11370 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11371
11372 //health
11373 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11374 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11375 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11376 //temperature
11377 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11378 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11379 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11380
11381 //wet
11382 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11383 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11384
11385 //liquidtype
11386 if (IsLiquidContainer())
11387 {
11388 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11389 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11390 }
11391
11392 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11393 // watch
11394 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11395 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11396
11397 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11398 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11399 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11400 }
11401
11402 // -------------------------------------------------------------------------
11403 // -------------------------------------------------------------------------
11404 // -------------------------------------------------------------------------
11405 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11406 {
11407 super.OnAction(action_id, player, ctx);
11408 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11409 {
11410 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11411 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11412 PlayerBase p = PlayerBase.Cast(player);
11413 if (EActions.RECIPES_RANGE_START < 1000)
11414 {
11415 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11416 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11417 }
11418 }
11419 #ifndef SERVER
11420 else if (action_id == EActions.WATCH_PLAYER)
11421 {
11422 PluginDeveloper.SetDeveloperItemClientEx(player);
11423 }
11424 #endif
11425 if (GetGame().IsServer())
11426 {
11427 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11428 {
11429 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11430 OnDebugButtonPressServer(id + 1);
11431 }
11432
11433 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11434 {
11435 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11436 InsertAgent(agent_id,100);
11437 }
11438
11439 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11440 {
11441 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11442 RemoveAgent(agent_id2);
11443 }
11444
11445 else if (action_id == EActions.ADD_QUANTITY)
11446 {
11447 if (IsMagazine())
11448 {
11449 Magazine mag = Magazine.Cast(this);
11450 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11451 }
11452 else
11453 {
11454 AddQuantity(GetQuantityMax() * 0.2);
11455 }
11456
11457 if (m_EM)
11458 {
11459 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11460 }
11461 //PrintVariables();
11462 }
11463
11464 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11465 {
11466 if (IsMagazine())
11467 {
11468 Magazine mag2 = Magazine.Cast(this);
11469 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11470 }
11471 else
11472 {
11473 AddQuantity(- GetQuantityMax() * 0.2);
11474 }
11475 if (m_EM)
11476 {
11477 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11478 }
11479 //PrintVariables();
11480 }
11481
11482 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11483 {
11484 SetQuantity(0);
11485
11486 if (m_EM)
11487 {
11488 m_EM.SetEnergy(0);
11489 }
11490 }
11491
11492 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11493 {
11495
11496 if (m_EM)
11497 {
11498 m_EM.SetEnergy(m_EM.GetEnergyMax());
11499 }
11500 }
11501
11502 else if (action_id == EActions.ADD_HEALTH)
11503 {
11504 AddHealth("","",GetMaxHealth("","Health")/5);
11505 }
11506 else if (action_id == EActions.REMOVE_HEALTH)
11507 {
11508 AddHealth("","",-GetMaxHealth("","Health")/5);
11509 }
11510 else if (action_id == EActions.DESTROY_HEALTH)
11511 {
11512 SetHealth01("","",0);
11513 }
11514 else if (action_id == EActions.WATCH_ITEM)
11515 {
11517 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11518 #ifdef DEVELOPER
11519 SetDebugDeveloper_item(this);
11520 #endif
11521 }
11522
11523 else if (action_id == EActions.ADD_TEMPERATURE)
11524 {
11525 AddTemperature(20);
11526 //PrintVariables();
11527 }
11528
11529 else if (action_id == EActions.REMOVE_TEMPERATURE)
11530 {
11531 AddTemperature(-20);
11532 //PrintVariables();
11533 }
11534
11535 else if (action_id == EActions.FLIP_FROZEN)
11536 {
11537 SetFrozen(!GetIsFrozen());
11538 //PrintVariables();
11539 }
11540
11541 else if (action_id == EActions.ADD_WETNESS)
11542 {
11543 AddWet(GetWetMax()/5);
11544 //PrintVariables();
11545 }
11546
11547 else if (action_id == EActions.REMOVE_WETNESS)
11548 {
11549 AddWet(-GetWetMax()/5);
11550 //PrintVariables();
11551 }
11552
11553 else if (action_id == EActions.LIQUIDTYPE_UP)
11554 {
11555 int curr_type = GetLiquidType();
11556 SetLiquidType(curr_type * 2);
11557 //AddWet(1);
11558 //PrintVariables();
11559 }
11560
11561 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11562 {
11563 int curr_type2 = GetLiquidType();
11564 SetLiquidType(curr_type2 / 2);
11565 }
11566
11567 else if (action_id == EActions.MAKE_SPECIAL)
11568 {
11569 auto debugParams = DebugSpawnParams.WithPlayer(player);
11570 OnDebugSpawnEx(debugParams);
11571 }
11572
11573 else if (action_id == EActions.DELETE)
11574 {
11575 Delete();
11576 }
11577
11578 }
11579
11580
11581 return false;
11582 }
11583
11584 // -------------------------------------------------------------------------
11585
11586
11589 void OnActivatedByTripWire();
11590
11592 void OnActivatedByItem(notnull ItemBase item);
11593
11594 //----------------------------------------------------------------
11595 //returns true if item is able to explode when put in fire
11596 bool CanExplodeInFire()
11597 {
11598 return false;
11599 }
11600
11601 //----------------------------------------------------------------
11602 bool CanEat()
11603 {
11604 return true;
11605 }
11606
11607 //----------------------------------------------------------------
11608 override bool IsIgnoredByConstruction()
11609 {
11610 return true;
11611 }
11612
11613 //----------------------------------------------------------------
11614 //has FoodStages in config?
11615 bool HasFoodStage()
11616 {
11617 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11618 return GetGame().ConfigIsExisting(config_path);
11619 }
11620
11622 FoodStage GetFoodStage()
11623 {
11624 return null;
11625 }
11626
11627 bool CanBeCooked()
11628 {
11629 return false;
11630 }
11631
11632 bool CanBeCookedOnStick()
11633 {
11634 return false;
11635 }
11636
11638 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11640
11641 //----------------------------------------------------------------
11642 bool CanRepair(ItemBase item_repair_kit)
11643 {
11644 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11645 return module_repairing.CanRepair(this, item_repair_kit);
11646 }
11647
11648 //----------------------------------------------------------------
11649 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11650 {
11651 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11652 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11653 }
11654
11655 //----------------------------------------------------------------
11656 int GetItemSize()
11657 {
11658 /*
11659 vector v_size = this.ConfigGetVector("itemSize");
11660 int v_size_x = v_size[0];
11661 int v_size_y = v_size[1];
11662 int size = v_size_x * v_size_y;
11663 return size;
11664 */
11665
11666 return 1;
11667 }
11668
11669 //----------------------------------------------------------------
11670 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11671 bool CanBeMovedOverride()
11672 {
11673 return m_CanBeMovedOverride;
11674 }
11675
11676 //----------------------------------------------------------------
11677 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11678 void SetCanBeMovedOverride(bool setting)
11679 {
11680 m_CanBeMovedOverride = setting;
11681 }
11682
11683 //----------------------------------------------------------------
11691 void MessageToOwnerStatus(string text)
11692 {
11693 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11694
11695 if (player)
11696 {
11697 player.MessageStatus(text);
11698 }
11699 }
11700
11701 //----------------------------------------------------------------
11709 void MessageToOwnerAction(string text)
11710 {
11711 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11712
11713 if (player)
11714 {
11715 player.MessageAction(text);
11716 }
11717 }
11718
11719 //----------------------------------------------------------------
11727 void MessageToOwnerFriendly(string text)
11728 {
11729 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11730
11731 if (player)
11732 {
11733 player.MessageFriendly(text);
11734 }
11735 }
11736
11737 //----------------------------------------------------------------
11745 void MessageToOwnerImportant(string text)
11746 {
11747 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11748
11749 if (player)
11750 {
11751 player.MessageImportant(text);
11752 }
11753 }
11754
11755 override bool IsItemBase()
11756 {
11757 return true;
11758 }
11759
11760 // Checks if item is of questioned kind
11761 override bool KindOf(string tag)
11762 {
11763 bool found = false;
11764 string item_name = this.GetType();
11765 ref TStringArray item_tag_array = new TStringArray;
11766 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11767
11768 int array_size = item_tag_array.Count();
11769 for (int i = 0; i < array_size; i++)
11770 {
11771 if (item_tag_array.Get(i) == tag)
11772 {
11773 found = true;
11774 break;
11775 }
11776 }
11777 return found;
11778 }
11779
11780
11781 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11782 {
11783 //Debug.Log("OnRPC called");
11784 super.OnRPC(sender, rpc_type,ctx);
11785
11786 //Play soundset for attachment locking (ActionLockAttachment.c)
11787 switch (rpc_type)
11788 {
11789 #ifndef SERVER
11790 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11791 Param2<bool, string> p = new Param2<bool, string>(false, "");
11792
11793 if (!ctx.Read(p))
11794 return;
11795
11796 bool play = p.param1;
11797 string soundSet = p.param2;
11798
11799 if (play)
11800 {
11801 if (m_LockingSound)
11802 {
11804 {
11805 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11806 }
11807 }
11808 else
11809 {
11810 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11811 }
11812 }
11813 else
11814 {
11815 SEffectManager.DestroyEffect(m_LockingSound);
11816 }
11817
11818 break;
11819 #endif
11820
11821 }
11822
11823 if (GetWrittenNoteData())
11824 {
11825 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11826 }
11827 }
11828
11829 //-----------------------------
11830 // VARIABLE MANIPULATION SYSTEM
11831 //-----------------------------
11832 int NameToID(string name)
11833 {
11834 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11835 return plugin.GetID(name);
11836 }
11837
11838 string IDToName(int id)
11839 {
11840 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11841 return plugin.GetName(id);
11842 }
11843
11845 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11846 {
11847 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11848 //read the flags
11849 int varFlags;
11850 if (!ctx.Read(varFlags))
11851 return;
11852
11853 if (varFlags & ItemVariableFlags.FLOAT)
11854 {
11855 ReadVarsFromCTX(ctx);
11856 }
11857 }
11858
11859 override void SerializeNumericalVars(array<float> floats_out)
11860 {
11861 //some variables handled on EntityAI level already!
11862 super.SerializeNumericalVars(floats_out);
11863
11864 // the order of serialization must be the same as the order of de-serialization
11865 //--------------------------------------------
11866 if (IsVariableSet(VARIABLE_QUANTITY))
11867 {
11868 floats_out.Insert(m_VarQuantity);
11869 }
11870 //--------------------------------------------
11871 if (IsVariableSet(VARIABLE_WET))
11872 {
11873 floats_out.Insert(m_VarWet);
11874 }
11875 //--------------------------------------------
11876 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11877 {
11878 floats_out.Insert(m_VarLiquidType);
11879 }
11880 //--------------------------------------------
11881 if (IsVariableSet(VARIABLE_COLOR))
11882 {
11883 floats_out.Insert(m_ColorComponentR);
11884 floats_out.Insert(m_ColorComponentG);
11885 floats_out.Insert(m_ColorComponentB);
11886 floats_out.Insert(m_ColorComponentA);
11887 }
11888 //--------------------------------------------
11889 if (IsVariableSet(VARIABLE_CLEANNESS))
11890 {
11891 floats_out.Insert(m_Cleanness);
11892 }
11893 }
11894
11895 override void DeSerializeNumericalVars(array<float> floats)
11896 {
11897 //some variables handled on EntityAI level already!
11898 super.DeSerializeNumericalVars(floats);
11899
11900 // the order of serialization must be the same as the order of de-serialization
11901 int index = 0;
11902 int mask = Math.Round(floats.Get(index));
11903
11904 index++;
11905 //--------------------------------------------
11906 if (mask & VARIABLE_QUANTITY)
11907 {
11908 if (m_IsStoreLoad)
11909 {
11910 SetStoreLoadedQuantity(floats.Get(index));
11911 }
11912 else
11913 {
11914 float quantity = floats.Get(index);
11915 SetQuantity(quantity, true, false, false, false);
11916 }
11917 index++;
11918 }
11919 //--------------------------------------------
11920 if (mask & VARIABLE_WET)
11921 {
11922 float wet = floats.Get(index);
11923 SetWet(wet);
11924 index++;
11925 }
11926 //--------------------------------------------
11927 if (mask & VARIABLE_LIQUIDTYPE)
11928 {
11929 int liquidtype = Math.Round(floats.Get(index));
11930 SetLiquidType(liquidtype);
11931 index++;
11932 }
11933 //--------------------------------------------
11934 if (mask & VARIABLE_COLOR)
11935 {
11936 m_ColorComponentR = Math.Round(floats.Get(index));
11937 index++;
11938 m_ColorComponentG = Math.Round(floats.Get(index));
11939 index++;
11940 m_ColorComponentB = Math.Round(floats.Get(index));
11941 index++;
11942 m_ColorComponentA = Math.Round(floats.Get(index));
11943 index++;
11944 }
11945 //--------------------------------------------
11946 if (mask & VARIABLE_CLEANNESS)
11947 {
11948 int cleanness = Math.Round(floats.Get(index));
11949 SetCleanness(cleanness);
11950 index++;
11951 }
11952 }
11953
11954 override void WriteVarsToCTX(ParamsWriteContext ctx)
11955 {
11956 super.WriteVarsToCTX(ctx);
11957
11958 //--------------------------------------------
11959 if (IsVariableSet(VARIABLE_QUANTITY))
11960 {
11961 ctx.Write(GetQuantity());
11962 }
11963 //--------------------------------------------
11964 if (IsVariableSet(VARIABLE_WET))
11965 {
11966 ctx.Write(GetWet());
11967 }
11968 //--------------------------------------------
11969 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11970 {
11971 ctx.Write(GetLiquidType());
11972 }
11973 //--------------------------------------------
11974 if (IsVariableSet(VARIABLE_COLOR))
11975 {
11976 int r,g,b,a;
11977 GetColor(r,g,b,a);
11978 ctx.Write(r);
11979 ctx.Write(g);
11980 ctx.Write(b);
11981 ctx.Write(a);
11982 }
11983 //--------------------------------------------
11984 if (IsVariableSet(VARIABLE_CLEANNESS))
11985 {
11986 ctx.Write(GetCleanness());
11987 }
11988 }
11989
11990 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11991 {
11992 if (!super.ReadVarsFromCTX(ctx,version))
11993 return false;
11994
11995 int intValue;
11996 float value;
11997
11998 if (version < 140)
11999 {
12000 if (!ctx.Read(intValue))
12001 return false;
12002
12003 m_VariablesMask = intValue;
12004 }
12005
12006 if (m_VariablesMask & VARIABLE_QUANTITY)
12007 {
12008 if (!ctx.Read(value))
12009 return false;
12010
12011 if (IsStoreLoad())
12012 {
12014 }
12015 else
12016 {
12017 SetQuantity(value, true, false, false, false);
12018 }
12019 }
12020 //--------------------------------------------
12021 if (version < 140)
12022 {
12023 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12024 {
12025 if (!ctx.Read(value))
12026 return false;
12027 SetTemperatureDirect(value);
12028 }
12029 }
12030 //--------------------------------------------
12031 if (m_VariablesMask & VARIABLE_WET)
12032 {
12033 if (!ctx.Read(value))
12034 return false;
12035 SetWet(value);
12036 }
12037 //--------------------------------------------
12038 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
12039 {
12040 if (!ctx.Read(intValue))
12041 return false;
12042 SetLiquidType(intValue);
12043 }
12044 //--------------------------------------------
12045 if (m_VariablesMask & VARIABLE_COLOR)
12046 {
12047 int r,g,b,a;
12048 if (!ctx.Read(r))
12049 return false;
12050 if (!ctx.Read(g))
12051 return false;
12052 if (!ctx.Read(b))
12053 return false;
12054 if (!ctx.Read(a))
12055 return false;
12056
12057 SetColor(r,g,b,a);
12058 }
12059 //--------------------------------------------
12060 if (m_VariablesMask & VARIABLE_CLEANNESS)
12061 {
12062 if (!ctx.Read(intValue))
12063 return false;
12064 SetCleanness(intValue);
12065 }
12066 //--------------------------------------------
12067 if (version >= 138 && version < 140)
12068 {
12069 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12070 {
12071 if (!ctx.Read(intValue))
12072 return false;
12073 SetFrozen(intValue);
12074 }
12075 }
12076
12077 return true;
12078 }
12079
12080 //----------------------------------------------------------------
12081 override bool OnStoreLoad(ParamsReadContext ctx, int version)
12082 {
12083 m_IsStoreLoad = true;
12085 {
12086 m_FixDamageSystemInit = true;
12087 }
12088
12089 if (!super.OnStoreLoad(ctx, version))
12090 {
12091 m_IsStoreLoad = false;
12092 return false;
12093 }
12094
12095 if (version >= 114)
12096 {
12097 bool hasQuickBarIndexSaved;
12098
12099 if (!ctx.Read(hasQuickBarIndexSaved))
12100 {
12101 m_IsStoreLoad = false;
12102 return false;
12103 }
12104
12105 if (hasQuickBarIndexSaved)
12106 {
12107 int itmQBIndex;
12108
12109 //Load quickbar item bind
12110 if (!ctx.Read(itmQBIndex))
12111 {
12112 m_IsStoreLoad = false;
12113 return false;
12114 }
12115
12116 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12117 if (itmQBIndex != -1 && parentPlayer)
12118 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12119 }
12120 }
12121 else
12122 {
12123 // Backup of how it used to be
12124 PlayerBase player;
12125 int itemQBIndex;
12126 if (version == int.MAX)
12127 {
12128 if (!ctx.Read(itemQBIndex))
12129 {
12130 m_IsStoreLoad = false;
12131 return false;
12132 }
12133 }
12134 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12135 {
12136 //Load quickbar item bind
12137 if (!ctx.Read(itemQBIndex))
12138 {
12139 m_IsStoreLoad = false;
12140 return false;
12141 }
12142 if (itemQBIndex != -1 && player)
12143 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12144 }
12145 }
12146
12147 if (version < 140)
12148 {
12149 // variable management system
12150 if (!LoadVariables(ctx, version))
12151 {
12152 m_IsStoreLoad = false;
12153 return false;
12154 }
12155 }
12156
12157 //agent trasmission system
12158 if (!LoadAgents(ctx, version))
12159 {
12160 m_IsStoreLoad = false;
12161 return false;
12162 }
12163 if (version >= 132)
12164 {
12165 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12166 if (raib)
12167 {
12168 if (!raib.OnStoreLoad(ctx,version))
12169 {
12170 m_IsStoreLoad = false;
12171 return false;
12172 }
12173 }
12174 }
12175
12176 m_IsStoreLoad = false;
12177 return true;
12178 }
12179
12180 //----------------------------------------------------------------
12181
12182 override void OnStoreSave(ParamsWriteContext ctx)
12183 {
12184 super.OnStoreSave(ctx);
12185
12186 PlayerBase player;
12187 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12188 {
12189 ctx.Write(true); // Keep track of if we should actually read this in or not
12190 //Save quickbar item bind
12191 int itemQBIndex = -1;
12192 itemQBIndex = player.FindQuickBarEntityIndex(this);
12193 ctx.Write(itemQBIndex);
12194 }
12195 else
12196 {
12197 ctx.Write(false); // Keep track of if we should actually read this in or not
12198 }
12199
12200 SaveAgents(ctx);//agent trasmission system
12201
12202 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12203 if (raib)
12204 {
12205 raib.OnStoreSave(ctx);
12206 }
12207 }
12208 //----------------------------------------------------------------
12209
12210 override void AfterStoreLoad()
12211 {
12212 super.AfterStoreLoad();
12213
12215 {
12217 }
12218
12219 if (GetStoreLoadedQuantity() != float.LOWEST)
12220 {
12222 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
12223 }
12224 }
12225
12226 override void EEOnAfterLoad()
12227 {
12228 super.EEOnAfterLoad();
12229
12231 {
12232 m_FixDamageSystemInit = false;
12233 }
12234
12237 }
12238
12239 bool CanBeDisinfected()
12240 {
12241 return false;
12242 }
12243
12244
12245 //----------------------------------------------------------------
12246 override void OnVariablesSynchronized()
12247 {
12248 if (m_Initialized)
12249 {
12250 #ifdef PLATFORM_CONSOLE
12251 //bruteforce it is
12252 if (IsSplitable())
12253 {
12254 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12255 if (menu)
12256 {
12257 menu.Refresh();
12258 }
12259 }
12260 #endif
12261 }
12262
12264 {
12265 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12266 m_WantPlayImpactSound = false;
12267 }
12268
12270 {
12271 SetWeightDirty();
12273 }
12274 if (m_VarWet != m_VarWetPrev)
12275 {
12278 }
12279
12280 if (m_SoundSyncPlay != 0)
12281 {
12282 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12283 m_SoundSyncPlay = 0;
12284 }
12285 if (m_SoundSyncStop != 0)
12286 {
12287 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12288 m_SoundSyncStop = 0;
12289 }
12290
12291 super.OnVariablesSynchronized();
12292 }
12293
12294 //------------------------- Quantity
12295 //----------------------------------------------------------------
12297 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12298 {
12299 if (!IsServerCheck(allow_client))
12300 return false;
12301
12302 if (!HasQuantity())
12303 return false;
12304
12305 float min = GetQuantityMin();
12306 float max = GetQuantityMax();
12307
12308 if (value <= (min + 0.001))
12309 value = min;
12310
12311 if (value == min)
12312 {
12313 if (destroy_config)
12314 {
12315 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12316 if (dstr)
12317 {
12318 m_VarQuantity = Math.Clamp(value, min, max);
12319 this.Delete();
12320 return true;
12321 }
12322 }
12323 else if (destroy_forced)
12324 {
12325 m_VarQuantity = Math.Clamp(value, min, max);
12326 this.Delete();
12327 return true;
12328 }
12329 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12330 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12331 }
12332
12333 float delta = m_VarQuantity;
12334 m_VarQuantity = Math.Clamp(value, min, max);
12335
12336 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12337 {
12338 delta = m_VarQuantity - delta;
12339
12340 if (delta)
12341 OnQuantityChanged(delta);
12342 }
12343
12344 SetVariableMask(VARIABLE_QUANTITY);
12345
12346 return false;
12347 }
12348
12349 //----------------------------------------------------------------
12351 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12352 {
12353 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12354 }
12355 //----------------------------------------------------------------
12356 void SetQuantityMax()
12357 {
12358 float max = GetQuantityMax();
12359 SetQuantity(max);
12360 }
12361
12362 override void SetQuantityToMinimum()
12363 {
12364 float min = GetQuantityMin();
12365 SetQuantity(min);
12366 }
12367 //----------------------------------------------------------------
12369 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12370 {
12371 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12372 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12373 SetQuantity(result, destroy_config, destroy_forced);
12374 }
12375
12376 //----------------------------------------------------------------
12378 override float GetQuantityNormalized()
12379 {
12380 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12381 }
12382
12384 {
12385 return GetQuantityNormalized();
12386 }
12387
12388 /*void SetAmmoNormalized(float value)
12389 {
12390 float value_clamped = Math.Clamp(value, 0, 1);
12391 Magazine this_mag = Magazine.Cast(this);
12392 int max_rounds = this_mag.GetAmmoMax();
12393 int result = value * max_rounds;//can the rounded if higher precision is required
12394 this_mag.SetAmmoCount(result);
12395 }*/
12396 //----------------------------------------------------------------
12397 override int GetQuantityMax()
12398 {
12399 int slot = -1;
12400 if (GetInventory())
12401 {
12402 InventoryLocation il = new InventoryLocation;
12403 GetInventory().GetCurrentInventoryLocation(il);
12404 slot = il.GetSlot();
12405 }
12406
12407 return GetTargetQuantityMax(slot);
12408 }
12409
12410 override int GetTargetQuantityMax(int attSlotID = -1)
12411 {
12412 float quantity_max = 0;
12413
12414 if (IsSplitable()) //only stackable/splitable items can check for stack size
12415 {
12416 if (attSlotID != -1)
12417 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12418
12419 if (quantity_max <= 0)
12420 quantity_max = m_VarStackMax;
12421 }
12422
12423 if (quantity_max <= 0)
12424 quantity_max = m_VarQuantityMax;
12425
12426 return quantity_max;
12427 }
12428 //----------------------------------------------------------------
12429 override int GetQuantityMin()
12430 {
12431 return m_VarQuantityMin;
12432 }
12433 //----------------------------------------------------------------
12434 int GetQuantityInit()
12435 {
12436 return m_VarQuantityInit;
12437 }
12438
12439 //----------------------------------------------------------------
12440 override bool HasQuantity()
12441 {
12442 return !(GetQuantityMax() - GetQuantityMin() == 0);
12443 }
12444
12445 override float GetQuantity()
12446 {
12447 return m_VarQuantity;
12448 }
12449
12450 bool IsFullQuantity()
12451 {
12452 return GetQuantity() >= GetQuantityMax();
12453 }
12454
12455 //Calculates weight of single item without attachments and cargo
12456 override float GetSingleInventoryItemWeightEx()
12457 {
12458 //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
12459 float weightEx = GetWeightEx();//overall weight of the item
12460 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12461 return weightEx - special;
12462 }
12463
12464 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12466 {
12468 }
12469
12470 override protected float GetWeightSpecialized(bool forceRecalc = false)
12471 {
12472 if (IsSplitable()) //quantity determines size of the stack
12473 {
12474 #ifdef DEVELOPER
12475 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12476 {
12477 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12478 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12479 }
12480 #endif
12481
12482 return GetQuantity() * GetConfigWeightModified();
12483 }
12484 else if (HasEnergyManager())// items with energy manager
12485 {
12486 #ifdef DEVELOPER
12487 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12488 {
12489 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12490 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12491 }
12492 #endif
12493 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12494 }
12495 else//everything else
12496 {
12497 #ifdef DEVELOPER
12498 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12499 {
12500 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12501 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12502 }
12503 #endif
12504 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12505 }
12506 }
12507
12509 int GetNumberOfItems()
12510 {
12511 int item_count = 0;
12512 ItemBase item;
12513
12514 if (GetInventory().GetCargo() != NULL)
12515 {
12516 item_count = GetInventory().GetCargo().GetItemCount();
12517 }
12518
12519 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12520 {
12521 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12522 if (item)
12523 item_count += item.GetNumberOfItems();
12524 }
12525 return item_count;
12526 }
12527
12529 float GetUnitWeight(bool include_wetness = true)
12530 {
12531 float weight = 0;
12532 float wetness = 1;
12533 if (include_wetness)
12534 wetness += GetWet();
12535 if (IsSplitable()) //quantity determines size of the stack
12536 {
12537 weight = wetness * m_ConfigWeight;
12538 }
12539 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12540 {
12541 weight = 1;
12542 }
12543 return weight;
12544 }
12545
12546 //-----------------------------------------------------------------
12547
12548 override void ClearInventory()
12549 {
12550 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12551 {
12552 GameInventory inv = GetInventory();
12553 array<EntityAI> items = new array<EntityAI>;
12554 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12555 for (int i = 0; i < items.Count(); i++)
12556 {
12557 ItemBase item = ItemBase.Cast(items.Get(i));
12558 if (item)
12559 {
12560 GetGame().ObjectDelete(item);
12561 }
12562 }
12563 }
12564 }
12565
12566 //------------------------- Energy
12567
12568 //----------------------------------------------------------------
12569 float GetEnergy()
12570 {
12571 float energy = 0;
12572 if (HasEnergyManager())
12573 {
12574 energy = GetCompEM().GetEnergy();
12575 }
12576 return energy;
12577 }
12578
12579
12580 override void OnEnergyConsumed()
12581 {
12582 super.OnEnergyConsumed();
12583
12585 }
12586
12587 override void OnEnergyAdded()
12588 {
12589 super.OnEnergyAdded();
12590
12592 }
12593
12594 // Converts energy (from Energy Manager) to quantity, if enabled.
12596 {
12597 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12598 {
12599 if (HasQuantity())
12600 {
12601 float energy_0to1 = GetCompEM().GetEnergy0To1();
12602 SetQuantityNormalized(energy_0to1);
12603 }
12604 }
12605 }
12606
12607 //----------------------------------------------------------------
12608 float GetHeatIsolationInit()
12609 {
12610 return ConfigGetFloat("heatIsolation");
12611 }
12612
12613 float GetHeatIsolation()
12614 {
12615 return m_HeatIsolation;
12616 }
12617
12618 float GetDryingIncrement(string pIncrementName)
12619 {
12620 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12621 if (GetGame().ConfigIsExisting(paramPath))
12622 return GetGame().ConfigGetFloat(paramPath);
12623
12624 return 0.0;
12625 }
12626
12627 float GetSoakingIncrement(string pIncrementName)
12628 {
12629 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12630 if (GetGame().ConfigIsExisting(paramPath))
12631 return GetGame().ConfigGetFloat(paramPath);
12632
12633 return 0.0;
12634 }
12635 //----------------------------------------------------------------
12636 override void SetWet(float value, bool allow_client = false)
12637 {
12638 if (!IsServerCheck(allow_client))
12639 return;
12640
12641 float min = GetWetMin();
12642 float max = GetWetMax();
12643
12644 float previousValue = m_VarWet;
12645
12646 m_VarWet = Math.Clamp(value, min, max);
12647
12648 if (previousValue != m_VarWet)
12649 {
12650 SetVariableMask(VARIABLE_WET);
12651 OnWetChanged(m_VarWet, previousValue);
12652 }
12653 }
12654 //----------------------------------------------------------------
12655 override void AddWet(float value)
12656 {
12657 SetWet(GetWet() + value);
12658 }
12659 //----------------------------------------------------------------
12660 override void SetWetMax()
12661 {
12663 }
12664 //----------------------------------------------------------------
12665 override float GetWet()
12666 {
12667 return m_VarWet;
12668 }
12669 //----------------------------------------------------------------
12670 override float GetWetMax()
12671 {
12672 return m_VarWetMax;
12673 }
12674 //----------------------------------------------------------------
12675 override float GetWetMin()
12676 {
12677 return m_VarWetMin;
12678 }
12679 //----------------------------------------------------------------
12680 override float GetWetInit()
12681 {
12682 return m_VarWetInit;
12683 }
12684 //----------------------------------------------------------------
12685 override void OnWetChanged(float newVal, float oldVal)
12686 {
12687 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12688 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12689 if (newLevel != oldLevel)
12690 {
12691 OnWetLevelChanged(newLevel,oldLevel);
12692 }
12693 }
12694
12695 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12696 {
12697 SetWeightDirty();
12698 }
12699
12700 override EWetnessLevel GetWetLevel()
12701 {
12702 return GetWetLevelInternal(m_VarWet);
12703 }
12704
12705 //----------------------------------------------------------------
12706
12707 override void SetStoreLoad(bool value)
12708 {
12709 m_IsStoreLoad = value;
12710 }
12711
12712 override bool IsStoreLoad()
12713 {
12714 return m_IsStoreLoad;
12715 }
12716
12717 override void SetStoreLoadedQuantity(float value)
12718 {
12719 m_StoreLoadedQuantity = value;
12720 }
12721
12722 override float GetStoreLoadedQuantity()
12723 {
12724 return m_StoreLoadedQuantity;
12725 }
12726
12727 //----------------------------------------------------------------
12728
12729 float GetItemModelLength()
12730 {
12731 if (ConfigIsExisting("itemModelLength"))
12732 {
12733 return ConfigGetFloat("itemModelLength");
12734 }
12735 return 0;
12736 }
12737
12738 float GetItemAttachOffset()
12739 {
12740 if (ConfigIsExisting("itemAttachOffset"))
12741 {
12742 return ConfigGetFloat("itemAttachOffset");
12743 }
12744 return 0;
12745 }
12746
12747 override void SetCleanness(int value, bool allow_client = false)
12748 {
12749 if (!IsServerCheck(allow_client))
12750 return;
12751
12752 int previousValue = m_Cleanness;
12753
12754 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12755
12756 if (previousValue != m_Cleanness)
12757 SetVariableMask(VARIABLE_CLEANNESS);
12758 }
12759
12760 override int GetCleanness()
12761 {
12762 return m_Cleanness;
12763 }
12764
12766 {
12767 return true;
12768 }
12769
12770 //----------------------------------------------------------------
12771 // ATTACHMENT LOCKING
12772 // Getters relevant to generic ActionLockAttachment
12773 int GetLockType()
12774 {
12775 return m_LockType;
12776 }
12777
12778 string GetLockSoundSet()
12779 {
12780 return m_LockSoundSet;
12781 }
12782
12783 //----------------------------------------------------------------
12784 //------------------------- Color
12785 // sets items color variable given color components
12786 override void SetColor(int r, int g, int b, int a)
12787 {
12792 SetVariableMask(VARIABLE_COLOR);
12793 }
12795 override void GetColor(out int r,out int g,out int b,out int a)
12796 {
12801 }
12802
12803 bool IsColorSet()
12804 {
12805 return IsVariableSet(VARIABLE_COLOR);
12806 }
12807
12809 string GetColorString()
12810 {
12811 int r,g,b,a;
12812 GetColor(r,g,b,a);
12813 r = r/255;
12814 g = g/255;
12815 b = b/255;
12816 a = a/255;
12817 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12818 }
12819 //----------------------------------------------------------------
12820 //------------------------- LiquidType
12821
12822 override void SetLiquidType(int value, bool allow_client = false)
12823 {
12824 if (!IsServerCheck(allow_client))
12825 return;
12826
12827 int old = m_VarLiquidType;
12828 m_VarLiquidType = value;
12829 OnLiquidTypeChanged(old,value);
12830 SetVariableMask(VARIABLE_LIQUIDTYPE);
12831 }
12832
12833 int GetLiquidTypeInit()
12834 {
12835 return ConfigGetInt("varLiquidTypeInit");
12836 }
12837
12838 override int GetLiquidType()
12839 {
12840 return m_VarLiquidType;
12841 }
12842
12843 protected void OnLiquidTypeChanged(int oldType, int newType)
12844 {
12845 if (newType == LIQUID_NONE && GetIsFrozen())
12846 SetFrozen(false);
12847 }
12848
12850 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12851 {
12852 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12853 }
12854
12855 // -------------------------------------------------------------------------
12857 void OnInventoryEnter(Man player)
12858 {
12859 PlayerBase nplayer;
12860 if (PlayerBase.CastTo(nplayer, player))
12861 {
12862 m_CanPlayImpactSound = true;
12863 //nplayer.OnItemInventoryEnter(this);
12864 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12865 }
12866 }
12867
12868 // -------------------------------------------------------------------------
12870 void OnInventoryExit(Man player)
12871 {
12872 PlayerBase nplayer;
12873 if (PlayerBase.CastTo(nplayer,player))
12874 {
12875 //nplayer.OnItemInventoryExit(this);
12876 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12877
12878 }
12879
12880 //if (!GetGame().IsDedicatedServer())
12881 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12882
12883
12884 if (HasEnergyManager())
12885 {
12886 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12887 }
12888 }
12889
12890 // ADVANCED PLACEMENT EVENTS
12891 override void OnPlacementStarted(Man player)
12892 {
12893 super.OnPlacementStarted(player);
12894
12895 SetTakeable(false);
12896 }
12897
12898 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12899 {
12900 if (m_AdminLog)
12901 {
12902 m_AdminLog.OnPlacementComplete(player, this);
12903 }
12904
12905 super.OnPlacementComplete(player, position, orientation);
12906 }
12907
12908 //-----------------------------
12909 // AGENT SYSTEM
12910 //-----------------------------
12911 //--------------------------------------------------------------------------
12912 bool ContainsAgent(int agent_id)
12913 {
12914 if (agent_id & m_AttachedAgents)
12915 {
12916 return true;
12917 }
12918 else
12919 {
12920 return false;
12921 }
12922 }
12923
12924 //--------------------------------------------------------------------------
12925 override void RemoveAgent(int agent_id)
12926 {
12927 if (ContainsAgent(agent_id))
12928 {
12929 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12930 }
12931 }
12932
12933 //--------------------------------------------------------------------------
12934 override void RemoveAllAgents()
12935 {
12936 m_AttachedAgents = 0;
12937 }
12938 //--------------------------------------------------------------------------
12939 override void RemoveAllAgentsExcept(int agent_to_keep)
12940 {
12941 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12942 }
12943 // -------------------------------------------------------------------------
12944 override void InsertAgent(int agent, float count = 1)
12945 {
12946 if (count < 1)
12947 return;
12948 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12950 }
12951
12953 void TransferAgents(int agents)
12954 {
12956 }
12957
12958 // -------------------------------------------------------------------------
12959 override int GetAgents()
12960 {
12961 return m_AttachedAgents;
12962 }
12963 //----------------------------------------------------------------------
12964
12965 /*int GetContaminationType()
12966 {
12967 int contamination_type;
12968
12969 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12970 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12971 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12972 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12973
12974 Edible_Base edible = Edible_Base.Cast(this);
12975 int agents = GetAgents();
12976 if (edible)
12977 {
12978 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12979 if (profile)
12980 {
12981 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12982 }
12983 }
12984 if (agents & CONTAMINATED_MASK)
12985 {
12986 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12987 }
12988 if (agents & POISONED_MASK)
12989 {
12990 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12991 }
12992 if (agents & NERVE_GAS_MASK)
12993 {
12994 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12995 }
12996 if (agents & DIRTY_MASK)
12997 {
12998 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12999 }
13000
13001 return agents;
13002 }*/
13003
13004 // -------------------------------------------------------------------------
13005 bool LoadAgents(ParamsReadContext ctx, int version)
13006 {
13007 if (!ctx.Read(m_AttachedAgents))
13008 return false;
13009 return true;
13010 }
13011 // -------------------------------------------------------------------------
13013 {
13014
13016 }
13017 // -------------------------------------------------------------------------
13018
13020 override void CheckForRoofLimited(float timeTresholdMS = 3000)
13021 {
13022 super.CheckForRoofLimited(timeTresholdMS);
13023
13024 float time = GetGame().GetTime();
13025 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13026 {
13027 m_PreviousRoofTestTime = time;
13028 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13029 }
13030 }
13031
13032 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
13033 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
13034 {
13035 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
13036 {
13037 return 0;
13038 }
13039
13040 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
13041 {
13042 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
13043 if (filter)
13044 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
13045 else
13046 return 0;//otherwise return 0 when no filter attached
13047 }
13048
13049 string subclassPath, entryName;
13050
13051 switch (type)
13052 {
13053 case DEF_BIOLOGICAL:
13054 entryName = "biological";
13055 break;
13056 case DEF_CHEMICAL:
13057 entryName = "chemical";
13058 break;
13059 default:
13060 entryName = "biological";
13061 break;
13062 }
13063
13064 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
13065
13066 return GetGame().ConfigGetFloat(subclassPath + entryName);
13067 }
13068
13069
13070
13072 override void EEOnCECreate()
13073 {
13074 if (!IsMagazine())
13076
13078 }
13079
13080
13081 //-------------------------
13082 // OPEN/CLOSE USER ACTIONS
13083 //-------------------------
13085 void Open();
13086 void Close();
13087 bool IsOpen()
13088 {
13089 return true;
13090 }
13091
13092 override bool CanDisplayCargo()
13093 {
13094 return IsOpen();
13095 }
13096
13097
13098 // ------------------------------------------------------------
13099 // CONDITIONS
13100 // ------------------------------------------------------------
13101 override bool CanPutInCargo(EntityAI parent)
13102 {
13103 if (parent)
13104 {
13105 if (parent.IsInherited(DayZInfected))
13106 return true;
13107
13108 if (!parent.IsRuined())
13109 return true;
13110 }
13111
13112 return true;
13113 }
13114
13115 override bool CanPutAsAttachment(EntityAI parent)
13116 {
13117 if (!super.CanPutAsAttachment(parent))
13118 {
13119 return false;
13120 }
13121
13122 if (!IsRuined() && !parent.IsRuined())
13123 {
13124 return true;
13125 }
13126
13127 return false;
13128 }
13129
13130 override bool CanReceiveItemIntoCargo(EntityAI item)
13131 {
13132 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13133 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13134 // return false;
13135
13136 return super.CanReceiveItemIntoCargo(item);
13137 }
13138
13139 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
13140 {
13141 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13142 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13143 // return false;
13144
13145 GameInventory attachmentInv = attachment.GetInventory();
13146 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13147 {
13148 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13149 return false;
13150 }
13151
13152 InventoryLocation loc = new InventoryLocation();
13153 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13154 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
13155 return false;
13156
13157 return super.CanReceiveAttachment(attachment, slotId);
13158 }
13159
13160 override bool CanReleaseAttachment(EntityAI attachment)
13161 {
13162 if (!super.CanReleaseAttachment(attachment))
13163 return false;
13164
13165 return GetInventory().AreChildrenAccessible();
13166 }
13167
13168 /*override bool CanLoadAttachment(EntityAI attachment)
13169 {
13170 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13171 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13172 // return false;
13173
13174 GameInventory attachmentInv = attachment.GetInventory();
13175 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13176 {
13177 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
13178 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
13179
13180 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13181 return false;
13182 }
13183
13184 return super.CanLoadAttachment(attachment);
13185 }*/
13186
13187 // Plays muzzle flash particle effects
13188 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13189 {
13190 int id = muzzle_owner.GetMuzzleID();
13191 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
13192
13193 if (WPOF_array)
13194 {
13195 for (int i = 0; i < WPOF_array.Count(); i++)
13196 {
13197 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13198
13199 if (WPOF)
13200 {
13201 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13202 }
13203 }
13204 }
13205 }
13206
13207 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
13208 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13209 {
13210 int id = muzzle_owner.GetMuzzleID();
13211 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
13212
13213 if (WPOBE_array)
13214 {
13215 for (int i = 0; i < WPOBE_array.Count(); i++)
13216 {
13217 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13218
13219 if (WPOBE)
13220 {
13221 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13222 }
13223 }
13224 }
13225 }
13226
13227 // Plays all weapon overheating particles
13228 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13229 {
13230 int id = muzzle_owner.GetMuzzleID();
13231 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13232
13233 if (WPOOH_array)
13234 {
13235 for (int i = 0; i < WPOOH_array.Count(); i++)
13236 {
13237 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13238
13239 if (WPOOH)
13240 {
13241 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13242 }
13243 }
13244 }
13245 }
13246
13247 // Updates all weapon overheating particles
13248 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13249 {
13250 int id = muzzle_owner.GetMuzzleID();
13251 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13252
13253 if (WPOOH_array)
13254 {
13255 for (int i = 0; i < WPOOH_array.Count(); i++)
13256 {
13257 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13258
13259 if (WPOOH)
13260 {
13261 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13262 }
13263 }
13264 }
13265 }
13266
13267 // Stops overheating particles
13268 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13269 {
13270 int id = muzzle_owner.GetMuzzleID();
13271 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13272
13273 if (WPOOH_array)
13274 {
13275 for (int i = 0; i < WPOOH_array.Count(); i++)
13276 {
13277 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13278
13279 if (WPOOH)
13280 {
13281 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13282 }
13283 }
13284 }
13285 }
13286
13287 //----------------------------------------------------------------
13288 //Item Behaviour - unified approach
13289 override bool IsHeavyBehaviour()
13290 {
13291 if (m_ItemBehaviour == 0)
13292 {
13293 return true;
13294 }
13295
13296 return false;
13297 }
13298
13299 override bool IsOneHandedBehaviour()
13300 {
13301 if (m_ItemBehaviour == 1)
13302 {
13303 return true;
13304 }
13305
13306 return false;
13307 }
13308
13309 override bool IsTwoHandedBehaviour()
13310 {
13311 if (m_ItemBehaviour == 2)
13312 {
13313 return true;
13314 }
13315
13316 return false;
13317 }
13318
13319 bool IsDeployable()
13320 {
13321 return false;
13322 }
13323
13325 float GetDeployTime()
13326 {
13327 return UATimeSpent.DEFAULT_DEPLOY;
13328 }
13329
13330
13331 //----------------------------------------------------------------
13332 // Item Targeting (User Actions)
13333 override void SetTakeable(bool pState)
13334 {
13335 m_IsTakeable = pState;
13336 SetSynchDirty();
13337 }
13338
13339 override bool IsTakeable()
13340 {
13341 return m_IsTakeable;
13342 }
13343
13344 // For cases where we want to show object widget which cant be taken to hands
13346 {
13347 return false;
13348 }
13349
13351 protected void PreLoadSoundAttachmentType()
13352 {
13353 string att_type = "None";
13354
13355 if (ConfigIsExisting("soundAttType"))
13356 {
13357 att_type = ConfigGetString("soundAttType");
13358 }
13359
13360 m_SoundAttType = att_type;
13361 }
13362
13363 override string GetAttachmentSoundType()
13364 {
13365 return m_SoundAttType;
13366 }
13367
13368 //----------------------------------------------------------------
13369 //SOUNDS - ItemSoundHandler
13370 //----------------------------------------------------------------
13371
13372 string GetPlaceSoundset(); // played when deploy starts
13373 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13374 string GetDeploySoundset(); // played when deploy sucessfully finishes
13375
13377 {
13378 if (!m_ItemSoundHandler)
13380
13381 return m_ItemSoundHandler;
13382 }
13383
13384 // override to initialize sounds
13385 protected void InitItemSounds()
13386 {
13387 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13388 return;
13389
13391
13392 if (GetPlaceSoundset() != string.Empty)
13393 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13394
13395 if (GetDeploySoundset() != string.Empty)
13396 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13397
13398 SoundParameters params = new SoundParameters();
13399 params.m_Loop = true;
13400 if (GetLoopDeploySoundset() != string.Empty)
13401 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13402 }
13403
13404 // Start sound using ItemSoundHandler
13405 void StartItemSoundServer(int id)
13406 {
13407 if (!GetGame().IsServer())
13408 return;
13409
13410 m_SoundSyncPlay = id;
13411 SetSynchDirty();
13412
13413 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13415 }
13416
13417 // Stop sound using ItemSoundHandler
13418 void StopItemSoundServer(int id)
13419 {
13420 if (!GetGame().IsServer())
13421 return;
13422
13423 m_SoundSyncStop = id;
13424 SetSynchDirty();
13425
13426 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13428 }
13429
13430 protected void ClearStartItemSoundServer()
13431 {
13432 m_SoundSyncPlay = 0;
13433 }
13434
13435 protected void ClearStopItemSoundServer()
13436 {
13437 m_SoundSyncStop = 0;
13438 }
13439
13441 void PlayAttachSound(string slot_type)
13442 {
13443 if (!GetGame().IsDedicatedServer())
13444 {
13445 if (ConfigIsExisting("attachSoundSet"))
13446 {
13447 string cfg_path = "";
13448 string soundset = "";
13449 string type_name = GetType();
13450
13451 TStringArray cfg_soundset_array = new TStringArray;
13452 TStringArray cfg_slot_array = new TStringArray;
13453 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13454 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13455
13456 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13457 {
13458 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13459 {
13460 if (cfg_slot_array[i] == slot_type)
13461 {
13462 soundset = cfg_soundset_array[i];
13463 break;
13464 }
13465 }
13466 }
13467
13468 if (soundset != "")
13469 {
13470 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13471 sound.SetAutodestroy(true);
13472 }
13473 }
13474 }
13475 }
13476
13477 void PlayDetachSound(string slot_type)
13478 {
13479 //TODO - evaluate if needed and devise universal config structure if so
13480 }
13481
13482 void OnApply(PlayerBase player);
13483
13485 {
13486 return 1.0;
13487 };
13488 //returns applicable selection
13489 array<string> GetHeadHidingSelection()
13490 {
13492 }
13493
13495 {
13497 }
13498
13499 WrittenNoteData GetWrittenNoteData() {};
13500
13502 {
13503 SetDynamicPhysicsLifeTime(0.01);
13504 m_ItemBeingDroppedPhys = false;
13505 }
13506
13508 {
13509 array<string> zone_names = new array<string>;
13510 GetDamageZones(zone_names);
13511 for (int i = 0; i < zone_names.Count(); i++)
13512 {
13513 SetHealthMax(zone_names.Get(i),"Health");
13514 }
13515 SetHealthMax("","Health");
13516 }
13517
13519 void SetZoneDamageCEInit()
13520 {
13521 float global_health = GetHealth01("","Health");
13522 array<string> zones = new array<string>;
13523 GetDamageZones(zones);
13524 //set damage of all zones to match global health level
13525 for (int i = 0; i < zones.Count(); i++)
13526 {
13527 SetHealth01(zones.Get(i),"Health",global_health);
13528 }
13529 }
13530
13532 bool IsCoverFaceForShave(string slot_name)
13533 {
13534 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13535 }
13536
13537 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13538 {
13539 if (!hasRootAsPlayer)
13540 {
13541 if (refParentIB)
13542 {
13543 // parent is wet
13544 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13545 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13546 // parent has liquid inside
13547 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13548 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13549 // drying
13550 else if (m_VarWet > m_VarWetMin)
13551 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13552 }
13553 else
13554 {
13555 // drying on ground or inside non-itembase (car, ...)
13556 if (m_VarWet > m_VarWetMin)
13557 AddWet(-1 * delta * GetDryingIncrement("ground"));
13558 }
13559 }
13560 }
13561
13562 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13563 {
13565 {
13566 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13567 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13568 {
13569 float heatPermCoef = 1.0;
13570 EntityAI ent = this;
13571 while (ent)
13572 {
13573 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13574 ent = ent.GetHierarchyParent();
13575 }
13576
13577 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13578 }
13579 }
13580 }
13581
13582 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13583 {
13584 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13585 EntityAI parent = GetHierarchyParent();
13586 if (!parent)
13587 {
13588 hasParent = false;
13589 hasRootAsPlayer = false;
13590 }
13591 else
13592 {
13593 hasParent = true;
13594 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13595 refParentIB = ItemBase.Cast(parent);
13596 }
13597 }
13598
13599 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13600 {
13601 // this is stub, implemented on Edible_Base
13602 }
13603
13604 bool CanDecay()
13605 {
13606 // return true used on selected food clases so they can decay
13607 return false;
13608 }
13609
13610 protected bool CanProcessDecay()
13611 {
13612 // this is stub, implemented on Edible_Base class
13613 // used to determine whether it is still necessary for the food to decay
13614 return false;
13615 }
13616
13617 protected bool CanHaveWetness()
13618 {
13619 // return true used on selected items that have a wetness effect
13620 return false;
13621 }
13622
13624 bool CanBeConsumed(ConsumeConditionData data = null)
13625 {
13626 return !GetIsFrozen() && IsOpen();
13627 }
13628
13629 override void ProcessVariables()
13630 {
13631 bool hasParent = false, hasRootAsPlayer = false;
13632 ItemBase refParentIB;
13633
13634 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13635 bool foodDecay = g_Game.IsFoodDecayEnabled();
13636
13637 if (wwtu || foodDecay)
13638 {
13639 bool processWetness = wwtu && CanHaveWetness();
13640 bool processTemperature = wwtu && CanHaveTemperature();
13641 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13642
13643 if (processWetness || processTemperature || processDecay)
13644 {
13645 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13646
13647 if (processWetness)
13648 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13649
13650 if (processTemperature)
13651 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13652
13653 if (processDecay)
13654 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13655 }
13656 }
13657 }
13658
13661 {
13662 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13663 }
13664
13665 override float GetTemperatureFreezeThreshold()
13666 {
13668 return Liquid.GetFreezeThreshold(GetLiquidType());
13669
13670 return super.GetTemperatureFreezeThreshold();
13671 }
13672
13673 override float GetTemperatureThawThreshold()
13674 {
13676 return Liquid.GetThawThreshold(GetLiquidType());
13677
13678 return super.GetTemperatureThawThreshold();
13679 }
13680
13681 override float GetItemOverheatThreshold()
13682 {
13684 return Liquid.GetBoilThreshold(GetLiquidType());
13685
13686 return super.GetItemOverheatThreshold();
13687 }
13688
13689 override float GetTemperatureFreezeTime()
13690 {
13691 if (HasQuantity())
13692 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13693
13694 return super.GetTemperatureFreezeTime();
13695 }
13696
13697 override float GetTemperatureThawTime()
13698 {
13699 if (HasQuantity())
13700 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13701
13702 return super.GetTemperatureThawTime();
13703 }
13704
13706 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13708 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13709
13710 bool IsCargoException4x3(EntityAI item)
13711 {
13712 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13713 }
13714
13716 {
13717 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13718 }
13719
13721 void AddLightSourceItem(ItemBase lightsource)
13722 {
13723 m_LightSourceItem = lightsource;
13724 }
13725
13727 {
13728 m_LightSourceItem = null;
13729 }
13730
13732 {
13733 return m_LightSourceItem;
13734 }
13735
13737 array<int> GetValidFinishers()
13738 {
13739 return null;
13740 }
13741
13743 bool GetActionWidgetOverride(out typename name)
13744 {
13745 return false;
13746 }
13747
13748 bool PairWithDevice(notnull ItemBase otherDevice)
13749 {
13750 if (GetGame().IsServer())
13751 {
13752 ItemBase explosive = otherDevice;
13754 if (!trg)
13755 {
13756 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13757 explosive = this;
13758 }
13759
13760 explosive.PairRemote(trg);
13761 trg.SetControlledDevice(explosive);
13762
13763 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13764 trg.SetPersistentPairID(persistentID);
13765 explosive.SetPersistentPairID(persistentID);
13766
13767 return true;
13768 }
13769 return false;
13770 }
13771
13773 float GetBaitEffectivity()
13774 {
13775 float ret = 1.0;
13776 if (HasQuantity())
13777 ret *= GetQuantityNormalized();
13778 ret *= GetHealth01();
13779
13780 return ret;
13781 }
13782
13783 #ifdef DEVELOPER
13784 override void SetDebugItem()
13785 {
13786 super.SetDebugItem();
13787 _itemBase = this;
13788 }
13789
13790 override string GetDebugText()
13791 {
13792 string text = super.GetDebugText();
13793
13794 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13795 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13796
13797 return text;
13798 }
13799 #endif
13800
13801 bool CanBeUsedForSuicide()
13802 {
13803 return true;
13804 }
13805
13807 //DEPRECATED BELOW
13809 // Backwards compatibility
13810 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13811 {
13812 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13813 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13814 }
13815
13816 // replaced by ItemSoundHandler
13817 protected EffectSound m_SoundDeployFinish;
13818 protected EffectSound m_SoundPlace;
13819 protected EffectSound m_DeployLoopSoundEx;
13820 protected EffectSound m_SoundDeploy;
13821 bool m_IsPlaceSound;
13822 bool m_IsDeploySound;
13824
13825 string GetDeployFinishSoundset();
13826 void PlayDeploySound();
13827 void PlayDeployFinishSound();
13828 void PlayPlaceSound();
13829 void PlayDeployLoopSoundEx();
13830 void StopDeployLoopSoundEx();
13831 void SoundSynchRemoteReset();
13832 void SoundSynchRemote();
13833 bool UsesGlobalDeploy(){return false;}
13834 bool CanPlayDeployLoopSound(){return false;}
13836 bool IsPlaceSound(){return m_IsPlaceSound;}
13837 bool IsDeploySound(){return m_IsDeploySound;}
13838 void SetIsPlaceSound(bool is_place_sound);
13839 void SetIsDeploySound(bool is_deploy_sound);
13840}
13841
13842EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13843{
13844 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13845 if (entity)
13846 {
13847 bool is_item = entity.IsInherited(ItemBase);
13848 if (is_item && full_quantity)
13849 {
13850 ItemBase item = ItemBase.Cast(entity);
13851 item.SetQuantity(item.GetQuantityInit());
13852 }
13853 }
13854 else
13855 {
13856 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13857 return NULL;
13858 }
13859 return entity;
13860}
13861
13862void SetupSpawnedItem(ItemBase item, float health, float quantity)
13863{
13864 if (item)
13865 {
13866 if (health > 0)
13867 item.SetHealth("", "", health);
13868
13869 if (item.CanHaveTemperature())
13870 {
13871 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13872 if (item.CanFreeze())
13873 item.SetFrozen(false);
13874 }
13875
13876 if (item.HasEnergyManager())
13877 {
13878 if (quantity >= 0)
13879 {
13880 item.GetCompEM().SetEnergy0To1(quantity);
13881 }
13882 else
13883 {
13884 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13885 }
13886 }
13887 else if (item.IsMagazine())
13888 {
13889 Magazine mag = Magazine.Cast(item);
13890 if (quantity >= 0)
13891 {
13892 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13893 }
13894 else
13895 {
13896 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13897 }
13898
13899 }
13900 else
13901 {
13902 if (quantity >= 0)
13903 {
13904 item.SetQuantityNormalized(quantity, false);
13905 }
13906 else
13907 {
13908 item.SetQuantity(Math.AbsFloat(quantity));
13909 }
13910
13911 }
13912 }
13913}
13914
13915#ifdef DEVELOPER
13916ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13917#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()

Используется в InventoryItem::ItemBase().