8678{
8680 {
8681 return true;
8682 }
8683};
8684
8686{
8687
8688};
8689
8690
8691
8693{
8697
8699
8702
8703
8704
8705
8706
8715
8721
8726
8731
8752 protected bool m_IsResultOfSplit
8753
8755
8760
8761
8762
8764
8768
8769
8770
8772
8775
8776
8777
8783
8784
8792
8795
8796
8798
8799
8801
8802
8807
8808
8813
8815
8816
8818
8819
8821 {
8826
8827 if (!
g_Game.IsDedicatedServer())
8828 {
8830 {
8832
8834 {
8836 }
8837 }
8838
8841 }
8842
8843 m_OldLocation = null;
8844
8846 {
8848 }
8849
8850 if (ConfigIsExisting("headSelectionsToHide"))
8851 {
8854 }
8855
8857 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8858 {
8860 }
8861
8863
8864 m_IsResultOfSplit = false;
8865
8867 }
8868
8870 {
8871 super.InitItemVariables();
8872
8878 m_Count = ConfigGetInt(
"count");
8879
8882
8887
8890
8895
8907
8911
8912
8915 if (ConfigIsExisting("canBeSplit"))
8916 {
8919 }
8920
8922 if (ConfigIsExisting("itemBehaviour"))
8924
8925
8928 RegisterNetSyncVariableInt("m_VarLiquidType");
8929 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8930
8931 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8932 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8933 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8934
8935 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8936 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8937 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8938 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8939
8940 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8941 RegisterNetSyncVariableBool("m_IsTakeable");
8942 RegisterNetSyncVariableBool("m_IsHologram");
8943
8946 {
8949 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8950 }
8951
8953
8955 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8957
8959 }
8960
8962 {
8964 }
8965
8967 {
8970 {
8975 }
8976 }
8977
8978 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8979 {
8981 {
8984 }
8985
8987 }
8988
8990 {
8996 }
8997
8999
9001 {
9003
9004 if (!action)
9005 {
9006 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9007 return;
9008 }
9009
9011 if (!ai)
9012 {
9014 return;
9015 }
9016
9018 if (!action_array)
9019 {
9020 action_array = new array<ActionBase_Basic>;
9022 }
9023 if (LogManager.IsActionLogEnable())
9024 {
9025 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9026 }
9027
9028 if (action_array.Find(action) != -1)
9029 {
9030 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9031 }
9032 else
9033 {
9034 action_array.Insert(action);
9035 }
9036 }
9037
9039 {
9040 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9041 ActionBase action = player.GetActionManager().GetAction(actionName);
9044
9045 if (action_array)
9046 {
9047 action_array.RemoveItem(action);
9048 }
9049 }
9050
9051
9052
9054 {
9055 ActionOverrideData overrideData = new ActionOverrideData();
9059
9061 if (!actionMap)
9062 {
9065 }
9066
9067 actionMap.Insert(this.
Type(), overrideData);
9068
9069 }
9070
9072
9074
9075
9077 {
9080
9083
9084 string config_to_search = "CfgVehicles";
9085 string muzzle_owner_config;
9086
9088 {
9089 if (IsInherited(Weapon))
9090 config_to_search = "CfgWeapons";
9091
9092 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9093
9094 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9095
9096 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9097
9098 if (config_OnFire_subclass_count > 0)
9099 {
9100 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9101
9102 for (int i = 0; i < config_OnFire_subclass_count; i++)
9103 {
9104 string particle_class = "";
9105 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9106 string config_OnFire_entry = config_OnFire_class + particle_class;
9107 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9108 WPOF_array.Insert(WPOF);
9109 }
9110
9111
9113 }
9114 }
9115
9117 {
9118 config_to_search = "CfgWeapons";
9119 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9120
9121 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9122
9123 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9124
9125 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9126 {
9127 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9128
9129 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9130 {
9131 string particle_class2 = "";
9132 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9133 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9134 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9135 WPOBE_array.Insert(WPOBE);
9136 }
9137
9138
9140 }
9141 }
9142 }
9143
9144
9146 {
9149
9151 {
9152 string config_to_search = "CfgVehicles";
9153
9154 if (IsInherited(Weapon))
9155 config_to_search = "CfgWeapons";
9156
9157 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9158 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9159
9160 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9161 {
9162
9164
9166 {
9168 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9170 return;
9171 }
9172
9175
9176
9177
9178 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9179 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9180
9181 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9182 {
9183 string particle_class = "";
9184 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9185 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9186 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9187
9188 if (entry_type == CT_CLASS)
9189 {
9190 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9191 WPOOH_array.Insert(WPOF);
9192 }
9193 }
9194
9195
9197 }
9198 }
9199 }
9200
9202 {
9204 }
9205
9207 {
9209 {
9211
9214
9217
9218 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9219 }
9220 }
9221
9223 {
9225 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9226
9228 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9229
9231 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9232
9234 {
9236 }
9237 }
9238
9240 {
9242 }
9243
9245 {
9248 else
9250
9252 {
9255 }
9256 else
9257 {
9260
9263 }
9264
9266 }
9267
9269 {
9271 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9272 }
9273
9275 {
9277 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9279 }
9280
9282 {
9284 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9285 }
9286
9288 {
9291
9292 OverheatingParticle OP = new OverheatingParticle();
9297
9299 }
9300
9302 {
9305
9306 return -1;
9307 }
9308
9310 {
9312 {
9315
9316 for (int i = count; i > 0; --i)
9317 {
9318 int id = i - 1;
9321
9324
9325 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9326 {
9327 if (p)
9328 {
9331 }
9332 }
9333 }
9334 }
9335 }
9336
9338 {
9340 {
9342 {
9343 int id = i - 1;
9345
9346 if (OP)
9347 {
9349
9350 if (p)
9351 {
9353 }
9354
9355 delete OP;
9356 }
9357 }
9358
9361 }
9362 }
9363
9366 {
9367 return 0.0;
9368 }
9369
9370
9372 {
9373 return 250;
9374 }
9375
9377 {
9378 return 0;
9379 }
9380
9383 {
9385 return true;
9386
9387 return false;
9388 }
9389
9392 {
9395
9397 {
9399 }
9400 else
9401 {
9402
9404 }
9405
9407 }
9408
9415 {
9416 return -1;
9417 }
9418
9419
9420
9421
9423 {
9425 {
9426 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9427 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9428
9429 if (r_index >= 0)
9430 {
9431 InventoryLocation r_il = new InventoryLocation;
9432 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9433
9434 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9437 {
9438 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9439 }
9441 {
9442 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9443 }
9444
9445 }
9446
9447 player.GetHumanInventory().ClearUserReservedLocation(this);
9448 }
9449
9452 }
9453
9454
9455
9456
9458 {
9459 return ItemBase.m_DebugActionsMask;
9460 }
9461
9463 {
9464 return ItemBase.m_DebugActionsMask & mask;
9465 }
9466
9468 {
9469 ItemBase.m_DebugActionsMask = mask;
9470 }
9471
9473 {
9474 ItemBase.m_DebugActionsMask |= mask;
9475 }
9476
9478 {
9479 ItemBase.m_DebugActionsMask &= ~mask;
9480 }
9481
9483 {
9485 {
9487 }
9488 else
9489 {
9491 }
9492 }
9493
9494
9496 {
9497 if (GetEconomyProfile())
9498 {
9499 float q_max = GetEconomyProfile().GetQuantityMax();
9500 if (q_max > 0)
9501 {
9502 float q_min = GetEconomyProfile().GetQuantityMin();
9503 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9504
9506 {
9507 ComponentEnergyManager comp = GetCompEM();
9509 {
9511 }
9512 }
9514 {
9516
9517 }
9518
9519 }
9520 }
9521 }
9522
9525 {
9526 EntityAI parent = GetHierarchyParent();
9527
9528 if (parent)
9529 {
9530 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9531 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9532 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9533 }
9534 }
9535
9538 {
9539 EntityAI parent = GetHierarchyParent();
9540
9541 if (parent)
9542 {
9543 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9544 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9545 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9546 }
9547 }
9548
9550 {
9551
9552
9553
9554
9556
9558 {
9559 if (ScriptInputUserData.CanStoreInputUserData())
9560 {
9561 ScriptInputUserData ctx = new ScriptInputUserData;
9567 ctx.
Write(use_stack_max);
9570
9572 {
9573 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9574 }
9575 }
9576 }
9577 else if (!
g_Game.IsMultiplayer())
9578 {
9580 }
9581 }
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9600
9601 return false;
9602 }
9603
9605 {
9606 return false;
9607 }
9608
9612 {
9613 return false;
9614 }
9615
9617 {
9618 return "";
9619 }
9620
9622
9624 {
9625 return false;
9626 }
9627
9629 {
9630 return true;
9631 }
9632
9633
9634
9636 {
9637 return true;
9638 }
9639
9641 {
9642 return true;
9643 }
9644
9646 {
9647 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9649 }
9650
9652 {
9654 }
9655
9657 {
9659 if (!is_being_placed)
9661 SetSynchDirty();
9662 }
9663
9664
9666
9668 {
9670 }
9671
9673 {
9675 }
9676
9678 {
9679 return 1;
9680 }
9681
9683 {
9684 return false;
9685 }
9686
9688 {
9690 SetSynchDirty();
9691 }
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9728 {
9729 super.OnMovedInsideCargo(container);
9730
9731 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9732 }
9733
9734 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9735 {
9736 super.EEItemLocationChanged(oldLoc, newLoc);
9737
9738 PlayerBase newPlayer = null;
9739 PlayerBase oldPlayer = null;
9740
9741 if (newLoc.GetParent())
9742 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9743
9744 if (oldLoc.GetParent())
9745 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9746
9748 {
9749 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9750
9751 if (rIndex >= 0)
9752 {
9753 InventoryLocation rIl = new InventoryLocation;
9754 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9755
9756 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9759 {
9760 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9761 }
9763 {
9765 }
9766
9767 }
9768 }
9769
9771 {
9772 if (newPlayer)
9773 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9774
9775 if (newPlayer == oldPlayer)
9776 {
9777 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9778 {
9780 {
9781 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9782 {
9783 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9784 }
9785 }
9786 else
9787 {
9788 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9789 }
9790 }
9791
9792 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9793 {
9794 int type = oldLoc.GetType();
9796 {
9797 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9798 }
9800 {
9801 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9802 }
9803 }
9804 if (!m_OldLocation)
9805 {
9806 m_OldLocation = new InventoryLocation;
9807 }
9808 m_OldLocation.Copy(oldLoc);
9809 }
9810 else
9811 {
9812 if (m_OldLocation)
9813 {
9814 m_OldLocation.Reset();
9815 }
9816 }
9817
9818 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9819 }
9820 else
9821 {
9822 if (newPlayer)
9823 {
9824 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9825 if (resIndex >= 0)
9826 {
9827 InventoryLocation il = new InventoryLocation;
9828 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9830 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9833 {
9834 il.
GetParent().GetOnReleaseLock().Invoke(it);
9835 }
9837 {
9839 }
9840
9841 }
9842 }
9844 {
9845
9847 }
9848
9849 if (m_OldLocation)
9850 {
9851 m_OldLocation.Reset();
9852 }
9853 }
9854
9856 {
9857 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9858 }
9859
9861 {
9862 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9863 }
9864 }
9865
9866 override void EOnContact(IEntity other, Contact extra)
9867 {
9869 {
9870 int liquidType = -1;
9872 if (impactSpeed > 0.0)
9873 {
9875 #ifndef SERVER
9877 #else
9879 SetSynchDirty();
9880 #endif
9882 }
9883 }
9884
9885 #ifdef SERVER
9886 if (GetCompEM() && GetCompEM().IsPlugged())
9887 {
9888 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9889 GetCompEM().UnplugThis();
9890 }
9891 #endif
9892 }
9893
9895
9897 {
9899 }
9900
9902 {
9903
9904 }
9905
9907 {
9908 super.OnItemLocationChanged(old_owner, new_owner);
9909
9910 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9911 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9912
9913 if (!relatedPlayer && playerNew)
9914 relatedPlayer = playerNew;
9915
9916 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9917 {
9919 if (actionMgr)
9920 {
9921 ActionBase currentAction = actionMgr.GetRunningAction();
9922 if (currentAction)
9924 }
9925 }
9926
9927 Man ownerPlayerOld = null;
9928 Man ownerPlayerNew = null;
9929
9930 if (old_owner)
9931 {
9932 if (old_owner.
IsMan())
9933 {
9934 ownerPlayerOld = Man.Cast(old_owner);
9935 }
9936 else
9937 {
9938 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9939 }
9940 }
9941 else
9942 {
9944 {
9946
9947 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9948 {
9949 GetCompEM().UnplugThis();
9950 }
9951 }
9952 }
9953
9954 if (new_owner)
9955 {
9956 if (new_owner.
IsMan())
9957 {
9958 ownerPlayerNew = Man.Cast(new_owner);
9959 }
9960 else
9961 {
9962 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9963 }
9964 }
9965
9966 if (ownerPlayerOld != ownerPlayerNew)
9967 {
9968 if (ownerPlayerOld)
9969 {
9970 array<EntityAI> subItemsExit = new array<EntityAI>;
9972 for (int i = 0; i < subItemsExit.Count(); i++)
9973 {
9976 }
9977 }
9978
9979 if (ownerPlayerNew)
9980 {
9981 array<EntityAI> subItemsEnter = new array<EntityAI>;
9983 for (int j = 0; j < subItemsEnter.Count(); j++)
9984 {
9987 }
9988 }
9989 }
9990 else if (ownerPlayerNew != null)
9991 {
9992 PlayerBase nplayer;
9993 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9994 {
9995 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9997 for (int k = 0; k < subItemsUpdate.Count(); k++)
9998 {
10000 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10001 }
10002 }
10003 }
10004
10005 if (old_owner)
10006 old_owner.OnChildItemRemoved(this);
10007 if (new_owner)
10008 new_owner.OnChildItemReceived(this);
10009 }
10010
10011
10013 {
10014 super.EEDelete(parent);
10015 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10016 if (player)
10017 {
10019
10020 if (player.IsAlive())
10021 {
10022 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10023 if (r_index >= 0)
10024 {
10025 InventoryLocation r_il = new InventoryLocation;
10026 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10027
10028 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10031 {
10032 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10033 }
10035 {
10036 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10037 }
10038
10039 }
10040
10041 player.RemoveQuickBarEntityShortcut(this);
10042 }
10043 }
10044 }
10045
10047 {
10048 super.EEKilled(killer);
10049
10052 {
10053 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10054 {
10055 if (IsMagazine())
10056 {
10057 if (Magazine.Cast(this).GetAmmoCount() > 0)
10058 {
10060 }
10061 }
10062 else
10063 {
10065 }
10066 }
10067 }
10068 }
10069
10071 {
10072 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10073
10074 super.OnWasAttached(parent, slot_id);
10075
10078
10081 }
10082
10084 {
10085 super.OnWasDetached(parent, slot_id);
10086
10089
10092 }
10093
10095 {
10096 int idx;
10099
10100 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10101 if (inventory_slots.Count() < 1)
10102 {
10103 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10104 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10105 }
10106 else
10107 {
10108 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10109 }
10110
10111 idx = inventory_slots.Find(slot);
10112 if (idx < 0)
10113 return "";
10114
10115 return attach_types.Get(idx);
10116 }
10117
10119 {
10120 int idx = -1;
10121 string slot;
10122
10125
10126 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10127 if (inventory_slots.Count() < 1)
10128 {
10129 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10130 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10131 }
10132 else
10133 {
10134 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10135 if (detach_types.Count() < 1)
10136 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10137 }
10138
10139 for (int i = 0; i < inventory_slots.Count(); i++)
10140 {
10141 slot = inventory_slots.Get(i);
10142 }
10143
10144 if (slot != "")
10145 {
10146 if (detach_types.Count() == 1)
10147 idx = 0;
10148 else
10149 idx = inventory_slots.Find(slot);
10150 }
10151 if (idx < 0)
10152 return "";
10153
10154 return detach_types.Get(idx);
10155 }
10156
10158 {
10159
10161
10162
10163 float min_time = 1;
10164 float max_time = 3;
10165 float delay = Math.RandomFloat(min_time, max_time);
10166
10167 explode_timer.Run(delay, this, "DoAmmoExplosion");
10168 }
10169
10171 {
10172 Magazine magazine = Magazine.Cast(this);
10173 int pop_sounds_count = 6;
10174 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10175
10176
10177 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10178 string sound_name = pop_sounds[ sound_idx ];
10179 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10180
10181
10182 magazine.ServerAddAmmoCount(-1);
10183
10184
10185 float min_temp_to_explode = 100;
10186
10187 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10188 {
10190 }
10191 }
10192
10193
10194 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10195 {
10196 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10197
10198 const int CHANCE_DAMAGE_CARGO = 4;
10199 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10200 const int CHANCE_DAMAGE_NOTHING = 2;
10201
10203 {
10204 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10205 int chances;
10206 int rnd;
10207
10208 if (GetInventory().GetCargo())
10209 {
10210 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10211 rnd = Math.RandomInt(0,chances);
10212
10213 if (rnd < CHANCE_DAMAGE_CARGO)
10214 {
10216 }
10217 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10218 {
10220 }
10221 }
10222 else
10223 {
10224 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10225 rnd = Math.RandomInt(0,chances);
10226
10227 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10228 {
10230 }
10231 }
10232 }
10233 }
10234
10236 {
10237 CargoBase cargo = GetInventory().GetCargo();
10238 if (cargo)
10239 {
10241 if (item_count > 0)
10242 {
10243 int random_pick = Math.RandomInt(0, item_count);
10245 if (!item.IsExplosive())
10246 {
10247 item.AddHealth("","",damage);
10248 return true;
10249 }
10250 }
10251 }
10252 return false;
10253 }
10254
10256 {
10257 GameInventory inventory = GetInventory();
10259 if (attachment_count > 0)
10260 {
10261 int random_pick = Math.RandomInt(0, attachment_count);
10263 if (!attachment.IsExplosive())
10264 {
10265 attachment.AddHealth("","",damage);
10266 return true;
10267 }
10268 }
10269 return false;
10270 }
10271
10273 {
10275 }
10276
10278 {
10280 return GetInventory().CanRemoveEntity();
10281
10282 return false;
10283 }
10284
10286 {
10287
10289 return false;
10290
10291
10293 return false;
10294
10295
10296
10298 if (delta == 0)
10299 return false;
10300
10301
10302 return true;
10303 }
10304
10306 {
10308 {
10309 if (ScriptInputUserData.CanStoreInputUserData())
10310 {
10311 ScriptInputUserData ctx = new ScriptInputUserData;
10316 ctx.
Write(destination_entity);
10318 ctx.
Write(slot_id);
10320 }
10321 }
10322 else if (!
g_Game.IsMultiplayer())
10323 {
10325 }
10326 }
10327
10329 {
10330 float split_quantity_new;
10334 InventoryLocation loc = new InventoryLocation;
10335
10336 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10337 {
10339 split_quantity_new = stack_max;
10340 else
10342
10344 {
10345 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10346 if (new_item)
10347 {
10348 new_item.SetResultOfSplit(true);
10349 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10351 new_item.
SetQuantity(split_quantity_new,
false,
true);
10352 }
10353 }
10354 }
10355 else if (destination_entity && slot_id == -1)
10356 {
10357 if (quantity > stack_max)
10358 split_quantity_new = stack_max;
10359 else
10360 split_quantity_new = quantity;
10361
10363 {
10364 GameInventory destinationInventory = destination_entity.GetInventory();
10366 {
10369 }
10370
10371 if (new_item)
10372 {
10373 new_item.SetResultOfSplit(true);
10374 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10376 new_item.
SetQuantity(split_quantity_new,
false,
true);
10377 }
10378 }
10379 }
10380 else
10381 {
10382 if (stack_max != 0)
10383 {
10385 {
10387 }
10388
10389 if (split_quantity_new == 0)
10390 {
10391 if (!
g_Game.IsMultiplayer())
10392 player.PhysicalPredictiveDropItem(this);
10393 else
10394 player.ServerDropEntity(this);
10395 return;
10396 }
10397
10399 {
10401
10402 if (new_item)
10403 {
10404 new_item.SetResultOfSplit(true);
10405 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10408 new_item.PlaceOnSurface();
10409 }
10410 }
10411 }
10412 }
10413 }
10414
10416 {
10417 float split_quantity_new;
10421 InventoryLocation loc = new InventoryLocation;
10422
10423 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10424 {
10426 split_quantity_new = stack_max;
10427 else
10429
10431 {
10432 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10433 if (new_item)
10434 {
10435 new_item.SetResultOfSplit(true);
10436 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10438 new_item.
SetQuantity(split_quantity_new,
false,
true);
10439 }
10440 }
10441 }
10442 else if (destination_entity && slot_id == -1)
10443 {
10444 if (quantity > stack_max)
10445 split_quantity_new = stack_max;
10446 else
10447 split_quantity_new = quantity;
10448
10450 {
10451 GameInventory destinationInventory = destination_entity.GetInventory();
10453 {
10456 }
10457
10458 if (new_item)
10459 {
10460 new_item.SetResultOfSplit(true);
10461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10463 new_item.
SetQuantity(split_quantity_new,
false,
true);
10464 }
10465 }
10466 }
10467 else
10468 {
10469 if (stack_max != 0)
10470 {
10472 {
10474 }
10475
10477 {
10479
10480 if (new_item)
10481 {
10482 new_item.SetResultOfSplit(true);
10483 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10486 new_item.PlaceOnSurface();
10487 }
10488 }
10489 }
10490 }
10491 }
10492
10494 {
10496 {
10497 if (ScriptInputUserData.CanStoreInputUserData())
10498 {
10499 ScriptInputUserData ctx = new ScriptInputUserData;
10504 dst.WriteToContext(ctx);
10506 }
10507 }
10508 else if (!
g_Game.IsMultiplayer())
10509 {
10511 }
10512 }
10513
10515 {
10517 {
10518 if (ScriptInputUserData.CanStoreInputUserData())
10519 {
10520 ScriptInputUserData ctx = new ScriptInputUserData;
10525 ctx.
Write(destination_entity);
10531 }
10532 }
10533 else if (!
g_Game.IsMultiplayer())
10534 {
10536 }
10537 }
10538
10540 {
10542 }
10543
10545 {
10547 float split_quantity_new;
10549 if (dst.IsValid())
10550 {
10551 int slot_id = dst.GetSlot();
10553
10554 if (quantity > stack_max)
10555 split_quantity_new = stack_max;
10556 else
10557 split_quantity_new = quantity;
10558
10560 {
10562
10563 if (new_item)
10564 {
10565 new_item.SetResultOfSplit(true);
10566 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10568 new_item.
SetQuantity(split_quantity_new,
false,
true);
10569 }
10570
10571 return new_item;
10572 }
10573 }
10574
10575 return null;
10576 }
10577
10579 {
10581 float split_quantity_new;
10583 if (destination_entity)
10584 {
10586 if (quantity > stackable)
10587 split_quantity_new = stackable;
10588 else
10589 split_quantity_new = quantity;
10590
10592 {
10593 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10594 if (new_item)
10595 {
10596 new_item.SetResultOfSplit(true);
10597 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10599 new_item.
SetQuantity(split_quantity_new,
false,
true);
10600 }
10601 }
10602 }
10603 }
10604
10606 {
10608 {
10609 if (ScriptInputUserData.CanStoreInputUserData())
10610 {
10611 ScriptInputUserData ctx = new ScriptInputUserData;
10616 ItemBase destination_entity =
this;
10617 ctx.
Write(destination_entity);
10621 }
10622 }
10623 else if (!
g_Game.IsMultiplayer())
10624 {
10626 }
10627 }
10628
10630 {
10632 float split_quantity_new;
10634 if (player)
10635 {
10637 if (quantity > stackable)
10638 split_quantity_new = stackable;
10639 else
10640 split_quantity_new = quantity;
10641
10643 {
10644 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10645 new_item =
ItemBase.Cast(in_hands);
10646 if (new_item)
10647 {
10648 new_item.SetResultOfSplit(true);
10649 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10651 new_item.SetQuantity(split_quantity_new, false, true);
10652 }
10653 }
10654 }
10655 }
10656
10658 {
10660 float split_quantity_new = Math.Floor(quantity * 0.5);
10661
10663 return;
10664
10666
10667 if (new_item)
10668 {
10669 if (new_item.GetQuantityMax() < split_quantity_new)
10670 {
10671 split_quantity_new = new_item.GetQuantityMax();
10672 }
10673
10674 new_item.SetResultOfSplit(true);
10675 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10676
10678 {
10681 }
10682 else
10683 {
10685 new_item.
SetQuantity(split_quantity_new,
false,
true);
10686 }
10687 }
10688 }
10689
10691 {
10693 float split_quantity_new = Math.Floor(quantity / 2);
10694
10696 return;
10697
10698 InventoryLocation invloc = new InventoryLocation;
10700
10702 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10703
10704 if (new_item)
10705 {
10706 if (new_item.GetQuantityMax() < split_quantity_new)
10707 {
10708 split_quantity_new = new_item.GetQuantityMax();
10709 }
10711 {
10714 }
10715 else if (split_quantity_new > 1)
10716 {
10718 new_item.
SetQuantity(split_quantity_new,
false,
true);
10719 }
10720 }
10721 }
10722
10725 {
10726 SetWeightDirty();
10728
10729 if (parent)
10730 parent.OnAttachmentQuantityChangedEx(this, delta);
10731
10733 {
10735 {
10737 }
10739 {
10740 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10742 }
10743 }
10744 }
10745
10748 {
10749
10750 }
10751
10754 {
10756 }
10757
10759 {
10760 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10761
10763 {
10764 if (newLevel == GameConstants.STATE_RUINED)
10765 {
10767 EntityAI parent = GetHierarchyParent();
10768 if (parent && parent.IsFireplace())
10769 {
10770 CargoBase cargo = GetInventory().GetCargo();
10771 if (cargo)
10772 {
10774 {
10776 }
10777 }
10778 }
10779 }
10780
10782 {
10783
10785 return;
10786 }
10787
10788 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10789 {
10791 }
10792 }
10793 }
10794
10795
10797 {
10798 super.OnRightClick();
10799
10801 {
10803 {
10804 if (ScriptInputUserData.CanStoreInputUserData())
10805 {
10806 EntityAI root = GetHierarchyRoot();
10807 Man playerOwner = GetHierarchyRootPlayer();
10808 InventoryLocation dst = new InventoryLocation;
10809
10810
10811 if (!playerOwner && root && root == this)
10812 {
10814 }
10815 else
10816 {
10817
10818 GetInventory().GetCurrentInventoryLocation(dst);
10820 {
10821 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10823 {
10825 }
10826 else
10827 {
10829
10830
10831 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10832 {
10834 }
10835 else
10836 {
10837 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10838 }
10839 }
10840 }
10841 }
10842
10843 ScriptInputUserData ctx = new ScriptInputUserData;
10851 }
10852 }
10853 else if (!
g_Game.IsMultiplayer())
10854 {
10856 }
10857 }
10858 }
10859
10861 {
10862 if (root)
10863 {
10864 vector m4[4];
10865 root.GetTransform(m4);
10866 dst.SetGround(this, m4);
10867 }
10868 else
10869 {
10870 GetInventory().GetCurrentInventoryLocation(dst);
10871 }
10872 }
10873
10874 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10875 {
10876
10877 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10878 return false;
10879
10880 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10881 return false;
10882
10883
10885 return false;
10886
10887
10888 Magazine mag = Magazine.Cast(this);
10889 if (mag)
10890 {
10891 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10892 return false;
10893
10894 if (stack_max_limit)
10895 {
10896 Magazine other_mag = Magazine.Cast(other_item);
10897 if (other_item)
10898 {
10899 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10900 return false;
10901 }
10902
10903 }
10904 }
10905 else
10906 {
10907
10909 return false;
10910
10912 return false;
10913 }
10914
10915 PlayerBase player = null;
10916 if (CastTo(player, GetHierarchyRootPlayer()))
10917 {
10918 if (player.GetInventory().HasAttachment(this))
10919 return false;
10920
10921 if (player.IsItemsToDelete())
10922 return false;
10923 }
10924
10925 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10926 return false;
10927
10928 int slotID;
10930 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10931 return false;
10932
10933 return true;
10934 }
10935
10937 {
10939 }
10940
10942 {
10943 return m_IsResultOfSplit;
10944 }
10945
10947 {
10948 m_IsResultOfSplit = value;
10949 }
10950
10952 {
10954 }
10955
10957 {
10958 float other_item_quantity = other_item.GetQuantity();
10959 float this_free_space;
10960
10962
10964
10965 if (other_item_quantity > this_free_space)
10966 {
10967 return this_free_space;
10968 }
10969 else
10970 {
10971 return other_item_quantity;
10972 }
10973 }
10974
10976 {
10978 }
10979
10981 {
10983 return;
10984
10985 if (!IsMagazine() && other_item)
10986 {
10988 if (quantity_used != 0)
10989 {
10990 float hp1 = GetHealth01("","");
10991 float hp2 = other_item.GetHealth01("","");
10992 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10993 hpResult = hpResult / (
GetQuantity() + quantity_used);
10994
10995 hpResult *= GetMaxHealth();
10996 Math.Round(hpResult);
10997 SetHealth("", "Health", hpResult);
10998
11000 other_item.AddQuantity(-quantity_used);
11001 }
11002 }
11004 }
11005
11007 {
11008 #ifdef SERVER
11009 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11010 GetHierarchyParent().IncreaseLifetimeUp();
11011 #endif
11012 };
11013
11015 {
11016 PlayerBase p = PlayerBase.Cast(player);
11017
11018 array<int> recipesIds = p.m_Recipes;
11019 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11020 if (moduleRecipesManager)
11021 {
11022 EntityAI itemInHands = player.GetEntityInHands();
11023 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11024 }
11025
11026 for (int i = 0;i < recipesIds.Count(); i++)
11027 {
11028 int key = recipesIds.Get(i);
11029 string recipeName = moduleRecipesManager.GetRecipeName(key);
11031 }
11032 }
11033
11034
11035 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11036 {
11037 super.GetDebugActions(outputList);
11038
11039
11045
11046
11051
11056
11057
11061
11062
11064 {
11068 }
11069
11072
11073
11077
11079
11080 InventoryLocation loc = new InventoryLocation();
11081 GetInventory().GetCurrentInventoryLocation(loc);
11083 {
11084 if (Gizmo_IsSupported())
11087 }
11088
11090 }
11091
11092
11093
11094
11096 {
11097 super.OnAction(action_id, player, ctx);
11098
11100 {
11101 switch (action_id)
11102 {
11106 return true;
11110 return true;
11111 }
11112 }
11113
11115 {
11116 switch (action_id)
11117 {
11119 Delete();
11120 return true;
11121 }
11122 }
11123
11124 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11125 {
11126 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11127 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11128 PlayerBase p = PlayerBase.Cast(player);
11129 if (
EActions.RECIPES_RANGE_START < 1000)
11130 {
11131 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11132 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11133 }
11134 }
11135 #ifndef SERVER
11136 else if (action_id ==
EActions.WATCH_PLAYER)
11137 {
11138 PluginDeveloper.SetDeveloperItemClientEx(player);
11139 }
11140 #endif
11142 {
11143 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11144 {
11145 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11146 OnDebugButtonPressServer(id + 1);
11147 }
11148
11149 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11150 {
11151 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11153 }
11154
11155 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11156 {
11157 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11159 }
11160
11161 else if (action_id ==
EActions.ADD_QUANTITY)
11162 {
11163 if (IsMagazine())
11164 {
11165 Magazine mag = Magazine.Cast(this);
11166 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11167 }
11168 else
11169 {
11171 }
11172
11173 if (m_EM)
11174 {
11175 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11176 }
11177
11178 }
11179
11180 else if (action_id ==
EActions.REMOVE_QUANTITY)
11181 {
11182 if (IsMagazine())
11183 {
11184 Magazine mag2 = Magazine.Cast(this);
11185 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11186 }
11187 else
11188 {
11190 }
11191 if (m_EM)
11192 {
11193 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11194 }
11195
11196 }
11197
11198 else if (action_id ==
EActions.SET_QUANTITY_0)
11199 {
11201
11202 if (m_EM)
11203 {
11204 m_EM.SetEnergy(0);
11205 }
11206 }
11207
11208 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11209 {
11211
11212 if (m_EM)
11213 {
11214 m_EM.SetEnergy(m_EM.GetEnergyMax());
11215 }
11216 }
11217
11218 else if (action_id ==
EActions.ADD_HEALTH)
11219 {
11220 AddHealth("","",GetMaxHealth("","Health")/5);
11221 }
11222 else if (action_id ==
EActions.REMOVE_HEALTH)
11223 {
11224 AddHealth("","",-GetMaxHealth("","Health")/5);
11225 }
11226 else if (action_id ==
EActions.DESTROY_HEALTH)
11227 {
11228 SetHealth01("","",0);
11229 }
11230 else if (action_id ==
EActions.WATCH_ITEM)
11231 {
11233 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11234 #ifdef DEVELOPER
11235 SetDebugDeveloper_item(this);
11236 #endif
11237 }
11238
11239 else if (action_id ==
EActions.ADD_TEMPERATURE)
11240 {
11241 AddTemperature(20);
11242
11243 }
11244
11245 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11246 {
11247 AddTemperature(-20);
11248
11249 }
11250
11251 else if (action_id ==
EActions.FLIP_FROZEN)
11252 {
11253 SetFrozen(!GetIsFrozen());
11254
11255 }
11256
11257 else if (action_id ==
EActions.ADD_WETNESS)
11258 {
11260
11261 }
11262
11263 else if (action_id ==
EActions.REMOVE_WETNESS)
11264 {
11266
11267 }
11268
11269 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11270 {
11273
11274
11275 }
11276
11277 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11278 {
11281 }
11282
11283 else if (action_id ==
EActions.MAKE_SPECIAL)
11284 {
11285 auto debugParams = DebugSpawnParams.WithPlayer(player);
11286 OnDebugSpawnEx(debugParams);
11287 }
11288
11289 }
11290
11291
11292 return false;
11293 }
11294
11295
11296
11297
11301
11304
11305
11306
11308 {
11309 return false;
11310 }
11311
11312
11314 {
11315 return true;
11316 }
11317
11318
11320 {
11321 return true;
11322 }
11323
11324
11325
11327 {
11328 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11329 return g_Game.ConfigIsExisting(config_path);
11330 }
11331
11334 {
11335 return null;
11336 }
11337
11339 {
11340 return false;
11341 }
11342
11344 {
11345 return false;
11346 }
11347
11351
11352
11354 {
11355 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11356 return module_repairing.CanRepair(this, item_repair_kit);
11357 }
11358
11359
11360 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11361 {
11362 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11363 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11364 }
11365
11366
11368 {
11369
11370
11371
11372
11373
11374
11375
11376
11377 return 1;
11378 }
11379
11380
11381
11383 {
11385 }
11386
11387
11388
11390 {
11392 }
11393
11394
11403 {
11404 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11405
11406 if (player)
11407 {
11408 player.MessageStatus(text);
11409 }
11410 }
11411
11412
11421 {
11422 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11423
11424 if (player)
11425 {
11426 player.MessageAction(text);
11427 }
11428 }
11429
11430
11439 {
11440 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11441
11442 if (player)
11443 {
11444 player.MessageFriendly(text);
11445 }
11446 }
11447
11448
11457 {
11458 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11459
11460 if (player)
11461 {
11462 player.MessageImportant(text);
11463 }
11464 }
11465
11467 {
11468 return true;
11469 }
11470
11471
11472 override bool KindOf(
string tag)
11473 {
11474 bool found = false;
11475 string item_name = this.
GetType();
11477 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11478
11479 int array_size = item_tag_array.Count();
11480 for (int i = 0; i < array_size; i++)
11481 {
11482 if (item_tag_array.Get(i) == tag)
11483 {
11484 found = true;
11485 break;
11486 }
11487 }
11488 return found;
11489 }
11490
11491
11493 {
11494
11495 super.OnRPC(sender, rpc_type,ctx);
11496
11497
11498 switch (rpc_type)
11499 {
11500 #ifndef SERVER
11501 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11502 Param2<bool, string> p = new Param2<bool, string>(false, "");
11503
11505 return;
11506
11507 bool play = p.param1;
11508 string soundSet = p.param2;
11509
11510 if (play)
11511 {
11513 {
11515 {
11517 }
11518 }
11519 else
11520 {
11522 }
11523 }
11524 else
11525 {
11527 }
11528
11529 break;
11530 #endif
11531
11532 }
11533
11535 {
11537 }
11538 }
11539
11540
11541
11542
11544 {
11545 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11546 return plugin.GetID(
name);
11547 }
11548
11550 {
11551 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11552 return plugin.GetName(id);
11553 }
11554
11557 {
11558
11559
11560 int varFlags;
11561 if (!ctx.
Read(varFlags))
11562 return;
11563
11564 if (varFlags & ItemVariableFlags.FLOAT)
11565 {
11567 }
11568 }
11569
11571 {
11572
11573 super.SerializeNumericalVars(floats_out);
11574
11575
11576
11578 {
11580 }
11581
11583 {
11585 }
11586
11588 {
11590 }
11591
11593 {
11598 }
11599
11601 {
11603 }
11604 }
11605
11607 {
11608
11609 super.DeSerializeNumericalVars(floats);
11610
11611
11612 int index = 0;
11613 int mask = Math.Round(floats.Get(index));
11614
11615 index++;
11616
11618 {
11620 {
11622 }
11623 else
11624 {
11625 float quantity = floats.Get(index);
11626 SetQuantity(quantity,
true,
false,
false,
false);
11627 }
11628 index++;
11629 }
11630
11632 {
11633 float wet = floats.Get(index);
11635 index++;
11636 }
11637
11639 {
11640 int liquidtype = Math.Round(floats.Get(index));
11642 index++;
11643 }
11644
11646 {
11648 index++;
11650 index++;
11652 index++;
11654 index++;
11655 }
11656
11658 {
11659 int cleanness = Math.Round(floats.Get(index));
11661 index++;
11662 }
11663 }
11664
11666 {
11667 super.WriteVarsToCTX(ctx);
11668
11669
11671 {
11673 }
11674
11676 {
11678 }
11679
11681 {
11683 }
11684
11686 {
11687 int r,g,b,a;
11693 }
11694
11696 {
11698 }
11699 }
11700
11702 {
11703 if (!super.ReadVarsFromCTX(ctx,version))
11704 return false;
11705
11706 int intValue;
11707 float value;
11708
11709 if (version < 140)
11710 {
11711 if (!ctx.
Read(intValue))
11712 return false;
11713
11714 m_VariablesMask = intValue;
11715 }
11716
11718 {
11719 if (!ctx.
Read(value))
11720 return false;
11721
11723 {
11725 }
11726 else
11727 {
11729 }
11730 }
11731
11732 if (version < 140)
11733 {
11735 {
11736 if (!ctx.
Read(value))
11737 return false;
11738 SetTemperatureDirect(value);
11739 }
11740 }
11741
11743 {
11744 if (!ctx.
Read(value))
11745 return false;
11747 }
11748
11750 {
11751 if (!ctx.
Read(intValue))
11752 return false;
11754 }
11755
11757 {
11758 int r,g,b,a;
11760 return false;
11762 return false;
11764 return false;
11766 return false;
11767
11769 }
11770
11772 {
11773 if (!ctx.
Read(intValue))
11774 return false;
11776 }
11777
11778 if (version >= 138 && version < 140)
11779 {
11781 {
11782 if (!ctx.
Read(intValue))
11783 return false;
11784 SetFrozen(intValue);
11785 }
11786 }
11787
11788 return true;
11789 }
11790
11791
11793 {
11796 {
11798 }
11799
11800 if (!super.OnStoreLoad(ctx, version))
11801 {
11803 return false;
11804 }
11805
11806 if (version >= 114)
11807 {
11808 bool hasQuickBarIndexSaved;
11809
11810 if (!ctx.
Read(hasQuickBarIndexSaved))
11811 {
11813 return false;
11814 }
11815
11816 if (hasQuickBarIndexSaved)
11817 {
11818 int itmQBIndex;
11819
11820
11821 if (!ctx.
Read(itmQBIndex))
11822 {
11824 return false;
11825 }
11826
11827 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11828 if (itmQBIndex != -1 && parentPlayer)
11829 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11830 }
11831 }
11832 else
11833 {
11834
11835 PlayerBase player;
11836 int itemQBIndex;
11837 if (version ==
int.
MAX)
11838 {
11839 if (!ctx.
Read(itemQBIndex))
11840 {
11842 return false;
11843 }
11844 }
11845 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11846 {
11847
11848 if (!ctx.
Read(itemQBIndex))
11849 {
11851 return false;
11852 }
11853 if (itemQBIndex != -1 && player)
11854 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11855 }
11856 }
11857
11858 if (version < 140)
11859 {
11860
11861 if (!LoadVariables(ctx, version))
11862 {
11864 return false;
11865 }
11866 }
11867
11868
11870 {
11872 return false;
11873 }
11874 if (version >= 132)
11875 {
11877 if (raib)
11878 {
11880 {
11882 return false;
11883 }
11884 }
11885 }
11886
11888 return true;
11889 }
11890
11891
11892
11894 {
11895 super.OnStoreSave(ctx);
11896
11897 PlayerBase player;
11898 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11899 {
11901
11902 int itemQBIndex = -1;
11903 itemQBIndex = player.FindQuickBarEntityIndex(this);
11904 ctx.
Write(itemQBIndex);
11905 }
11906 else
11907 {
11909 }
11910
11912
11914 if (raib)
11915 {
11917 }
11918 }
11919
11920
11922 {
11923 super.AfterStoreLoad();
11924
11926 {
11928 }
11929
11931 {
11934 }
11935 }
11936
11938 {
11939 super.EEOnAfterLoad();
11940
11942 {
11944 }
11945
11948 }
11949
11951 {
11952 return false;
11953 }
11954
11955
11956
11958 {
11960 {
11961 #ifdef PLATFORM_CONSOLE
11962
11964 {
11966 if (menu)
11967 {
11969 }
11970 }
11971 #endif
11972 }
11973
11975 {
11978 }
11979
11981 {
11982 SetWeightDirty();
11984 }
11986 {
11989 }
11990
11992 {
11995
11998 }
12000 {
12004 }
12005
12006 super.OnVariablesSynchronized();
12007 }
12008
12009
12010
12012 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12013 {
12014 if (!IsServerCheck(allow_client))
12015 return false;
12016
12018 return false;
12019
12022
12023 if (value <= (min + 0.001))
12024 value = min;
12025
12026 if (value == min)
12027 {
12028 if (destroy_config)
12029 {
12030 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12031 if (dstr)
12032 {
12034 this.Delete();
12035 return true;
12036 }
12037 }
12038 else if (destroy_forced)
12039 {
12041 this.Delete();
12042 return true;
12043 }
12044
12046 }
12047
12050
12052 {
12053 EntityAI parent = GetHierarchyRoot();
12054 InventoryLocation iLoc = new InventoryLocation();
12055 GetInventory().GetCurrentInventoryLocation(iLoc);
12057 {
12058 int iLocSlot = iLoc.
GetSlot();
12060 {
12062 }
12064 {
12066 }
12067 }
12068 }
12069
12071 {
12073
12074 if (delta)
12076 }
12077
12079
12080 return false;
12081 }
12082
12083
12085 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12086 {
12088 }
12089
12091 {
12094 }
12095
12097 {
12100 }
12101
12103 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12104 {
12105 float value_clamped = Math.Clamp(value, 0, 1);
12107 SetQuantity(result, destroy_config, destroy_forced);
12108 }
12109
12110
12113 {
12115 }
12116
12118 {
12120 }
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12132 {
12133 int slot = -1;
12134 GameInventory inventory = GetInventory();
12135 if (inventory)
12136 {
12137 InventoryLocation il = new InventoryLocation;
12140 }
12141
12143 }
12144
12146 {
12147 float quantity_max = 0;
12148
12150 {
12151 if (attSlotID != -1)
12152 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12153
12154 if (quantity_max <= 0)
12156 }
12157
12158 if (quantity_max <= 0)
12160
12161 return quantity_max;
12162 }
12163
12165 {
12167 }
12168
12170 {
12172 }
12173
12174
12176 {
12178 }
12179
12181 {
12183 }
12184
12186 {
12188 }
12189
12190
12192 {
12193
12194 float weightEx = GetWeightEx();
12195 float special = GetInventoryAndCargoWeight();
12196 return weightEx - special;
12197 }
12198
12199
12201 {
12203 }
12204
12206 {
12208 {
12209 #ifdef DEVELOPER
12210 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12211 {
12212 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12214 }
12215 #endif
12216
12217 return GetQuantity() * GetConfigWeightModified();
12218 }
12219 else if (HasEnergyManager())
12220 {
12221 #ifdef DEVELOPER
12222 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12223 {
12224 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12225 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12226 }
12227 #endif
12228 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12229 }
12230 else
12231 {
12232 #ifdef DEVELOPER
12233 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12234 {
12235 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12236 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12237 }
12238 #endif
12239 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12240 }
12241 }
12242
12245 {
12246 int item_count = 0;
12248
12249 GameInventory inventory = GetInventory();
12250 CargoBase cargo = inventory.
GetCargo();
12251 if (cargo != NULL)
12252 {
12254 }
12255
12257 for (int i = 0; i < nAttachments; ++i)
12258 {
12260 if (item)
12261 item_count += item.GetNumberOfItems();
12262 }
12263 return item_count;
12264 }
12265
12268 {
12269 float weight = 0;
12270 float wetness = 1;
12271 if (include_wetness)
12274 {
12275 weight = wetness * m_ConfigWeight;
12276 }
12278 {
12279 weight = 1;
12280 }
12281 return weight;
12282 }
12283
12284
12285
12287 {
12288 GameInventory inventory = GetInventory();
12289 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12290 {
12291 array<EntityAI> items = new array<EntityAI>;
12293 for (int i = 0; i < items.Count(); ++i)
12294 {
12296 if (item)
12297 {
12298 g_Game.ObjectDelete(item);
12299 }
12300 }
12301 }
12302 }
12303
12304
12305
12306
12308 {
12309 float energy = 0;
12310 if (HasEnergyManager())
12311 {
12312 energy = GetCompEM().GetEnergy();
12313 }
12314 return energy;
12315 }
12316
12317
12319 {
12320 super.OnEnergyConsumed();
12321
12323 }
12324
12326 {
12327 super.OnEnergyAdded();
12328
12330 }
12331
12332
12334 {
12335 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12336 {
12338 {
12339 float energy_0to1 = GetCompEM().GetEnergy0To1();
12341 }
12342 }
12343 }
12344
12345
12347 {
12348 return ConfigGetFloat("heatIsolation");
12349 }
12350
12352 {
12354 }
12355
12357 {
12358 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12359 if (
g_Game.ConfigIsExisting(paramPath))
12360 return g_Game.ConfigGetFloat(paramPath);
12361
12362 return 0.0;
12363 }
12364
12366 {
12367 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12368 if (
g_Game.ConfigIsExisting(paramPath))
12369 return g_Game.ConfigGetFloat(paramPath);
12370
12371 return 0.0;
12372 }
12373
12374 override void SetWet(
float value,
bool allow_client =
false)
12375 {
12376 if (!IsServerCheck(allow_client))
12377 return;
12378
12381
12383
12384 m_VarWet = Math.Clamp(value, min, max);
12385
12387 {
12390 }
12391 }
12392
12393 override void AddWet(
float value)
12394 {
12396 }
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12414 {
12416 }
12417
12419 {
12421 }
12422
12423 override void OnWetChanged(
float newVal,
float oldVal)
12424 {
12427 if (newLevel != oldLevel)
12428 {
12430 }
12431 }
12432
12434 {
12435 SetWeightDirty();
12436 }
12437
12439 {
12440 return GetWetLevelInternal(
m_VarWet);
12441 }
12442
12443
12444
12446 {
12448 }
12449
12451 {
12453 }
12454
12456 {
12458 }
12459
12461 {
12463 }
12464
12465
12466
12468 {
12469 if (ConfigIsExisting("itemModelLength"))
12470 {
12471 return ConfigGetFloat("itemModelLength");
12472 }
12473 return 0;
12474 }
12475
12477 {
12478 if (ConfigIsExisting("itemAttachOffset"))
12479 {
12480 return ConfigGetFloat("itemAttachOffset");
12481 }
12482 return 0;
12483 }
12484
12485 override void SetCleanness(
int value,
bool allow_client =
false)
12486 {
12487 if (!IsServerCheck(allow_client))
12488 return;
12489
12491
12493
12496 }
12497
12499 {
12501 }
12502
12504 {
12505 return true;
12506 }
12507
12508
12509
12510
12512 {
12514 }
12515
12517 {
12519 }
12520
12521
12522
12523
12524 override void SetColor(
int r,
int g,
int b,
int a)
12525 {
12531 }
12533 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12534 {
12539 }
12540
12542 {
12544 }
12545
12548 {
12549 int r,g,b,a;
12551 r = r/255;
12552 g = g/255;
12553 b = b/255;
12554 a = a/255;
12555 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12556 }
12557
12558
12559
12560 override void SetLiquidType(
int value,
bool allow_client =
false)
12561 {
12562 if (!IsServerCheck(allow_client))
12563 return;
12564
12569 }
12570
12572 {
12573 return ConfigGetInt("varLiquidTypeInit");
12574 }
12575
12577 {
12579 }
12580
12582 {
12584 SetFrozen(false);
12585 }
12586
12589 {
12590 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12591 }
12592
12593
12596 {
12597 PlayerBase nplayer;
12598 if (PlayerBase.CastTo(nplayer, player))
12599 {
12601 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12602 }
12603 }
12604
12605
12608 {
12609 PlayerBase nplayer;
12610 if (PlayerBase.CastTo(nplayer,player))
12611 {
12612 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12613 }
12614
12615 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12616
12617 if (HasEnergyManager())
12618 {
12619 GetCompEM().UpdatePlugState();
12620 }
12621 }
12622
12623
12625 {
12626 super.OnPlacementStarted(player);
12627
12629 }
12630
12631 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12632 {
12634 {
12635 m_AdminLog.OnPlacementComplete(player,
this);
12636 }
12637
12638 super.OnPlacementComplete(player, position, orientation);
12639 }
12640
12641
12642
12643
12644
12646 {
12648 {
12649 return true;
12650 }
12651 else
12652 {
12653 return false;
12654 }
12655 }
12656
12657
12659 {
12661 {
12663 }
12664 }
12665
12666
12668 {
12670 }
12671
12673 {
12675 }
12676
12677 override void InsertAgent(
int agent,
float count = 1)
12678 {
12679 if (count < 1)
12680 return;
12681
12683 }
12684
12687 {
12689 }
12690
12691
12693 {
12695 }
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12739 {
12741 return false;
12742 return true;
12743 }
12744
12746 {
12747
12749 }
12750
12751
12754 {
12755 super.CheckForRoofLimited(timeTresholdMS);
12756
12757 float time =
g_Game.GetTime();
12758 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12759 {
12760 m_PreviousRoofTestTime = time;
12761 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12762 }
12763 }
12764
12765
12767 {
12769 {
12770 return 0;
12771 }
12772
12773 if (GetInventory().GetAttachmentSlotsCount() != 0)
12774 {
12775 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12776 if (filter)
12777 return filter.GetProtectionLevel(type, false, system);
12778 else
12779 return 0;
12780 }
12781
12782 string subclassPath, entryName;
12783
12784 switch (type)
12785 {
12787 entryName = "biological";
12788 break;
12790 entryName = "chemical";
12791 break;
12792 default:
12793 entryName = "biological";
12794 break;
12795 }
12796
12797 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12798
12799 return g_Game.ConfigGetFloat(subclassPath + entryName);
12800 }
12801
12802
12803
12806 {
12807 if (!IsMagazine())
12809
12811 }
12812
12813
12814
12815
12816
12821 {
12822 return true;
12823 }
12824
12826 {
12828 }
12829
12830
12831
12832
12833
12835 {
12836 if (parent)
12837 {
12838 if (parent.IsInherited(DayZInfected))
12839 return true;
12840
12841 if (!parent.IsRuined())
12842 return true;
12843 }
12844
12845 return true;
12846 }
12847
12849 {
12850 if (!super.CanPutAsAttachment(parent))
12851 {
12852 return false;
12853 }
12854
12855 if (!IsRuined() && !parent.IsRuined())
12856 {
12857 return true;
12858 }
12859
12860 return false;
12861 }
12862
12864 {
12865
12866
12867
12868
12869 return super.CanReceiveItemIntoCargo(item);
12870 }
12871
12873 {
12874
12875
12876
12877
12878 GameInventory attachmentInv = attachment.GetInventory();
12880 {
12881 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12882 return false;
12883 }
12884
12885 InventoryLocation loc = new InventoryLocation();
12886 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12887 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12888 return false;
12889
12890 return super.CanReceiveAttachment(attachment, slotId);
12891 }
12892
12894 {
12895 if (!super.CanReleaseAttachment(attachment))
12896 return false;
12897
12898 return GetInventory().AreChildrenAccessible();
12899 }
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12922 {
12923 int id = muzzle_owner.GetMuzzleID();
12924 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12925
12926 if (WPOF_array)
12927 {
12928 for (int i = 0; i < WPOF_array.Count(); i++)
12929 {
12930 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12931
12932 if (WPOF)
12933 {
12934 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12935 }
12936 }
12937 }
12938 }
12939
12940
12942 {
12943 int id = muzzle_owner.GetMuzzleID();
12945
12946 if (WPOBE_array)
12947 {
12948 for (int i = 0; i < WPOBE_array.Count(); i++)
12949 {
12950 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12951
12952 if (WPOBE)
12953 {
12954 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12955 }
12956 }
12957 }
12958 }
12959
12960
12962 {
12963 int id = muzzle_owner.GetMuzzleID();
12964 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12965
12966 if (WPOOH_array)
12967 {
12968 for (int i = 0; i < WPOOH_array.Count(); i++)
12969 {
12970 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12971
12972 if (WPOOH)
12973 {
12974 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12975 }
12976 }
12977 }
12978 }
12979
12980
12982 {
12983 int id = muzzle_owner.GetMuzzleID();
12984 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12985
12986 if (WPOOH_array)
12987 {
12988 for (int i = 0; i < WPOOH_array.Count(); i++)
12989 {
12990 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12991
12992 if (WPOOH)
12993 {
12994 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12995 }
12996 }
12997 }
12998 }
12999
13000
13002 {
13003 int id = muzzle_owner.GetMuzzleID();
13004 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13005
13006 if (WPOOH_array)
13007 {
13008 for (int i = 0; i < WPOOH_array.Count(); i++)
13009 {
13010 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13011
13012 if (WPOOH)
13013 {
13014 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13015 }
13016 }
13017 }
13018 }
13019
13020
13021
13023 {
13025 {
13026 return true;
13027 }
13028
13029 return false;
13030 }
13031
13033 {
13035 {
13036 return true;
13037 }
13038
13039 return false;
13040 }
13041
13043 {
13045 {
13046 return true;
13047 }
13048
13049 return false;
13050 }
13051
13053 {
13054 return false;
13055 }
13056
13059 {
13060 return UATimeSpent.DEFAULT_DEPLOY;
13061 }
13062
13063
13064
13065
13067 {
13069 SetSynchDirty();
13070 }
13071
13073 {
13075 }
13076
13077
13079 {
13080 return false;
13081 }
13082
13085 {
13086 string att_type = "None";
13087
13088 if (ConfigIsExisting("soundAttType"))
13089 {
13090 att_type = ConfigGetString("soundAttType");
13091 }
13092
13094 }
13095
13097 {
13099 }
13100
13101
13102
13103
13104
13110
13112 {
13115
13117 }
13118
13119
13121 {
13123 return;
13124
13126
13129
13132
13133 SoundParameters params = new SoundParameters();
13137 }
13138
13139
13141 {
13143 {
13146
13147 SetSynchDirty();
13148
13151 }
13152 }
13153
13155 {
13157 }
13158
13159
13161 {
13163 return;
13164
13166 SetSynchDirty();
13167
13170 }
13171
13173 {
13176 }
13177
13179 {
13181 }
13182
13183 void OnApply(PlayerBase player);
13184
13186 {
13187 return 1.0;
13188 };
13189
13191 {
13193 }
13194
13196 {
13198 }
13199
13201
13203 {
13204 SetDynamicPhysicsLifeTime(0.01);
13206 }
13207
13209 {
13210 array<string> zone_names = new array<string>;
13211 GetDamageZones(zone_names);
13212 for (int i = 0; i < zone_names.Count(); i++)
13213 {
13214 SetHealthMax(zone_names.Get(i),"Health");
13215 }
13216 SetHealthMax("","Health");
13217 }
13218
13221 {
13222 float global_health = GetHealth01("","Health");
13223 array<string> zones = new array<string>;
13224 GetDamageZones(zones);
13225
13226 for (int i = 0; i < zones.Count(); i++)
13227 {
13228 SetHealth01(zones.Get(i),"Health",global_health);
13229 }
13230 }
13231
13234 {
13235 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13236 }
13237
13239 {
13240 if (!hasRootAsPlayer)
13241 {
13242 if (refParentIB)
13243 {
13244
13245 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13246 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13247
13248 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13249 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13250
13253 }
13254 else
13255 {
13256
13259 }
13260 }
13261 }
13262
13264 {
13266 {
13267 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13268 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13269 {
13270 float heatPermCoef = 1.0;
13272 while (ent)
13273 {
13274 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13275 ent = ent.GetHierarchyParent();
13276 }
13277
13278 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13279 }
13280 }
13281 }
13282
13284 {
13285
13286 EntityAI parent = GetHierarchyParent();
13287 if (!parent)
13288 {
13289 hasParent = false;
13290 hasRootAsPlayer = false;
13291 }
13292 else
13293 {
13294 hasParent = true;
13295 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13296 refParentIB =
ItemBase.Cast(parent);
13297 }
13298 }
13299
13300 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13301 {
13302
13303 }
13304
13306 {
13307
13308 return false;
13309 }
13310
13312 {
13313
13314
13315 return false;
13316 }
13317
13319 {
13320
13321 return false;
13322 }
13323
13326 {
13327 return !GetIsFrozen() &&
IsOpen();
13328 }
13329
13331 {
13332 bool hasParent = false, hasRootAsPlayer = false;
13334
13335 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13336 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13337
13338 if (wwtu || foodDecay)
13339 {
13343
13344 if (processWetness || processTemperature || processDecay)
13345 {
13347
13348 if (processWetness)
13349 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13350
13351 if (processTemperature)
13353
13354 if (processDecay)
13355 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13356 }
13357 }
13358 }
13359
13362 {
13364 }
13365
13367 {
13370
13371 return super.GetTemperatureFreezeThreshold();
13372 }
13373
13375 {
13378
13379 return super.GetTemperatureThawThreshold();
13380 }
13381
13383 {
13386
13387 return super.GetItemOverheatThreshold();
13388 }
13389
13391 {
13393 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13394
13395 return super.GetTemperatureFreezeTime();
13396 }
13397
13399 {
13401 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13402
13403 return super.GetTemperatureThawTime();
13404 }
13405
13410
13412 {
13413 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13414 }
13415
13417 {
13418 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13419 }
13420
13423 {
13425 }
13426
13428 {
13430 }
13431
13433 {
13435 }
13436
13439 {
13440 return null;
13441 }
13442
13445 {
13446 return false;
13447 }
13448
13450 {
13452 {
13455 if (!trg)
13456 {
13458 explosive = this;
13459 }
13460
13461 explosive.PairRemote(trg);
13463
13464 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13465 trg.SetPersistentPairID(persistentID);
13466 explosive.SetPersistentPairID(persistentID);
13467
13468 return true;
13469 }
13470 return false;
13471 }
13472
13475 {
13476 float ret = 1.0;
13479 ret *= GetHealth01();
13480
13481 return ret;
13482 }
13483
13484 #ifdef DEVELOPER
13485 override void SetDebugItem()
13486 {
13487 super.SetDebugItem();
13488 _itemBase = this;
13489 }
13490
13492 {
13493 string text = super.GetDebugText();
13494
13496 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13497
13498 return text;
13499 }
13500 #endif
13501
13503 {
13504 return true;
13505 }
13506
13508
13510
13512 {
13515 }
13516
13517
13525
13541
13542 [
Obsolete(
"Use ItemSoundHandler instead")]
13545 {
13546 if (!
g_Game.IsDedicatedServer())
13547 {
13548 if (ConfigIsExisting("attachSoundSet"))
13549 {
13550 string cfg_path = "";
13551 string soundset = "";
13552 string type_name =
GetType();
13553
13556 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13557 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13558
13559 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13560 {
13561 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13562 {
13563 if (cfg_slot_array[i] == slot_type)
13564 {
13565 soundset = cfg_soundset_array[i];
13566 break;
13567 }
13568 }
13569 }
13570
13571 if (soundset != "")
13572 {
13573 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13575 }
13576 }
13577 }
13578 }
13579
13581}
13582
13584{
13586 if (entity)
13587 {
13588 bool is_item = entity.IsInherited(
ItemBase);
13589 if (is_item && full_quantity)
13590 {
13593 }
13594 }
13595 else
13596 {
13598 return NULL;
13599 }
13600 return entity;
13601}
13602
13604{
13605 if (item)
13606 {
13607 if (health > 0)
13608 item.SetHealth("", "", health);
13609
13610 if (item.CanHaveTemperature())
13611 {
13613 if (item.CanFreeze())
13614 item.SetFrozen(false);
13615 }
13616
13617 if (item.HasEnergyManager())
13618 {
13619 if (quantity >= 0)
13620 {
13621 item.GetCompEM().SetEnergy0To1(quantity);
13622 }
13623 else
13624 {
13626 }
13627 }
13628 else if (item.IsMagazine())
13629 {
13630 Magazine mag = Magazine.Cast(item);
13631 if (quantity >= 0)
13632 {
13633 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13634 }
13635 else
13636 {
13638 }
13639
13640 }
13641 else
13642 {
13643 if (quantity >= 0)
13644 {
13645 item.SetQuantityNormalized(quantity, false);
13646 }
13647 else
13648 {
13650 }
13651
13652 }
13653 }
13654}
13655
13656#ifdef DEVELOPER
13658#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.