8616{
8618 {
8619 return true;
8620 }
8621};
8622
8624{
8625
8626};
8627
8628
8629
8631{
8635
8637
8640
8641
8642
8643
8644
8653
8659
8664
8669
8690 protected bool m_IsResultOfSplit
8691
8693
8698
8699
8700
8702
8706
8707
8708
8710
8713
8714
8715
8721
8722
8730
8733
8734
8736
8737
8739
8740
8745
8746
8751
8753
8754
8756
8757
8759 {
8764
8765 if (!
g_Game.IsDedicatedServer())
8766 {
8768 {
8770
8772 {
8774 }
8775 }
8776
8779 }
8780
8781 m_OldLocation = null;
8782
8784 {
8786 }
8787
8788 if (ConfigIsExisting("headSelectionsToHide"))
8789 {
8792 }
8793
8795 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8796 {
8798 }
8799
8801
8802 m_IsResultOfSplit = false;
8803
8805 }
8806
8808 {
8809 super.InitItemVariables();
8810
8816 m_Count = ConfigGetInt(
"count");
8817
8820
8825
8828
8833
8845
8849
8850
8853 if (ConfigIsExisting("canBeSplit"))
8854 {
8857 }
8858
8860 if (ConfigIsExisting("itemBehaviour"))
8862
8863
8866 RegisterNetSyncVariableInt("m_VarLiquidType");
8867 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8868
8869 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8870 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8871 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8872
8873 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8874 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8875 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8876 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8877
8878 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8879 RegisterNetSyncVariableBool("m_IsTakeable");
8880 RegisterNetSyncVariableBool("m_IsHologram");
8881
8884 {
8887 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8888 }
8889
8891
8893 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8895
8897 }
8898
8900 {
8902 }
8903
8905 {
8908 {
8913 }
8914 }
8915
8916 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8917 {
8919 {
8922 }
8923
8925 }
8926
8928 {
8934 }
8935
8937
8939 {
8941
8942 if (!action)
8943 {
8944 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8945 return;
8946 }
8947
8949 if (!ai)
8950 {
8952 return;
8953 }
8954
8956 if (!action_array)
8957 {
8958 action_array = new array<ActionBase_Basic>;
8960 }
8961 if (LogManager.IsActionLogEnable())
8962 {
8963 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8964 }
8965
8966 if (action_array.Find(action) != -1)
8967 {
8968 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8969 }
8970 else
8971 {
8972 action_array.Insert(action);
8973 }
8974 }
8975
8977 {
8978 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8979 ActionBase action = player.GetActionManager().GetAction(actionName);
8982
8983 if (action_array)
8984 {
8985 action_array.RemoveItem(action);
8986 }
8987 }
8988
8989
8990
8992 {
8993 ActionOverrideData overrideData = new ActionOverrideData();
8997
8999 if (!actionMap)
9000 {
9003 }
9004
9005 actionMap.Insert(this.
Type(), overrideData);
9006
9007 }
9008
9010
9012
9013
9015 {
9018
9021
9022 string config_to_search = "CfgVehicles";
9023 string muzzle_owner_config;
9024
9026 {
9027 if (IsInherited(Weapon))
9028 config_to_search = "CfgWeapons";
9029
9030 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9031
9032 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9033
9034 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9035
9036 if (config_OnFire_subclass_count > 0)
9037 {
9038 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9039
9040 for (int i = 0; i < config_OnFire_subclass_count; i++)
9041 {
9042 string particle_class = "";
9043 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9044 string config_OnFire_entry = config_OnFire_class + particle_class;
9045 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9046 WPOF_array.Insert(WPOF);
9047 }
9048
9049
9051 }
9052 }
9053
9055 {
9056 config_to_search = "CfgWeapons";
9057 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9058
9059 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9060
9061 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9062
9063 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9064 {
9065 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9066
9067 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9068 {
9069 string particle_class2 = "";
9070 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9071 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9072 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9073 WPOBE_array.Insert(WPOBE);
9074 }
9075
9076
9078 }
9079 }
9080 }
9081
9082
9084 {
9087
9089 {
9090 string config_to_search = "CfgVehicles";
9091
9092 if (IsInherited(Weapon))
9093 config_to_search = "CfgWeapons";
9094
9095 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9096 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9097
9098 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9099 {
9100
9102
9104 {
9106 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9108 return;
9109 }
9110
9113
9114
9115
9116 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9117 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9118
9119 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9120 {
9121 string particle_class = "";
9122 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9123 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9124 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9125
9126 if (entry_type == CT_CLASS)
9127 {
9128 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9129 WPOOH_array.Insert(WPOF);
9130 }
9131 }
9132
9133
9135 }
9136 }
9137 }
9138
9140 {
9142 }
9143
9145 {
9147 {
9149
9152
9155
9156 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9157 }
9158 }
9159
9161 {
9163 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9164
9166 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9167
9169 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9170
9172 {
9174 }
9175 }
9176
9178 {
9180 }
9181
9183 {
9186 else
9188
9190 {
9193 }
9194 else
9195 {
9198
9201 }
9202
9204 }
9205
9207 {
9209 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9210 }
9211
9213 {
9215 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9217 }
9218
9220 {
9222 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9223 }
9224
9226 {
9229
9230 OverheatingParticle OP = new OverheatingParticle();
9235
9237 }
9238
9240 {
9243
9244 return -1;
9245 }
9246
9248 {
9250 {
9253
9254 for (int i = count; i > 0; --i)
9255 {
9256 int id = i - 1;
9259
9262
9263 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9264 {
9265 if (p)
9266 {
9269 }
9270 }
9271 }
9272 }
9273 }
9274
9276 {
9278 {
9280 {
9281 int id = i - 1;
9283
9284 if (OP)
9285 {
9287
9288 if (p)
9289 {
9291 }
9292
9293 delete OP;
9294 }
9295 }
9296
9299 }
9300 }
9301
9304 {
9305 return 0.0;
9306 }
9307
9308
9310 {
9311 return 250;
9312 }
9313
9315 {
9316 return 0;
9317 }
9318
9321 {
9323 return true;
9324
9325 return false;
9326 }
9327
9330 {
9333
9335 {
9337 }
9338 else
9339 {
9340
9342 }
9343
9345 }
9346
9353 {
9354 return -1;
9355 }
9356
9357
9358
9359
9361 {
9363 {
9364 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9365 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9366
9367 if (r_index >= 0)
9368 {
9369 InventoryLocation r_il = new InventoryLocation;
9370 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9371
9372 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9375 {
9376 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9377 }
9379 {
9380 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9381 }
9382
9383 }
9384
9385 player.GetHumanInventory().ClearUserReservedLocation(this);
9386 }
9387
9390 }
9391
9392
9393
9394
9396 {
9397 return ItemBase.m_DebugActionsMask;
9398 }
9399
9401 {
9402 return ItemBase.m_DebugActionsMask & mask;
9403 }
9404
9406 {
9407 ItemBase.m_DebugActionsMask = mask;
9408 }
9409
9411 {
9412 ItemBase.m_DebugActionsMask |= mask;
9413 }
9414
9416 {
9417 ItemBase.m_DebugActionsMask &= ~mask;
9418 }
9419
9421 {
9423 {
9425 }
9426 else
9427 {
9429 }
9430 }
9431
9432
9434 {
9435 if (GetEconomyProfile())
9436 {
9437 float q_max = GetEconomyProfile().GetQuantityMax();
9438 if (q_max > 0)
9439 {
9440 float q_min = GetEconomyProfile().GetQuantityMin();
9441 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9442
9444 {
9445 ComponentEnergyManager comp = GetCompEM();
9447 {
9449 }
9450 }
9452 {
9454
9455 }
9456
9457 }
9458 }
9459 }
9460
9463 {
9464 EntityAI parent = GetHierarchyParent();
9465
9466 if (parent)
9467 {
9468 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9469 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9470 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9471 }
9472 }
9473
9476 {
9477 EntityAI parent = GetHierarchyParent();
9478
9479 if (parent)
9480 {
9481 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9482 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9483 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9484 }
9485 }
9486
9488 {
9489
9490
9491
9492
9494
9496 {
9497 if (ScriptInputUserData.CanStoreInputUserData())
9498 {
9499 ScriptInputUserData ctx = new ScriptInputUserData;
9505 ctx.
Write(use_stack_max);
9508
9510 {
9511 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9512 }
9513 }
9514 }
9515 else if (!
g_Game.IsMultiplayer())
9516 {
9518 }
9519 }
9520
9522 {
9524 }
9525
9527 {
9529 }
9530
9532 {
9534 }
9535
9537 {
9538
9539 return false;
9540 }
9541
9543 {
9544 return false;
9545 }
9546
9550 {
9551 return false;
9552 }
9553
9555 {
9556 return "";
9557 }
9558
9560
9562 {
9563 return false;
9564 }
9565
9567 {
9568 return true;
9569 }
9570
9571
9572
9574 {
9575 return true;
9576 }
9577
9579 {
9580 return true;
9581 }
9582
9584 {
9585 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9587 }
9588
9590 {
9592 }
9593
9595 {
9597 if (!is_being_placed)
9599 SetSynchDirty();
9600 }
9601
9602
9604
9606 {
9608 }
9609
9611 {
9613 }
9614
9616 {
9617 return 1;
9618 }
9619
9621 {
9622 return false;
9623 }
9624
9626 {
9628 SetSynchDirty();
9629 }
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9666 {
9667 super.OnMovedInsideCargo(container);
9668
9669 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9670 }
9671
9672 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9673 {
9674 super.EEItemLocationChanged(oldLoc, newLoc);
9675
9676 PlayerBase newPlayer = null;
9677 PlayerBase oldPlayer = null;
9678
9679 if (newLoc.GetParent())
9680 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9681
9682 if (oldLoc.GetParent())
9683 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9684
9686 {
9687 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9688
9689 if (rIndex >= 0)
9690 {
9691 InventoryLocation rIl = new InventoryLocation;
9692 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9693
9694 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9697 {
9698 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9699 }
9701 {
9703 }
9704
9705 }
9706 }
9707
9709 {
9710 if (newPlayer)
9711 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9712
9713 if (newPlayer == oldPlayer)
9714 {
9715 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9716 {
9718 {
9719 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9720 {
9721 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9722 }
9723 }
9724 else
9725 {
9726 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9727 }
9728 }
9729
9730 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9731 {
9732 int type = oldLoc.GetType();
9734 {
9735 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9736 }
9738 {
9739 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9740 }
9741 }
9742 if (!m_OldLocation)
9743 {
9744 m_OldLocation = new InventoryLocation;
9745 }
9746 m_OldLocation.Copy(oldLoc);
9747 }
9748 else
9749 {
9750 if (m_OldLocation)
9751 {
9752 m_OldLocation.Reset();
9753 }
9754 }
9755
9756 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9757 }
9758 else
9759 {
9760 if (newPlayer)
9761 {
9762 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9763 if (resIndex >= 0)
9764 {
9765 InventoryLocation il = new InventoryLocation;
9766 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9768 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9771 {
9772 il.
GetParent().GetOnReleaseLock().Invoke(it);
9773 }
9775 {
9777 }
9778
9779 }
9780 }
9782 {
9783
9785 }
9786
9787 if (m_OldLocation)
9788 {
9789 m_OldLocation.Reset();
9790 }
9791 }
9792
9794 {
9795 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9796 }
9797
9799 {
9800 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9801 }
9802 }
9803
9804 override void EOnContact(IEntity other, Contact extra)
9805 {
9807 {
9808 int liquidType = -1;
9810 if (impactSpeed > 0.0)
9811 {
9813 #ifndef SERVER
9815 #else
9817 SetSynchDirty();
9818 #endif
9820 }
9821 }
9822
9823 #ifdef SERVER
9824 if (GetCompEM() && GetCompEM().IsPlugged())
9825 {
9826 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9827 GetCompEM().UnplugThis();
9828 }
9829 #endif
9830 }
9831
9833
9835 {
9837 }
9838
9840 {
9841
9842 }
9843
9845 {
9846 super.OnItemLocationChanged(old_owner, new_owner);
9847
9848 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9849 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9850
9851 if (!relatedPlayer && playerNew)
9852 relatedPlayer = playerNew;
9853
9854 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9855 {
9857 if (actionMgr)
9858 {
9859 ActionBase currentAction = actionMgr.GetRunningAction();
9860 if (currentAction)
9862 }
9863 }
9864
9865 Man ownerPlayerOld = null;
9866 Man ownerPlayerNew = null;
9867
9868 if (old_owner)
9869 {
9870 if (old_owner.
IsMan())
9871 {
9872 ownerPlayerOld = Man.Cast(old_owner);
9873 }
9874 else
9875 {
9876 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9877 }
9878 }
9879 else
9880 {
9882 {
9884
9885 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9886 {
9887 GetCompEM().UnplugThis();
9888 }
9889 }
9890 }
9891
9892 if (new_owner)
9893 {
9894 if (new_owner.
IsMan())
9895 {
9896 ownerPlayerNew = Man.Cast(new_owner);
9897 }
9898 else
9899 {
9900 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9901 }
9902 }
9903
9904 if (ownerPlayerOld != ownerPlayerNew)
9905 {
9906 if (ownerPlayerOld)
9907 {
9908 array<EntityAI> subItemsExit = new array<EntityAI>;
9910 for (int i = 0; i < subItemsExit.Count(); i++)
9911 {
9914 }
9915 }
9916
9917 if (ownerPlayerNew)
9918 {
9919 array<EntityAI> subItemsEnter = new array<EntityAI>;
9921 for (int j = 0; j < subItemsEnter.Count(); j++)
9922 {
9925 }
9926 }
9927 }
9928 else if (ownerPlayerNew != null)
9929 {
9930 PlayerBase nplayer;
9931 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9932 {
9933 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9935 for (int k = 0; k < subItemsUpdate.Count(); k++)
9936 {
9938 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9939 }
9940 }
9941 }
9942
9943 if (old_owner)
9944 old_owner.OnChildItemRemoved(this);
9945 if (new_owner)
9946 new_owner.OnChildItemReceived(this);
9947 }
9948
9949
9951 {
9952 super.EEDelete(parent);
9953 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9954 if (player)
9955 {
9957
9958 if (player.IsAlive())
9959 {
9960 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9961 if (r_index >= 0)
9962 {
9963 InventoryLocation r_il = new InventoryLocation;
9964 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9965
9966 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9969 {
9970 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9971 }
9973 {
9974 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9975 }
9976
9977 }
9978
9979 player.RemoveQuickBarEntityShortcut(this);
9980 }
9981 }
9982 }
9983
9985 {
9986 super.EEKilled(killer);
9987
9990 {
9991 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9992 {
9993 if (IsMagazine())
9994 {
9995 if (Magazine.Cast(this).GetAmmoCount() > 0)
9996 {
9998 }
9999 }
10000 else
10001 {
10003 }
10004 }
10005 }
10006 }
10007
10009 {
10010 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10011
10012 super.OnWasAttached(parent, slot_id);
10013
10016
10019 }
10020
10022 {
10023 super.OnWasDetached(parent, slot_id);
10024
10027
10030 }
10031
10033 {
10034 int idx;
10037
10038 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10039 if (inventory_slots.Count() < 1)
10040 {
10041 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10042 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10043 }
10044 else
10045 {
10046 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10047 }
10048
10049 idx = inventory_slots.Find(slot);
10050 if (idx < 0)
10051 return "";
10052
10053 return attach_types.Get(idx);
10054 }
10055
10057 {
10058 int idx = -1;
10059 string slot;
10060
10063
10064 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10065 if (inventory_slots.Count() < 1)
10066 {
10067 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10068 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10069 }
10070 else
10071 {
10072 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10073 if (detach_types.Count() < 1)
10074 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10075 }
10076
10077 for (int i = 0; i < inventory_slots.Count(); i++)
10078 {
10079 slot = inventory_slots.Get(i);
10080 }
10081
10082 if (slot != "")
10083 {
10084 if (detach_types.Count() == 1)
10085 idx = 0;
10086 else
10087 idx = inventory_slots.Find(slot);
10088 }
10089 if (idx < 0)
10090 return "";
10091
10092 return detach_types.Get(idx);
10093 }
10094
10096 {
10097
10099
10100
10101 float min_time = 1;
10102 float max_time = 3;
10103 float delay = Math.RandomFloat(min_time, max_time);
10104
10105 explode_timer.Run(delay, this, "DoAmmoExplosion");
10106 }
10107
10109 {
10110 Magazine magazine = Magazine.Cast(this);
10111 int pop_sounds_count = 6;
10112 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10113
10114
10115 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10116 string sound_name = pop_sounds[ sound_idx ];
10117 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10118
10119
10120 magazine.ServerAddAmmoCount(-1);
10121
10122
10123 float min_temp_to_explode = 100;
10124
10125 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10126 {
10128 }
10129 }
10130
10131
10132 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10133 {
10134 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10135
10136 const int CHANCE_DAMAGE_CARGO = 4;
10137 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10138 const int CHANCE_DAMAGE_NOTHING = 2;
10139
10141 {
10142 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10143 int chances;
10144 int rnd;
10145
10146 if (GetInventory().GetCargo())
10147 {
10148 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10149 rnd = Math.RandomInt(0,chances);
10150
10151 if (rnd < CHANCE_DAMAGE_CARGO)
10152 {
10154 }
10155 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10156 {
10158 }
10159 }
10160 else
10161 {
10162 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10163 rnd = Math.RandomInt(0,chances);
10164
10165 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10166 {
10168 }
10169 }
10170 }
10171 }
10172
10174 {
10175 CargoBase cargo = GetInventory().GetCargo();
10176 if (cargo)
10177 {
10179 if (item_count > 0)
10180 {
10181 int random_pick = Math.RandomInt(0, item_count);
10183 if (!item.IsExplosive())
10184 {
10185 item.AddHealth("","",damage);
10186 return true;
10187 }
10188 }
10189 }
10190 return false;
10191 }
10192
10194 {
10195 GameInventory inventory = GetInventory();
10197 if (attachment_count > 0)
10198 {
10199 int random_pick = Math.RandomInt(0, attachment_count);
10201 if (!attachment.IsExplosive())
10202 {
10203 attachment.AddHealth("","",damage);
10204 return true;
10205 }
10206 }
10207 return false;
10208 }
10209
10211 {
10213 }
10214
10216 {
10218 return GetInventory().CanRemoveEntity();
10219
10220 return false;
10221 }
10222
10224 {
10225
10227 return false;
10228
10229
10231 return false;
10232
10233
10234
10236 if (delta == 0)
10237 return false;
10238
10239
10240 return true;
10241 }
10242
10244 {
10246 {
10247 if (ScriptInputUserData.CanStoreInputUserData())
10248 {
10249 ScriptInputUserData ctx = new ScriptInputUserData;
10254 ctx.
Write(destination_entity);
10256 ctx.
Write(slot_id);
10258 }
10259 }
10260 else if (!
g_Game.IsMultiplayer())
10261 {
10263 }
10264 }
10265
10267 {
10268 float split_quantity_new;
10272 InventoryLocation loc = new InventoryLocation;
10273
10274 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10275 {
10277 split_quantity_new = stack_max;
10278 else
10280
10282 {
10283 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10284 if (new_item)
10285 {
10286 new_item.SetResultOfSplit(true);
10287 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10289 new_item.
SetQuantity(split_quantity_new,
false,
true);
10290 }
10291 }
10292 }
10293 else if (destination_entity && slot_id == -1)
10294 {
10295 if (quantity > stack_max)
10296 split_quantity_new = stack_max;
10297 else
10298 split_quantity_new = quantity;
10299
10301 {
10302 GameInventory destinationInventory = destination_entity.GetInventory();
10304 {
10307 }
10308
10309 if (new_item)
10310 {
10311 new_item.SetResultOfSplit(true);
10312 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10314 new_item.
SetQuantity(split_quantity_new,
false,
true);
10315 }
10316 }
10317 }
10318 else
10319 {
10320 if (stack_max != 0)
10321 {
10323 {
10325 }
10326
10327 if (split_quantity_new == 0)
10328 {
10329 if (!
g_Game.IsMultiplayer())
10330 player.PhysicalPredictiveDropItem(this);
10331 else
10332 player.ServerDropEntity(this);
10333 return;
10334 }
10335
10337 {
10339
10340 if (new_item)
10341 {
10342 new_item.SetResultOfSplit(true);
10343 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10346 new_item.PlaceOnSurface();
10347 }
10348 }
10349 }
10350 }
10351 }
10352
10354 {
10355 float split_quantity_new;
10359 InventoryLocation loc = new InventoryLocation;
10360
10361 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10362 {
10364 split_quantity_new = stack_max;
10365 else
10367
10369 {
10370 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
10381 {
10382 if (quantity > stack_max)
10383 split_quantity_new = stack_max;
10384 else
10385 split_quantity_new = quantity;
10386
10388 {
10389 GameInventory destinationInventory = destination_entity.GetInventory();
10391 {
10394 }
10395
10396 if (new_item)
10397 {
10398 new_item.SetResultOfSplit(true);
10399 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10401 new_item.
SetQuantity(split_quantity_new,
false,
true);
10402 }
10403 }
10404 }
10405 else
10406 {
10407 if (stack_max != 0)
10408 {
10410 {
10412 }
10413
10415 {
10417
10418 if (new_item)
10419 {
10420 new_item.SetResultOfSplit(true);
10421 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10424 new_item.PlaceOnSurface();
10425 }
10426 }
10427 }
10428 }
10429 }
10430
10432 {
10434 {
10435 if (ScriptInputUserData.CanStoreInputUserData())
10436 {
10437 ScriptInputUserData ctx = new ScriptInputUserData;
10442 dst.WriteToContext(ctx);
10444 }
10445 }
10446 else if (!
g_Game.IsMultiplayer())
10447 {
10449 }
10450 }
10451
10453 {
10455 {
10456 if (ScriptInputUserData.CanStoreInputUserData())
10457 {
10458 ScriptInputUserData ctx = new ScriptInputUserData;
10463 ctx.
Write(destination_entity);
10469 }
10470 }
10471 else if (!
g_Game.IsMultiplayer())
10472 {
10474 }
10475 }
10476
10478 {
10480 }
10481
10483 {
10485 float split_quantity_new;
10487 if (dst.IsValid())
10488 {
10489 int slot_id = dst.GetSlot();
10491
10492 if (quantity > stack_max)
10493 split_quantity_new = stack_max;
10494 else
10495 split_quantity_new = quantity;
10496
10498 {
10500
10501 if (new_item)
10502 {
10503 new_item.SetResultOfSplit(true);
10504 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10506 new_item.
SetQuantity(split_quantity_new,
false,
true);
10507 }
10508
10509 return new_item;
10510 }
10511 }
10512
10513 return null;
10514 }
10515
10517 {
10519 float split_quantity_new;
10521 if (destination_entity)
10522 {
10524 if (quantity > stackable)
10525 split_quantity_new = stackable;
10526 else
10527 split_quantity_new = quantity;
10528
10530 {
10531 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10532 if (new_item)
10533 {
10534 new_item.SetResultOfSplit(true);
10535 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10537 new_item.
SetQuantity(split_quantity_new,
false,
true);
10538 }
10539 }
10540 }
10541 }
10542
10544 {
10546 {
10547 if (ScriptInputUserData.CanStoreInputUserData())
10548 {
10549 ScriptInputUserData ctx = new ScriptInputUserData;
10554 ItemBase destination_entity =
this;
10555 ctx.
Write(destination_entity);
10559 }
10560 }
10561 else if (!
g_Game.IsMultiplayer())
10562 {
10564 }
10565 }
10566
10568 {
10570 float split_quantity_new;
10572 if (player)
10573 {
10575 if (quantity > stackable)
10576 split_quantity_new = stackable;
10577 else
10578 split_quantity_new = quantity;
10579
10581 {
10582 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10583 new_item =
ItemBase.Cast(in_hands);
10584 if (new_item)
10585 {
10586 new_item.SetResultOfSplit(true);
10587 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10589 new_item.SetQuantity(split_quantity_new, false, true);
10590 }
10591 }
10592 }
10593 }
10594
10596 {
10598 float split_quantity_new = Math.Floor(quantity * 0.5);
10599
10601 return;
10602
10604
10605 if (new_item)
10606 {
10607 if (new_item.GetQuantityMax() < split_quantity_new)
10608 {
10609 split_quantity_new = new_item.GetQuantityMax();
10610 }
10611
10612 new_item.SetResultOfSplit(true);
10613 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10614
10616 {
10619 }
10620 else
10621 {
10623 new_item.
SetQuantity(split_quantity_new,
false,
true);
10624 }
10625 }
10626 }
10627
10629 {
10631 float split_quantity_new = Math.Floor(quantity / 2);
10632
10634 return;
10635
10636 InventoryLocation invloc = new InventoryLocation;
10638
10640 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10641
10642 if (new_item)
10643 {
10644 if (new_item.GetQuantityMax() < split_quantity_new)
10645 {
10646 split_quantity_new = new_item.GetQuantityMax();
10647 }
10649 {
10652 }
10653 else if (split_quantity_new > 1)
10654 {
10656 new_item.
SetQuantity(split_quantity_new,
false,
true);
10657 }
10658 }
10659 }
10660
10663 {
10664 SetWeightDirty();
10666
10667 if (parent)
10668 parent.OnAttachmentQuantityChangedEx(this, delta);
10669
10671 {
10673 {
10675 }
10677 {
10678 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10680 }
10681 }
10682 }
10683
10686 {
10687
10688 }
10689
10692 {
10694 }
10695
10697 {
10698 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10699
10701 {
10702 if (newLevel == GameConstants.STATE_RUINED)
10703 {
10705 EntityAI parent = GetHierarchyParent();
10706 if (parent && parent.IsFireplace())
10707 {
10708 CargoBase cargo = GetInventory().GetCargo();
10709 if (cargo)
10710 {
10712 {
10714 }
10715 }
10716 }
10717 }
10718
10720 {
10721
10723 return;
10724 }
10725
10726 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10727 {
10729 }
10730 }
10731 }
10732
10733
10735 {
10736 super.OnRightClick();
10737
10739 {
10741 {
10742 if (ScriptInputUserData.CanStoreInputUserData())
10743 {
10744 EntityAI root = GetHierarchyRoot();
10745 Man playerOwner = GetHierarchyRootPlayer();
10746 InventoryLocation dst = new InventoryLocation;
10747
10748
10749 if (!playerOwner && root && root == this)
10750 {
10752 }
10753 else
10754 {
10755
10756 GetInventory().GetCurrentInventoryLocation(dst);
10758 {
10759 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10761 {
10763 }
10764 else
10765 {
10767
10768
10769 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10770 {
10772 }
10773 else
10774 {
10775 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10776 }
10777 }
10778 }
10779 }
10780
10781 ScriptInputUserData ctx = new ScriptInputUserData;
10789 }
10790 }
10791 else if (!
g_Game.IsMultiplayer())
10792 {
10794 }
10795 }
10796 }
10797
10799 {
10800 if (root)
10801 {
10802 vector m4[4];
10803 root.GetTransform(m4);
10804 dst.SetGround(this, m4);
10805 }
10806 else
10807 {
10808 GetInventory().GetCurrentInventoryLocation(dst);
10809 }
10810 }
10811
10812 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10813 {
10814
10815 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10816 return false;
10817
10818 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10819 return false;
10820
10821
10823 return false;
10824
10825
10826 Magazine mag = Magazine.Cast(this);
10827 if (mag)
10828 {
10829 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10830 return false;
10831
10832 if (stack_max_limit)
10833 {
10834 Magazine other_mag = Magazine.Cast(other_item);
10835 if (other_item)
10836 {
10837 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10838 return false;
10839 }
10840
10841 }
10842 }
10843 else
10844 {
10845
10847 return false;
10848
10850 return false;
10851 }
10852
10853 PlayerBase player = null;
10854 if (CastTo(player, GetHierarchyRootPlayer()))
10855 {
10856 if (player.GetInventory().HasAttachment(this))
10857 return false;
10858
10859 if (player.IsItemsToDelete())
10860 return false;
10861 }
10862
10863 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10864 return false;
10865
10866 int slotID;
10868 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10869 return false;
10870
10871 return true;
10872 }
10873
10875 {
10877 }
10878
10880 {
10881 return m_IsResultOfSplit;
10882 }
10883
10885 {
10886 m_IsResultOfSplit = value;
10887 }
10888
10890 {
10892 }
10893
10895 {
10896 float other_item_quantity = other_item.GetQuantity();
10897 float this_free_space;
10898
10900
10902
10903 if (other_item_quantity > this_free_space)
10904 {
10905 return this_free_space;
10906 }
10907 else
10908 {
10909 return other_item_quantity;
10910 }
10911 }
10912
10914 {
10916 }
10917
10919 {
10921 return;
10922
10923 if (!IsMagazine() && other_item)
10924 {
10926 if (quantity_used != 0)
10927 {
10928 float hp1 = GetHealth01("","");
10929 float hp2 = other_item.GetHealth01("","");
10930 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10931 hpResult = hpResult / (
GetQuantity() + quantity_used);
10932
10933 hpResult *= GetMaxHealth();
10934 Math.Round(hpResult);
10935 SetHealth("", "Health", hpResult);
10936
10938 other_item.AddQuantity(-quantity_used);
10939 }
10940 }
10942 }
10943
10945 {
10946 #ifdef SERVER
10947 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10948 GetHierarchyParent().IncreaseLifetimeUp();
10949 #endif
10950 };
10951
10953 {
10954 PlayerBase p = PlayerBase.Cast(player);
10955
10956 array<int> recipesIds = p.m_Recipes;
10957 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10958 if (moduleRecipesManager)
10959 {
10960 EntityAI itemInHands = player.GetEntityInHands();
10961 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10962 }
10963
10964 for (int i = 0;i < recipesIds.Count(); i++)
10965 {
10966 int key = recipesIds.Get(i);
10967 string recipeName = moduleRecipesManager.GetRecipeName(key);
10969 }
10970 }
10971
10972
10973 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10974 {
10975 super.GetDebugActions(outputList);
10976
10977
10983
10984
10989
10994
10995
10999
11000
11002 {
11006 }
11007
11010
11011
11015
11017
11018 InventoryLocation loc = new InventoryLocation();
11019 GetInventory().GetCurrentInventoryLocation(loc);
11021 {
11022 if (Gizmo_IsSupported())
11025 }
11026
11028 }
11029
11030
11031
11032
11034 {
11035 super.OnAction(action_id, player, ctx);
11036
11038 {
11039 switch (action_id)
11040 {
11044 return true;
11048 return true;
11049 }
11050 }
11051
11053 {
11054 switch (action_id)
11055 {
11057 Delete();
11058 return true;
11059 }
11060 }
11061
11062 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11063 {
11064 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11065 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11066 PlayerBase p = PlayerBase.Cast(player);
11067 if (
EActions.RECIPES_RANGE_START < 1000)
11068 {
11069 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11070 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11071 }
11072 }
11073 #ifndef SERVER
11074 else if (action_id ==
EActions.WATCH_PLAYER)
11075 {
11076 PluginDeveloper.SetDeveloperItemClientEx(player);
11077 }
11078 #endif
11080 {
11081 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11082 {
11083 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11084 OnDebugButtonPressServer(id + 1);
11085 }
11086
11087 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11088 {
11089 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11091 }
11092
11093 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11094 {
11095 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11097 }
11098
11099 else if (action_id ==
EActions.ADD_QUANTITY)
11100 {
11101 if (IsMagazine())
11102 {
11103 Magazine mag = Magazine.Cast(this);
11104 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11105 }
11106 else
11107 {
11109 }
11110
11111 if (m_EM)
11112 {
11113 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11114 }
11115
11116 }
11117
11118 else if (action_id ==
EActions.REMOVE_QUANTITY)
11119 {
11120 if (IsMagazine())
11121 {
11122 Magazine mag2 = Magazine.Cast(this);
11123 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11124 }
11125 else
11126 {
11128 }
11129 if (m_EM)
11130 {
11131 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11132 }
11133
11134 }
11135
11136 else if (action_id ==
EActions.SET_QUANTITY_0)
11137 {
11139
11140 if (m_EM)
11141 {
11142 m_EM.SetEnergy(0);
11143 }
11144 }
11145
11146 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11147 {
11149
11150 if (m_EM)
11151 {
11152 m_EM.SetEnergy(m_EM.GetEnergyMax());
11153 }
11154 }
11155
11156 else if (action_id ==
EActions.ADD_HEALTH)
11157 {
11158 AddHealth("","",GetMaxHealth("","Health")/5);
11159 }
11160 else if (action_id ==
EActions.REMOVE_HEALTH)
11161 {
11162 AddHealth("","",-GetMaxHealth("","Health")/5);
11163 }
11164 else if (action_id ==
EActions.DESTROY_HEALTH)
11165 {
11166 SetHealth01("","",0);
11167 }
11168 else if (action_id ==
EActions.WATCH_ITEM)
11169 {
11171 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11172 #ifdef DEVELOPER
11173 SetDebugDeveloper_item(this);
11174 #endif
11175 }
11176
11177 else if (action_id ==
EActions.ADD_TEMPERATURE)
11178 {
11179 AddTemperature(20);
11180
11181 }
11182
11183 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11184 {
11185 AddTemperature(-20);
11186
11187 }
11188
11189 else if (action_id ==
EActions.FLIP_FROZEN)
11190 {
11191 SetFrozen(!GetIsFrozen());
11192
11193 }
11194
11195 else if (action_id ==
EActions.ADD_WETNESS)
11196 {
11198
11199 }
11200
11201 else if (action_id ==
EActions.REMOVE_WETNESS)
11202 {
11204
11205 }
11206
11207 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11208 {
11211
11212
11213 }
11214
11215 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11216 {
11219 }
11220
11221 else if (action_id ==
EActions.MAKE_SPECIAL)
11222 {
11223 auto debugParams = DebugSpawnParams.WithPlayer(player);
11224 OnDebugSpawnEx(debugParams);
11225 }
11226
11227 }
11228
11229
11230 return false;
11231 }
11232
11233
11234
11235
11239
11242
11243
11244
11246 {
11247 return false;
11248 }
11249
11250
11252 {
11253 return true;
11254 }
11255
11256
11258 {
11259 return true;
11260 }
11261
11262
11263
11265 {
11266 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11267 return g_Game.ConfigIsExisting(config_path);
11268 }
11269
11272 {
11273 return null;
11274 }
11275
11277 {
11278 return false;
11279 }
11280
11282 {
11283 return false;
11284 }
11285
11289
11290
11292 {
11293 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11294 return module_repairing.CanRepair(this, item_repair_kit);
11295 }
11296
11297
11298 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11299 {
11300 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11301 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11302 }
11303
11304
11306 {
11307
11308
11309
11310
11311
11312
11313
11314
11315 return 1;
11316 }
11317
11318
11319
11321 {
11323 }
11324
11325
11326
11328 {
11330 }
11331
11332
11341 {
11342 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11343
11344 if (player)
11345 {
11346 player.MessageStatus(text);
11347 }
11348 }
11349
11350
11359 {
11360 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11361
11362 if (player)
11363 {
11364 player.MessageAction(text);
11365 }
11366 }
11367
11368
11377 {
11378 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11379
11380 if (player)
11381 {
11382 player.MessageFriendly(text);
11383 }
11384 }
11385
11386
11395 {
11396 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11397
11398 if (player)
11399 {
11400 player.MessageImportant(text);
11401 }
11402 }
11403
11405 {
11406 return true;
11407 }
11408
11409
11410 override bool KindOf(
string tag)
11411 {
11412 bool found = false;
11413 string item_name = this.
GetType();
11415 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11416
11417 int array_size = item_tag_array.Count();
11418 for (int i = 0; i < array_size; i++)
11419 {
11420 if (item_tag_array.Get(i) == tag)
11421 {
11422 found = true;
11423 break;
11424 }
11425 }
11426 return found;
11427 }
11428
11429
11431 {
11432
11433 super.OnRPC(sender, rpc_type,ctx);
11434
11435
11436 switch (rpc_type)
11437 {
11438 #ifndef SERVER
11439 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11440 Param2<bool, string> p = new Param2<bool, string>(false, "");
11441
11443 return;
11444
11445 bool play = p.param1;
11446 string soundSet = p.param2;
11447
11448 if (play)
11449 {
11451 {
11453 {
11455 }
11456 }
11457 else
11458 {
11460 }
11461 }
11462 else
11463 {
11465 }
11466
11467 break;
11468 #endif
11469
11470 }
11471
11473 {
11475 }
11476 }
11477
11478
11479
11480
11482 {
11483 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11484 return plugin.GetID(
name);
11485 }
11486
11488 {
11489 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11490 return plugin.GetName(id);
11491 }
11492
11495 {
11496
11497
11498 int varFlags;
11499 if (!ctx.
Read(varFlags))
11500 return;
11501
11502 if (varFlags & ItemVariableFlags.FLOAT)
11503 {
11505 }
11506 }
11507
11509 {
11510
11511 super.SerializeNumericalVars(floats_out);
11512
11513
11514
11516 {
11518 }
11519
11521 {
11523 }
11524
11526 {
11528 }
11529
11531 {
11536 }
11537
11539 {
11541 }
11542 }
11543
11545 {
11546
11547 super.DeSerializeNumericalVars(floats);
11548
11549
11550 int index = 0;
11551 int mask = Math.Round(floats.Get(index));
11552
11553 index++;
11554
11556 {
11558 {
11560 }
11561 else
11562 {
11563 float quantity = floats.Get(index);
11564 SetQuantity(quantity,
true,
false,
false,
false);
11565 }
11566 index++;
11567 }
11568
11570 {
11571 float wet = floats.Get(index);
11573 index++;
11574 }
11575
11577 {
11578 int liquidtype = Math.Round(floats.Get(index));
11580 index++;
11581 }
11582
11584 {
11586 index++;
11588 index++;
11590 index++;
11592 index++;
11593 }
11594
11596 {
11597 int cleanness = Math.Round(floats.Get(index));
11599 index++;
11600 }
11601 }
11602
11604 {
11605 super.WriteVarsToCTX(ctx);
11606
11607
11609 {
11611 }
11612
11614 {
11616 }
11617
11619 {
11621 }
11622
11624 {
11625 int r,g,b,a;
11631 }
11632
11634 {
11636 }
11637 }
11638
11640 {
11641 if (!super.ReadVarsFromCTX(ctx,version))
11642 return false;
11643
11644 int intValue;
11645 float value;
11646
11647 if (version < 140)
11648 {
11649 if (!ctx.
Read(intValue))
11650 return false;
11651
11652 m_VariablesMask = intValue;
11653 }
11654
11656 {
11657 if (!ctx.
Read(value))
11658 return false;
11659
11661 {
11663 }
11664 else
11665 {
11667 }
11668 }
11669
11670 if (version < 140)
11671 {
11673 {
11674 if (!ctx.
Read(value))
11675 return false;
11676 SetTemperatureDirect(value);
11677 }
11678 }
11679
11681 {
11682 if (!ctx.
Read(value))
11683 return false;
11685 }
11686
11688 {
11689 if (!ctx.
Read(intValue))
11690 return false;
11692 }
11693
11695 {
11696 int r,g,b,a;
11698 return false;
11700 return false;
11702 return false;
11704 return false;
11705
11707 }
11708
11710 {
11711 if (!ctx.
Read(intValue))
11712 return false;
11714 }
11715
11716 if (version >= 138 && version < 140)
11717 {
11719 {
11720 if (!ctx.
Read(intValue))
11721 return false;
11722 SetFrozen(intValue);
11723 }
11724 }
11725
11726 return true;
11727 }
11728
11729
11731 {
11734 {
11736 }
11737
11738 if (!super.OnStoreLoad(ctx, version))
11739 {
11741 return false;
11742 }
11743
11744 if (version >= 114)
11745 {
11746 bool hasQuickBarIndexSaved;
11747
11748 if (!ctx.
Read(hasQuickBarIndexSaved))
11749 {
11751 return false;
11752 }
11753
11754 if (hasQuickBarIndexSaved)
11755 {
11756 int itmQBIndex;
11757
11758
11759 if (!ctx.
Read(itmQBIndex))
11760 {
11762 return false;
11763 }
11764
11765 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11766 if (itmQBIndex != -1 && parentPlayer)
11767 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11768 }
11769 }
11770 else
11771 {
11772
11773 PlayerBase player;
11774 int itemQBIndex;
11775 if (version ==
int.
MAX)
11776 {
11777 if (!ctx.
Read(itemQBIndex))
11778 {
11780 return false;
11781 }
11782 }
11783 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11784 {
11785
11786 if (!ctx.
Read(itemQBIndex))
11787 {
11789 return false;
11790 }
11791 if (itemQBIndex != -1 && player)
11792 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11793 }
11794 }
11795
11796 if (version < 140)
11797 {
11798
11799 if (!LoadVariables(ctx, version))
11800 {
11802 return false;
11803 }
11804 }
11805
11806
11808 {
11810 return false;
11811 }
11812 if (version >= 132)
11813 {
11815 if (raib)
11816 {
11818 {
11820 return false;
11821 }
11822 }
11823 }
11824
11826 return true;
11827 }
11828
11829
11830
11832 {
11833 super.OnStoreSave(ctx);
11834
11835 PlayerBase player;
11836 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11837 {
11839
11840 int itemQBIndex = -1;
11841 itemQBIndex = player.FindQuickBarEntityIndex(this);
11842 ctx.
Write(itemQBIndex);
11843 }
11844 else
11845 {
11847 }
11848
11850
11852 if (raib)
11853 {
11855 }
11856 }
11857
11858
11860 {
11861 super.AfterStoreLoad();
11862
11864 {
11866 }
11867
11869 {
11872 }
11873 }
11874
11876 {
11877 super.EEOnAfterLoad();
11878
11880 {
11882 }
11883
11886 }
11887
11889 {
11890 return false;
11891 }
11892
11893
11894
11896 {
11898 {
11899 #ifdef PLATFORM_CONSOLE
11900
11902 {
11904 if (menu)
11905 {
11907 }
11908 }
11909 #endif
11910 }
11911
11913 {
11916 }
11917
11919 {
11920 SetWeightDirty();
11922 }
11924 {
11927 }
11928
11930 {
11933
11936 }
11938 {
11942 }
11943
11944 super.OnVariablesSynchronized();
11945 }
11946
11947
11948
11950 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11951 {
11952 if (!IsServerCheck(allow_client))
11953 return false;
11954
11956 return false;
11957
11960
11961 if (value <= (min + 0.001))
11962 value = min;
11963
11964 if (value == min)
11965 {
11966 if (destroy_config)
11967 {
11968 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11969 if (dstr)
11970 {
11972 this.Delete();
11973 return true;
11974 }
11975 }
11976 else if (destroy_forced)
11977 {
11979 this.Delete();
11980 return true;
11981 }
11982
11984 }
11985
11988
11990 {
11991 EntityAI parent = GetHierarchyRoot();
11992 InventoryLocation iLoc = new InventoryLocation();
11993 GetInventory().GetCurrentInventoryLocation(iLoc);
11995 {
11996 int iLocSlot = iLoc.
GetSlot();
11998 {
12000 }
12002 {
12004 }
12005 }
12006 }
12007
12009 {
12011
12012 if (delta)
12014 }
12015
12017
12018 return false;
12019 }
12020
12021
12023 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12024 {
12026 }
12027
12029 {
12032 }
12033
12035 {
12038 }
12039
12041 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12042 {
12043 float value_clamped = Math.Clamp(value, 0, 1);
12045 SetQuantity(result, destroy_config, destroy_forced);
12046 }
12047
12048
12051 {
12053 }
12054
12056 {
12058 }
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12070 {
12071 int slot = -1;
12072 GameInventory inventory = GetInventory();
12073 if (inventory)
12074 {
12075 InventoryLocation il = new InventoryLocation;
12078 }
12079
12081 }
12082
12084 {
12085 float quantity_max = 0;
12086
12088 {
12089 if (attSlotID != -1)
12090 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12091
12092 if (quantity_max <= 0)
12094 }
12095
12096 if (quantity_max <= 0)
12098
12099 return quantity_max;
12100 }
12101
12103 {
12105 }
12106
12108 {
12110 }
12111
12112
12114 {
12116 }
12117
12119 {
12121 }
12122
12124 {
12126 }
12127
12128
12130 {
12131
12132 float weightEx = GetWeightEx();
12133 float special = GetInventoryAndCargoWeight();
12134 return weightEx - special;
12135 }
12136
12137
12139 {
12141 }
12142
12144 {
12146 {
12147 #ifdef DEVELOPER
12148 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12149 {
12150 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12152 }
12153 #endif
12154
12155 return GetQuantity() * GetConfigWeightModified();
12156 }
12157 else if (HasEnergyManager())
12158 {
12159 #ifdef DEVELOPER
12160 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12161 {
12162 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12163 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12164 }
12165 #endif
12166 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12167 }
12168 else
12169 {
12170 #ifdef DEVELOPER
12171 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12172 {
12173 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12174 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12175 }
12176 #endif
12177 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12178 }
12179 }
12180
12183 {
12184 int item_count = 0;
12186
12187 GameInventory inventory = GetInventory();
12188 CargoBase cargo = inventory.
GetCargo();
12189 if (cargo != NULL)
12190 {
12192 }
12193
12195 for (int i = 0; i < nAttachments; ++i)
12196 {
12198 if (item)
12199 item_count += item.GetNumberOfItems();
12200 }
12201 return item_count;
12202 }
12203
12206 {
12207 float weight = 0;
12208 float wetness = 1;
12209 if (include_wetness)
12212 {
12213 weight = wetness * m_ConfigWeight;
12214 }
12216 {
12217 weight = 1;
12218 }
12219 return weight;
12220 }
12221
12222
12223
12225 {
12226 GameInventory inventory = GetInventory();
12227 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12228 {
12229 array<EntityAI> items = new array<EntityAI>;
12231 for (int i = 0; i < items.Count(); ++i)
12232 {
12234 if (item)
12235 {
12236 g_Game.ObjectDelete(item);
12237 }
12238 }
12239 }
12240 }
12241
12242
12243
12244
12246 {
12247 float energy = 0;
12248 if (HasEnergyManager())
12249 {
12250 energy = GetCompEM().GetEnergy();
12251 }
12252 return energy;
12253 }
12254
12255
12257 {
12258 super.OnEnergyConsumed();
12259
12261 }
12262
12264 {
12265 super.OnEnergyAdded();
12266
12268 }
12269
12270
12272 {
12273 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12274 {
12276 {
12277 float energy_0to1 = GetCompEM().GetEnergy0To1();
12279 }
12280 }
12281 }
12282
12283
12285 {
12286 return ConfigGetFloat("heatIsolation");
12287 }
12288
12290 {
12292 }
12293
12295 {
12296 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12297 if (
g_Game.ConfigIsExisting(paramPath))
12298 return g_Game.ConfigGetFloat(paramPath);
12299
12300 return 0.0;
12301 }
12302
12304 {
12305 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12306 if (
g_Game.ConfigIsExisting(paramPath))
12307 return g_Game.ConfigGetFloat(paramPath);
12308
12309 return 0.0;
12310 }
12311
12312 override void SetWet(
float value,
bool allow_client =
false)
12313 {
12314 if (!IsServerCheck(allow_client))
12315 return;
12316
12319
12321
12322 m_VarWet = Math.Clamp(value, min, max);
12323
12325 {
12328 }
12329 }
12330
12331 override void AddWet(
float value)
12332 {
12334 }
12335
12337 {
12339 }
12340
12342 {
12344 }
12345
12347 {
12349 }
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12361 override void OnWetChanged(
float newVal,
float oldVal)
12362 {
12365 if (newLevel != oldLevel)
12366 {
12368 }
12369 }
12370
12372 {
12373 SetWeightDirty();
12374 }
12375
12377 {
12378 return GetWetLevelInternal(
m_VarWet);
12379 }
12380
12381
12382
12384 {
12386 }
12387
12389 {
12391 }
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12403
12404
12406 {
12407 if (ConfigIsExisting("itemModelLength"))
12408 {
12409 return ConfigGetFloat("itemModelLength");
12410 }
12411 return 0;
12412 }
12413
12415 {
12416 if (ConfigIsExisting("itemAttachOffset"))
12417 {
12418 return ConfigGetFloat("itemAttachOffset");
12419 }
12420 return 0;
12421 }
12422
12423 override void SetCleanness(
int value,
bool allow_client =
false)
12424 {
12425 if (!IsServerCheck(allow_client))
12426 return;
12427
12429
12431
12434 }
12435
12437 {
12439 }
12440
12442 {
12443 return true;
12444 }
12445
12446
12447
12448
12450 {
12452 }
12453
12455 {
12457 }
12458
12459
12460
12461
12462 override void SetColor(
int r,
int g,
int b,
int a)
12463 {
12469 }
12471 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12472 {
12477 }
12478
12480 {
12482 }
12483
12486 {
12487 int r,g,b,a;
12489 r = r/255;
12490 g = g/255;
12491 b = b/255;
12492 a = a/255;
12493 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12494 }
12495
12496
12497
12498 override void SetLiquidType(
int value,
bool allow_client =
false)
12499 {
12500 if (!IsServerCheck(allow_client))
12501 return;
12502
12507 }
12508
12510 {
12511 return ConfigGetInt("varLiquidTypeInit");
12512 }
12513
12515 {
12517 }
12518
12520 {
12522 SetFrozen(false);
12523 }
12524
12527 {
12528 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12529 }
12530
12531
12534 {
12535 PlayerBase nplayer;
12536 if (PlayerBase.CastTo(nplayer, player))
12537 {
12539 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12540 }
12541 }
12542
12543
12546 {
12547 PlayerBase nplayer;
12548 if (PlayerBase.CastTo(nplayer,player))
12549 {
12550 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12551 }
12552
12553 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12554
12555 if (HasEnergyManager())
12556 {
12557 GetCompEM().UpdatePlugState();
12558 }
12559 }
12560
12561
12563 {
12564 super.OnPlacementStarted(player);
12565
12567 }
12568
12569 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12570 {
12572 {
12573 m_AdminLog.OnPlacementComplete(player,
this);
12574 }
12575
12576 super.OnPlacementComplete(player, position, orientation);
12577 }
12578
12579
12580
12581
12582
12584 {
12586 {
12587 return true;
12588 }
12589 else
12590 {
12591 return false;
12592 }
12593 }
12594
12595
12597 {
12599 {
12601 }
12602 }
12603
12604
12606 {
12608 }
12609
12611 {
12613 }
12614
12615 override void InsertAgent(
int agent,
float count = 1)
12616 {
12617 if (count < 1)
12618 return;
12619
12621 }
12622
12625 {
12627 }
12628
12629
12631 {
12633 }
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12677 {
12679 return false;
12680 return true;
12681 }
12682
12684 {
12685
12687 }
12688
12689
12692 {
12693 super.CheckForRoofLimited(timeTresholdMS);
12694
12695 float time =
g_Game.GetTime();
12696 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12697 {
12698 m_PreviousRoofTestTime = time;
12699 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12700 }
12701 }
12702
12703
12705 {
12707 {
12708 return 0;
12709 }
12710
12711 if (GetInventory().GetAttachmentSlotsCount() != 0)
12712 {
12713 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12714 if (filter)
12715 return filter.GetProtectionLevel(type, false, system);
12716 else
12717 return 0;
12718 }
12719
12720 string subclassPath, entryName;
12721
12722 switch (type)
12723 {
12725 entryName = "biological";
12726 break;
12728 entryName = "chemical";
12729 break;
12730 default:
12731 entryName = "biological";
12732 break;
12733 }
12734
12735 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12736
12737 return g_Game.ConfigGetFloat(subclassPath + entryName);
12738 }
12739
12740
12741
12744 {
12745 if (!IsMagazine())
12747
12749 }
12750
12751
12752
12753
12754
12759 {
12760 return true;
12761 }
12762
12764 {
12766 }
12767
12768
12769
12770
12771
12773 {
12774 if (parent)
12775 {
12776 if (parent.IsInherited(DayZInfected))
12777 return true;
12778
12779 if (!parent.IsRuined())
12780 return true;
12781 }
12782
12783 return true;
12784 }
12785
12787 {
12788 if (!super.CanPutAsAttachment(parent))
12789 {
12790 return false;
12791 }
12792
12793 if (!IsRuined() && !parent.IsRuined())
12794 {
12795 return true;
12796 }
12797
12798 return false;
12799 }
12800
12802 {
12803
12804
12805
12806
12807 return super.CanReceiveItemIntoCargo(item);
12808 }
12809
12811 {
12812
12813
12814
12815
12816 GameInventory attachmentInv = attachment.GetInventory();
12818 {
12819 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12820 return false;
12821 }
12822
12823 InventoryLocation loc = new InventoryLocation();
12824 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12825 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12826 return false;
12827
12828 return super.CanReceiveAttachment(attachment, slotId);
12829 }
12830
12832 {
12833 if (!super.CanReleaseAttachment(attachment))
12834 return false;
12835
12836 return GetInventory().AreChildrenAccessible();
12837 }
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12860 {
12861 int id = muzzle_owner.GetMuzzleID();
12862 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12863
12864 if (WPOF_array)
12865 {
12866 for (int i = 0; i < WPOF_array.Count(); i++)
12867 {
12868 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12869
12870 if (WPOF)
12871 {
12872 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12873 }
12874 }
12875 }
12876 }
12877
12878
12880 {
12881 int id = muzzle_owner.GetMuzzleID();
12883
12884 if (WPOBE_array)
12885 {
12886 for (int i = 0; i < WPOBE_array.Count(); i++)
12887 {
12888 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12889
12890 if (WPOBE)
12891 {
12892 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12893 }
12894 }
12895 }
12896 }
12897
12898
12900 {
12901 int id = muzzle_owner.GetMuzzleID();
12902 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12903
12904 if (WPOOH_array)
12905 {
12906 for (int i = 0; i < WPOOH_array.Count(); i++)
12907 {
12908 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12909
12910 if (WPOOH)
12911 {
12912 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12913 }
12914 }
12915 }
12916 }
12917
12918
12920 {
12921 int id = muzzle_owner.GetMuzzleID();
12922 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12923
12924 if (WPOOH_array)
12925 {
12926 for (int i = 0; i < WPOOH_array.Count(); i++)
12927 {
12928 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12929
12930 if (WPOOH)
12931 {
12932 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12933 }
12934 }
12935 }
12936 }
12937
12938
12940 {
12941 int id = muzzle_owner.GetMuzzleID();
12942 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12943
12944 if (WPOOH_array)
12945 {
12946 for (int i = 0; i < WPOOH_array.Count(); i++)
12947 {
12948 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12949
12950 if (WPOOH)
12951 {
12952 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12953 }
12954 }
12955 }
12956 }
12957
12958
12959
12961 {
12963 {
12964 return true;
12965 }
12966
12967 return false;
12968 }
12969
12971 {
12973 {
12974 return true;
12975 }
12976
12977 return false;
12978 }
12979
12981 {
12983 {
12984 return true;
12985 }
12986
12987 return false;
12988 }
12989
12991 {
12992 return false;
12993 }
12994
12997 {
12998 return UATimeSpent.DEFAULT_DEPLOY;
12999 }
13000
13001
13002
13003
13005 {
13007 SetSynchDirty();
13008 }
13009
13011 {
13013 }
13014
13015
13017 {
13018 return false;
13019 }
13020
13023 {
13024 string att_type = "None";
13025
13026 if (ConfigIsExisting("soundAttType"))
13027 {
13028 att_type = ConfigGetString("soundAttType");
13029 }
13030
13032 }
13033
13035 {
13037 }
13038
13039
13040
13041
13042
13048
13050 {
13053
13055 }
13056
13057
13059 {
13061 return;
13062
13064
13067
13070
13071 SoundParameters params = new SoundParameters();
13075 }
13076
13077
13079 {
13081 {
13084
13085 SetSynchDirty();
13086
13089 }
13090 }
13091
13093 {
13095 }
13096
13097
13099 {
13101 return;
13102
13104 SetSynchDirty();
13105
13108 }
13109
13111 {
13114 }
13115
13117 {
13119 }
13120
13121 void OnApply(PlayerBase player);
13122
13124 {
13125 return 1.0;
13126 };
13127
13129 {
13131 }
13132
13134 {
13136 }
13137
13139
13141 {
13142 SetDynamicPhysicsLifeTime(0.01);
13144 }
13145
13147 {
13148 array<string> zone_names = new array<string>;
13149 GetDamageZones(zone_names);
13150 for (int i = 0; i < zone_names.Count(); i++)
13151 {
13152 SetHealthMax(zone_names.Get(i),"Health");
13153 }
13154 SetHealthMax("","Health");
13155 }
13156
13159 {
13160 float global_health = GetHealth01("","Health");
13161 array<string> zones = new array<string>;
13162 GetDamageZones(zones);
13163
13164 for (int i = 0; i < zones.Count(); i++)
13165 {
13166 SetHealth01(zones.Get(i),"Health",global_health);
13167 }
13168 }
13169
13172 {
13173 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13174 }
13175
13177 {
13178 if (!hasRootAsPlayer)
13179 {
13180 if (refParentIB)
13181 {
13182
13183 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13184 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13185
13186 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13187 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13188
13191 }
13192 else
13193 {
13194
13197 }
13198 }
13199 }
13200
13202 {
13204 {
13205 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13206 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13207 {
13208 float heatPermCoef = 1.0;
13210 while (ent)
13211 {
13212 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13213 ent = ent.GetHierarchyParent();
13214 }
13215
13216 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13217 }
13218 }
13219 }
13220
13222 {
13223
13224 EntityAI parent = GetHierarchyParent();
13225 if (!parent)
13226 {
13227 hasParent = false;
13228 hasRootAsPlayer = false;
13229 }
13230 else
13231 {
13232 hasParent = true;
13233 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13234 refParentIB =
ItemBase.Cast(parent);
13235 }
13236 }
13237
13238 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13239 {
13240
13241 }
13242
13244 {
13245
13246 return false;
13247 }
13248
13250 {
13251
13252
13253 return false;
13254 }
13255
13257 {
13258
13259 return false;
13260 }
13261
13264 {
13265 return !GetIsFrozen() &&
IsOpen();
13266 }
13267
13269 {
13270 bool hasParent = false, hasRootAsPlayer = false;
13272
13273 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13274 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13275
13276 if (wwtu || foodDecay)
13277 {
13281
13282 if (processWetness || processTemperature || processDecay)
13283 {
13285
13286 if (processWetness)
13287 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13288
13289 if (processTemperature)
13291
13292 if (processDecay)
13293 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13294 }
13295 }
13296 }
13297
13300 {
13302 }
13303
13305 {
13308
13309 return super.GetTemperatureFreezeThreshold();
13310 }
13311
13313 {
13316
13317 return super.GetTemperatureThawThreshold();
13318 }
13319
13321 {
13324
13325 return super.GetItemOverheatThreshold();
13326 }
13327
13329 {
13331 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13332
13333 return super.GetTemperatureFreezeTime();
13334 }
13335
13337 {
13339 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13340
13341 return super.GetTemperatureThawTime();
13342 }
13343
13348
13350 {
13351 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13352 }
13353
13355 {
13356 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13357 }
13358
13361 {
13363 }
13364
13366 {
13368 }
13369
13371 {
13373 }
13374
13377 {
13378 return null;
13379 }
13380
13383 {
13384 return false;
13385 }
13386
13388 {
13390 {
13393 if (!trg)
13394 {
13396 explosive = this;
13397 }
13398
13399 explosive.PairRemote(trg);
13401
13402 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13403 trg.SetPersistentPairID(persistentID);
13404 explosive.SetPersistentPairID(persistentID);
13405
13406 return true;
13407 }
13408 return false;
13409 }
13410
13413 {
13414 float ret = 1.0;
13417 ret *= GetHealth01();
13418
13419 return ret;
13420 }
13421
13422 #ifdef DEVELOPER
13423 override void SetDebugItem()
13424 {
13425 super.SetDebugItem();
13426 _itemBase = this;
13427 }
13428
13430 {
13431 string text = super.GetDebugText();
13432
13434 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13435
13436 return text;
13437 }
13438 #endif
13439
13441 {
13442 return true;
13443 }
13444
13446
13448
13450 {
13453 }
13454
13455
13463
13479
13480 [
Obsolete(
"Use ItemSoundHandler instead")]
13483 {
13484 if (!
g_Game.IsDedicatedServer())
13485 {
13486 if (ConfigIsExisting("attachSoundSet"))
13487 {
13488 string cfg_path = "";
13489 string soundset = "";
13490 string type_name =
GetType();
13491
13494 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13495 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13496
13497 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13498 {
13499 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13500 {
13501 if (cfg_slot_array[i] == slot_type)
13502 {
13503 soundset = cfg_soundset_array[i];
13504 break;
13505 }
13506 }
13507 }
13508
13509 if (soundset != "")
13510 {
13511 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13513 }
13514 }
13515 }
13516 }
13517
13519}
13520
13522{
13524 if (entity)
13525 {
13526 bool is_item = entity.IsInherited(
ItemBase);
13527 if (is_item && full_quantity)
13528 {
13531 }
13532 }
13533 else
13534 {
13536 return NULL;
13537 }
13538 return entity;
13539}
13540
13542{
13543 if (item)
13544 {
13545 if (health > 0)
13546 item.SetHealth("", "", health);
13547
13548 if (item.CanHaveTemperature())
13549 {
13551 if (item.CanFreeze())
13552 item.SetFrozen(false);
13553 }
13554
13555 if (item.HasEnergyManager())
13556 {
13557 if (quantity >= 0)
13558 {
13559 item.GetCompEM().SetEnergy0To1(quantity);
13560 }
13561 else
13562 {
13564 }
13565 }
13566 else if (item.IsMagazine())
13567 {
13568 Magazine mag = Magazine.Cast(item);
13569 if (quantity >= 0)
13570 {
13571 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13572 }
13573 else
13574 {
13576 }
13577
13578 }
13579 else
13580 {
13581 if (quantity >= 0)
13582 {
13583 item.SetQuantityNormalized(quantity, false);
13584 }
13585 else
13586 {
13588 }
13589
13590 }
13591 }
13592}
13593
13594#ifdef DEVELOPER
13596#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.