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

◆ IsHeavyBehaviour()

override bool SpawnItemOnLocation::IsHeavyBehaviour ( )
protected

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

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

Используется в Start().