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

◆ IsTwoHandedBehaviour()

override bool SpawnItemOnLocation::IsTwoHandedBehaviour ( )
protected

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

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