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

◆ PlayFireParticles()

static void SpawnItemOnLocation::PlayFireParticles ( ItemBase weapon,
int muzzle_index,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search )
staticprotected

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

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