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

◆ IsTakeable()

override bool SpawnItemOnLocation::IsTakeable ( )
protected

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

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