8509{
8511 {
8512 return true;
8513 }
8514};
8515
8517{
8518
8519};
8520
8521
8522
8524{
8528
8530
8533
8534
8535
8536
8537
8546
8552
8557
8562
8583 protected bool m_IsResultOfSplit
8584
8586
8591
8592
8593
8595
8599
8600
8601
8603
8606
8607
8608
8614
8615
8623
8626
8627
8629
8630
8632
8633
8638
8639
8644
8646
8647
8649
8650
8652 {
8657
8658 if (!
g_Game.IsDedicatedServer())
8659 {
8661 {
8663
8665 {
8667 }
8668 }
8669
8672 }
8673
8674 m_OldLocation = null;
8675
8677 {
8679 }
8680
8681 if (ConfigIsExisting("headSelectionsToHide"))
8682 {
8685 }
8686
8688 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8689 {
8691 }
8692
8694
8695 m_IsResultOfSplit = false;
8696
8698 }
8699
8701 {
8702 super.InitItemVariables();
8703
8709 m_Count = ConfigGetInt(
"count");
8710
8713
8718
8721
8726
8738
8742
8743
8746 if (ConfigIsExisting("canBeSplit"))
8747 {
8750 }
8751
8753 if (ConfigIsExisting("itemBehaviour"))
8755
8756
8759 RegisterNetSyncVariableInt("m_VarLiquidType");
8760 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8761
8762 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8763 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8764 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8765
8766 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8767 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8768 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8769 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8770
8771 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8772 RegisterNetSyncVariableBool("m_IsTakeable");
8773 RegisterNetSyncVariableBool("m_IsHologram");
8774
8777 {
8780 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8781 }
8782
8784
8786 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8788
8790 }
8791
8793 {
8795 }
8796
8798 {
8801 {
8806 }
8807 }
8808
8809 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8810 {
8812 {
8815 }
8816
8818 }
8819
8821 {
8827 }
8828
8830
8832 {
8834
8835 if (!action)
8836 {
8837 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8838 return;
8839 }
8840
8842 if (!ai)
8843 {
8845 return;
8846 }
8847
8849 if (!action_array)
8850 {
8851 action_array = new array<ActionBase_Basic>;
8853 }
8854 if (LogManager.IsActionLogEnable())
8855 {
8856 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8857 }
8858
8859 if (action_array.Find(action) != -1)
8860 {
8861 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8862 }
8863 else
8864 {
8865 action_array.Insert(action);
8866 }
8867 }
8868
8870 {
8871 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8872 ActionBase action = player.GetActionManager().GetAction(actionName);
8875
8876 if (action_array)
8877 {
8878 action_array.RemoveItem(action);
8879 }
8880 }
8881
8882
8883
8885 {
8886 ActionOverrideData overrideData = new ActionOverrideData();
8890
8892 if (!actionMap)
8893 {
8896 }
8897
8898 actionMap.Insert(this.
Type(), overrideData);
8899
8900 }
8901
8903
8905
8906
8908 {
8911
8914
8915 string config_to_search = "CfgVehicles";
8916 string muzzle_owner_config;
8917
8919 {
8920 if (IsInherited(Weapon))
8921 config_to_search = "CfgWeapons";
8922
8923 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8924
8925 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8926
8927 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8928
8929 if (config_OnFire_subclass_count > 0)
8930 {
8931 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8932
8933 for (int i = 0; i < config_OnFire_subclass_count; i++)
8934 {
8935 string particle_class = "";
8936 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8937 string config_OnFire_entry = config_OnFire_class + particle_class;
8938 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8939 WPOF_array.Insert(WPOF);
8940 }
8941
8942
8944 }
8945 }
8946
8948 {
8949 config_to_search = "CfgWeapons";
8950 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8951
8952 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8953
8954 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8955
8956 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8957 {
8958 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8959
8960 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8961 {
8962 string particle_class2 = "";
8963 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8964 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8965 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8966 WPOBE_array.Insert(WPOBE);
8967 }
8968
8969
8971 }
8972 }
8973 }
8974
8975
8977 {
8980
8982 {
8983 string config_to_search = "CfgVehicles";
8984
8985 if (IsInherited(Weapon))
8986 config_to_search = "CfgWeapons";
8987
8988 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8989 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8990
8991 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8992 {
8993
8995
8997 {
8999 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9001 return;
9002 }
9003
9006
9007
9008
9009 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9010 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9011
9012 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9013 {
9014 string particle_class = "";
9015 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9016 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9017 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9018
9019 if (entry_type == CT_CLASS)
9020 {
9021 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9022 WPOOH_array.Insert(WPOF);
9023 }
9024 }
9025
9026
9028 }
9029 }
9030 }
9031
9033 {
9035 }
9036
9038 {
9040 {
9042
9045
9048
9049 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9050 }
9051 }
9052
9054 {
9056 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9057
9059 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9060
9062 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9063
9065 {
9067 }
9068 }
9069
9071 {
9073 }
9074
9076 {
9079 else
9081
9083 {
9086 }
9087 else
9088 {
9091
9094 }
9095
9097 }
9098
9100 {
9102 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9103 }
9104
9106 {
9108 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9110 }
9111
9113 {
9115 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9116 }
9117
9119 {
9122
9123 OverheatingParticle OP = new OverheatingParticle();
9128
9130 }
9131
9133 {
9136
9137 return -1;
9138 }
9139
9141 {
9143 {
9146
9147 for (int i = count; i > 0; --i)
9148 {
9149 int id = i - 1;
9152
9155
9156 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9157 {
9158 if (p)
9159 {
9162 }
9163 }
9164 }
9165 }
9166 }
9167
9169 {
9171 {
9173 {
9174 int id = i - 1;
9176
9177 if (OP)
9178 {
9180
9181 if (p)
9182 {
9184 }
9185
9186 delete OP;
9187 }
9188 }
9189
9192 }
9193 }
9194
9197 {
9198 return 0.0;
9199 }
9200
9201
9203 {
9204 return 250;
9205 }
9206
9208 {
9209 return 0;
9210 }
9211
9214 {
9216 return true;
9217
9218 return false;
9219 }
9220
9223 {
9226
9228 {
9230 }
9231 else
9232 {
9233
9235 }
9236
9238 }
9239
9246 {
9247 return -1;
9248 }
9249
9250
9251
9252
9254 {
9256 {
9257 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9258 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9259
9260 if (r_index >= 0)
9261 {
9262 InventoryLocation r_il = new InventoryLocation;
9263 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9264
9265 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9268 {
9269 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9270 }
9272 {
9273 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9274 }
9275
9276 }
9277
9278 player.GetHumanInventory().ClearUserReservedLocation(this);
9279 }
9280
9283 }
9284
9285
9286
9287
9289 {
9290 return ItemBase.m_DebugActionsMask;
9291 }
9292
9294 {
9295 return ItemBase.m_DebugActionsMask & mask;
9296 }
9297
9299 {
9300 ItemBase.m_DebugActionsMask = mask;
9301 }
9302
9304 {
9305 ItemBase.m_DebugActionsMask |= mask;
9306 }
9307
9309 {
9310 ItemBase.m_DebugActionsMask &= ~mask;
9311 }
9312
9314 {
9316 {
9318 }
9319 else
9320 {
9322 }
9323 }
9324
9325
9327 {
9328 if (GetEconomyProfile())
9329 {
9330 float q_max = GetEconomyProfile().GetQuantityMax();
9331 if (q_max > 0)
9332 {
9333 float q_min = GetEconomyProfile().GetQuantityMin();
9334 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9335
9337 {
9338 ComponentEnergyManager comp = GetCompEM();
9340 {
9342 }
9343 }
9345 {
9347
9348 }
9349
9350 }
9351 }
9352 }
9353
9356 {
9357 EntityAI parent = GetHierarchyParent();
9358
9359 if (parent)
9360 {
9361 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9362 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9363 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9364 }
9365 }
9366
9369 {
9370 EntityAI parent = GetHierarchyParent();
9371
9372 if (parent)
9373 {
9374 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9375 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9376 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9377 }
9378 }
9379
9381 {
9382
9383
9384
9385
9387
9389 {
9390 if (ScriptInputUserData.CanStoreInputUserData())
9391 {
9392 ScriptInputUserData ctx = new ScriptInputUserData;
9398 ctx.
Write(use_stack_max);
9401
9403 {
9404 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9405 }
9406 }
9407 }
9408 else if (!
g_Game.IsMultiplayer())
9409 {
9411 }
9412 }
9413
9415 {
9417 }
9418
9420 {
9422 }
9423
9425 {
9427 }
9428
9430 {
9431
9432 return false;
9433 }
9434
9436 {
9437 return false;
9438 }
9439
9443 {
9444 return false;
9445 }
9446
9448 {
9449 return "";
9450 }
9451
9453
9455 {
9456 return false;
9457 }
9458
9460 {
9461 return true;
9462 }
9463
9464
9465
9467 {
9468 return true;
9469 }
9470
9472 {
9473 return true;
9474 }
9475
9477 {
9478 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9480 }
9481
9483 {
9485 }
9486
9488 {
9490 if (!is_being_placed)
9492 SetSynchDirty();
9493 }
9494
9495
9497
9499 {
9501 }
9502
9504 {
9506 }
9507
9509 {
9510 return 1;
9511 }
9512
9514 {
9515 return false;
9516 }
9517
9519 {
9521 SetSynchDirty();
9522 }
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9559 {
9560 super.OnMovedInsideCargo(container);
9561
9562 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9563 }
9564
9565 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9566 {
9567 super.EEItemLocationChanged(oldLoc, newLoc);
9568
9569 PlayerBase newPlayer = null;
9570 PlayerBase oldPlayer = null;
9571
9572 if (newLoc.GetParent())
9573 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9574
9575 if (oldLoc.GetParent())
9576 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9577
9579 {
9580 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9581
9582 if (rIndex >= 0)
9583 {
9584 InventoryLocation rIl = new InventoryLocation;
9585 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9586
9587 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9590 {
9591 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9592 }
9594 {
9596 }
9597
9598 }
9599 }
9600
9602 {
9603 if (newPlayer)
9604 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9605
9606 if (newPlayer == oldPlayer)
9607 {
9608 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9609 {
9611 {
9612 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9613 {
9614 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9615 }
9616 }
9617 else
9618 {
9619 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9620 }
9621 }
9622
9623 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9624 {
9625 int type = oldLoc.GetType();
9627 {
9628 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9629 }
9631 {
9632 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9633 }
9634 }
9635 if (!m_OldLocation)
9636 {
9637 m_OldLocation = new InventoryLocation;
9638 }
9639 m_OldLocation.Copy(oldLoc);
9640 }
9641 else
9642 {
9643 if (m_OldLocation)
9644 {
9645 m_OldLocation.Reset();
9646 }
9647 }
9648
9649 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9650 }
9651 else
9652 {
9653 if (newPlayer)
9654 {
9655 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9656 if (resIndex >= 0)
9657 {
9658 InventoryLocation il = new InventoryLocation;
9659 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9661 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9664 {
9665 il.
GetParent().GetOnReleaseLock().Invoke(it);
9666 }
9668 {
9670 }
9671
9672 }
9673 }
9675 {
9676
9678 }
9679
9680 if (m_OldLocation)
9681 {
9682 m_OldLocation.Reset();
9683 }
9684 }
9685
9687 {
9688 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9689 }
9690
9692 {
9693 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9694 }
9695 }
9696
9697 override void EOnContact(IEntity other, Contact extra)
9698 {
9700 {
9701 int liquidType = -1;
9703 if (impactSpeed > 0.0)
9704 {
9706 #ifndef SERVER
9708 #else
9710 SetSynchDirty();
9711 #endif
9713 }
9714 }
9715
9716 #ifdef SERVER
9717 if (GetCompEM() && GetCompEM().IsPlugged())
9718 {
9719 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9720 GetCompEM().UnplugThis();
9721 }
9722 #endif
9723 }
9724
9726
9728 {
9730 }
9731
9733 {
9734
9735 }
9736
9738 {
9739 super.OnItemLocationChanged(old_owner, new_owner);
9740
9741 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9742 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9743
9744 if (!relatedPlayer && playerNew)
9745 relatedPlayer = playerNew;
9746
9747 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9748 {
9750 if (actionMgr)
9751 {
9752 ActionBase currentAction = actionMgr.GetRunningAction();
9753 if (currentAction)
9755 }
9756 }
9757
9758 Man ownerPlayerOld = null;
9759 Man ownerPlayerNew = null;
9760
9761 if (old_owner)
9762 {
9763 if (old_owner.
IsMan())
9764 {
9765 ownerPlayerOld = Man.Cast(old_owner);
9766 }
9767 else
9768 {
9769 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9770 }
9771 }
9772 else
9773 {
9775 {
9777
9778 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9779 {
9780 GetCompEM().UnplugThis();
9781 }
9782 }
9783 }
9784
9785 if (new_owner)
9786 {
9787 if (new_owner.
IsMan())
9788 {
9789 ownerPlayerNew = Man.Cast(new_owner);
9790 }
9791 else
9792 {
9793 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9794 }
9795 }
9796
9797 if (ownerPlayerOld != ownerPlayerNew)
9798 {
9799 if (ownerPlayerOld)
9800 {
9801 array<EntityAI> subItemsExit = new array<EntityAI>;
9803 for (int i = 0; i < subItemsExit.Count(); i++)
9804 {
9807 }
9808 }
9809
9810 if (ownerPlayerNew)
9811 {
9812 array<EntityAI> subItemsEnter = new array<EntityAI>;
9814 for (int j = 0; j < subItemsEnter.Count(); j++)
9815 {
9818 }
9819 }
9820 }
9821 else if (ownerPlayerNew != null)
9822 {
9823 PlayerBase nplayer;
9824 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9825 {
9826 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9828 for (int k = 0; k < subItemsUpdate.Count(); k++)
9829 {
9831 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9832 }
9833 }
9834 }
9835
9836 if (old_owner)
9837 old_owner.OnChildItemRemoved(this);
9838 if (new_owner)
9839 new_owner.OnChildItemReceived(this);
9840 }
9841
9842
9844 {
9845 super.EEDelete(parent);
9846 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9847 if (player)
9848 {
9850
9851 if (player.IsAlive())
9852 {
9853 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9854 if (r_index >= 0)
9855 {
9856 InventoryLocation r_il = new InventoryLocation;
9857 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9858
9859 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9862 {
9863 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9864 }
9866 {
9867 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9868 }
9869
9870 }
9871
9872 player.RemoveQuickBarEntityShortcut(this);
9873 }
9874 }
9875 }
9876
9878 {
9879 super.EEKilled(killer);
9880
9883 {
9884 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9885 {
9886 if (IsMagazine())
9887 {
9888 if (Magazine.Cast(this).GetAmmoCount() > 0)
9889 {
9891 }
9892 }
9893 else
9894 {
9896 }
9897 }
9898 }
9899 }
9900
9902 {
9903 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9904
9905 super.OnWasAttached(parent, slot_id);
9906
9909
9912 }
9913
9915 {
9916 super.OnWasDetached(parent, slot_id);
9917
9920
9923 }
9924
9926 {
9927 int idx;
9930
9931 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9932 if (inventory_slots.Count() < 1)
9933 {
9934 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9935 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9936 }
9937 else
9938 {
9939 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9940 }
9941
9942 idx = inventory_slots.Find(slot);
9943 if (idx < 0)
9944 return "";
9945
9946 return attach_types.Get(idx);
9947 }
9948
9950 {
9951 int idx = -1;
9952 string slot;
9953
9956
9957 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9958 if (inventory_slots.Count() < 1)
9959 {
9960 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9961 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9962 }
9963 else
9964 {
9965 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9966 if (detach_types.Count() < 1)
9967 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9968 }
9969
9970 for (int i = 0; i < inventory_slots.Count(); i++)
9971 {
9972 slot = inventory_slots.Get(i);
9973 }
9974
9975 if (slot != "")
9976 {
9977 if (detach_types.Count() == 1)
9978 idx = 0;
9979 else
9980 idx = inventory_slots.Find(slot);
9981 }
9982 if (idx < 0)
9983 return "";
9984
9985 return detach_types.Get(idx);
9986 }
9987
9989 {
9990
9992
9993
9994 float min_time = 1;
9995 float max_time = 3;
9996 float delay = Math.RandomFloat(min_time, max_time);
9997
9998 explode_timer.Run(delay, this, "DoAmmoExplosion");
9999 }
10000
10002 {
10003 Magazine magazine = Magazine.Cast(this);
10004 int pop_sounds_count = 6;
10005 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10006
10007
10008 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10009 string sound_name = pop_sounds[ sound_idx ];
10010 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10011
10012
10013 magazine.ServerAddAmmoCount(-1);
10014
10015
10016 float min_temp_to_explode = 100;
10017
10018 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10019 {
10021 }
10022 }
10023
10024
10025 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10026 {
10027 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10028
10029 const int CHANCE_DAMAGE_CARGO = 4;
10030 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10031 const int CHANCE_DAMAGE_NOTHING = 2;
10032
10034 {
10035 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10036 int chances;
10037 int rnd;
10038
10039 if (GetInventory().GetCargo())
10040 {
10041 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10042 rnd = Math.RandomInt(0,chances);
10043
10044 if (rnd < CHANCE_DAMAGE_CARGO)
10045 {
10047 }
10048 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10049 {
10051 }
10052 }
10053 else
10054 {
10055 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10056 rnd = Math.RandomInt(0,chances);
10057
10058 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10059 {
10061 }
10062 }
10063 }
10064 }
10065
10067 {
10068 CargoBase cargo = GetInventory().GetCargo();
10069 if (cargo)
10070 {
10072 if (item_count > 0)
10073 {
10074 int random_pick = Math.RandomInt(0, item_count);
10076 if (!item.IsExplosive())
10077 {
10078 item.AddHealth("","",damage);
10079 return true;
10080 }
10081 }
10082 }
10083 return false;
10084 }
10085
10087 {
10088 GameInventory inventory = GetInventory();
10090 if (attachment_count > 0)
10091 {
10092 int random_pick = Math.RandomInt(0, attachment_count);
10094 if (!attachment.IsExplosive())
10095 {
10096 attachment.AddHealth("","",damage);
10097 return true;
10098 }
10099 }
10100 return false;
10101 }
10102
10104 {
10106 }
10107
10109 {
10111 return GetInventory().CanRemoveEntity();
10112
10113 return false;
10114 }
10115
10117 {
10118
10120 return false;
10121
10122
10124 return false;
10125
10126
10127
10129 if (delta == 0)
10130 return false;
10131
10132
10133 return true;
10134 }
10135
10137 {
10139 {
10140 if (ScriptInputUserData.CanStoreInputUserData())
10141 {
10142 ScriptInputUserData ctx = new ScriptInputUserData;
10147 ctx.
Write(destination_entity);
10149 ctx.
Write(slot_id);
10151 }
10152 }
10153 else if (!
g_Game.IsMultiplayer())
10154 {
10156 }
10157 }
10158
10160 {
10161 float split_quantity_new;
10165 InventoryLocation loc = new InventoryLocation;
10166
10167 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10168 {
10170 split_quantity_new = stack_max;
10171 else
10173
10175 {
10176 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10177 if (new_item)
10178 {
10179 new_item.SetResultOfSplit(true);
10180 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10182 new_item.
SetQuantity(split_quantity_new,
false,
true);
10183 }
10184 }
10185 }
10186 else if (destination_entity && slot_id == -1)
10187 {
10188 if (quantity > stack_max)
10189 split_quantity_new = stack_max;
10190 else
10191 split_quantity_new = quantity;
10192
10194 {
10195 GameInventory destinationInventory = destination_entity.GetInventory();
10197 {
10200 }
10201
10202 if (new_item)
10203 {
10204 new_item.SetResultOfSplit(true);
10205 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10207 new_item.
SetQuantity(split_quantity_new,
false,
true);
10208 }
10209 }
10210 }
10211 else
10212 {
10213 if (stack_max != 0)
10214 {
10216 {
10218 }
10219
10220 if (split_quantity_new == 0)
10221 {
10222 if (!
g_Game.IsMultiplayer())
10223 player.PhysicalPredictiveDropItem(this);
10224 else
10225 player.ServerDropEntity(this);
10226 return;
10227 }
10228
10230 {
10232
10233 if (new_item)
10234 {
10235 new_item.SetResultOfSplit(true);
10236 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10239 new_item.PlaceOnSurface();
10240 }
10241 }
10242 }
10243 }
10244 }
10245
10247 {
10248 float split_quantity_new;
10252 InventoryLocation loc = new InventoryLocation;
10253
10254 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10255 {
10257 split_quantity_new = stack_max;
10258 else
10260
10262 {
10263 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10264 if (new_item)
10265 {
10266 new_item.SetResultOfSplit(true);
10267 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10269 new_item.
SetQuantity(split_quantity_new,
false,
true);
10270 }
10271 }
10272 }
10273 else if (destination_entity && slot_id == -1)
10274 {
10275 if (quantity > stack_max)
10276 split_quantity_new = stack_max;
10277 else
10278 split_quantity_new = quantity;
10279
10281 {
10282 GameInventory destinationInventory = destination_entity.GetInventory();
10284 {
10287 }
10288
10289 if (new_item)
10290 {
10291 new_item.SetResultOfSplit(true);
10292 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10294 new_item.
SetQuantity(split_quantity_new,
false,
true);
10295 }
10296 }
10297 }
10298 else
10299 {
10300 if (stack_max != 0)
10301 {
10303 {
10305 }
10306
10308 {
10310
10311 if (new_item)
10312 {
10313 new_item.SetResultOfSplit(true);
10314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10317 new_item.PlaceOnSurface();
10318 }
10319 }
10320 }
10321 }
10322 }
10323
10325 {
10327 {
10328 if (ScriptInputUserData.CanStoreInputUserData())
10329 {
10330 ScriptInputUserData ctx = new ScriptInputUserData;
10335 dst.WriteToContext(ctx);
10337 }
10338 }
10339 else if (!
g_Game.IsMultiplayer())
10340 {
10342 }
10343 }
10344
10346 {
10348 {
10349 if (ScriptInputUserData.CanStoreInputUserData())
10350 {
10351 ScriptInputUserData ctx = new ScriptInputUserData;
10356 ctx.
Write(destination_entity);
10362 }
10363 }
10364 else if (!
g_Game.IsMultiplayer())
10365 {
10367 }
10368 }
10369
10371 {
10373 }
10374
10376 {
10378 float split_quantity_new;
10380 if (dst.IsValid())
10381 {
10382 int slot_id = dst.GetSlot();
10384
10385 if (quantity > stack_max)
10386 split_quantity_new = stack_max;
10387 else
10388 split_quantity_new = quantity;
10389
10391 {
10393
10394 if (new_item)
10395 {
10396 new_item.SetResultOfSplit(true);
10397 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10399 new_item.
SetQuantity(split_quantity_new,
false,
true);
10400 }
10401
10402 return new_item;
10403 }
10404 }
10405
10406 return null;
10407 }
10408
10410 {
10412 float split_quantity_new;
10414 if (destination_entity)
10415 {
10417 if (quantity > stackable)
10418 split_quantity_new = stackable;
10419 else
10420 split_quantity_new = quantity;
10421
10423 {
10424 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10425 if (new_item)
10426 {
10427 new_item.SetResultOfSplit(true);
10428 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10430 new_item.
SetQuantity(split_quantity_new,
false,
true);
10431 }
10432 }
10433 }
10434 }
10435
10437 {
10439 {
10440 if (ScriptInputUserData.CanStoreInputUserData())
10441 {
10442 ScriptInputUserData ctx = new ScriptInputUserData;
10447 ItemBase destination_entity =
this;
10448 ctx.
Write(destination_entity);
10452 }
10453 }
10454 else if (!
g_Game.IsMultiplayer())
10455 {
10457 }
10458 }
10459
10461 {
10463 float split_quantity_new;
10465 if (player)
10466 {
10468 if (quantity > stackable)
10469 split_quantity_new = stackable;
10470 else
10471 split_quantity_new = quantity;
10472
10474 {
10475 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10476 new_item =
ItemBase.Cast(in_hands);
10477 if (new_item)
10478 {
10479 new_item.SetResultOfSplit(true);
10480 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10482 new_item.SetQuantity(split_quantity_new, false, true);
10483 }
10484 }
10485 }
10486 }
10487
10489 {
10491 float split_quantity_new = Math.Floor(quantity * 0.5);
10492
10494 return;
10495
10497
10498 if (new_item)
10499 {
10500 if (new_item.GetQuantityMax() < split_quantity_new)
10501 {
10502 split_quantity_new = new_item.GetQuantityMax();
10503 }
10504
10505 new_item.SetResultOfSplit(true);
10506 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10507
10509 {
10512 }
10513 else
10514 {
10516 new_item.
SetQuantity(split_quantity_new,
false,
true);
10517 }
10518 }
10519 }
10520
10522 {
10524 float split_quantity_new = Math.Floor(quantity / 2);
10525
10527 return;
10528
10529 InventoryLocation invloc = new InventoryLocation;
10531
10533 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10534
10535 if (new_item)
10536 {
10537 if (new_item.GetQuantityMax() < split_quantity_new)
10538 {
10539 split_quantity_new = new_item.GetQuantityMax();
10540 }
10542 {
10545 }
10546 else if (split_quantity_new > 1)
10547 {
10549 new_item.
SetQuantity(split_quantity_new,
false,
true);
10550 }
10551 }
10552 }
10553
10556 {
10557 SetWeightDirty();
10559
10560 if (parent)
10561 parent.OnAttachmentQuantityChangedEx(this, delta);
10562
10564 {
10566 {
10568 }
10570 {
10571 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10573 }
10574 }
10575 }
10576
10579 {
10580
10581 }
10582
10585 {
10587 }
10588
10590 {
10591 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10592
10594 {
10595 if (newLevel == GameConstants.STATE_RUINED)
10596 {
10598 EntityAI parent = GetHierarchyParent();
10599 if (parent && parent.IsFireplace())
10600 {
10601 CargoBase cargo = GetInventory().GetCargo();
10602 if (cargo)
10603 {
10605 {
10607 }
10608 }
10609 }
10610 }
10611
10613 {
10614
10616 return;
10617 }
10618
10619 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10620 {
10622 }
10623 }
10624 }
10625
10626
10628 {
10629 super.OnRightClick();
10630
10632 {
10634 {
10635 if (ScriptInputUserData.CanStoreInputUserData())
10636 {
10637 EntityAI root = GetHierarchyRoot();
10638 Man playerOwner = GetHierarchyRootPlayer();
10639 InventoryLocation dst = new InventoryLocation;
10640
10641
10642 if (!playerOwner && root && root == this)
10643 {
10645 }
10646 else
10647 {
10648
10649 GetInventory().GetCurrentInventoryLocation(dst);
10651 {
10652 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10654 {
10656 }
10657 else
10658 {
10660
10661
10662 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10663 {
10665 }
10666 else
10667 {
10668 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10669 }
10670 }
10671 }
10672 }
10673
10674 ScriptInputUserData ctx = new ScriptInputUserData;
10682 }
10683 }
10684 else if (!
g_Game.IsMultiplayer())
10685 {
10687 }
10688 }
10689 }
10690
10692 {
10693 if (root)
10694 {
10695 vector m4[4];
10696 root.GetTransform(m4);
10697 dst.SetGround(this, m4);
10698 }
10699 else
10700 {
10701 GetInventory().GetCurrentInventoryLocation(dst);
10702 }
10703 }
10704
10705 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10706 {
10707
10708 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10709 return false;
10710
10711 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10712 return false;
10713
10714
10716 return false;
10717
10718
10719 Magazine mag = Magazine.Cast(this);
10720 if (mag)
10721 {
10722 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10723 return false;
10724
10725 if (stack_max_limit)
10726 {
10727 Magazine other_mag = Magazine.Cast(other_item);
10728 if (other_item)
10729 {
10730 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10731 return false;
10732 }
10733
10734 }
10735 }
10736 else
10737 {
10738
10740 return false;
10741
10743 return false;
10744 }
10745
10746 PlayerBase player = null;
10747 if (CastTo(player, GetHierarchyRootPlayer()))
10748 {
10749 if (player.GetInventory().HasAttachment(this))
10750 return false;
10751
10752 if (player.IsItemsToDelete())
10753 return false;
10754 }
10755
10756 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10757 return false;
10758
10759 int slotID;
10761 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10762 return false;
10763
10764 return true;
10765 }
10766
10768 {
10770 }
10771
10773 {
10774 return m_IsResultOfSplit;
10775 }
10776
10778 {
10779 m_IsResultOfSplit = value;
10780 }
10781
10783 {
10785 }
10786
10788 {
10789 float other_item_quantity = other_item.GetQuantity();
10790 float this_free_space;
10791
10793
10795
10796 if (other_item_quantity > this_free_space)
10797 {
10798 return this_free_space;
10799 }
10800 else
10801 {
10802 return other_item_quantity;
10803 }
10804 }
10805
10807 {
10809 }
10810
10812 {
10814 return;
10815
10816 if (!IsMagazine() && other_item)
10817 {
10819 if (quantity_used != 0)
10820 {
10821 float hp1 = GetHealth01("","");
10822 float hp2 = other_item.GetHealth01("","");
10823 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10824 hpResult = hpResult / (
GetQuantity() + quantity_used);
10825
10826 hpResult *= GetMaxHealth();
10827 Math.Round(hpResult);
10828 SetHealth("", "Health", hpResult);
10829
10831 other_item.AddQuantity(-quantity_used);
10832 }
10833 }
10835 }
10836
10838 {
10839 #ifdef SERVER
10840 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10841 GetHierarchyParent().IncreaseLifetimeUp();
10842 #endif
10843 };
10844
10846 {
10847 PlayerBase p = PlayerBase.Cast(player);
10848
10849 array<int> recipesIds = p.m_Recipes;
10850 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10851 if (moduleRecipesManager)
10852 {
10853 EntityAI itemInHands = player.GetEntityInHands();
10854 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10855 }
10856
10857 for (int i = 0;i < recipesIds.Count(); i++)
10858 {
10859 int key = recipesIds.Get(i);
10860 string recipeName = moduleRecipesManager.GetRecipeName(key);
10862 }
10863 }
10864
10865
10866 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10867 {
10868 super.GetDebugActions(outputList);
10869
10870
10876
10877
10882
10887
10888
10892
10893
10895 {
10899 }
10900
10903
10904
10908
10910
10911 InventoryLocation loc = new InventoryLocation();
10912 GetInventory().GetCurrentInventoryLocation(loc);
10914 {
10915 if (Gizmo_IsSupported())
10918 }
10919
10921 }
10922
10923
10924
10925
10927 {
10928 super.OnAction(action_id, player, ctx);
10929
10931 {
10932 switch (action_id)
10933 {
10937 return true;
10941 return true;
10942 }
10943 }
10944
10946 {
10947 switch (action_id)
10948 {
10950 Delete();
10951 return true;
10952 }
10953 }
10954
10955 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10956 {
10957 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10958 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10959 PlayerBase p = PlayerBase.Cast(player);
10960 if (
EActions.RECIPES_RANGE_START < 1000)
10961 {
10962 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10963 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10964 }
10965 }
10966 #ifndef SERVER
10967 else if (action_id ==
EActions.WATCH_PLAYER)
10968 {
10969 PluginDeveloper.SetDeveloperItemClientEx(player);
10970 }
10971 #endif
10973 {
10974 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10975 {
10976 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10977 OnDebugButtonPressServer(id + 1);
10978 }
10979
10980 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10981 {
10982 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10984 }
10985
10986 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10987 {
10988 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10990 }
10991
10992 else if (action_id ==
EActions.ADD_QUANTITY)
10993 {
10994 if (IsMagazine())
10995 {
10996 Magazine mag = Magazine.Cast(this);
10997 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10998 }
10999 else
11000 {
11002 }
11003
11004 if (m_EM)
11005 {
11006 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11007 }
11008
11009 }
11010
11011 else if (action_id ==
EActions.REMOVE_QUANTITY)
11012 {
11013 if (IsMagazine())
11014 {
11015 Magazine mag2 = Magazine.Cast(this);
11016 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11017 }
11018 else
11019 {
11021 }
11022 if (m_EM)
11023 {
11024 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11025 }
11026
11027 }
11028
11029 else if (action_id ==
EActions.SET_QUANTITY_0)
11030 {
11032
11033 if (m_EM)
11034 {
11035 m_EM.SetEnergy(0);
11036 }
11037 }
11038
11039 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11040 {
11042
11043 if (m_EM)
11044 {
11045 m_EM.SetEnergy(m_EM.GetEnergyMax());
11046 }
11047 }
11048
11049 else if (action_id ==
EActions.ADD_HEALTH)
11050 {
11051 AddHealth("","",GetMaxHealth("","Health")/5);
11052 }
11053 else if (action_id ==
EActions.REMOVE_HEALTH)
11054 {
11055 AddHealth("","",-GetMaxHealth("","Health")/5);
11056 }
11057 else if (action_id ==
EActions.DESTROY_HEALTH)
11058 {
11059 SetHealth01("","",0);
11060 }
11061 else if (action_id ==
EActions.WATCH_ITEM)
11062 {
11064 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11065 #ifdef DEVELOPER
11066 SetDebugDeveloper_item(this);
11067 #endif
11068 }
11069
11070 else if (action_id ==
EActions.ADD_TEMPERATURE)
11071 {
11072 AddTemperature(20);
11073
11074 }
11075
11076 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11077 {
11078 AddTemperature(-20);
11079
11080 }
11081
11082 else if (action_id ==
EActions.FLIP_FROZEN)
11083 {
11084 SetFrozen(!GetIsFrozen());
11085
11086 }
11087
11088 else if (action_id ==
EActions.ADD_WETNESS)
11089 {
11091
11092 }
11093
11094 else if (action_id ==
EActions.REMOVE_WETNESS)
11095 {
11097
11098 }
11099
11100 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11101 {
11104
11105
11106 }
11107
11108 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11109 {
11112 }
11113
11114 else if (action_id ==
EActions.MAKE_SPECIAL)
11115 {
11116 auto debugParams = DebugSpawnParams.WithPlayer(player);
11117 OnDebugSpawnEx(debugParams);
11118 }
11119
11120 }
11121
11122
11123 return false;
11124 }
11125
11126
11127
11128
11132
11135
11136
11137
11139 {
11140 return false;
11141 }
11142
11143
11145 {
11146 return true;
11147 }
11148
11149
11151 {
11152 return true;
11153 }
11154
11155
11156
11158 {
11159 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11160 return g_Game.ConfigIsExisting(config_path);
11161 }
11162
11165 {
11166 return null;
11167 }
11168
11170 {
11171 return false;
11172 }
11173
11175 {
11176 return false;
11177 }
11178
11182
11183
11185 {
11186 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11187 return module_repairing.CanRepair(this, item_repair_kit);
11188 }
11189
11190
11191 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11192 {
11193 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11194 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11195 }
11196
11197
11199 {
11200
11201
11202
11203
11204
11205
11206
11207
11208 return 1;
11209 }
11210
11211
11212
11214 {
11216 }
11217
11218
11219
11221 {
11223 }
11224
11225
11234 {
11235 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11236
11237 if (player)
11238 {
11239 player.MessageStatus(text);
11240 }
11241 }
11242
11243
11252 {
11253 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11254
11255 if (player)
11256 {
11257 player.MessageAction(text);
11258 }
11259 }
11260
11261
11270 {
11271 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11272
11273 if (player)
11274 {
11275 player.MessageFriendly(text);
11276 }
11277 }
11278
11279
11288 {
11289 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11290
11291 if (player)
11292 {
11293 player.MessageImportant(text);
11294 }
11295 }
11296
11298 {
11299 return true;
11300 }
11301
11302
11303 override bool KindOf(
string tag)
11304 {
11305 bool found = false;
11306 string item_name = this.
GetType();
11308 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11309
11310 int array_size = item_tag_array.Count();
11311 for (int i = 0; i < array_size; i++)
11312 {
11313 if (item_tag_array.Get(i) == tag)
11314 {
11315 found = true;
11316 break;
11317 }
11318 }
11319 return found;
11320 }
11321
11322
11324 {
11325
11326 super.OnRPC(sender, rpc_type,ctx);
11327
11328
11329 switch (rpc_type)
11330 {
11331 #ifndef SERVER
11332 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11333 Param2<bool, string> p = new Param2<bool, string>(false, "");
11334
11336 return;
11337
11338 bool play = p.param1;
11339 string soundSet = p.param2;
11340
11341 if (play)
11342 {
11344 {
11346 {
11348 }
11349 }
11350 else
11351 {
11353 }
11354 }
11355 else
11356 {
11358 }
11359
11360 break;
11361 #endif
11362
11363 }
11364
11366 {
11368 }
11369 }
11370
11371
11372
11373
11375 {
11376 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11377 return plugin.GetID(
name);
11378 }
11379
11381 {
11382 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11383 return plugin.GetName(id);
11384 }
11385
11388 {
11389
11390
11391 int varFlags;
11392 if (!ctx.
Read(varFlags))
11393 return;
11394
11395 if (varFlags & ItemVariableFlags.FLOAT)
11396 {
11398 }
11399 }
11400
11402 {
11403
11404 super.SerializeNumericalVars(floats_out);
11405
11406
11407
11409 {
11411 }
11412
11414 {
11416 }
11417
11419 {
11421 }
11422
11424 {
11429 }
11430
11432 {
11434 }
11435 }
11436
11438 {
11439
11440 super.DeSerializeNumericalVars(floats);
11441
11442
11443 int index = 0;
11444 int mask = Math.Round(floats.Get(index));
11445
11446 index++;
11447
11449 {
11451 {
11453 }
11454 else
11455 {
11456 float quantity = floats.Get(index);
11457 SetQuantity(quantity,
true,
false,
false,
false);
11458 }
11459 index++;
11460 }
11461
11463 {
11464 float wet = floats.Get(index);
11466 index++;
11467 }
11468
11470 {
11471 int liquidtype = Math.Round(floats.Get(index));
11473 index++;
11474 }
11475
11477 {
11479 index++;
11481 index++;
11483 index++;
11485 index++;
11486 }
11487
11489 {
11490 int cleanness = Math.Round(floats.Get(index));
11492 index++;
11493 }
11494 }
11495
11497 {
11498 super.WriteVarsToCTX(ctx);
11499
11500
11502 {
11504 }
11505
11507 {
11509 }
11510
11512 {
11514 }
11515
11517 {
11518 int r,g,b,a;
11524 }
11525
11527 {
11529 }
11530 }
11531
11533 {
11534 if (!super.ReadVarsFromCTX(ctx,version))
11535 return false;
11536
11537 int intValue;
11538 float value;
11539
11540 if (version < 140)
11541 {
11542 if (!ctx.
Read(intValue))
11543 return false;
11544
11545 m_VariablesMask = intValue;
11546 }
11547
11549 {
11550 if (!ctx.
Read(value))
11551 return false;
11552
11554 {
11556 }
11557 else
11558 {
11560 }
11561 }
11562
11563 if (version < 140)
11564 {
11566 {
11567 if (!ctx.
Read(value))
11568 return false;
11569 SetTemperatureDirect(value);
11570 }
11571 }
11572
11574 {
11575 if (!ctx.
Read(value))
11576 return false;
11578 }
11579
11581 {
11582 if (!ctx.
Read(intValue))
11583 return false;
11585 }
11586
11588 {
11589 int r,g,b,a;
11591 return false;
11593 return false;
11595 return false;
11597 return false;
11598
11600 }
11601
11603 {
11604 if (!ctx.
Read(intValue))
11605 return false;
11607 }
11608
11609 if (version >= 138 && version < 140)
11610 {
11612 {
11613 if (!ctx.
Read(intValue))
11614 return false;
11615 SetFrozen(intValue);
11616 }
11617 }
11618
11619 return true;
11620 }
11621
11622
11624 {
11627 {
11629 }
11630
11631 if (!super.OnStoreLoad(ctx, version))
11632 {
11634 return false;
11635 }
11636
11637 if (version >= 114)
11638 {
11639 bool hasQuickBarIndexSaved;
11640
11641 if (!ctx.
Read(hasQuickBarIndexSaved))
11642 {
11644 return false;
11645 }
11646
11647 if (hasQuickBarIndexSaved)
11648 {
11649 int itmQBIndex;
11650
11651
11652 if (!ctx.
Read(itmQBIndex))
11653 {
11655 return false;
11656 }
11657
11658 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11659 if (itmQBIndex != -1 && parentPlayer)
11660 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11661 }
11662 }
11663 else
11664 {
11665
11666 PlayerBase player;
11667 int itemQBIndex;
11668 if (version ==
int.
MAX)
11669 {
11670 if (!ctx.
Read(itemQBIndex))
11671 {
11673 return false;
11674 }
11675 }
11676 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11677 {
11678
11679 if (!ctx.
Read(itemQBIndex))
11680 {
11682 return false;
11683 }
11684 if (itemQBIndex != -1 && player)
11685 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11686 }
11687 }
11688
11689 if (version < 140)
11690 {
11691
11692 if (!LoadVariables(ctx, version))
11693 {
11695 return false;
11696 }
11697 }
11698
11699
11701 {
11703 return false;
11704 }
11705 if (version >= 132)
11706 {
11708 if (raib)
11709 {
11711 {
11713 return false;
11714 }
11715 }
11716 }
11717
11719 return true;
11720 }
11721
11722
11723
11725 {
11726 super.OnStoreSave(ctx);
11727
11728 PlayerBase player;
11729 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11730 {
11732
11733 int itemQBIndex = -1;
11734 itemQBIndex = player.FindQuickBarEntityIndex(this);
11735 ctx.
Write(itemQBIndex);
11736 }
11737 else
11738 {
11740 }
11741
11743
11745 if (raib)
11746 {
11748 }
11749 }
11750
11751
11753 {
11754 super.AfterStoreLoad();
11755
11757 {
11759 }
11760
11762 {
11765 }
11766 }
11767
11769 {
11770 super.EEOnAfterLoad();
11771
11773 {
11775 }
11776
11779 }
11780
11782 {
11783 return false;
11784 }
11785
11786
11787
11789 {
11791 {
11792 #ifdef PLATFORM_CONSOLE
11793
11795 {
11797 if (menu)
11798 {
11800 }
11801 }
11802 #endif
11803 }
11804
11806 {
11809 }
11810
11812 {
11813 SetWeightDirty();
11815 }
11817 {
11820 }
11821
11823 {
11826
11829 }
11831 {
11835 }
11836
11837 super.OnVariablesSynchronized();
11838 }
11839
11840
11841
11843 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11844 {
11845 if (!IsServerCheck(allow_client))
11846 return false;
11847
11849 return false;
11850
11853
11854 if (value <= (min + 0.001))
11855 value = min;
11856
11857 if (value == min)
11858 {
11859 if (destroy_config)
11860 {
11861 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11862 if (dstr)
11863 {
11865 this.Delete();
11866 return true;
11867 }
11868 }
11869 else if (destroy_forced)
11870 {
11872 this.Delete();
11873 return true;
11874 }
11875
11877 }
11878
11881
11883 {
11884 EntityAI parent = GetHierarchyRoot();
11885 InventoryLocation iLoc = new InventoryLocation();
11886 GetInventory().GetCurrentInventoryLocation(iLoc);
11888 {
11889 int iLocSlot = iLoc.
GetSlot();
11891 {
11893 }
11895 {
11897 }
11898 }
11899 }
11900
11902 {
11904
11905 if (delta)
11907 }
11908
11910
11911 return false;
11912 }
11913
11914
11916 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11917 {
11919 }
11920
11922 {
11925 }
11926
11928 {
11931 }
11932
11934 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11935 {
11936 float value_clamped = Math.Clamp(value, 0, 1);
11938 SetQuantity(result, destroy_config, destroy_forced);
11939 }
11940
11941
11944 {
11946 }
11947
11949 {
11951 }
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11963 {
11964 int slot = -1;
11965 GameInventory inventory = GetInventory();
11966 if (inventory)
11967 {
11968 InventoryLocation il = new InventoryLocation;
11971 }
11972
11974 }
11975
11977 {
11978 float quantity_max = 0;
11979
11981 {
11982 if (attSlotID != -1)
11983 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11984
11985 if (quantity_max <= 0)
11987 }
11988
11989 if (quantity_max <= 0)
11991
11992 return quantity_max;
11993 }
11994
11996 {
11998 }
11999
12001 {
12003 }
12004
12005
12007 {
12009 }
12010
12012 {
12014 }
12015
12017 {
12019 }
12020
12021
12023 {
12024
12025 float weightEx = GetWeightEx();
12026 float special = GetInventoryAndCargoWeight();
12027 return weightEx - special;
12028 }
12029
12030
12032 {
12034 }
12035
12037 {
12039 {
12040 #ifdef DEVELOPER
12041 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12042 {
12043 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12045 }
12046 #endif
12047
12048 return GetQuantity() * GetConfigWeightModified();
12049 }
12050 else if (HasEnergyManager())
12051 {
12052 #ifdef DEVELOPER
12053 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12054 {
12055 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12056 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12057 }
12058 #endif
12059 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12060 }
12061 else
12062 {
12063 #ifdef DEVELOPER
12064 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12065 {
12066 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12067 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12068 }
12069 #endif
12070 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12071 }
12072 }
12073
12076 {
12077 int item_count = 0;
12079
12080 GameInventory inventory = GetInventory();
12081 CargoBase cargo = inventory.
GetCargo();
12082 if (cargo != NULL)
12083 {
12085 }
12086
12088 for (int i = 0; i < nAttachments; ++i)
12089 {
12091 if (item)
12092 item_count += item.GetNumberOfItems();
12093 }
12094 return item_count;
12095 }
12096
12099 {
12100 float weight = 0;
12101 float wetness = 1;
12102 if (include_wetness)
12105 {
12106 weight = wetness * m_ConfigWeight;
12107 }
12109 {
12110 weight = 1;
12111 }
12112 return weight;
12113 }
12114
12115
12116
12118 {
12119 GameInventory inventory = GetInventory();
12120 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12121 {
12122 array<EntityAI> items = new array<EntityAI>;
12124 for (int i = 0; i < items.Count(); ++i)
12125 {
12127 if (item)
12128 {
12129 g_Game.ObjectDelete(item);
12130 }
12131 }
12132 }
12133 }
12134
12135
12136
12137
12139 {
12140 float energy = 0;
12141 if (HasEnergyManager())
12142 {
12143 energy = GetCompEM().GetEnergy();
12144 }
12145 return energy;
12146 }
12147
12148
12150 {
12151 super.OnEnergyConsumed();
12152
12154 }
12155
12157 {
12158 super.OnEnergyAdded();
12159
12161 }
12162
12163
12165 {
12166 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12167 {
12169 {
12170 float energy_0to1 = GetCompEM().GetEnergy0To1();
12172 }
12173 }
12174 }
12175
12176
12178 {
12179 return ConfigGetFloat("heatIsolation");
12180 }
12181
12183 {
12185 }
12186
12188 {
12189 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12190 if (
g_Game.ConfigIsExisting(paramPath))
12191 return g_Game.ConfigGetFloat(paramPath);
12192
12193 return 0.0;
12194 }
12195
12197 {
12198 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12199 if (
g_Game.ConfigIsExisting(paramPath))
12200 return g_Game.ConfigGetFloat(paramPath);
12201
12202 return 0.0;
12203 }
12204
12205 override void SetWet(
float value,
bool allow_client =
false)
12206 {
12207 if (!IsServerCheck(allow_client))
12208 return;
12209
12212
12214
12215 m_VarWet = Math.Clamp(value, min, max);
12216
12218 {
12221 }
12222 }
12223
12224 override void AddWet(
float value)
12225 {
12227 }
12228
12230 {
12232 }
12233
12235 {
12237 }
12238
12240 {
12242 }
12243
12245 {
12247 }
12248
12250 {
12252 }
12253
12254 override void OnWetChanged(
float newVal,
float oldVal)
12255 {
12258 if (newLevel != oldLevel)
12259 {
12261 }
12262 }
12263
12265 {
12266 SetWeightDirty();
12267 }
12268
12270 {
12271 return GetWetLevelInternal(
m_VarWet);
12272 }
12273
12274
12275
12277 {
12279 }
12280
12282 {
12284 }
12285
12287 {
12289 }
12290
12292 {
12294 }
12295
12296
12297
12299 {
12300 if (ConfigIsExisting("itemModelLength"))
12301 {
12302 return ConfigGetFloat("itemModelLength");
12303 }
12304 return 0;
12305 }
12306
12308 {
12309 if (ConfigIsExisting("itemAttachOffset"))
12310 {
12311 return ConfigGetFloat("itemAttachOffset");
12312 }
12313 return 0;
12314 }
12315
12316 override void SetCleanness(
int value,
bool allow_client =
false)
12317 {
12318 if (!IsServerCheck(allow_client))
12319 return;
12320
12322
12324
12327 }
12328
12330 {
12332 }
12333
12335 {
12336 return true;
12337 }
12338
12339
12340
12341
12343 {
12345 }
12346
12348 {
12350 }
12351
12352
12353
12354
12355 override void SetColor(
int r,
int g,
int b,
int a)
12356 {
12362 }
12364 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12365 {
12370 }
12371
12373 {
12375 }
12376
12379 {
12380 int r,g,b,a;
12382 r = r/255;
12383 g = g/255;
12384 b = b/255;
12385 a = a/255;
12386 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12387 }
12388
12389
12390
12391 override void SetLiquidType(
int value,
bool allow_client =
false)
12392 {
12393 if (!IsServerCheck(allow_client))
12394 return;
12395
12400 }
12401
12403 {
12404 return ConfigGetInt("varLiquidTypeInit");
12405 }
12406
12408 {
12410 }
12411
12413 {
12415 SetFrozen(false);
12416 }
12417
12420 {
12421 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12422 }
12423
12424
12427 {
12428 PlayerBase nplayer;
12429 if (PlayerBase.CastTo(nplayer, player))
12430 {
12432 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12433 }
12434 }
12435
12436
12439 {
12440 PlayerBase nplayer;
12441 if (PlayerBase.CastTo(nplayer,player))
12442 {
12443 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12444 }
12445
12446 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12447
12448 if (HasEnergyManager())
12449 {
12450 GetCompEM().UpdatePlugState();
12451 }
12452 }
12453
12454
12456 {
12457 super.OnPlacementStarted(player);
12458
12460 }
12461
12462 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12463 {
12465 {
12466 m_AdminLog.OnPlacementComplete(player,
this);
12467 }
12468
12469 super.OnPlacementComplete(player, position, orientation);
12470 }
12471
12472
12473
12474
12475
12477 {
12479 {
12480 return true;
12481 }
12482 else
12483 {
12484 return false;
12485 }
12486 }
12487
12488
12490 {
12492 {
12494 }
12495 }
12496
12497
12499 {
12501 }
12502
12504 {
12506 }
12507
12508 override void InsertAgent(
int agent,
float count = 1)
12509 {
12510 if (count < 1)
12511 return;
12512
12514 }
12515
12518 {
12520 }
12521
12522
12524 {
12526 }
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12570 {
12572 return false;
12573 return true;
12574 }
12575
12577 {
12578
12580 }
12581
12582
12585 {
12586 super.CheckForRoofLimited(timeTresholdMS);
12587
12588 float time =
g_Game.GetTime();
12589 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12590 {
12591 m_PreviousRoofTestTime = time;
12592 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12593 }
12594 }
12595
12596
12598 {
12600 {
12601 return 0;
12602 }
12603
12604 if (GetInventory().GetAttachmentSlotsCount() != 0)
12605 {
12606 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12607 if (filter)
12608 return filter.GetProtectionLevel(type, false, system);
12609 else
12610 return 0;
12611 }
12612
12613 string subclassPath, entryName;
12614
12615 switch (type)
12616 {
12618 entryName = "biological";
12619 break;
12621 entryName = "chemical";
12622 break;
12623 default:
12624 entryName = "biological";
12625 break;
12626 }
12627
12628 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12629
12630 return g_Game.ConfigGetFloat(subclassPath + entryName);
12631 }
12632
12633
12634
12637 {
12638 if (!IsMagazine())
12640
12642 }
12643
12644
12645
12646
12647
12652 {
12653 return true;
12654 }
12655
12657 {
12659 }
12660
12661
12662
12663
12664
12666 {
12667 if (parent)
12668 {
12669 if (parent.IsInherited(DayZInfected))
12670 return true;
12671
12672 if (!parent.IsRuined())
12673 return true;
12674 }
12675
12676 return true;
12677 }
12678
12680 {
12681 if (!super.CanPutAsAttachment(parent))
12682 {
12683 return false;
12684 }
12685
12686 if (!IsRuined() && !parent.IsRuined())
12687 {
12688 return true;
12689 }
12690
12691 return false;
12692 }
12693
12695 {
12696
12697
12698
12699
12700 return super.CanReceiveItemIntoCargo(item);
12701 }
12702
12704 {
12705
12706
12707
12708
12709 GameInventory attachmentInv = attachment.GetInventory();
12711 {
12712 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12713 return false;
12714 }
12715
12716 InventoryLocation loc = new InventoryLocation();
12717 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12718 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12719 return false;
12720
12721 return super.CanReceiveAttachment(attachment, slotId);
12722 }
12723
12725 {
12726 if (!super.CanReleaseAttachment(attachment))
12727 return false;
12728
12729 return GetInventory().AreChildrenAccessible();
12730 }
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12753 {
12754 int id = muzzle_owner.GetMuzzleID();
12755 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12756
12757 if (WPOF_array)
12758 {
12759 for (int i = 0; i < WPOF_array.Count(); i++)
12760 {
12761 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12762
12763 if (WPOF)
12764 {
12765 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12766 }
12767 }
12768 }
12769 }
12770
12771
12773 {
12774 int id = muzzle_owner.GetMuzzleID();
12776
12777 if (WPOBE_array)
12778 {
12779 for (int i = 0; i < WPOBE_array.Count(); i++)
12780 {
12781 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12782
12783 if (WPOBE)
12784 {
12785 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12786 }
12787 }
12788 }
12789 }
12790
12791
12793 {
12794 int id = muzzle_owner.GetMuzzleID();
12795 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12796
12797 if (WPOOH_array)
12798 {
12799 for (int i = 0; i < WPOOH_array.Count(); i++)
12800 {
12801 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12802
12803 if (WPOOH)
12804 {
12805 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12806 }
12807 }
12808 }
12809 }
12810
12811
12813 {
12814 int id = muzzle_owner.GetMuzzleID();
12815 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12816
12817 if (WPOOH_array)
12818 {
12819 for (int i = 0; i < WPOOH_array.Count(); i++)
12820 {
12821 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12822
12823 if (WPOOH)
12824 {
12825 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12826 }
12827 }
12828 }
12829 }
12830
12831
12833 {
12834 int id = muzzle_owner.GetMuzzleID();
12835 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12836
12837 if (WPOOH_array)
12838 {
12839 for (int i = 0; i < WPOOH_array.Count(); i++)
12840 {
12841 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12842
12843 if (WPOOH)
12844 {
12845 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12846 }
12847 }
12848 }
12849 }
12850
12851
12852
12854 {
12856 {
12857 return true;
12858 }
12859
12860 return false;
12861 }
12862
12864 {
12866 {
12867 return true;
12868 }
12869
12870 return false;
12871 }
12872
12874 {
12876 {
12877 return true;
12878 }
12879
12880 return false;
12881 }
12882
12884 {
12885 return false;
12886 }
12887
12890 {
12891 return UATimeSpent.DEFAULT_DEPLOY;
12892 }
12893
12894
12895
12896
12898 {
12900 SetSynchDirty();
12901 }
12902
12904 {
12906 }
12907
12908
12910 {
12911 return false;
12912 }
12913
12916 {
12917 string att_type = "None";
12918
12919 if (ConfigIsExisting("soundAttType"))
12920 {
12921 att_type = ConfigGetString("soundAttType");
12922 }
12923
12925 }
12926
12928 {
12930 }
12931
12932
12933
12934
12935
12941
12943 {
12946
12948 }
12949
12950
12952 {
12954 return;
12955
12957
12960
12963
12964 SoundParameters params = new SoundParameters();
12968 }
12969
12970
12972 {
12974 {
12977
12978 SetSynchDirty();
12979
12982 }
12983 }
12984
12986 {
12988 }
12989
12990
12992 {
12994 return;
12995
12997 SetSynchDirty();
12998
13001 }
13002
13004 {
13007 }
13008
13010 {
13012 }
13013
13014 void OnApply(PlayerBase player);
13015
13017 {
13018 return 1.0;
13019 };
13020
13022 {
13024 }
13025
13027 {
13029 }
13030
13032
13034 {
13035 SetDynamicPhysicsLifeTime(0.01);
13037 }
13038
13040 {
13041 array<string> zone_names = new array<string>;
13042 GetDamageZones(zone_names);
13043 for (int i = 0; i < zone_names.Count(); i++)
13044 {
13045 SetHealthMax(zone_names.Get(i),"Health");
13046 }
13047 SetHealthMax("","Health");
13048 }
13049
13052 {
13053 float global_health = GetHealth01("","Health");
13054 array<string> zones = new array<string>;
13055 GetDamageZones(zones);
13056
13057 for (int i = 0; i < zones.Count(); i++)
13058 {
13059 SetHealth01(zones.Get(i),"Health",global_health);
13060 }
13061 }
13062
13065 {
13066 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13067 }
13068
13070 {
13071 if (!hasRootAsPlayer)
13072 {
13073 if (refParentIB)
13074 {
13075
13076 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13077 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13078
13079 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13080 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13081
13084 }
13085 else
13086 {
13087
13090 }
13091 }
13092 }
13093
13095 {
13097 {
13098 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13099 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13100 {
13101 float heatPermCoef = 1.0;
13103 while (ent)
13104 {
13105 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13106 ent = ent.GetHierarchyParent();
13107 }
13108
13109 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13110 }
13111 }
13112 }
13113
13115 {
13116
13117 EntityAI parent = GetHierarchyParent();
13118 if (!parent)
13119 {
13120 hasParent = false;
13121 hasRootAsPlayer = false;
13122 }
13123 else
13124 {
13125 hasParent = true;
13126 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13127 refParentIB =
ItemBase.Cast(parent);
13128 }
13129 }
13130
13131 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13132 {
13133
13134 }
13135
13137 {
13138
13139 return false;
13140 }
13141
13143 {
13144
13145
13146 return false;
13147 }
13148
13150 {
13151
13152 return false;
13153 }
13154
13157 {
13158 return !GetIsFrozen() &&
IsOpen();
13159 }
13160
13162 {
13163 bool hasParent = false, hasRootAsPlayer = false;
13165
13166 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13167 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13168
13169 if (wwtu || foodDecay)
13170 {
13174
13175 if (processWetness || processTemperature || processDecay)
13176 {
13178
13179 if (processWetness)
13180 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13181
13182 if (processTemperature)
13184
13185 if (processDecay)
13186 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13187 }
13188 }
13189 }
13190
13193 {
13195 }
13196
13198 {
13201
13202 return super.GetTemperatureFreezeThreshold();
13203 }
13204
13206 {
13209
13210 return super.GetTemperatureThawThreshold();
13211 }
13212
13214 {
13217
13218 return super.GetItemOverheatThreshold();
13219 }
13220
13222 {
13224 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13225
13226 return super.GetTemperatureFreezeTime();
13227 }
13228
13230 {
13232 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13233
13234 return super.GetTemperatureThawTime();
13235 }
13236
13241
13243 {
13244 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13245 }
13246
13248 {
13249 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13250 }
13251
13254 {
13256 }
13257
13259 {
13261 }
13262
13264 {
13266 }
13267
13270 {
13271 return null;
13272 }
13273
13276 {
13277 return false;
13278 }
13279
13281 {
13283 {
13286 if (!trg)
13287 {
13289 explosive = this;
13290 }
13291
13292 explosive.PairRemote(trg);
13294
13295 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13296 trg.SetPersistentPairID(persistentID);
13297 explosive.SetPersistentPairID(persistentID);
13298
13299 return true;
13300 }
13301 return false;
13302 }
13303
13306 {
13307 float ret = 1.0;
13310 ret *= GetHealth01();
13311
13312 return ret;
13313 }
13314
13315 #ifdef DEVELOPER
13316 override void SetDebugItem()
13317 {
13318 super.SetDebugItem();
13319 _itemBase = this;
13320 }
13321
13323 {
13324 string text = super.GetDebugText();
13325
13327 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13328
13329 return text;
13330 }
13331 #endif
13332
13334 {
13335 return true;
13336 }
13337
13339
13341
13343 {
13346 }
13347
13348
13356
13372
13373 [
Obsolete(
"Use ItemSoundHandler instead")]
13376 {
13377 if (!
g_Game.IsDedicatedServer())
13378 {
13379 if (ConfigIsExisting("attachSoundSet"))
13380 {
13381 string cfg_path = "";
13382 string soundset = "";
13383 string type_name =
GetType();
13384
13387 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13388 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13389
13390 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13391 {
13392 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13393 {
13394 if (cfg_slot_array[i] == slot_type)
13395 {
13396 soundset = cfg_soundset_array[i];
13397 break;
13398 }
13399 }
13400 }
13401
13402 if (soundset != "")
13403 {
13404 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13406 }
13407 }
13408 }
13409 }
13410
13412}
13413
13415{
13417 if (entity)
13418 {
13419 bool is_item = entity.IsInherited(
ItemBase);
13420 if (is_item && full_quantity)
13421 {
13424 }
13425 }
13426 else
13427 {
13429 return NULL;
13430 }
13431 return entity;
13432}
13433
13435{
13436 if (item)
13437 {
13438 if (health > 0)
13439 item.SetHealth("", "", health);
13440
13441 if (item.CanHaveTemperature())
13442 {
13444 if (item.CanFreeze())
13445 item.SetFrozen(false);
13446 }
13447
13448 if (item.HasEnergyManager())
13449 {
13450 if (quantity >= 0)
13451 {
13452 item.GetCompEM().SetEnergy0To1(quantity);
13453 }
13454 else
13455 {
13457 }
13458 }
13459 else if (item.IsMagazine())
13460 {
13461 Magazine mag = Magazine.Cast(item);
13462 if (quantity >= 0)
13463 {
13464 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13465 }
13466 else
13467 {
13469 }
13470
13471 }
13472 else
13473 {
13474 if (quantity >= 0)
13475 {
13476 item.SetQuantityNormalized(quantity, false);
13477 }
13478 else
13479 {
13481 }
13482
13483 }
13484 }
13485}
13486
13487#ifdef DEVELOPER
13489#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
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...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
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()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
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
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
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.