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

◆ IsOneHandedBehaviour()

override bool SpawnItemOnLocation::IsOneHandedBehaviour ( )
protected

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

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