8579{
8581 {
8582 return true;
8583 }
8584};
8585
8587{
8588
8589};
8590
8591
8592
8594{
8598
8600
8603
8604
8605
8606
8607
8616
8622
8627
8632
8653 protected bool m_IsResultOfSplit
8654
8656
8661
8662
8663
8665
8669
8670
8671
8673
8676
8677
8678
8684
8685
8693
8696
8697
8699
8700
8702
8703
8708
8709
8714
8716
8717
8719
8720
8722 {
8727
8728 if (!
g_Game.IsDedicatedServer())
8729 {
8731 {
8733
8735 {
8737 }
8738 }
8739
8742 }
8743
8744 m_OldLocation = null;
8745
8747 {
8749 }
8750
8751 if (ConfigIsExisting("headSelectionsToHide"))
8752 {
8755 }
8756
8758 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8759 {
8761 }
8762
8764
8765 m_IsResultOfSplit = false;
8766
8768 }
8769
8771 {
8772 super.InitItemVariables();
8773
8779 m_Count = ConfigGetInt(
"count");
8780
8783
8788
8791
8796
8808
8812
8813
8816 if (ConfigIsExisting("canBeSplit"))
8817 {
8820 }
8821
8823 if (ConfigIsExisting("itemBehaviour"))
8825
8826
8829 RegisterNetSyncVariableInt("m_VarLiquidType");
8830 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8831
8832 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8833 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8834 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8835
8836 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8837 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8838 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8839 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8840
8841 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8842 RegisterNetSyncVariableBool("m_IsTakeable");
8843 RegisterNetSyncVariableBool("m_IsHologram");
8844
8847 {
8850 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8851 }
8852
8854
8856 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8858
8860 }
8861
8863 {
8865 }
8866
8868 {
8871 {
8876 }
8877 }
8878
8879 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8880 {
8882 {
8885 }
8886
8888 }
8889
8891 {
8897 }
8898
8900
8902 {
8904
8905 if (!action)
8906 {
8907 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8908 return;
8909 }
8910
8912 if (!ai)
8913 {
8915 return;
8916 }
8917
8919 if (!action_array)
8920 {
8921 action_array = new array<ActionBase_Basic>;
8923 }
8924 if (LogManager.IsActionLogEnable())
8925 {
8926 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8927 }
8928
8929 if (action_array.Find(action) != -1)
8930 {
8931 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8932 }
8933 else
8934 {
8935 action_array.Insert(action);
8936 }
8937 }
8938
8940 {
8941 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8942 ActionBase action = player.GetActionManager().GetAction(actionName);
8945
8946 if (action_array)
8947 {
8948 action_array.RemoveItem(action);
8949 }
8950 }
8951
8952
8953
8955 {
8956 ActionOverrideData overrideData = new ActionOverrideData();
8960
8962 if (!actionMap)
8963 {
8966 }
8967
8968 actionMap.Insert(this.
Type(), overrideData);
8969
8970 }
8971
8973
8975
8976
8978 {
8981
8984
8985 string config_to_search = "CfgVehicles";
8986 string muzzle_owner_config;
8987
8989 {
8990 if (IsInherited(Weapon))
8991 config_to_search = "CfgWeapons";
8992
8993 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8994
8995 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8996
8997 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8998
8999 if (config_OnFire_subclass_count > 0)
9000 {
9001 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9002
9003 for (int i = 0; i < config_OnFire_subclass_count; i++)
9004 {
9005 string particle_class = "";
9006 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9007 string config_OnFire_entry = config_OnFire_class + particle_class;
9008 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9009 WPOF_array.Insert(WPOF);
9010 }
9011
9012
9014 }
9015 }
9016
9018 {
9019 config_to_search = "CfgWeapons";
9020 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9021
9022 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9023
9024 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9025
9026 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9027 {
9028 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9029
9030 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9031 {
9032 string particle_class2 = "";
9033 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9034 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9035 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9036 WPOBE_array.Insert(WPOBE);
9037 }
9038
9039
9041 }
9042 }
9043 }
9044
9045
9047 {
9050
9052 {
9053 string config_to_search = "CfgVehicles";
9054
9055 if (IsInherited(Weapon))
9056 config_to_search = "CfgWeapons";
9057
9058 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9059 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9060
9061 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9062 {
9063
9065
9067 {
9069 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9071 return;
9072 }
9073
9076
9077
9078
9079 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9080 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9081
9082 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9083 {
9084 string particle_class = "";
9085 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9086 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9087 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9088
9089 if (entry_type == CT_CLASS)
9090 {
9091 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9092 WPOOH_array.Insert(WPOF);
9093 }
9094 }
9095
9096
9098 }
9099 }
9100 }
9101
9103 {
9105 }
9106
9108 {
9110 {
9112
9115
9118
9119 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9120 }
9121 }
9122
9124 {
9126 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9127
9129 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9130
9132 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9133
9135 {
9137 }
9138 }
9139
9141 {
9143 }
9144
9146 {
9149 else
9151
9153 {
9156 }
9157 else
9158 {
9161
9164 }
9165
9167 }
9168
9170 {
9172 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9173 }
9174
9176 {
9178 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9180 }
9181
9183 {
9185 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9186 }
9187
9189 {
9192
9193 OverheatingParticle OP = new OverheatingParticle();
9198
9200 }
9201
9203 {
9206
9207 return -1;
9208 }
9209
9211 {
9213 {
9216
9217 for (int i = count; i > 0; --i)
9218 {
9219 int id = i - 1;
9222
9225
9226 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9227 {
9228 if (p)
9229 {
9232 }
9233 }
9234 }
9235 }
9236 }
9237
9239 {
9241 {
9243 {
9244 int id = i - 1;
9246
9247 if (OP)
9248 {
9250
9251 if (p)
9252 {
9254 }
9255
9256 delete OP;
9257 }
9258 }
9259
9262 }
9263 }
9264
9267 {
9268 return 0.0;
9269 }
9270
9271
9273 {
9274 return 250;
9275 }
9276
9278 {
9279 return 0;
9280 }
9281
9284 {
9286 return true;
9287
9288 return false;
9289 }
9290
9293 {
9296
9298 {
9300 }
9301 else
9302 {
9303
9305 }
9306
9308 }
9309
9316 {
9317 return -1;
9318 }
9319
9320
9321
9322
9324 {
9326 {
9327 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9328 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9329
9330 if (r_index >= 0)
9331 {
9332 InventoryLocation r_il = new InventoryLocation;
9333 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9334
9335 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9338 {
9339 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9340 }
9342 {
9343 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9344 }
9345
9346 }
9347
9348 player.GetHumanInventory().ClearUserReservedLocation(this);
9349 }
9350
9353 }
9354
9355
9356
9357
9359 {
9360 return ItemBase.m_DebugActionsMask;
9361 }
9362
9364 {
9365 return ItemBase.m_DebugActionsMask & mask;
9366 }
9367
9369 {
9370 ItemBase.m_DebugActionsMask = mask;
9371 }
9372
9374 {
9375 ItemBase.m_DebugActionsMask |= mask;
9376 }
9377
9379 {
9380 ItemBase.m_DebugActionsMask &= ~mask;
9381 }
9382
9384 {
9386 {
9388 }
9389 else
9390 {
9392 }
9393 }
9394
9395
9397 {
9398 if (GetEconomyProfile())
9399 {
9400 float q_max = GetEconomyProfile().GetQuantityMax();
9401 if (q_max > 0)
9402 {
9403 float q_min = GetEconomyProfile().GetQuantityMin();
9404 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9405
9407 {
9408 ComponentEnergyManager comp = GetCompEM();
9410 {
9412 }
9413 }
9415 {
9417
9418 }
9419
9420 }
9421 }
9422 }
9423
9426 {
9427 EntityAI parent = GetHierarchyParent();
9428
9429 if (parent)
9430 {
9431 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9432 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9433 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9434 }
9435 }
9436
9439 {
9440 EntityAI parent = GetHierarchyParent();
9441
9442 if (parent)
9443 {
9444 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9445 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9446 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9447 }
9448 }
9449
9451 {
9452
9453
9454
9455
9457
9459 {
9460 if (ScriptInputUserData.CanStoreInputUserData())
9461 {
9462 ScriptInputUserData ctx = new ScriptInputUserData;
9468 ctx.
Write(use_stack_max);
9471
9473 {
9474 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9475 }
9476 }
9477 }
9478 else if (!
g_Game.IsMultiplayer())
9479 {
9481 }
9482 }
9483
9485 {
9487 }
9488
9490 {
9492 }
9493
9495 {
9497 }
9498
9500 {
9501
9502 return false;
9503 }
9504
9506 {
9507 return false;
9508 }
9509
9513 {
9514 return false;
9515 }
9516
9518 {
9519 return "";
9520 }
9521
9523
9525 {
9526 return false;
9527 }
9528
9530 {
9531 return true;
9532 }
9533
9534
9535
9537 {
9538 return true;
9539 }
9540
9542 {
9543 return true;
9544 }
9545
9547 {
9548 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9550 }
9551
9553 {
9555 }
9556
9558 {
9560 if (!is_being_placed)
9562 SetSynchDirty();
9563 }
9564
9565
9567
9569 {
9571 }
9572
9574 {
9576 }
9577
9579 {
9580 return 1;
9581 }
9582
9584 {
9585 return false;
9586 }
9587
9589 {
9591 SetSynchDirty();
9592 }
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9629 {
9630 super.OnMovedInsideCargo(container);
9631
9632 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9633 }
9634
9635 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9636 {
9637 super.EEItemLocationChanged(oldLoc, newLoc);
9638
9639 PlayerBase newPlayer = null;
9640 PlayerBase oldPlayer = null;
9641
9642 if (newLoc.GetParent())
9643 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9644
9645 if (oldLoc.GetParent())
9646 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9647
9649 {
9650 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9651
9652 if (rIndex >= 0)
9653 {
9654 InventoryLocation rIl = new InventoryLocation;
9655 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9656
9657 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9660 {
9661 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9662 }
9664 {
9666 }
9667
9668 }
9669 }
9670
9672 {
9673 if (newPlayer)
9674 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9675
9676 if (newPlayer == oldPlayer)
9677 {
9678 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9679 {
9681 {
9682 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9683 {
9684 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9685 }
9686 }
9687 else
9688 {
9689 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9690 }
9691 }
9692
9693 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9694 {
9695 int type = oldLoc.GetType();
9697 {
9698 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9699 }
9701 {
9702 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9703 }
9704 }
9705 if (!m_OldLocation)
9706 {
9707 m_OldLocation = new InventoryLocation;
9708 }
9709 m_OldLocation.Copy(oldLoc);
9710 }
9711 else
9712 {
9713 if (m_OldLocation)
9714 {
9715 m_OldLocation.Reset();
9716 }
9717 }
9718
9719 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9720 }
9721 else
9722 {
9723 if (newPlayer)
9724 {
9725 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9726 if (resIndex >= 0)
9727 {
9728 InventoryLocation il = new InventoryLocation;
9729 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9731 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9734 {
9735 il.
GetParent().GetOnReleaseLock().Invoke(it);
9736 }
9738 {
9740 }
9741
9742 }
9743 }
9745 {
9746
9748 }
9749
9750 if (m_OldLocation)
9751 {
9752 m_OldLocation.Reset();
9753 }
9754 }
9755
9757 {
9758 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9759 }
9760
9762 {
9763 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9764 }
9765 }
9766
9767 override void EOnContact(IEntity other, Contact extra)
9768 {
9770 {
9771 int liquidType = -1;
9773 if (impactSpeed > 0.0)
9774 {
9776 #ifndef SERVER
9778 #else
9780 SetSynchDirty();
9781 #endif
9783 }
9784 }
9785
9786 #ifdef SERVER
9787 if (GetCompEM() && GetCompEM().IsPlugged())
9788 {
9789 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9790 GetCompEM().UnplugThis();
9791 }
9792 #endif
9793 }
9794
9796
9798 {
9800 }
9801
9803 {
9804
9805 }
9806
9808 {
9809 super.OnItemLocationChanged(old_owner, new_owner);
9810
9811 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9812 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9813
9814 if (!relatedPlayer && playerNew)
9815 relatedPlayer = playerNew;
9816
9817 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9818 {
9820 if (actionMgr)
9821 {
9822 ActionBase currentAction = actionMgr.GetRunningAction();
9823 if (currentAction)
9825 }
9826 }
9827
9828 Man ownerPlayerOld = null;
9829 Man ownerPlayerNew = null;
9830
9831 if (old_owner)
9832 {
9833 if (old_owner.
IsMan())
9834 {
9835 ownerPlayerOld = Man.Cast(old_owner);
9836 }
9837 else
9838 {
9839 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9840 }
9841 }
9842 else
9843 {
9845 {
9847
9848 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9849 {
9850 GetCompEM().UnplugThis();
9851 }
9852 }
9853 }
9854
9855 if (new_owner)
9856 {
9857 if (new_owner.
IsMan())
9858 {
9859 ownerPlayerNew = Man.Cast(new_owner);
9860 }
9861 else
9862 {
9863 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9864 }
9865 }
9866
9867 if (ownerPlayerOld != ownerPlayerNew)
9868 {
9869 if (ownerPlayerOld)
9870 {
9871 array<EntityAI> subItemsExit = new array<EntityAI>;
9873 for (int i = 0; i < subItemsExit.Count(); i++)
9874 {
9877 }
9878 }
9879
9880 if (ownerPlayerNew)
9881 {
9882 array<EntityAI> subItemsEnter = new array<EntityAI>;
9884 for (int j = 0; j < subItemsEnter.Count(); j++)
9885 {
9888 }
9889 }
9890 }
9891 else if (ownerPlayerNew != null)
9892 {
9893 PlayerBase nplayer;
9894 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9895 {
9896 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9898 for (int k = 0; k < subItemsUpdate.Count(); k++)
9899 {
9901 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9902 }
9903 }
9904 }
9905
9906 if (old_owner)
9907 old_owner.OnChildItemRemoved(this);
9908 if (new_owner)
9909 new_owner.OnChildItemReceived(this);
9910 }
9911
9912
9914 {
9915 super.EEDelete(parent);
9916 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9917 if (player)
9918 {
9920
9921 if (player.IsAlive())
9922 {
9923 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9924 if (r_index >= 0)
9925 {
9926 InventoryLocation r_il = new InventoryLocation;
9927 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9928
9929 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9932 {
9933 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9934 }
9936 {
9937 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9938 }
9939
9940 }
9941
9942 player.RemoveQuickBarEntityShortcut(this);
9943 }
9944 }
9945 }
9946
9948 {
9949 super.EEKilled(killer);
9950
9953 {
9954 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9955 {
9956 if (IsMagazine())
9957 {
9958 if (Magazine.Cast(this).GetAmmoCount() > 0)
9959 {
9961 }
9962 }
9963 else
9964 {
9966 }
9967 }
9968 }
9969 }
9970
9972 {
9973 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9974
9975 super.OnWasAttached(parent, slot_id);
9976
9979
9982 }
9983
9985 {
9986 super.OnWasDetached(parent, slot_id);
9987
9990
9993 }
9994
9996 {
9997 int idx;
10000
10001 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10002 if (inventory_slots.Count() < 1)
10003 {
10004 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10005 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10006 }
10007 else
10008 {
10009 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10010 }
10011
10012 idx = inventory_slots.Find(slot);
10013 if (idx < 0)
10014 return "";
10015
10016 return attach_types.Get(idx);
10017 }
10018
10020 {
10021 int idx = -1;
10022 string slot;
10023
10026
10027 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10028 if (inventory_slots.Count() < 1)
10029 {
10030 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10031 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10032 }
10033 else
10034 {
10035 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10036 if (detach_types.Count() < 1)
10037 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10038 }
10039
10040 for (int i = 0; i < inventory_slots.Count(); i++)
10041 {
10042 slot = inventory_slots.Get(i);
10043 }
10044
10045 if (slot != "")
10046 {
10047 if (detach_types.Count() == 1)
10048 idx = 0;
10049 else
10050 idx = inventory_slots.Find(slot);
10051 }
10052 if (idx < 0)
10053 return "";
10054
10055 return detach_types.Get(idx);
10056 }
10057
10059 {
10060
10062
10063
10064 float min_time = 1;
10065 float max_time = 3;
10066 float delay = Math.RandomFloat(min_time, max_time);
10067
10068 explode_timer.Run(delay, this, "DoAmmoExplosion");
10069 }
10070
10072 {
10073 Magazine magazine = Magazine.Cast(this);
10074 int pop_sounds_count = 6;
10075 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10076
10077
10078 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10079 string sound_name = pop_sounds[ sound_idx ];
10080 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10081
10082
10083 magazine.ServerAddAmmoCount(-1);
10084
10085
10086 float min_temp_to_explode = 100;
10087
10088 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10089 {
10091 }
10092 }
10093
10094
10095 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10096 {
10097 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10098
10099 const int CHANCE_DAMAGE_CARGO = 4;
10100 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10101 const int CHANCE_DAMAGE_NOTHING = 2;
10102
10104 {
10105 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10106 int chances;
10107 int rnd;
10108
10109 if (GetInventory().GetCargo())
10110 {
10111 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10112 rnd = Math.RandomInt(0,chances);
10113
10114 if (rnd < CHANCE_DAMAGE_CARGO)
10115 {
10117 }
10118 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10119 {
10121 }
10122 }
10123 else
10124 {
10125 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10126 rnd = Math.RandomInt(0,chances);
10127
10128 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10129 {
10131 }
10132 }
10133 }
10134 }
10135
10137 {
10138 CargoBase cargo = GetInventory().GetCargo();
10139 if (cargo)
10140 {
10142 if (item_count > 0)
10143 {
10144 int random_pick = Math.RandomInt(0, item_count);
10146 if (!item.IsExplosive())
10147 {
10148 item.AddHealth("","",damage);
10149 return true;
10150 }
10151 }
10152 }
10153 return false;
10154 }
10155
10157 {
10158 GameInventory inventory = GetInventory();
10160 if (attachment_count > 0)
10161 {
10162 int random_pick = Math.RandomInt(0, attachment_count);
10164 if (!attachment.IsExplosive())
10165 {
10166 attachment.AddHealth("","",damage);
10167 return true;
10168 }
10169 }
10170 return false;
10171 }
10172
10174 {
10176 }
10177
10179 {
10181 return GetInventory().CanRemoveEntity();
10182
10183 return false;
10184 }
10185
10187 {
10188
10190 return false;
10191
10192
10194 return false;
10195
10196
10197
10199 if (delta == 0)
10200 return false;
10201
10202
10203 return true;
10204 }
10205
10207 {
10209 {
10210 if (ScriptInputUserData.CanStoreInputUserData())
10211 {
10212 ScriptInputUserData ctx = new ScriptInputUserData;
10217 ctx.
Write(destination_entity);
10219 ctx.
Write(slot_id);
10221 }
10222 }
10223 else if (!
g_Game.IsMultiplayer())
10224 {
10226 }
10227 }
10228
10230 {
10231 float split_quantity_new;
10235 InventoryLocation loc = new InventoryLocation;
10236
10237 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10238 {
10240 split_quantity_new = stack_max;
10241 else
10243
10245 {
10246 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10247 if (new_item)
10248 {
10249 new_item.SetResultOfSplit(true);
10250 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10252 new_item.
SetQuantity(split_quantity_new,
false,
true);
10253 }
10254 }
10255 }
10256 else if (destination_entity && slot_id == -1)
10257 {
10258 if (quantity > stack_max)
10259 split_quantity_new = stack_max;
10260 else
10261 split_quantity_new = quantity;
10262
10264 {
10265 GameInventory destinationInventory = destination_entity.GetInventory();
10267 {
10270 }
10271
10272 if (new_item)
10273 {
10274 new_item.SetResultOfSplit(true);
10275 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10277 new_item.
SetQuantity(split_quantity_new,
false,
true);
10278 }
10279 }
10280 }
10281 else
10282 {
10283 if (stack_max != 0)
10284 {
10286 {
10288 }
10289
10290 if (split_quantity_new == 0)
10291 {
10292 if (!
g_Game.IsMultiplayer())
10293 player.PhysicalPredictiveDropItem(this);
10294 else
10295 player.ServerDropEntity(this);
10296 return;
10297 }
10298
10300 {
10302
10303 if (new_item)
10304 {
10305 new_item.SetResultOfSplit(true);
10306 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10309 new_item.PlaceOnSurface();
10310 }
10311 }
10312 }
10313 }
10314 }
10315
10317 {
10318 float split_quantity_new;
10322 InventoryLocation loc = new InventoryLocation;
10323
10324 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10325 {
10327 split_quantity_new = stack_max;
10328 else
10330
10332 {
10333 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10334 if (new_item)
10335 {
10336 new_item.SetResultOfSplit(true);
10337 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10339 new_item.
SetQuantity(split_quantity_new,
false,
true);
10340 }
10341 }
10342 }
10343 else if (destination_entity && slot_id == -1)
10344 {
10345 if (quantity > stack_max)
10346 split_quantity_new = stack_max;
10347 else
10348 split_quantity_new = quantity;
10349
10351 {
10352 GameInventory destinationInventory = destination_entity.GetInventory();
10354 {
10357 }
10358
10359 if (new_item)
10360 {
10361 new_item.SetResultOfSplit(true);
10362 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10364 new_item.
SetQuantity(split_quantity_new,
false,
true);
10365 }
10366 }
10367 }
10368 else
10369 {
10370 if (stack_max != 0)
10371 {
10373 {
10375 }
10376
10378 {
10380
10381 if (new_item)
10382 {
10383 new_item.SetResultOfSplit(true);
10384 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10387 new_item.PlaceOnSurface();
10388 }
10389 }
10390 }
10391 }
10392 }
10393
10395 {
10397 {
10398 if (ScriptInputUserData.CanStoreInputUserData())
10399 {
10400 ScriptInputUserData ctx = new ScriptInputUserData;
10405 dst.WriteToContext(ctx);
10407 }
10408 }
10409 else if (!
g_Game.IsMultiplayer())
10410 {
10412 }
10413 }
10414
10416 {
10418 {
10419 if (ScriptInputUserData.CanStoreInputUserData())
10420 {
10421 ScriptInputUserData ctx = new ScriptInputUserData;
10426 ctx.
Write(destination_entity);
10432 }
10433 }
10434 else if (!
g_Game.IsMultiplayer())
10435 {
10437 }
10438 }
10439
10441 {
10443 }
10444
10446 {
10448 float split_quantity_new;
10450 if (dst.IsValid())
10451 {
10452 int slot_id = dst.GetSlot();
10454
10455 if (quantity > stack_max)
10456 split_quantity_new = stack_max;
10457 else
10458 split_quantity_new = quantity;
10459
10461 {
10463
10464 if (new_item)
10465 {
10466 new_item.SetResultOfSplit(true);
10467 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10469 new_item.
SetQuantity(split_quantity_new,
false,
true);
10470 }
10471
10472 return new_item;
10473 }
10474 }
10475
10476 return null;
10477 }
10478
10480 {
10482 float split_quantity_new;
10484 if (destination_entity)
10485 {
10487 if (quantity > stackable)
10488 split_quantity_new = stackable;
10489 else
10490 split_quantity_new = quantity;
10491
10493 {
10494 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10495 if (new_item)
10496 {
10497 new_item.SetResultOfSplit(true);
10498 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10500 new_item.
SetQuantity(split_quantity_new,
false,
true);
10501 }
10502 }
10503 }
10504 }
10505
10507 {
10509 {
10510 if (ScriptInputUserData.CanStoreInputUserData())
10511 {
10512 ScriptInputUserData ctx = new ScriptInputUserData;
10517 ItemBase destination_entity =
this;
10518 ctx.
Write(destination_entity);
10522 }
10523 }
10524 else if (!
g_Game.IsMultiplayer())
10525 {
10527 }
10528 }
10529
10531 {
10533 float split_quantity_new;
10535 if (player)
10536 {
10538 if (quantity > stackable)
10539 split_quantity_new = stackable;
10540 else
10541 split_quantity_new = quantity;
10542
10544 {
10545 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10546 new_item =
ItemBase.Cast(in_hands);
10547 if (new_item)
10548 {
10549 new_item.SetResultOfSplit(true);
10550 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10552 new_item.SetQuantity(split_quantity_new, false, true);
10553 }
10554 }
10555 }
10556 }
10557
10559 {
10561 float split_quantity_new = Math.Floor(quantity * 0.5);
10562
10564 return;
10565
10567
10568 if (new_item)
10569 {
10570 if (new_item.GetQuantityMax() < split_quantity_new)
10571 {
10572 split_quantity_new = new_item.GetQuantityMax();
10573 }
10574
10575 new_item.SetResultOfSplit(true);
10576 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10577
10579 {
10582 }
10583 else
10584 {
10586 new_item.
SetQuantity(split_quantity_new,
false,
true);
10587 }
10588 }
10589 }
10590
10592 {
10594 float split_quantity_new = Math.Floor(quantity / 2);
10595
10597 return;
10598
10599 InventoryLocation invloc = new InventoryLocation;
10601
10603 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10604
10605 if (new_item)
10606 {
10607 if (new_item.GetQuantityMax() < split_quantity_new)
10608 {
10609 split_quantity_new = new_item.GetQuantityMax();
10610 }
10612 {
10615 }
10616 else if (split_quantity_new > 1)
10617 {
10619 new_item.
SetQuantity(split_quantity_new,
false,
true);
10620 }
10621 }
10622 }
10623
10626 {
10627 SetWeightDirty();
10629
10630 if (parent)
10631 parent.OnAttachmentQuantityChangedEx(this, delta);
10632
10634 {
10636 {
10638 }
10640 {
10641 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10643 }
10644 }
10645 }
10646
10649 {
10650
10651 }
10652
10655 {
10657 }
10658
10660 {
10661 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10662
10664 {
10665 if (newLevel == GameConstants.STATE_RUINED)
10666 {
10668 EntityAI parent = GetHierarchyParent();
10669 if (parent && parent.IsFireplace())
10670 {
10671 CargoBase cargo = GetInventory().GetCargo();
10672 if (cargo)
10673 {
10675 {
10677 }
10678 }
10679 }
10680 }
10681
10683 {
10684
10686 return;
10687 }
10688
10689 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10690 {
10692 }
10693 }
10694 }
10695
10696
10698 {
10699 super.OnRightClick();
10700
10702 {
10704 {
10705 if (ScriptInputUserData.CanStoreInputUserData())
10706 {
10707 EntityAI root = GetHierarchyRoot();
10708 Man playerOwner = GetHierarchyRootPlayer();
10709 InventoryLocation dst = new InventoryLocation;
10710
10711
10712 if (!playerOwner && root && root == this)
10713 {
10715 }
10716 else
10717 {
10718
10719 GetInventory().GetCurrentInventoryLocation(dst);
10721 {
10722 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10724 {
10726 }
10727 else
10728 {
10730
10731
10732 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10733 {
10735 }
10736 else
10737 {
10738 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10739 }
10740 }
10741 }
10742 }
10743
10744 ScriptInputUserData ctx = new ScriptInputUserData;
10752 }
10753 }
10754 else if (!
g_Game.IsMultiplayer())
10755 {
10757 }
10758 }
10759 }
10760
10762 {
10763 if (root)
10764 {
10765 vector m4[4];
10766 root.GetTransform(m4);
10767 dst.SetGround(this, m4);
10768 }
10769 else
10770 {
10771 GetInventory().GetCurrentInventoryLocation(dst);
10772 }
10773 }
10774
10775 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10776 {
10777
10778 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10779 return false;
10780
10781 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10782 return false;
10783
10784
10786 return false;
10787
10788
10789 Magazine mag = Magazine.Cast(this);
10790 if (mag)
10791 {
10792 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10793 return false;
10794
10795 if (stack_max_limit)
10796 {
10797 Magazine other_mag = Magazine.Cast(other_item);
10798 if (other_item)
10799 {
10800 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10801 return false;
10802 }
10803
10804 }
10805 }
10806 else
10807 {
10808
10810 return false;
10811
10813 return false;
10814 }
10815
10816 PlayerBase player = null;
10817 if (CastTo(player, GetHierarchyRootPlayer()))
10818 {
10819 if (player.GetInventory().HasAttachment(this))
10820 return false;
10821
10822 if (player.IsItemsToDelete())
10823 return false;
10824 }
10825
10826 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10827 return false;
10828
10829 int slotID;
10831 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10832 return false;
10833
10834 return true;
10835 }
10836
10838 {
10840 }
10841
10843 {
10844 return m_IsResultOfSplit;
10845 }
10846
10848 {
10849 m_IsResultOfSplit = value;
10850 }
10851
10853 {
10855 }
10856
10858 {
10859 float other_item_quantity = other_item.GetQuantity();
10860 float this_free_space;
10861
10863
10865
10866 if (other_item_quantity > this_free_space)
10867 {
10868 return this_free_space;
10869 }
10870 else
10871 {
10872 return other_item_quantity;
10873 }
10874 }
10875
10877 {
10879 }
10880
10882 {
10884 return;
10885
10886 if (!IsMagazine() && other_item)
10887 {
10889 if (quantity_used != 0)
10890 {
10891 float hp1 = GetHealth01("","");
10892 float hp2 = other_item.GetHealth01("","");
10893 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10894 hpResult = hpResult / (
GetQuantity() + quantity_used);
10895
10896 hpResult *= GetMaxHealth();
10897 Math.Round(hpResult);
10898 SetHealth("", "Health", hpResult);
10899
10901 other_item.AddQuantity(-quantity_used);
10902 }
10903 }
10905 }
10906
10908 {
10909 #ifdef SERVER
10910 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10911 GetHierarchyParent().IncreaseLifetimeUp();
10912 #endif
10913 };
10914
10916 {
10917 PlayerBase p = PlayerBase.Cast(player);
10918
10919 array<int> recipesIds = p.m_Recipes;
10920 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10921 if (moduleRecipesManager)
10922 {
10923 EntityAI itemInHands = player.GetEntityInHands();
10924 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10925 }
10926
10927 for (int i = 0;i < recipesIds.Count(); i++)
10928 {
10929 int key = recipesIds.Get(i);
10930 string recipeName = moduleRecipesManager.GetRecipeName(key);
10932 }
10933 }
10934
10935
10936 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10937 {
10938 super.GetDebugActions(outputList);
10939
10940
10946
10947
10952
10957
10958
10962
10963
10965 {
10969 }
10970
10973
10974
10978
10980
10981 InventoryLocation loc = new InventoryLocation();
10982 GetInventory().GetCurrentInventoryLocation(loc);
10984 {
10985 if (Gizmo_IsSupported())
10988 }
10989
10991 }
10992
10993
10994
10995
10997 {
10998 super.OnAction(action_id, player, ctx);
10999
11001 {
11002 switch (action_id)
11003 {
11007 return true;
11011 return true;
11012 }
11013 }
11014
11016 {
11017 switch (action_id)
11018 {
11020 Delete();
11021 return true;
11022 }
11023 }
11024
11025 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11026 {
11027 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11028 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11029 PlayerBase p = PlayerBase.Cast(player);
11030 if (
EActions.RECIPES_RANGE_START < 1000)
11031 {
11032 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11033 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11034 }
11035 }
11036 #ifndef SERVER
11037 else if (action_id ==
EActions.WATCH_PLAYER)
11038 {
11039 PluginDeveloper.SetDeveloperItemClientEx(player);
11040 }
11041 #endif
11043 {
11044 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11045 {
11046 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11047 OnDebugButtonPressServer(id + 1);
11048 }
11049
11050 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11051 {
11052 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11054 }
11055
11056 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11057 {
11058 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11060 }
11061
11062 else if (action_id ==
EActions.ADD_QUANTITY)
11063 {
11064 if (IsMagazine())
11065 {
11066 Magazine mag = Magazine.Cast(this);
11067 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11068 }
11069 else
11070 {
11072 }
11073
11074 if (m_EM)
11075 {
11076 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11077 }
11078
11079 }
11080
11081 else if (action_id ==
EActions.REMOVE_QUANTITY)
11082 {
11083 if (IsMagazine())
11084 {
11085 Magazine mag2 = Magazine.Cast(this);
11086 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11087 }
11088 else
11089 {
11091 }
11092 if (m_EM)
11093 {
11094 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11095 }
11096
11097 }
11098
11099 else if (action_id ==
EActions.SET_QUANTITY_0)
11100 {
11102
11103 if (m_EM)
11104 {
11105 m_EM.SetEnergy(0);
11106 }
11107 }
11108
11109 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11110 {
11112
11113 if (m_EM)
11114 {
11115 m_EM.SetEnergy(m_EM.GetEnergyMax());
11116 }
11117 }
11118
11119 else if (action_id ==
EActions.ADD_HEALTH)
11120 {
11121 AddHealth("","",GetMaxHealth("","Health")/5);
11122 }
11123 else if (action_id ==
EActions.REMOVE_HEALTH)
11124 {
11125 AddHealth("","",-GetMaxHealth("","Health")/5);
11126 }
11127 else if (action_id ==
EActions.DESTROY_HEALTH)
11128 {
11129 SetHealth01("","",0);
11130 }
11131 else if (action_id ==
EActions.WATCH_ITEM)
11132 {
11134 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11135 #ifdef DEVELOPER
11136 SetDebugDeveloper_item(this);
11137 #endif
11138 }
11139
11140 else if (action_id ==
EActions.ADD_TEMPERATURE)
11141 {
11142 AddTemperature(20);
11143
11144 }
11145
11146 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11147 {
11148 AddTemperature(-20);
11149
11150 }
11151
11152 else if (action_id ==
EActions.FLIP_FROZEN)
11153 {
11154 SetFrozen(!GetIsFrozen());
11155
11156 }
11157
11158 else if (action_id ==
EActions.ADD_WETNESS)
11159 {
11161
11162 }
11163
11164 else if (action_id ==
EActions.REMOVE_WETNESS)
11165 {
11167
11168 }
11169
11170 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11171 {
11174
11175
11176 }
11177
11178 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11179 {
11182 }
11183
11184 else if (action_id ==
EActions.MAKE_SPECIAL)
11185 {
11186 auto debugParams = DebugSpawnParams.WithPlayer(player);
11187 OnDebugSpawnEx(debugParams);
11188 }
11189
11190 }
11191
11192
11193 return false;
11194 }
11195
11196
11197
11198
11202
11205
11206
11207
11209 {
11210 return false;
11211 }
11212
11213
11215 {
11216 return true;
11217 }
11218
11219
11221 {
11222 return true;
11223 }
11224
11225
11226
11228 {
11229 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11230 return g_Game.ConfigIsExisting(config_path);
11231 }
11232
11235 {
11236 return null;
11237 }
11238
11240 {
11241 return false;
11242 }
11243
11245 {
11246 return false;
11247 }
11248
11252
11253
11255 {
11256 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11257 return module_repairing.CanRepair(this, item_repair_kit);
11258 }
11259
11260
11261 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11262 {
11263 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11264 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11265 }
11266
11267
11269 {
11270
11271
11272
11273
11274
11275
11276
11277
11278 return 1;
11279 }
11280
11281
11282
11284 {
11286 }
11287
11288
11289
11291 {
11293 }
11294
11295
11304 {
11305 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11306
11307 if (player)
11308 {
11309 player.MessageStatus(text);
11310 }
11311 }
11312
11313
11322 {
11323 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11324
11325 if (player)
11326 {
11327 player.MessageAction(text);
11328 }
11329 }
11330
11331
11340 {
11341 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11342
11343 if (player)
11344 {
11345 player.MessageFriendly(text);
11346 }
11347 }
11348
11349
11358 {
11359 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11360
11361 if (player)
11362 {
11363 player.MessageImportant(text);
11364 }
11365 }
11366
11368 {
11369 return true;
11370 }
11371
11372
11373 override bool KindOf(
string tag)
11374 {
11375 bool found = false;
11376 string item_name = this.
GetType();
11378 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11379
11380 int array_size = item_tag_array.Count();
11381 for (int i = 0; i < array_size; i++)
11382 {
11383 if (item_tag_array.Get(i) == tag)
11384 {
11385 found = true;
11386 break;
11387 }
11388 }
11389 return found;
11390 }
11391
11392
11394 {
11395
11396 super.OnRPC(sender, rpc_type,ctx);
11397
11398
11399 switch (rpc_type)
11400 {
11401 #ifndef SERVER
11402 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11403 Param2<bool, string> p = new Param2<bool, string>(false, "");
11404
11406 return;
11407
11408 bool play = p.param1;
11409 string soundSet = p.param2;
11410
11411 if (play)
11412 {
11414 {
11416 {
11418 }
11419 }
11420 else
11421 {
11423 }
11424 }
11425 else
11426 {
11428 }
11429
11430 break;
11431 #endif
11432
11433 }
11434
11436 {
11438 }
11439 }
11440
11441
11442
11443
11445 {
11446 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11447 return plugin.GetID(
name);
11448 }
11449
11451 {
11452 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11453 return plugin.GetName(id);
11454 }
11455
11458 {
11459
11460
11461 int varFlags;
11462 if (!ctx.
Read(varFlags))
11463 return;
11464
11465 if (varFlags & ItemVariableFlags.FLOAT)
11466 {
11468 }
11469 }
11470
11472 {
11473
11474 super.SerializeNumericalVars(floats_out);
11475
11476
11477
11479 {
11481 }
11482
11484 {
11486 }
11487
11489 {
11491 }
11492
11494 {
11499 }
11500
11502 {
11504 }
11505 }
11506
11508 {
11509
11510 super.DeSerializeNumericalVars(floats);
11511
11512
11513 int index = 0;
11514 int mask = Math.Round(floats.Get(index));
11515
11516 index++;
11517
11519 {
11521 {
11523 }
11524 else
11525 {
11526 float quantity = floats.Get(index);
11527 SetQuantity(quantity,
true,
false,
false,
false);
11528 }
11529 index++;
11530 }
11531
11533 {
11534 float wet = floats.Get(index);
11536 index++;
11537 }
11538
11540 {
11541 int liquidtype = Math.Round(floats.Get(index));
11543 index++;
11544 }
11545
11547 {
11549 index++;
11551 index++;
11553 index++;
11555 index++;
11556 }
11557
11559 {
11560 int cleanness = Math.Round(floats.Get(index));
11562 index++;
11563 }
11564 }
11565
11567 {
11568 super.WriteVarsToCTX(ctx);
11569
11570
11572 {
11574 }
11575
11577 {
11579 }
11580
11582 {
11584 }
11585
11587 {
11588 int r,g,b,a;
11594 }
11595
11597 {
11599 }
11600 }
11601
11603 {
11604 if (!super.ReadVarsFromCTX(ctx,version))
11605 return false;
11606
11607 int intValue;
11608 float value;
11609
11610 if (version < 140)
11611 {
11612 if (!ctx.
Read(intValue))
11613 return false;
11614
11615 m_VariablesMask = intValue;
11616 }
11617
11619 {
11620 if (!ctx.
Read(value))
11621 return false;
11622
11624 {
11626 }
11627 else
11628 {
11630 }
11631 }
11632
11633 if (version < 140)
11634 {
11636 {
11637 if (!ctx.
Read(value))
11638 return false;
11639 SetTemperatureDirect(value);
11640 }
11641 }
11642
11644 {
11645 if (!ctx.
Read(value))
11646 return false;
11648 }
11649
11651 {
11652 if (!ctx.
Read(intValue))
11653 return false;
11655 }
11656
11658 {
11659 int r,g,b,a;
11661 return false;
11663 return false;
11665 return false;
11667 return false;
11668
11670 }
11671
11673 {
11674 if (!ctx.
Read(intValue))
11675 return false;
11677 }
11678
11679 if (version >= 138 && version < 140)
11680 {
11682 {
11683 if (!ctx.
Read(intValue))
11684 return false;
11685 SetFrozen(intValue);
11686 }
11687 }
11688
11689 return true;
11690 }
11691
11692
11694 {
11697 {
11699 }
11700
11701 if (!super.OnStoreLoad(ctx, version))
11702 {
11704 return false;
11705 }
11706
11707 if (version >= 114)
11708 {
11709 bool hasQuickBarIndexSaved;
11710
11711 if (!ctx.
Read(hasQuickBarIndexSaved))
11712 {
11714 return false;
11715 }
11716
11717 if (hasQuickBarIndexSaved)
11718 {
11719 int itmQBIndex;
11720
11721
11722 if (!ctx.
Read(itmQBIndex))
11723 {
11725 return false;
11726 }
11727
11728 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11729 if (itmQBIndex != -1 && parentPlayer)
11730 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11731 }
11732 }
11733 else
11734 {
11735
11736 PlayerBase player;
11737 int itemQBIndex;
11738 if (version ==
int.
MAX)
11739 {
11740 if (!ctx.
Read(itemQBIndex))
11741 {
11743 return false;
11744 }
11745 }
11746 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11747 {
11748
11749 if (!ctx.
Read(itemQBIndex))
11750 {
11752 return false;
11753 }
11754 if (itemQBIndex != -1 && player)
11755 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11756 }
11757 }
11758
11759 if (version < 140)
11760 {
11761
11762 if (!LoadVariables(ctx, version))
11763 {
11765 return false;
11766 }
11767 }
11768
11769
11771 {
11773 return false;
11774 }
11775 if (version >= 132)
11776 {
11778 if (raib)
11779 {
11781 {
11783 return false;
11784 }
11785 }
11786 }
11787
11789 return true;
11790 }
11791
11792
11793
11795 {
11796 super.OnStoreSave(ctx);
11797
11798 PlayerBase player;
11799 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11800 {
11802
11803 int itemQBIndex = -1;
11804 itemQBIndex = player.FindQuickBarEntityIndex(this);
11805 ctx.
Write(itemQBIndex);
11806 }
11807 else
11808 {
11810 }
11811
11813
11815 if (raib)
11816 {
11818 }
11819 }
11820
11821
11823 {
11824 super.AfterStoreLoad();
11825
11827 {
11829 }
11830
11832 {
11835 }
11836 }
11837
11839 {
11840 super.EEOnAfterLoad();
11841
11843 {
11845 }
11846
11849 }
11850
11852 {
11853 return false;
11854 }
11855
11856
11857
11859 {
11861 {
11862 #ifdef PLATFORM_CONSOLE
11863
11865 {
11867 if (menu)
11868 {
11870 }
11871 }
11872 #endif
11873 }
11874
11876 {
11879 }
11880
11882 {
11883 SetWeightDirty();
11885 }
11887 {
11890 }
11891
11893 {
11896
11899 }
11901 {
11905 }
11906
11907 super.OnVariablesSynchronized();
11908 }
11909
11910
11911
11913 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11914 {
11915 if (!IsServerCheck(allow_client))
11916 return false;
11917
11919 return false;
11920
11923
11924 if (value <= (min + 0.001))
11925 value = min;
11926
11927 if (value == min)
11928 {
11929 if (destroy_config)
11930 {
11931 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11932 if (dstr)
11933 {
11935 this.Delete();
11936 return true;
11937 }
11938 }
11939 else if (destroy_forced)
11940 {
11942 this.Delete();
11943 return true;
11944 }
11945
11947 }
11948
11951
11953 {
11954 EntityAI parent = GetHierarchyRoot();
11955 InventoryLocation iLoc = new InventoryLocation();
11956 GetInventory().GetCurrentInventoryLocation(iLoc);
11958 {
11959 int iLocSlot = iLoc.
GetSlot();
11961 {
11963 }
11965 {
11967 }
11968 }
11969 }
11970
11972 {
11974
11975 if (delta)
11977 }
11978
11980
11981 return false;
11982 }
11983
11984
11986 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11987 {
11989 }
11990
11992 {
11995 }
11996
11998 {
12001 }
12002
12004 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12005 {
12006 float value_clamped = Math.Clamp(value, 0, 1);
12008 SetQuantity(result, destroy_config, destroy_forced);
12009 }
12010
12011
12014 {
12016 }
12017
12019 {
12021 }
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12033 {
12034 int slot = -1;
12035 GameInventory inventory = GetInventory();
12036 if (inventory)
12037 {
12038 InventoryLocation il = new InventoryLocation;
12041 }
12042
12044 }
12045
12047 {
12048 float quantity_max = 0;
12049
12051 {
12052 if (attSlotID != -1)
12053 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12054
12055 if (quantity_max <= 0)
12057 }
12058
12059 if (quantity_max <= 0)
12061
12062 return quantity_max;
12063 }
12064
12066 {
12068 }
12069
12071 {
12073 }
12074
12075
12077 {
12079 }
12080
12082 {
12084 }
12085
12087 {
12089 }
12090
12091
12093 {
12094
12095 float weightEx = GetWeightEx();
12096 float special = GetInventoryAndCargoWeight();
12097 return weightEx - special;
12098 }
12099
12100
12102 {
12104 }
12105
12107 {
12109 {
12110 #ifdef DEVELOPER
12111 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12112 {
12113 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12115 }
12116 #endif
12117
12118 return GetQuantity() * GetConfigWeightModified();
12119 }
12120 else if (HasEnergyManager())
12121 {
12122 #ifdef DEVELOPER
12123 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12124 {
12125 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12126 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12127 }
12128 #endif
12129 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12130 }
12131 else
12132 {
12133 #ifdef DEVELOPER
12134 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12135 {
12136 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12137 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12138 }
12139 #endif
12140 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12141 }
12142 }
12143
12146 {
12147 int item_count = 0;
12149
12150 GameInventory inventory = GetInventory();
12151 CargoBase cargo = inventory.
GetCargo();
12152 if (cargo != NULL)
12153 {
12155 }
12156
12158 for (int i = 0; i < nAttachments; ++i)
12159 {
12161 if (item)
12162 item_count += item.GetNumberOfItems();
12163 }
12164 return item_count;
12165 }
12166
12169 {
12170 float weight = 0;
12171 float wetness = 1;
12172 if (include_wetness)
12175 {
12176 weight = wetness * m_ConfigWeight;
12177 }
12179 {
12180 weight = 1;
12181 }
12182 return weight;
12183 }
12184
12185
12186
12188 {
12189 GameInventory inventory = GetInventory();
12190 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12191 {
12192 array<EntityAI> items = new array<EntityAI>;
12194 for (int i = 0; i < items.Count(); ++i)
12195 {
12197 if (item)
12198 {
12199 g_Game.ObjectDelete(item);
12200 }
12201 }
12202 }
12203 }
12204
12205
12206
12207
12209 {
12210 float energy = 0;
12211 if (HasEnergyManager())
12212 {
12213 energy = GetCompEM().GetEnergy();
12214 }
12215 return energy;
12216 }
12217
12218
12220 {
12221 super.OnEnergyConsumed();
12222
12224 }
12225
12227 {
12228 super.OnEnergyAdded();
12229
12231 }
12232
12233
12235 {
12236 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12237 {
12239 {
12240 float energy_0to1 = GetCompEM().GetEnergy0To1();
12242 }
12243 }
12244 }
12245
12246
12248 {
12249 return ConfigGetFloat("heatIsolation");
12250 }
12251
12253 {
12255 }
12256
12258 {
12259 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12260 if (
g_Game.ConfigIsExisting(paramPath))
12261 return g_Game.ConfigGetFloat(paramPath);
12262
12263 return 0.0;
12264 }
12265
12267 {
12268 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12269 if (
g_Game.ConfigIsExisting(paramPath))
12270 return g_Game.ConfigGetFloat(paramPath);
12271
12272 return 0.0;
12273 }
12274
12275 override void SetWet(
float value,
bool allow_client =
false)
12276 {
12277 if (!IsServerCheck(allow_client))
12278 return;
12279
12282
12284
12285 m_VarWet = Math.Clamp(value, min, max);
12286
12288 {
12291 }
12292 }
12293
12294 override void AddWet(
float value)
12295 {
12297 }
12298
12300 {
12302 }
12303
12305 {
12307 }
12308
12310 {
12312 }
12313
12315 {
12317 }
12318
12320 {
12322 }
12323
12324 override void OnWetChanged(
float newVal,
float oldVal)
12325 {
12328 if (newLevel != oldLevel)
12329 {
12331 }
12332 }
12333
12335 {
12336 SetWeightDirty();
12337 }
12338
12340 {
12341 return GetWetLevelInternal(
m_VarWet);
12342 }
12343
12344
12345
12347 {
12349 }
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12366
12367
12369 {
12370 if (ConfigIsExisting("itemModelLength"))
12371 {
12372 return ConfigGetFloat("itemModelLength");
12373 }
12374 return 0;
12375 }
12376
12378 {
12379 if (ConfigIsExisting("itemAttachOffset"))
12380 {
12381 return ConfigGetFloat("itemAttachOffset");
12382 }
12383 return 0;
12384 }
12385
12386 override void SetCleanness(
int value,
bool allow_client =
false)
12387 {
12388 if (!IsServerCheck(allow_client))
12389 return;
12390
12392
12394
12397 }
12398
12400 {
12402 }
12403
12405 {
12406 return true;
12407 }
12408
12409
12410
12411
12413 {
12415 }
12416
12418 {
12420 }
12421
12422
12423
12424
12425 override void SetColor(
int r,
int g,
int b,
int a)
12426 {
12432 }
12434 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12435 {
12440 }
12441
12443 {
12445 }
12446
12449 {
12450 int r,g,b,a;
12452 r = r/255;
12453 g = g/255;
12454 b = b/255;
12455 a = a/255;
12456 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12457 }
12458
12459
12460
12461 override void SetLiquidType(
int value,
bool allow_client =
false)
12462 {
12463 if (!IsServerCheck(allow_client))
12464 return;
12465
12470 }
12471
12473 {
12474 return ConfigGetInt("varLiquidTypeInit");
12475 }
12476
12478 {
12480 }
12481
12483 {
12485 SetFrozen(false);
12486 }
12487
12490 {
12491 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12492 }
12493
12494
12497 {
12498 PlayerBase nplayer;
12499 if (PlayerBase.CastTo(nplayer, player))
12500 {
12502 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12503 }
12504 }
12505
12506
12509 {
12510 PlayerBase nplayer;
12511 if (PlayerBase.CastTo(nplayer,player))
12512 {
12513 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12514 }
12515
12516 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12517
12518 if (HasEnergyManager())
12519 {
12520 GetCompEM().UpdatePlugState();
12521 }
12522 }
12523
12524
12526 {
12527 super.OnPlacementStarted(player);
12528
12530 }
12531
12532 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12533 {
12535 {
12536 m_AdminLog.OnPlacementComplete(player,
this);
12537 }
12538
12539 super.OnPlacementComplete(player, position, orientation);
12540 }
12541
12542
12543
12544
12545
12547 {
12549 {
12550 return true;
12551 }
12552 else
12553 {
12554 return false;
12555 }
12556 }
12557
12558
12560 {
12562 {
12564 }
12565 }
12566
12567
12569 {
12571 }
12572
12574 {
12576 }
12577
12578 override void InsertAgent(
int agent,
float count = 1)
12579 {
12580 if (count < 1)
12581 return;
12582
12584 }
12585
12588 {
12590 }
12591
12592
12594 {
12596 }
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12640 {
12642 return false;
12643 return true;
12644 }
12645
12647 {
12648
12650 }
12651
12652
12655 {
12656 super.CheckForRoofLimited(timeTresholdMS);
12657
12658 float time =
g_Game.GetTime();
12659 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12660 {
12661 m_PreviousRoofTestTime = time;
12662 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12663 }
12664 }
12665
12666
12668 {
12670 {
12671 return 0;
12672 }
12673
12674 if (GetInventory().GetAttachmentSlotsCount() != 0)
12675 {
12676 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12677 if (filter)
12678 return filter.GetProtectionLevel(type, false, system);
12679 else
12680 return 0;
12681 }
12682
12683 string subclassPath, entryName;
12684
12685 switch (type)
12686 {
12688 entryName = "biological";
12689 break;
12691 entryName = "chemical";
12692 break;
12693 default:
12694 entryName = "biological";
12695 break;
12696 }
12697
12698 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12699
12700 return g_Game.ConfigGetFloat(subclassPath + entryName);
12701 }
12702
12703
12704
12707 {
12708 if (!IsMagazine())
12710
12712 }
12713
12714
12715
12716
12717
12722 {
12723 return true;
12724 }
12725
12727 {
12729 }
12730
12731
12732
12733
12734
12736 {
12737 if (parent)
12738 {
12739 if (parent.IsInherited(DayZInfected))
12740 return true;
12741
12742 if (!parent.IsRuined())
12743 return true;
12744 }
12745
12746 return true;
12747 }
12748
12750 {
12751 if (!super.CanPutAsAttachment(parent))
12752 {
12753 return false;
12754 }
12755
12756 if (!IsRuined() && !parent.IsRuined())
12757 {
12758 return true;
12759 }
12760
12761 return false;
12762 }
12763
12765 {
12766
12767
12768
12769
12770 return super.CanReceiveItemIntoCargo(item);
12771 }
12772
12774 {
12775
12776
12777
12778
12779 GameInventory attachmentInv = attachment.GetInventory();
12781 {
12782 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12783 return false;
12784 }
12785
12786 InventoryLocation loc = new InventoryLocation();
12787 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12788 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12789 return false;
12790
12791 return super.CanReceiveAttachment(attachment, slotId);
12792 }
12793
12795 {
12796 if (!super.CanReleaseAttachment(attachment))
12797 return false;
12798
12799 return GetInventory().AreChildrenAccessible();
12800 }
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12823 {
12824 int id = muzzle_owner.GetMuzzleID();
12825 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12826
12827 if (WPOF_array)
12828 {
12829 for (int i = 0; i < WPOF_array.Count(); i++)
12830 {
12831 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12832
12833 if (WPOF)
12834 {
12835 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12836 }
12837 }
12838 }
12839 }
12840
12841
12843 {
12844 int id = muzzle_owner.GetMuzzleID();
12846
12847 if (WPOBE_array)
12848 {
12849 for (int i = 0; i < WPOBE_array.Count(); i++)
12850 {
12851 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12852
12853 if (WPOBE)
12854 {
12855 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12856 }
12857 }
12858 }
12859 }
12860
12861
12863 {
12864 int id = muzzle_owner.GetMuzzleID();
12865 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12866
12867 if (WPOOH_array)
12868 {
12869 for (int i = 0; i < WPOOH_array.Count(); i++)
12870 {
12871 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12872
12873 if (WPOOH)
12874 {
12875 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12876 }
12877 }
12878 }
12879 }
12880
12881
12883 {
12884 int id = muzzle_owner.GetMuzzleID();
12885 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12886
12887 if (WPOOH_array)
12888 {
12889 for (int i = 0; i < WPOOH_array.Count(); i++)
12890 {
12891 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12892
12893 if (WPOOH)
12894 {
12895 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12896 }
12897 }
12898 }
12899 }
12900
12901
12903 {
12904 int id = muzzle_owner.GetMuzzleID();
12905 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12906
12907 if (WPOOH_array)
12908 {
12909 for (int i = 0; i < WPOOH_array.Count(); i++)
12910 {
12911 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12912
12913 if (WPOOH)
12914 {
12915 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12916 }
12917 }
12918 }
12919 }
12920
12921
12922
12924 {
12926 {
12927 return true;
12928 }
12929
12930 return false;
12931 }
12932
12934 {
12936 {
12937 return true;
12938 }
12939
12940 return false;
12941 }
12942
12944 {
12946 {
12947 return true;
12948 }
12949
12950 return false;
12951 }
12952
12954 {
12955 return false;
12956 }
12957
12960 {
12961 return UATimeSpent.DEFAULT_DEPLOY;
12962 }
12963
12964
12965
12966
12968 {
12970 SetSynchDirty();
12971 }
12972
12974 {
12976 }
12977
12978
12980 {
12981 return false;
12982 }
12983
12986 {
12987 string att_type = "None";
12988
12989 if (ConfigIsExisting("soundAttType"))
12990 {
12991 att_type = ConfigGetString("soundAttType");
12992 }
12993
12995 }
12996
12998 {
13000 }
13001
13002
13003
13004
13005
13011
13013 {
13016
13018 }
13019
13020
13022 {
13024 return;
13025
13027
13030
13033
13034 SoundParameters params = new SoundParameters();
13038 }
13039
13040
13042 {
13044 {
13047
13048 SetSynchDirty();
13049
13052 }
13053 }
13054
13056 {
13058 }
13059
13060
13062 {
13064 return;
13065
13067 SetSynchDirty();
13068
13071 }
13072
13074 {
13077 }
13078
13080 {
13082 }
13083
13084 void OnApply(PlayerBase player);
13085
13087 {
13088 return 1.0;
13089 };
13090
13092 {
13094 }
13095
13097 {
13099 }
13100
13102
13104 {
13105 SetDynamicPhysicsLifeTime(0.01);
13107 }
13108
13110 {
13111 array<string> zone_names = new array<string>;
13112 GetDamageZones(zone_names);
13113 for (int i = 0; i < zone_names.Count(); i++)
13114 {
13115 SetHealthMax(zone_names.Get(i),"Health");
13116 }
13117 SetHealthMax("","Health");
13118 }
13119
13122 {
13123 float global_health = GetHealth01("","Health");
13124 array<string> zones = new array<string>;
13125 GetDamageZones(zones);
13126
13127 for (int i = 0; i < zones.Count(); i++)
13128 {
13129 SetHealth01(zones.Get(i),"Health",global_health);
13130 }
13131 }
13132
13135 {
13136 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13137 }
13138
13140 {
13141 if (!hasRootAsPlayer)
13142 {
13143 if (refParentIB)
13144 {
13145
13146 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13147 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13148
13149 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13150 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13151
13154 }
13155 else
13156 {
13157
13160 }
13161 }
13162 }
13163
13165 {
13167 {
13168 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13169 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13170 {
13171 float heatPermCoef = 1.0;
13173 while (ent)
13174 {
13175 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13176 ent = ent.GetHierarchyParent();
13177 }
13178
13179 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13180 }
13181 }
13182 }
13183
13185 {
13186
13187 EntityAI parent = GetHierarchyParent();
13188 if (!parent)
13189 {
13190 hasParent = false;
13191 hasRootAsPlayer = false;
13192 }
13193 else
13194 {
13195 hasParent = true;
13196 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13197 refParentIB =
ItemBase.Cast(parent);
13198 }
13199 }
13200
13201 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13202 {
13203
13204 }
13205
13207 {
13208
13209 return false;
13210 }
13211
13213 {
13214
13215
13216 return false;
13217 }
13218
13220 {
13221
13222 return false;
13223 }
13224
13227 {
13228 return !GetIsFrozen() &&
IsOpen();
13229 }
13230
13232 {
13233 bool hasParent = false, hasRootAsPlayer = false;
13235
13236 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13237 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13238
13239 if (wwtu || foodDecay)
13240 {
13244
13245 if (processWetness || processTemperature || processDecay)
13246 {
13248
13249 if (processWetness)
13250 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13251
13252 if (processTemperature)
13254
13255 if (processDecay)
13256 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13257 }
13258 }
13259 }
13260
13263 {
13265 }
13266
13268 {
13271
13272 return super.GetTemperatureFreezeThreshold();
13273 }
13274
13276 {
13279
13280 return super.GetTemperatureThawThreshold();
13281 }
13282
13284 {
13287
13288 return super.GetItemOverheatThreshold();
13289 }
13290
13292 {
13294 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13295
13296 return super.GetTemperatureFreezeTime();
13297 }
13298
13300 {
13302 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13303
13304 return super.GetTemperatureThawTime();
13305 }
13306
13311
13313 {
13314 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13315 }
13316
13318 {
13319 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13320 }
13321
13324 {
13326 }
13327
13329 {
13331 }
13332
13334 {
13336 }
13337
13340 {
13341 return null;
13342 }
13343
13346 {
13347 return false;
13348 }
13349
13351 {
13353 {
13356 if (!trg)
13357 {
13359 explosive = this;
13360 }
13361
13362 explosive.PairRemote(trg);
13364
13365 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13366 trg.SetPersistentPairID(persistentID);
13367 explosive.SetPersistentPairID(persistentID);
13368
13369 return true;
13370 }
13371 return false;
13372 }
13373
13376 {
13377 float ret = 1.0;
13380 ret *= GetHealth01();
13381
13382 return ret;
13383 }
13384
13385 #ifdef DEVELOPER
13386 override void SetDebugItem()
13387 {
13388 super.SetDebugItem();
13389 _itemBase = this;
13390 }
13391
13393 {
13394 string text = super.GetDebugText();
13395
13397 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13398
13399 return text;
13400 }
13401 #endif
13402
13404 {
13405 return true;
13406 }
13407
13409
13411
13413 {
13416 }
13417
13418
13426
13442
13443 [
Obsolete(
"Use ItemSoundHandler instead")]
13446 {
13447 if (!
g_Game.IsDedicatedServer())
13448 {
13449 if (ConfigIsExisting("attachSoundSet"))
13450 {
13451 string cfg_path = "";
13452 string soundset = "";
13453 string type_name =
GetType();
13454
13457 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13458 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13459
13460 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13461 {
13462 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13463 {
13464 if (cfg_slot_array[i] == slot_type)
13465 {
13466 soundset = cfg_soundset_array[i];
13467 break;
13468 }
13469 }
13470 }
13471
13472 if (soundset != "")
13473 {
13474 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13476 }
13477 }
13478 }
13479 }
13480
13482}
13483
13485{
13487 if (entity)
13488 {
13489 bool is_item = entity.IsInherited(
ItemBase);
13490 if (is_item && full_quantity)
13491 {
13494 }
13495 }
13496 else
13497 {
13499 return NULL;
13500 }
13501 return entity;
13502}
13503
13505{
13506 if (item)
13507 {
13508 if (health > 0)
13509 item.SetHealth("", "", health);
13510
13511 if (item.CanHaveTemperature())
13512 {
13514 if (item.CanFreeze())
13515 item.SetFrozen(false);
13516 }
13517
13518 if (item.HasEnergyManager())
13519 {
13520 if (quantity >= 0)
13521 {
13522 item.GetCompEM().SetEnergy0To1(quantity);
13523 }
13524 else
13525 {
13527 }
13528 }
13529 else if (item.IsMagazine())
13530 {
13531 Magazine mag = Magazine.Cast(item);
13532 if (quantity >= 0)
13533 {
13534 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13535 }
13536 else
13537 {
13539 }
13540
13541 }
13542 else
13543 {
13544 if (quantity >= 0)
13545 {
13546 item.SetQuantityNormalized(quantity, false);
13547 }
13548 else
13549 {
13551 }
13552
13553 }
13554 }
13555}
13556
13557#ifdef DEVELOPER
13559#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.