8593{
8595 {
8596 return true;
8597 }
8598};
8599
8600
8601
8603{
8607
8609
8612
8613
8614
8615
8616
8625
8631
8636
8641
8662 protected bool m_IsResultOfSplit
8663
8665
8670
8671
8672
8674
8678
8679
8680
8682
8685
8686
8687
8693
8694
8702
8705
8706
8708
8709
8711
8712
8717
8718
8723
8724
8726
8727
8729 {
8734
8735 if (!
GetGame().IsDedicatedServer())
8736 {
8738 {
8740
8742 {
8744 }
8745 }
8746
8749 }
8750
8751 m_OldLocation = null;
8752
8754 {
8756 }
8757
8758 if (ConfigIsExisting("headSelectionsToHide"))
8759 {
8762 }
8763
8765 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8766 {
8768 }
8769
8771
8772 m_IsResultOfSplit = false;
8773
8775 }
8776
8778 {
8779 super.InitItemVariables();
8780
8786 m_Count = ConfigGetInt(
"count");
8787
8790
8795
8798
8803
8815
8819
8820
8823 if (ConfigIsExisting("canBeSplit"))
8824 {
8827 }
8828
8830 if (ConfigIsExisting("itemBehaviour"))
8832
8833
8836 RegisterNetSyncVariableInt("m_VarLiquidType");
8837 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8838
8839 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8840 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8841 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8842
8843 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8844 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8845 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8846 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8847
8848 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8849 RegisterNetSyncVariableBool("m_IsTakeable");
8850 RegisterNetSyncVariableBool("m_IsHologram");
8851
8854 {
8857 }
8858
8860
8862 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8864
8865 }
8866
8868 {
8870 }
8871
8873 {
8876 {
8881 }
8882 }
8883
8884 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8885 {
8887 {
8890 }
8891
8893 }
8894
8896 {
8902 }
8903
8905
8907 {
8909
8910 if (!action)
8911 {
8912 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8913 return;
8914 }
8915
8917 if (!ai)
8918 {
8920 return;
8921 }
8922
8924 if (!action_array)
8925 {
8926 action_array = new array<ActionBase_Basic>;
8928 }
8929 if (LogManager.IsActionLogEnable())
8930 {
8931 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8932 }
8933
8934 if (action_array.Find(action) != -1)
8935 {
8936 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8937 }
8938 else
8939 {
8940 action_array.Insert(action);
8941 }
8942 }
8943
8945 {
8947 ActionBase action = player.GetActionManager().GetAction(actionName);
8950
8951 if (action_array)
8952 {
8953 action_array.RemoveItem(action);
8954 }
8955 }
8956
8957
8958
8960 {
8961 ActionOverrideData overrideData = new ActionOverrideData();
8965
8967 if (!actionMap)
8968 {
8971 }
8972
8973 actionMap.Insert(this.
Type(), overrideData);
8974
8975 }
8976
8978
8980
8981
8983 {
8986
8989
8990 string config_to_search = "CfgVehicles";
8991 string muzzle_owner_config;
8992
8994 {
8995 if (IsInherited(Weapon))
8996 config_to_search = "CfgWeapons";
8997
8998 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8999
9000 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9001
9003
9004 if (config_OnFire_subclass_count > 0)
9005 {
9006 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9007
9008 for (int i = 0; i < config_OnFire_subclass_count; i++)
9009 {
9010 string particle_class = "";
9012 string config_OnFire_entry = config_OnFire_class + particle_class;
9013 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9014 WPOF_array.Insert(WPOF);
9015 }
9016
9017
9019 }
9020 }
9021
9023 {
9024 config_to_search = "CfgWeapons";
9025 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9026
9027 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9028
9030
9031 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9032 {
9033 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9034
9035 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9036 {
9037 string particle_class2 = "";
9039 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9040 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9041 WPOBE_array.Insert(WPOBE);
9042 }
9043
9044
9046 }
9047 }
9048 }
9049
9050
9052 {
9055
9057 {
9058 string config_to_search = "CfgVehicles";
9059
9060 if (IsInherited(Weapon))
9061 config_to_search = "CfgWeapons";
9062
9063 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9064 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9065
9066 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9067 {
9068
9070
9072 {
9074 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9076 return;
9077 }
9078
9081
9082
9083
9085 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9086
9087 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9088 {
9089 string particle_class = "";
9091 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9093
9094 if (entry_type == CT_CLASS)
9095 {
9096 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9097 WPOOH_array.Insert(WPOF);
9098 }
9099 }
9100
9101
9103 }
9104 }
9105 }
9106
9108 {
9110 }
9111
9113 {
9115 {
9117
9120
9123
9124 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9125 }
9126 }
9127
9129 {
9131 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9132
9134 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9135
9137 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9138
9140 {
9142 }
9143 }
9144
9146 {
9148 }
9149
9151 {
9154 else
9156
9158 {
9161 }
9162 else
9163 {
9166
9169 }
9170
9172 }
9173
9175 {
9177 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9178 }
9179
9181 {
9183 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9185 }
9186
9188 {
9190 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9191 }
9192
9194 {
9197
9198 OverheatingParticle OP = new OverheatingParticle();
9203
9205 }
9206
9208 {
9211
9212 return -1;
9213 }
9214
9216 {
9218 {
9221
9222 for (int i = count; i > 0; --i)
9223 {
9224 int id = i - 1;
9227
9230
9231 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9232 {
9233 if (p)
9234 {
9237 }
9238 }
9239 }
9240 }
9241 }
9242
9244 {
9246 {
9248 {
9249 int id = i - 1;
9251
9252 if (OP)
9253 {
9255
9256 if (p)
9257 {
9259 }
9260
9261 delete OP;
9262 }
9263 }
9264
9267 }
9268 }
9269
9272 {
9273 return 0.0;
9274 }
9275
9276
9278 {
9279 return 250;
9280 }
9281
9283 {
9284 return 0;
9285 }
9286
9289 {
9291 return true;
9292
9293 return false;
9294 }
9295
9298 {
9301
9303 {
9305 }
9306 else
9307 {
9308
9310 }
9311
9313 }
9314
9321 {
9322 return -1;
9323 }
9324
9325
9326
9327
9329 {
9331 {
9333 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9334
9335 if (r_index >= 0)
9336 {
9337 InventoryLocation r_il = new InventoryLocation;
9338 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9339
9340 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9343 {
9344 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9345 }
9347 {
9348 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9349 }
9350
9351 }
9352
9353 player.GetHumanInventory().ClearUserReservedLocation(this);
9354 }
9355
9358 }
9359
9360
9361
9362
9364 {
9365 return ItemBase.m_DebugActionsMask;
9366 }
9367
9369 {
9370 return ItemBase.m_DebugActionsMask & mask;
9371 }
9372
9374 {
9375 ItemBase.m_DebugActionsMask = mask;
9376 }
9377
9379 {
9380 ItemBase.m_DebugActionsMask |= mask;
9381 }
9382
9384 {
9385 ItemBase.m_DebugActionsMask &= ~mask;
9386 }
9387
9389 {
9391 {
9393 }
9394 else
9395 {
9397 }
9398 }
9399
9400
9402 {
9403 if (GetEconomyProfile())
9404 {
9405 float q_max = GetEconomyProfile().GetQuantityMax();
9406 if (q_max > 0)
9407 {
9408 float q_min = GetEconomyProfile().GetQuantityMin();
9409 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9410
9412 {
9413 ComponentEnergyManager comp = GetCompEM();
9415 {
9417 }
9418 }
9420 {
9422
9423 }
9424
9425 }
9426 }
9427 }
9428
9431 {
9432 EntityAI parent = GetHierarchyParent();
9433
9434 if (parent)
9435 {
9436 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9437 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9438 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9439 }
9440 }
9441
9444 {
9445 EntityAI parent = GetHierarchyParent();
9446
9447 if (parent)
9448 {
9449 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9450 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9451 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9452 }
9453 }
9454
9456 {
9457
9458
9459
9460
9462
9464 {
9465 if (ScriptInputUserData.CanStoreInputUserData())
9466 {
9467 ScriptInputUserData ctx = new ScriptInputUserData;
9473 ctx.
Write(use_stack_max);
9476
9478 {
9479 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9480 }
9481 }
9482 }
9483 else if (!
GetGame().IsMultiplayer())
9484 {
9486 }
9487 }
9488
9490 {
9492 }
9493
9495 {
9497 }
9498
9500 {
9502 }
9503
9505 {
9506
9507 return false;
9508 }
9509
9511 {
9512 return false;
9513 }
9514
9518 {
9519 return false;
9520 }
9521
9523 {
9524 return "";
9525 }
9526
9528
9530 {
9531 return false;
9532 }
9533
9535 {
9536 return true;
9537 }
9538
9539
9540
9542 {
9543 return true;
9544 }
9545
9547 {
9548 return true;
9549 }
9550
9552 {
9553 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9555 }
9556
9558 {
9560 }
9561
9563 {
9565 if (!is_being_placed)
9567 SetSynchDirty();
9568 }
9569
9570
9572
9574 {
9576 }
9577
9579 {
9581 }
9582
9584 {
9585 return 1;
9586 }
9587
9589 {
9590 return false;
9591 }
9592
9594 {
9596 SetSynchDirty();
9597 }
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9634 {
9635 super.OnMovedInsideCargo(container);
9636
9637 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9638 }
9639
9640 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9641 {
9642 super.EEItemLocationChanged(oldLoc,newLoc);
9643
9644 PlayerBase new_player = null;
9645 PlayerBase old_player = null;
9646
9647 if (newLoc.GetParent())
9648 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9649
9650 if (oldLoc.GetParent())
9651 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9652
9654 {
9655 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9656
9657 if (r_index >= 0)
9658 {
9659 InventoryLocation r_il = new InventoryLocation;
9660 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9661
9662 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9665 {
9666 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9667 }
9669 {
9670 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9671 }
9672
9673 }
9674 }
9675
9677 {
9678 if (new_player)
9679 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9680
9681 if (new_player == old_player)
9682 {
9683
9684 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9685 {
9687 {
9688 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9689 {
9690 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9691 }
9692 }
9693 else
9694 {
9695 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9696 }
9697 }
9698
9699 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9700 {
9701 int type = oldLoc.GetType();
9703 {
9704 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9705 }
9707 {
9708 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9709 }
9710 }
9711 if (!m_OldLocation)
9712 {
9713 m_OldLocation = new InventoryLocation;
9714 }
9715 m_OldLocation.Copy(oldLoc);
9716 }
9717 else
9718 {
9719 if (m_OldLocation)
9720 {
9721 m_OldLocation.Reset();
9722 }
9723 }
9724
9726 }
9727 else
9728 {
9729 if (new_player)
9730 {
9731 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9732 if (res_index >= 0)
9733 {
9734 InventoryLocation il = new InventoryLocation;
9735 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9737 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9740 {
9741 il.
GetParent().GetOnReleaseLock().Invoke(it);
9742 }
9744 {
9746 }
9747
9748 }
9749 }
9751 {
9752
9754 }
9755
9756 if (m_OldLocation)
9757 {
9758 m_OldLocation.Reset();
9759 }
9760 }
9761 }
9762
9763 override void EOnContact(IEntity other, Contact extra)
9764 {
9766 {
9767 int liquidType = -1;
9769 if (impactSpeed > 0.0)
9770 {
9772 #ifndef SERVER
9774 #else
9776 SetSynchDirty();
9777 #endif
9779 }
9780 }
9781
9782 #ifdef SERVER
9783 if (GetCompEM() && GetCompEM().IsPlugged())
9784 {
9785 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9786 GetCompEM().UnplugThis();
9787 }
9788 #endif
9789 }
9790
9792
9794 {
9796 }
9797
9799 {
9800
9801 }
9802
9804 {
9805 super.OnItemLocationChanged(old_owner, new_owner);
9806
9807 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9808 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9809
9810 if (!relatedPlayer && playerNew)
9811 relatedPlayer = playerNew;
9812
9813 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9814 {
9816 if (actionMgr)
9817 {
9818 ActionBase currentAction = actionMgr.GetRunningAction();
9819 if (currentAction)
9821 }
9822 }
9823
9824 Man ownerPlayerOld = null;
9825 Man ownerPlayerNew = null;
9826
9827 if (old_owner)
9828 {
9829 if (old_owner.
IsMan())
9830 {
9831 ownerPlayerOld = Man.Cast(old_owner);
9832 }
9833 else
9834 {
9835 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9836 }
9837 }
9838 else
9839 {
9841 {
9843
9844 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9845 {
9846 GetCompEM().UnplugThis();
9847 }
9848 }
9849 }
9850
9851 if (new_owner)
9852 {
9853 if (new_owner.
IsMan())
9854 {
9855 ownerPlayerNew = Man.Cast(new_owner);
9856 }
9857 else
9858 {
9859 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9860 }
9861 }
9862
9863 if (ownerPlayerOld != ownerPlayerNew)
9864 {
9865 if (ownerPlayerOld)
9866 {
9867 array<EntityAI> subItemsExit = new array<EntityAI>;
9869 for (int i = 0; i < subItemsExit.Count(); i++)
9870 {
9873 }
9874 }
9875
9876 if (ownerPlayerNew)
9877 {
9878 array<EntityAI> subItemsEnter = new array<EntityAI>;
9880 for (int j = 0; j < subItemsEnter.Count(); j++)
9881 {
9884 }
9885 }
9886 }
9887 else if (ownerPlayerNew != null)
9888 {
9889 PlayerBase nplayer;
9890 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9891 {
9892 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9894 for (int k = 0; k < subItemsUpdate.Count(); k++)
9895 {
9897 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9898 }
9899 }
9900 }
9901
9902 if (old_owner)
9903 old_owner.OnChildItemRemoved(this);
9904 if (new_owner)
9905 new_owner.OnChildItemReceived(this);
9906 }
9907
9908
9910 {
9911 super.EEDelete(parent);
9912 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9913 if (player)
9914 {
9916
9917 if (player.IsAlive())
9918 {
9919 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9920 if (r_index >= 0)
9921 {
9922 InventoryLocation r_il = new InventoryLocation;
9923 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9924
9925 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9928 {
9929 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9930 }
9932 {
9933 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9934 }
9935
9936 }
9937
9938 player.RemoveQuickBarEntityShortcut(this);
9939 }
9940 }
9941 }
9942
9944 {
9945 super.EEKilled(killer);
9946
9949 {
9950 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9951 {
9952 if (IsMagazine())
9953 {
9954 if (Magazine.Cast(this).GetAmmoCount() > 0)
9955 {
9957 }
9958 }
9959 else
9960 {
9962 }
9963 }
9964 }
9965 }
9966
9968 {
9969 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9970
9971 super.OnWasAttached(parent, slot_id);
9972
9975
9977 }
9978
9980 {
9981 super.OnWasDetached(parent, slot_id);
9982
9985 }
9986
9988 {
9989 int idx;
9992
9993 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9994 if (inventory_slots.Count() < 1)
9995 {
9996 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9997 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9998 }
9999 else
10000 {
10001 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10002 }
10003
10004 idx = inventory_slots.Find(slot);
10005 if (idx < 0)
10006 return "";
10007
10008 return attach_types.Get(idx);
10009 }
10010
10012 {
10013 int idx = -1;
10014 string slot;
10015
10018
10019 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10020 if (inventory_slots.Count() < 1)
10021 {
10022 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10023 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10024 }
10025 else
10026 {
10027 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10028 if (detach_types.Count() < 1)
10029 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10030 }
10031
10032 for (int i = 0; i < inventory_slots.Count(); i++)
10033 {
10034 slot = inventory_slots.Get(i);
10035 }
10036
10037 if (slot != "")
10038 {
10039 if (detach_types.Count() == 1)
10040 idx = 0;
10041 else
10042 idx = inventory_slots.Find(slot);
10043 }
10044 if (idx < 0)
10045 return "";
10046
10047 return detach_types.Get(idx);
10048 }
10049
10051 {
10052
10054
10055
10056 float min_time = 1;
10057 float max_time = 3;
10058 float delay = Math.RandomFloat(min_time, max_time);
10059
10060 explode_timer.Run(delay, this, "DoAmmoExplosion");
10061 }
10062
10064 {
10065 Magazine magazine = Magazine.Cast(this);
10066 int pop_sounds_count = 6;
10067 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10068
10069
10070 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10071 string sound_name = pop_sounds[ sound_idx ];
10073
10074
10075 magazine.ServerAddAmmoCount(-1);
10076
10077
10078 float min_temp_to_explode = 100;
10079
10080 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10081 {
10083 }
10084 }
10085
10086
10087 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10088 {
10089 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10090
10091 const int CHANCE_DAMAGE_CARGO = 4;
10092 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10093 const int CHANCE_DAMAGE_NOTHING = 2;
10094
10096 {
10097 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10098 int chances;
10099 int rnd;
10100
10101 if (GetInventory().GetCargo())
10102 {
10103 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10104 rnd = Math.RandomInt(0,chances);
10105
10106 if (rnd < CHANCE_DAMAGE_CARGO)
10107 {
10109 }
10110 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10111 {
10113 }
10114 }
10115 else
10116 {
10117 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10118 rnd = Math.RandomInt(0,chances);
10119
10120 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10121 {
10123 }
10124 }
10125 }
10126 }
10127
10129 {
10130 if (GetInventory().GetCargo())
10131 {
10132 int item_count = GetInventory().GetCargo().GetItemCount();
10133 if (item_count > 0)
10134 {
10135 int random_pick = Math.RandomInt(0, item_count);
10137 if (!item.IsExplosive())
10138 {
10139 item.AddHealth("","",damage);
10140 return true;
10141 }
10142 }
10143 }
10144 return false;
10145 }
10146
10148 {
10149 int attachment_count = GetInventory().AttachmentCount();
10150 if (attachment_count > 0)
10151 {
10152 int random_pick = Math.RandomInt(0, attachment_count);
10153 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10154 if (!attachment.IsExplosive())
10155 {
10156 attachment.AddHealth("","",damage);
10157 return true;
10158 }
10159 }
10160 return false;
10161 }
10162
10164 {
10166 }
10167
10169 {
10171 return GetInventory().CanRemoveEntity();
10172
10173 return false;
10174 }
10175
10177 {
10178
10180 return false;
10181
10182
10184 return false;
10185
10186
10187
10189 if (delta == 0)
10190 return false;
10191
10192
10193 return true;
10194 }
10195
10197 {
10199 {
10200 if (ScriptInputUserData.CanStoreInputUserData())
10201 {
10202 ScriptInputUserData ctx = new ScriptInputUserData;
10207 ctx.
Write(destination_entity);
10209 ctx.
Write(slot_id);
10211 }
10212 }
10213 else if (!
GetGame().IsMultiplayer())
10214 {
10216 }
10217 }
10218
10220 {
10221 float split_quantity_new;
10225 InventoryLocation loc = new InventoryLocation;
10226
10227 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10228 {
10230 split_quantity_new = stack_max;
10231 else
10233
10235 {
10236 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10237 if (new_item)
10238 {
10239 new_item.SetResultOfSplit(true);
10240 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10242 new_item.
SetQuantity(split_quantity_new,
false,
true);
10243 }
10244 }
10245 }
10246 else if (destination_entity && slot_id == -1)
10247 {
10248 if (quantity > stack_max)
10249 split_quantity_new = stack_max;
10250 else
10251 split_quantity_new = quantity;
10252
10254 {
10256 {
10259 }
10260
10261 if (new_item)
10262 {
10263 new_item.SetResultOfSplit(true);
10264 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10266 new_item.
SetQuantity(split_quantity_new,
false,
true);
10267 }
10268 }
10269 }
10270 else
10271 {
10272 if (stack_max != 0)
10273 {
10275 {
10277 }
10278
10279 if (split_quantity_new == 0)
10280 {
10281 if (!
GetGame().IsMultiplayer())
10282 player.PhysicalPredictiveDropItem(this);
10283 else
10284 player.ServerDropEntity(this);
10285 return;
10286 }
10287
10289 {
10291
10292 if (new_item)
10293 {
10294 new_item.SetResultOfSplit(true);
10295 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10298 new_item.PlaceOnSurface();
10299 }
10300 }
10301 }
10302 }
10303 }
10304
10306 {
10307 float split_quantity_new;
10311 InventoryLocation loc = new InventoryLocation;
10312
10313 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10314 {
10316 split_quantity_new = stack_max;
10317 else
10319
10321 {
10322 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10323 if (new_item)
10324 {
10325 new_item.SetResultOfSplit(true);
10326 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10328 new_item.
SetQuantity(split_quantity_new,
false,
true);
10329 }
10330 }
10331 }
10332 else if (destination_entity && slot_id == -1)
10333 {
10334 if (quantity > stack_max)
10335 split_quantity_new = stack_max;
10336 else
10337 split_quantity_new = quantity;
10338
10340 {
10342 {
10345 }
10346
10347 if (new_item)
10348 {
10349 new_item.SetResultOfSplit(true);
10350 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10352 new_item.
SetQuantity(split_quantity_new,
false,
true);
10353 }
10354 }
10355 }
10356 else
10357 {
10358 if (stack_max != 0)
10359 {
10361 {
10363 }
10364
10366 {
10368
10369 if (new_item)
10370 {
10371 new_item.SetResultOfSplit(true);
10372 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10375 new_item.PlaceOnSurface();
10376 }
10377 }
10378 }
10379 }
10380 }
10381
10383 {
10385 {
10386 if (ScriptInputUserData.CanStoreInputUserData())
10387 {
10388 ScriptInputUserData ctx = new ScriptInputUserData;
10393 dst.WriteToContext(ctx);
10395 }
10396 }
10397 else if (!
GetGame().IsMultiplayer())
10398 {
10400 }
10401 }
10402
10404 {
10406 {
10407 if (ScriptInputUserData.CanStoreInputUserData())
10408 {
10409 ScriptInputUserData ctx = new ScriptInputUserData;
10414 ctx.
Write(destination_entity);
10420 }
10421 }
10422 else if (!
GetGame().IsMultiplayer())
10423 {
10425 }
10426 }
10427
10429 {
10431 }
10432
10434 {
10436 float split_quantity_new;
10438 if (dst.IsValid())
10439 {
10440 int slot_id = dst.GetSlot();
10442
10443 if (quantity > stack_max)
10444 split_quantity_new = stack_max;
10445 else
10446 split_quantity_new = quantity;
10447
10449 {
10451
10452 if (new_item)
10453 {
10454 new_item.SetResultOfSplit(true);
10455 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10457 new_item.
SetQuantity(split_quantity_new,
false,
true);
10458 }
10459
10460 return new_item;
10461 }
10462 }
10463
10464 return null;
10465 }
10466
10468 {
10470 float split_quantity_new;
10472 if (destination_entity)
10473 {
10475 if (quantity > stackable)
10476 split_quantity_new = stackable;
10477 else
10478 split_quantity_new = quantity;
10479
10481 {
10482 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10483 if (new_item)
10484 {
10485 new_item.SetResultOfSplit(true);
10486 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10488 new_item.
SetQuantity(split_quantity_new,
false,
true);
10489 }
10490 }
10491 }
10492 }
10493
10495 {
10497 {
10498 if (ScriptInputUserData.CanStoreInputUserData())
10499 {
10500 ScriptInputUserData ctx = new ScriptInputUserData;
10505 ItemBase destination_entity =
this;
10506 ctx.
Write(destination_entity);
10510 }
10511 }
10512 else if (!
GetGame().IsMultiplayer())
10513 {
10515 }
10516 }
10517
10519 {
10521 float split_quantity_new;
10523 if (player)
10524 {
10526 if (quantity > stackable)
10527 split_quantity_new = stackable;
10528 else
10529 split_quantity_new = quantity;
10530
10532 {
10533 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10534 new_item =
ItemBase.Cast(in_hands);
10535 if (new_item)
10536 {
10537 new_item.SetResultOfSplit(true);
10538 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10540 new_item.SetQuantity(split_quantity_new, false, true);
10541 }
10542 }
10543 }
10544 }
10545
10547 {
10549 float split_quantity_new = Math.Floor(quantity * 0.5);
10550
10552 return;
10553
10555
10556 if (new_item)
10557 {
10558 if (new_item.GetQuantityMax() < split_quantity_new)
10559 {
10560 split_quantity_new = new_item.GetQuantityMax();
10561 }
10562
10563 new_item.SetResultOfSplit(true);
10564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10565
10567 {
10570 }
10571 else
10572 {
10574 new_item.
SetQuantity(split_quantity_new,
false,
true);
10575 }
10576 }
10577 }
10578
10580 {
10582 float split_quantity_new = Math.Floor(quantity / 2);
10583
10585 return;
10586
10587 InventoryLocation invloc = new InventoryLocation;
10589
10591 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10592
10593 if (new_item)
10594 {
10595 if (new_item.GetQuantityMax() < split_quantity_new)
10596 {
10597 split_quantity_new = new_item.GetQuantityMax();
10598 }
10600 {
10603 }
10604 else if (split_quantity_new > 1)
10605 {
10607 new_item.
SetQuantity(split_quantity_new,
false,
true);
10608 }
10609 }
10610 }
10611
10614 {
10615 SetWeightDirty();
10617
10618 if (parent)
10619 parent.OnAttachmentQuantityChangedEx(this, delta);
10620
10622 {
10624 {
10626 }
10628 {
10629 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10631 }
10632 }
10633
10634 }
10635
10638 {
10639
10640 }
10641
10644 {
10646 }
10647
10649 {
10650 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10651
10653 {
10654 if (newLevel == GameConstants.STATE_RUINED)
10655 {
10657 EntityAI parent = GetHierarchyParent();
10658 if (parent && parent.IsFireplace())
10659 {
10660 CargoBase cargo = GetInventory().GetCargo();
10661 if (cargo)
10662 {
10664 {
10666 }
10667 }
10668 }
10669 }
10670
10672 {
10673
10675 return;
10676 }
10677
10678 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10679 {
10681 }
10682 }
10683 }
10684
10685
10687 {
10688 super.OnRightClick();
10689
10691 {
10693 {
10694 if (ScriptInputUserData.CanStoreInputUserData())
10695 {
10696 EntityAI root = GetHierarchyRoot();
10697 Man playerOwner = GetHierarchyRootPlayer();
10698 InventoryLocation dst = new InventoryLocation;
10699
10700
10701 if (!playerOwner && root && root == this)
10702 {
10704 }
10705 else
10706 {
10707
10708 GetInventory().GetCurrentInventoryLocation(dst);
10710 {
10713 {
10715 }
10716 else
10717 {
10719
10720
10721 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10722 {
10724 }
10725 else
10726 {
10727 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10728 }
10729 }
10730 }
10731 }
10732
10733 ScriptInputUserData ctx = new ScriptInputUserData;
10741 }
10742 }
10743 else if (!
GetGame().IsMultiplayer())
10744 {
10746 }
10747 }
10748 }
10749
10751 {
10752 if (root)
10753 {
10754 vector m4[4];
10755 root.GetTransform(m4);
10756 dst.SetGround(this, m4);
10757 }
10758 else
10759 {
10760 GetInventory().GetCurrentInventoryLocation(dst);
10761 }
10762 }
10763
10764 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10765 {
10766
10767 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10768 return false;
10769
10770 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10771 return false;
10772
10773
10775 return false;
10776
10777
10778 Magazine mag = Magazine.Cast(this);
10779 if (mag)
10780 {
10781 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10782 return false;
10783
10784 if (stack_max_limit)
10785 {
10786 Magazine other_mag = Magazine.Cast(other_item);
10787 if (other_item)
10788 {
10789 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10790 return false;
10791 }
10792
10793 }
10794 }
10795 else
10796 {
10797
10799 return false;
10800
10802 return false;
10803 }
10804
10805 PlayerBase player = null;
10806 if (CastTo(player, GetHierarchyRootPlayer()))
10807 {
10808 if (player.GetInventory().HasAttachment(this))
10809 return false;
10810
10811 if (player.IsItemsToDelete())
10812 return false;
10813 }
10814
10815 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10816 return false;
10817
10818 int slotID;
10820 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10821 return false;
10822
10823 return true;
10824 }
10825
10827 {
10829 }
10830
10832 {
10833 return m_IsResultOfSplit;
10834 }
10835
10837 {
10838 m_IsResultOfSplit = value;
10839 }
10840
10842 {
10844 }
10845
10847 {
10848 float other_item_quantity = other_item.GetQuantity();
10849 float this_free_space;
10850
10852
10854
10855 if (other_item_quantity > this_free_space)
10856 {
10857 return this_free_space;
10858 }
10859 else
10860 {
10861 return other_item_quantity;
10862 }
10863 }
10864
10866 {
10868 }
10869
10871 {
10873 return;
10874
10875 if (!IsMagazine() && other_item)
10876 {
10878 if (quantity_used != 0)
10879 {
10880 float hp1 = GetHealth01("","");
10881 float hp2 = other_item.GetHealth01("","");
10882 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10883 hpResult = hpResult / (
GetQuantity() + quantity_used);
10884
10885 hpResult *= GetMaxHealth();
10886 Math.Round(hpResult);
10887 SetHealth("", "Health", hpResult);
10888
10890 other_item.AddQuantity(-quantity_used);
10891 }
10892 }
10894 }
10895
10897 {
10898 #ifdef SERVER
10899 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10900 GetHierarchyParent().IncreaseLifetimeUp();
10901 #endif
10902 };
10903
10905 {
10906 PlayerBase p = PlayerBase.Cast(player);
10907
10908 array<int> recipesIds = p.m_Recipes;
10909 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10910 if (moduleRecipesManager)
10911 {
10912 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10913 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10914 }
10915
10916 for (int i = 0;i < recipesIds.Count(); i++)
10917 {
10918 int key = recipesIds.Get(i);
10919 string recipeName = moduleRecipesManager.GetRecipeName(key);
10921 }
10922 }
10923
10924
10925 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10926 {
10927 super.GetDebugActions(outputList);
10928
10929
10935
10936
10941
10946
10947
10951
10952
10954 {
10958 }
10959
10962
10963
10967
10969
10970 InventoryLocation loc = new InventoryLocation();
10971 GetInventory().GetCurrentInventoryLocation(loc);
10973 {
10974 if (Gizmo_IsSupported())
10977 }
10978
10980 }
10981
10982
10983
10984
10986 {
10987 super.OnAction(action_id, player, ctx);
10988
10990 {
10991 switch (action_id)
10992 {
10995 return true;
10998 return true;
10999 }
11000 }
11001
11003 {
11004 switch (action_id)
11005 {
11007 Delete();
11008 return true;
11009 }
11010 }
11011
11012 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11013 {
11014 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11015 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11016 PlayerBase p = PlayerBase.Cast(player);
11017 if (
EActions.RECIPES_RANGE_START < 1000)
11018 {
11019 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11020 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11021 }
11022 }
11023 #ifndef SERVER
11024 else if (action_id ==
EActions.WATCH_PLAYER)
11025 {
11026 PluginDeveloper.SetDeveloperItemClientEx(player);
11027 }
11028 #endif
11030 {
11031 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11032 {
11033 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11034 OnDebugButtonPressServer(id + 1);
11035 }
11036
11037 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11038 {
11039 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11041 }
11042
11043 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11044 {
11045 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11047 }
11048
11049 else if (action_id ==
EActions.ADD_QUANTITY)
11050 {
11051 if (IsMagazine())
11052 {
11053 Magazine mag = Magazine.Cast(this);
11054 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11055 }
11056 else
11057 {
11059 }
11060
11061 if (m_EM)
11062 {
11063 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11064 }
11065
11066 }
11067
11068 else if (action_id ==
EActions.REMOVE_QUANTITY)
11069 {
11070 if (IsMagazine())
11071 {
11072 Magazine mag2 = Magazine.Cast(this);
11073 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11074 }
11075 else
11076 {
11078 }
11079 if (m_EM)
11080 {
11081 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11082 }
11083
11084 }
11085
11086 else if (action_id ==
EActions.SET_QUANTITY_0)
11087 {
11089
11090 if (m_EM)
11091 {
11092 m_EM.SetEnergy(0);
11093 }
11094 }
11095
11096 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11097 {
11099
11100 if (m_EM)
11101 {
11102 m_EM.SetEnergy(m_EM.GetEnergyMax());
11103 }
11104 }
11105
11106 else if (action_id ==
EActions.ADD_HEALTH)
11107 {
11108 AddHealth("","",GetMaxHealth("","Health")/5);
11109 }
11110 else if (action_id ==
EActions.REMOVE_HEALTH)
11111 {
11112 AddHealth("","",-GetMaxHealth("","Health")/5);
11113 }
11114 else if (action_id ==
EActions.DESTROY_HEALTH)
11115 {
11116 SetHealth01("","",0);
11117 }
11118 else if (action_id ==
EActions.WATCH_ITEM)
11119 {
11121 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11122 #ifdef DEVELOPER
11123 SetDebugDeveloper_item(this);
11124 #endif
11125 }
11126
11127 else if (action_id ==
EActions.ADD_TEMPERATURE)
11128 {
11129 AddTemperature(20);
11130
11131 }
11132
11133 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11134 {
11135 AddTemperature(-20);
11136
11137 }
11138
11139 else if (action_id ==
EActions.FLIP_FROZEN)
11140 {
11141 SetFrozen(!GetIsFrozen());
11142
11143 }
11144
11145 else if (action_id ==
EActions.ADD_WETNESS)
11146 {
11148
11149 }
11150
11151 else if (action_id ==
EActions.REMOVE_WETNESS)
11152 {
11154
11155 }
11156
11157 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11158 {
11161
11162
11163 }
11164
11165 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11166 {
11169 }
11170
11171 else if (action_id ==
EActions.MAKE_SPECIAL)
11172 {
11173 auto debugParams = DebugSpawnParams.WithPlayer(player);
11174 OnDebugSpawnEx(debugParams);
11175 }
11176
11177 }
11178
11179
11180 return false;
11181 }
11182
11183
11184
11185
11189
11192
11193
11194
11196 {
11197 return false;
11198 }
11199
11200
11202 {
11203 return true;
11204 }
11205
11206
11208 {
11209 return true;
11210 }
11211
11212
11213
11215 {
11216 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11218 }
11219
11222 {
11223 return null;
11224 }
11225
11227 {
11228 return false;
11229 }
11230
11232 {
11233 return false;
11234 }
11235
11239
11240
11242 {
11243 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11244 return module_repairing.CanRepair(this, item_repair_kit);
11245 }
11246
11247
11248 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11249 {
11250 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11251 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11252 }
11253
11254
11256 {
11257
11258
11259
11260
11261
11262
11263
11264
11265 return 1;
11266 }
11267
11268
11269
11271 {
11273 }
11274
11275
11276
11278 {
11280 }
11281
11282
11291 {
11292 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11293
11294 if (player)
11295 {
11296 player.MessageStatus(text);
11297 }
11298 }
11299
11300
11309 {
11310 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11311
11312 if (player)
11313 {
11314 player.MessageAction(text);
11315 }
11316 }
11317
11318
11327 {
11328 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11329
11330 if (player)
11331 {
11332 player.MessageFriendly(text);
11333 }
11334 }
11335
11336
11345 {
11346 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11347
11348 if (player)
11349 {
11350 player.MessageImportant(text);
11351 }
11352 }
11353
11355 {
11356 return true;
11357 }
11358
11359
11360 override bool KindOf(
string tag)
11361 {
11362 bool found = false;
11363 string item_name = this.
GetType();
11366
11367 int array_size = item_tag_array.Count();
11368 for (int i = 0; i < array_size; i++)
11369 {
11370 if (item_tag_array.Get(i) == tag)
11371 {
11372 found = true;
11373 break;
11374 }
11375 }
11376 return found;
11377 }
11378
11379
11381 {
11382
11383 super.OnRPC(sender, rpc_type,ctx);
11384
11385
11386 switch (rpc_type)
11387 {
11388 #ifndef SERVER
11389 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11390 Param2<bool, string> p = new Param2<bool, string>(false, "");
11391
11393 return;
11394
11395 bool play = p.param1;
11396 string soundSet = p.param2;
11397
11398 if (play)
11399 {
11401 {
11403 {
11405 }
11406 }
11407 else
11408 {
11410 }
11411 }
11412 else
11413 {
11415 }
11416
11417 break;
11418 #endif
11419
11420 }
11421
11423 {
11425 }
11426 }
11427
11428
11429
11430
11432 {
11433 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11434 return plugin.GetID(
name);
11435 }
11436
11438 {
11439 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11440 return plugin.GetName(id);
11441 }
11442
11445 {
11446
11447
11448 int varFlags;
11449 if (!ctx.
Read(varFlags))
11450 return;
11451
11452 if (varFlags & ItemVariableFlags.FLOAT)
11453 {
11455 }
11456 }
11457
11459 {
11460
11461 super.SerializeNumericalVars(floats_out);
11462
11463
11464
11466 {
11468 }
11469
11471 {
11473 }
11474
11476 {
11478 }
11479
11481 {
11486 }
11487
11489 {
11491 }
11492 }
11493
11495 {
11496
11497 super.DeSerializeNumericalVars(floats);
11498
11499
11500 int index = 0;
11501 int mask = Math.Round(floats.Get(index));
11502
11503 index++;
11504
11506 {
11508 {
11510 }
11511 else
11512 {
11513 float quantity = floats.Get(index);
11514 SetQuantity(quantity,
true,
false,
false,
false);
11515 }
11516 index++;
11517 }
11518
11520 {
11521 float wet = floats.Get(index);
11523 index++;
11524 }
11525
11527 {
11528 int liquidtype = Math.Round(floats.Get(index));
11530 index++;
11531 }
11532
11534 {
11536 index++;
11538 index++;
11540 index++;
11542 index++;
11543 }
11544
11546 {
11547 int cleanness = Math.Round(floats.Get(index));
11549 index++;
11550 }
11551 }
11552
11554 {
11555 super.WriteVarsToCTX(ctx);
11556
11557
11559 {
11561 }
11562
11564 {
11566 }
11567
11569 {
11571 }
11572
11574 {
11575 int r,g,b,a;
11581 }
11582
11584 {
11586 }
11587 }
11588
11590 {
11591 if (!super.ReadVarsFromCTX(ctx,version))
11592 return false;
11593
11594 int intValue;
11595 float value;
11596
11597 if (version < 140)
11598 {
11599 if (!ctx.
Read(intValue))
11600 return false;
11601
11602 m_VariablesMask = intValue;
11603 }
11604
11606 {
11607 if (!ctx.
Read(value))
11608 return false;
11609
11611 {
11613 }
11614 else
11615 {
11617 }
11618 }
11619
11620 if (version < 140)
11621 {
11623 {
11624 if (!ctx.
Read(value))
11625 return false;
11626 SetTemperatureDirect(value);
11627 }
11628 }
11629
11631 {
11632 if (!ctx.
Read(value))
11633 return false;
11635 }
11636
11638 {
11639 if (!ctx.
Read(intValue))
11640 return false;
11642 }
11643
11645 {
11646 int r,g,b,a;
11648 return false;
11650 return false;
11652 return false;
11654 return false;
11655
11657 }
11658
11660 {
11661 if (!ctx.
Read(intValue))
11662 return false;
11664 }
11665
11666 if (version >= 138 && version < 140)
11667 {
11669 {
11670 if (!ctx.
Read(intValue))
11671 return false;
11672 SetFrozen(intValue);
11673 }
11674 }
11675
11676 return true;
11677 }
11678
11679
11681 {
11684 {
11686 }
11687
11688 if (!super.OnStoreLoad(ctx, version))
11689 {
11691 return false;
11692 }
11693
11694 if (version >= 114)
11695 {
11696 bool hasQuickBarIndexSaved;
11697
11698 if (!ctx.
Read(hasQuickBarIndexSaved))
11699 {
11701 return false;
11702 }
11703
11704 if (hasQuickBarIndexSaved)
11705 {
11706 int itmQBIndex;
11707
11708
11709 if (!ctx.
Read(itmQBIndex))
11710 {
11712 return false;
11713 }
11714
11715 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11716 if (itmQBIndex != -1 && parentPlayer)
11717 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11718 }
11719 }
11720 else
11721 {
11722
11723 PlayerBase player;
11724 int itemQBIndex;
11725 if (version ==
int.
MAX)
11726 {
11727 if (!ctx.
Read(itemQBIndex))
11728 {
11730 return false;
11731 }
11732 }
11733 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11734 {
11735
11736 if (!ctx.
Read(itemQBIndex))
11737 {
11739 return false;
11740 }
11741 if (itemQBIndex != -1 && player)
11742 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11743 }
11744 }
11745
11746 if (version < 140)
11747 {
11748
11749 if (!LoadVariables(ctx, version))
11750 {
11752 return false;
11753 }
11754 }
11755
11756
11758 {
11760 return false;
11761 }
11762 if (version >= 132)
11763 {
11765 if (raib)
11766 {
11768 {
11770 return false;
11771 }
11772 }
11773 }
11774
11776 return true;
11777 }
11778
11779
11780
11782 {
11783 super.OnStoreSave(ctx);
11784
11785 PlayerBase player;
11786 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11787 {
11789
11790 int itemQBIndex = -1;
11791 itemQBIndex = player.FindQuickBarEntityIndex(this);
11792 ctx.
Write(itemQBIndex);
11793 }
11794 else
11795 {
11797 }
11798
11800
11802 if (raib)
11803 {
11805 }
11806 }
11807
11808
11810 {
11811 super.AfterStoreLoad();
11812
11814 {
11816 }
11817
11819 {
11822 }
11823 }
11824
11826 {
11827 super.EEOnAfterLoad();
11828
11830 {
11832 }
11833
11836 }
11837
11839 {
11840 return false;
11841 }
11842
11843
11844
11846 {
11848 {
11849 #ifdef PLATFORM_CONSOLE
11850
11852 {
11854 if (menu)
11855 {
11857 }
11858 }
11859 #endif
11860 }
11861
11863 {
11866 }
11867
11869 {
11870 SetWeightDirty();
11872 }
11874 {
11877 }
11878
11880 {
11883 }
11885 {
11888 }
11889
11890 super.OnVariablesSynchronized();
11891 }
11892
11893
11894
11896 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11897 {
11898 if (!IsServerCheck(allow_client))
11899 return false;
11900
11902 return false;
11903
11906
11907 if (value <= (min + 0.001))
11908 value = min;
11909
11910 if (value == min)
11911 {
11912 if (destroy_config)
11913 {
11914 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11915 if (dstr)
11916 {
11918 this.Delete();
11919 return true;
11920 }
11921 }
11922 else if (destroy_forced)
11923 {
11925 this.Delete();
11926 return true;
11927 }
11928
11930 }
11931
11934
11936 {
11938
11939 if (delta)
11941 }
11942
11944
11945 return false;
11946 }
11947
11948
11950 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11951 {
11953 }
11954
11956 {
11959 }
11960
11962 {
11965 }
11966
11968 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11969 {
11970 float value_clamped = Math.Clamp(value, 0, 1);
11972 SetQuantity(result, destroy_config, destroy_forced);
11973 }
11974
11975
11978 {
11980 }
11981
11983 {
11985 }
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11997 {
11998 int slot = -1;
11999 if (GetInventory())
12000 {
12001 InventoryLocation il = new InventoryLocation;
12002 GetInventory().GetCurrentInventoryLocation(il);
12004 }
12005
12007 }
12008
12010 {
12011 float quantity_max = 0;
12012
12014 {
12015 if (attSlotID != -1)
12016 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12017
12018 if (quantity_max <= 0)
12020 }
12021
12022 if (quantity_max <= 0)
12024
12025 return quantity_max;
12026 }
12027
12029 {
12031 }
12032
12034 {
12036 }
12037
12038
12040 {
12042 }
12043
12045 {
12047 }
12048
12050 {
12052 }
12053
12054
12056 {
12057
12058 float weightEx = GetWeightEx();
12059 float special = GetInventoryAndCargoWeight();
12060 return weightEx - special;
12061 }
12062
12063
12065 {
12067 }
12068
12070 {
12072 {
12073 #ifdef DEVELOPER
12074 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12075 {
12076 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12078 }
12079 #endif
12080
12081 return GetQuantity() * GetConfigWeightModified();
12082 }
12083 else if (HasEnergyManager())
12084 {
12085 #ifdef DEVELOPER
12086 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12087 {
12088 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12089 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12090 }
12091 #endif
12092 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12093 }
12094 else
12095 {
12096 #ifdef DEVELOPER
12097 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12098 {
12099 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12100 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12101 }
12102 #endif
12103 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12104 }
12105 }
12106
12109 {
12110 int item_count = 0;
12112
12113 if (GetInventory().GetCargo() != NULL)
12114 {
12115 item_count = GetInventory().GetCargo().GetItemCount();
12116 }
12117
12118 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12119 {
12120 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12121 if (item)
12122 item_count += item.GetNumberOfItems();
12123 }
12124 return item_count;
12125 }
12126
12129 {
12130 float weight = 0;
12131 float wetness = 1;
12132 if (include_wetness)
12135 {
12136 weight = wetness * m_ConfigWeight;
12137 }
12139 {
12140 weight = 1;
12141 }
12142 return weight;
12143 }
12144
12145
12146
12148 {
12149 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12150 {
12151 GameInventory inv = GetInventory();
12152 array<EntityAI> items = new array<EntityAI>;
12154 for (int i = 0; i < items.Count(); i++)
12155 {
12157 if (item)
12158 {
12160 }
12161 }
12162 }
12163 }
12164
12165
12166
12167
12169 {
12170 float energy = 0;
12171 if (HasEnergyManager())
12172 {
12173 energy = GetCompEM().GetEnergy();
12174 }
12175 return energy;
12176 }
12177
12178
12180 {
12181 super.OnEnergyConsumed();
12182
12184 }
12185
12187 {
12188 super.OnEnergyAdded();
12189
12191 }
12192
12193
12195 {
12196 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12197 {
12199 {
12200 float energy_0to1 = GetCompEM().GetEnergy0To1();
12202 }
12203 }
12204 }
12205
12206
12208 {
12209 return ConfigGetFloat("heatIsolation");
12210 }
12211
12213 {
12215 }
12216
12218 {
12219 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12220 if (
GetGame().ConfigIsExisting(paramPath))
12222
12223 return 0.0;
12224 }
12225
12227 {
12228 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12229 if (
GetGame().ConfigIsExisting(paramPath))
12231
12232 return 0.0;
12233 }
12234
12235 override void SetWet(
float value,
bool allow_client =
false)
12236 {
12237 if (!IsServerCheck(allow_client))
12238 return;
12239
12242
12244
12245 m_VarWet = Math.Clamp(value, min, max);
12246
12248 {
12251 }
12252 }
12253
12254 override void AddWet(
float value)
12255 {
12257 }
12258
12260 {
12262 }
12263
12265 {
12267 }
12268
12270 {
12272 }
12273
12275 {
12277 }
12278
12280 {
12282 }
12283
12284 override void OnWetChanged(
float newVal,
float oldVal)
12285 {
12288 if (newLevel != oldLevel)
12289 {
12291 }
12292 }
12293
12295 {
12296 SetWeightDirty();
12297 }
12298
12300 {
12301 return GetWetLevelInternal(
m_VarWet);
12302 }
12303
12304
12305
12307 {
12309 }
12310
12312 {
12314 }
12315
12317 {
12319 }
12320
12322 {
12324 }
12325
12326
12327
12329 {
12330 if (ConfigIsExisting("itemModelLength"))
12331 {
12332 return ConfigGetFloat("itemModelLength");
12333 }
12334 return 0;
12335 }
12336
12338 {
12339 if (ConfigIsExisting("itemAttachOffset"))
12340 {
12341 return ConfigGetFloat("itemAttachOffset");
12342 }
12343 return 0;
12344 }
12345
12346 override void SetCleanness(
int value,
bool allow_client =
false)
12347 {
12348 if (!IsServerCheck(allow_client))
12349 return;
12350
12352
12354
12357 }
12358
12360 {
12362 }
12363
12365 {
12366 return true;
12367 }
12368
12369
12370
12371
12373 {
12375 }
12376
12378 {
12380 }
12381
12382
12383
12384
12385 override void SetColor(
int r,
int g,
int b,
int a)
12386 {
12392 }
12394 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12395 {
12400 }
12401
12403 {
12405 }
12406
12409 {
12410 int r,g,b,a;
12412 r = r/255;
12413 g = g/255;
12414 b = b/255;
12415 a = a/255;
12416 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12417 }
12418
12419
12420
12421 override void SetLiquidType(
int value,
bool allow_client =
false)
12422 {
12423 if (!IsServerCheck(allow_client))
12424 return;
12425
12430 }
12431
12433 {
12434 return ConfigGetInt("varLiquidTypeInit");
12435 }
12436
12438 {
12440 }
12441
12443 {
12445 SetFrozen(false);
12446 }
12447
12450 {
12451 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12452 }
12453
12454
12457 {
12458 PlayerBase nplayer;
12459 if (PlayerBase.CastTo(nplayer, player))
12460 {
12462
12463 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12464 }
12465 }
12466
12467
12470 {
12471 PlayerBase nplayer;
12472 if (PlayerBase.CastTo(nplayer,player))
12473 {
12474
12475 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12476
12477 }
12478
12479
12480 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12481
12482
12483 if (HasEnergyManager())
12484 {
12485 GetCompEM().UpdatePlugState();
12486 }
12487 }
12488
12489
12491 {
12492 super.OnPlacementStarted(player);
12493
12495 }
12496
12497 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12498 {
12500 {
12501 m_AdminLog.OnPlacementComplete(player,
this);
12502 }
12503
12504 super.OnPlacementComplete(player, position, orientation);
12505 }
12506
12507
12508
12509
12510
12512 {
12514 {
12515 return true;
12516 }
12517 else
12518 {
12519 return false;
12520 }
12521 }
12522
12523
12525 {
12527 {
12529 }
12530 }
12531
12532
12534 {
12536 }
12537
12539 {
12541 }
12542
12543 override void InsertAgent(
int agent,
float count = 1)
12544 {
12545 if (count < 1)
12546 return;
12547
12549 }
12550
12553 {
12555 }
12556
12557
12559 {
12561 }
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12605 {
12607 return false;
12608 return true;
12609 }
12610
12612 {
12613
12615 }
12616
12617
12620 {
12621 super.CheckForRoofLimited(timeTresholdMS);
12622
12624 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12625 {
12626 m_PreviousRoofTestTime = time;
12627 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12628 }
12629 }
12630
12631
12633 {
12635 {
12636 return 0;
12637 }
12638
12639 if (GetInventory().GetAttachmentSlotsCount() != 0)
12640 {
12641 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12642 if (filter)
12643 return filter.GetProtectionLevel(type, false, system);
12644 else
12645 return 0;
12646 }
12647
12648 string subclassPath, entryName;
12649
12650 switch (type)
12651 {
12653 entryName = "biological";
12654 break;
12656 entryName = "chemical";
12657 break;
12658 default:
12659 entryName = "biological";
12660 break;
12661 }
12662
12663 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12664
12666 }
12667
12668
12669
12672 {
12673 if (!IsMagazine())
12675
12677 }
12678
12679
12680
12681
12682
12687 {
12688 return true;
12689 }
12690
12692 {
12694 }
12695
12696
12697
12698
12699
12701 {
12702 if (parent)
12703 {
12704 if (parent.IsInherited(DayZInfected))
12705 return true;
12706
12707 if (!parent.IsRuined())
12708 return true;
12709 }
12710
12711 return true;
12712 }
12713
12715 {
12716 if (!super.CanPutAsAttachment(parent))
12717 {
12718 return false;
12719 }
12720
12721 if (!IsRuined() && !parent.IsRuined())
12722 {
12723 return true;
12724 }
12725
12726 return false;
12727 }
12728
12730 {
12731
12732
12733
12734
12735 return super.CanReceiveItemIntoCargo(item);
12736 }
12737
12739 {
12740
12741
12742
12743
12744 GameInventory attachmentInv = attachment.GetInventory();
12746 {
12747 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12748 return false;
12749 }
12750
12751 InventoryLocation loc = new InventoryLocation();
12752 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12753 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12754 return false;
12755
12756 return super.CanReceiveAttachment(attachment, slotId);
12757 }
12758
12760 {
12761 if (!super.CanReleaseAttachment(attachment))
12762 return false;
12763
12764 return GetInventory().AreChildrenAccessible();
12765 }
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12788 {
12789 int id = muzzle_owner.GetMuzzleID();
12790 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12791
12792 if (WPOF_array)
12793 {
12794 for (int i = 0; i < WPOF_array.Count(); i++)
12795 {
12796 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12797
12798 if (WPOF)
12799 {
12800 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12801 }
12802 }
12803 }
12804 }
12805
12806
12808 {
12809 int id = muzzle_owner.GetMuzzleID();
12811
12812 if (WPOBE_array)
12813 {
12814 for (int i = 0; i < WPOBE_array.Count(); i++)
12815 {
12816 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12817
12818 if (WPOBE)
12819 {
12820 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12821 }
12822 }
12823 }
12824 }
12825
12826
12828 {
12829 int id = muzzle_owner.GetMuzzleID();
12830 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12831
12832 if (WPOOH_array)
12833 {
12834 for (int i = 0; i < WPOOH_array.Count(); i++)
12835 {
12836 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12837
12838 if (WPOOH)
12839 {
12840 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12841 }
12842 }
12843 }
12844 }
12845
12846
12848 {
12849 int id = muzzle_owner.GetMuzzleID();
12850 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12851
12852 if (WPOOH_array)
12853 {
12854 for (int i = 0; i < WPOOH_array.Count(); i++)
12855 {
12856 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12857
12858 if (WPOOH)
12859 {
12860 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12861 }
12862 }
12863 }
12864 }
12865
12866
12868 {
12869 int id = muzzle_owner.GetMuzzleID();
12870 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12871
12872 if (WPOOH_array)
12873 {
12874 for (int i = 0; i < WPOOH_array.Count(); i++)
12875 {
12876 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12877
12878 if (WPOOH)
12879 {
12880 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12881 }
12882 }
12883 }
12884 }
12885
12886
12887
12889 {
12891 {
12892 return true;
12893 }
12894
12895 return false;
12896 }
12897
12899 {
12901 {
12902 return true;
12903 }
12904
12905 return false;
12906 }
12907
12909 {
12911 {
12912 return true;
12913 }
12914
12915 return false;
12916 }
12917
12919 {
12920 return false;
12921 }
12922
12925 {
12926 return UATimeSpent.DEFAULT_DEPLOY;
12927 }
12928
12929
12930
12931
12933 {
12935 SetSynchDirty();
12936 }
12937
12939 {
12941 }
12942
12943
12945 {
12946 return false;
12947 }
12948
12951 {
12952 string att_type = "None";
12953
12954 if (ConfigIsExisting("soundAttType"))
12955 {
12956 att_type = ConfigGetString("soundAttType");
12957 }
12958
12960 }
12961
12963 {
12965 }
12966
12967
12968
12969
12970
12976
12978 {
12981
12983 }
12984
12985
12987 {
12989 return;
12990
12992
12995
12998
12999 SoundParameters params = new SoundParameters();
13003 }
13004
13005
13007 {
13009 return;
13010
13012 SetSynchDirty();
13013
13016 }
13017
13018
13020 {
13022 return;
13023
13025 SetSynchDirty();
13026
13029 }
13030
13032 {
13034 }
13035
13037 {
13039 }
13040
13043 {
13044 if (!
GetGame().IsDedicatedServer())
13045 {
13046 if (ConfigIsExisting("attachSoundSet"))
13047 {
13048 string cfg_path = "";
13049 string soundset = "";
13050 string type_name =
GetType();
13051
13054 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13055 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13056
13057 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13058 {
13059 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13060 {
13061 if (cfg_slot_array[i] == slot_type)
13062 {
13063 soundset = cfg_soundset_array[i];
13064 break;
13065 }
13066 }
13067 }
13068
13069 if (soundset != "")
13070 {
13071 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13073 }
13074 }
13075 }
13076 }
13077
13079 {
13080
13081 }
13082
13083 void OnApply(PlayerBase player);
13084
13086 {
13087 return 1.0;
13088 };
13089
13091 {
13093 }
13094
13096 {
13098 }
13099
13101
13103 {
13104 SetDynamicPhysicsLifeTime(0.01);
13106 }
13107
13109 {
13110 array<string> zone_names = new array<string>;
13111 GetDamageZones(zone_names);
13112 for (int i = 0; i < zone_names.Count(); i++)
13113 {
13114 SetHealthMax(zone_names.Get(i),"Health");
13115 }
13116 SetHealthMax("","Health");
13117 }
13118
13121 {
13122 float global_health = GetHealth01("","Health");
13123 array<string> zones = new array<string>;
13124 GetDamageZones(zones);
13125
13126 for (int i = 0; i < zones.Count(); i++)
13127 {
13128 SetHealth01(zones.Get(i),"Health",global_health);
13129 }
13130 }
13131
13134 {
13135 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13136 }
13137
13139 {
13140 if (!hasRootAsPlayer)
13141 {
13142 if (refParentIB)
13143 {
13144
13145 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13146 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13147
13148 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13149 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13150
13153 }
13154 else
13155 {
13156
13159 }
13160 }
13161 }
13162
13164 {
13166 {
13167 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13168 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13169 {
13170 float heatPermCoef = 1.0;
13172 while (ent)
13173 {
13174 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13175 ent = ent.GetHierarchyParent();
13176 }
13177
13178 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13179 }
13180 }
13181 }
13182
13184 {
13185
13186 EntityAI parent = GetHierarchyParent();
13187 if (!parent)
13188 {
13189 hasParent = false;
13190 hasRootAsPlayer = false;
13191 }
13192 else
13193 {
13194 hasParent = true;
13195 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13196 refParentIB =
ItemBase.Cast(parent);
13197 }
13198 }
13199
13200 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13201 {
13202
13203 }
13204
13206 {
13207
13208 return false;
13209 }
13210
13212 {
13213
13214
13215 return false;
13216 }
13217
13219 {
13220
13221 return false;
13222 }
13223
13226 {
13227 return !GetIsFrozen() &&
IsOpen();
13228 }
13229
13231 {
13232 bool hasParent = false, hasRootAsPlayer = false;
13234
13235 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13236 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13237
13238 if (wwtu || foodDecay)
13239 {
13243
13244 if (processWetness || processTemperature || processDecay)
13245 {
13247
13248 if (processWetness)
13249 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13250
13251 if (processTemperature)
13253
13254 if (processDecay)
13255 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13256 }
13257 }
13258 }
13259
13262 {
13264 }
13265
13267 {
13270
13271 return super.GetTemperatureFreezeThreshold();
13272 }
13273
13275 {
13278
13279 return super.GetTemperatureThawThreshold();
13280 }
13281
13283 {
13286
13287 return super.GetItemOverheatThreshold();
13288 }
13289
13291 {
13293 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13294
13295 return super.GetTemperatureFreezeTime();
13296 }
13297
13299 {
13301 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13302
13303 return super.GetTemperatureThawTime();
13304 }
13305
13310
13312 {
13313 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13314 }
13315
13317 {
13318 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13319 }
13320
13323 {
13325 }
13326
13328 {
13330 }
13331
13333 {
13335 }
13336
13339 {
13340 return null;
13341 }
13342
13345 {
13346 return false;
13347 }
13348
13350 {
13352 {
13355 if (!trg)
13356 {
13358 explosive = this;
13359 }
13360
13361 explosive.PairRemote(trg);
13363
13364 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13365 trg.SetPersistentPairID(persistentID);
13366 explosive.SetPersistentPairID(persistentID);
13367
13368 return true;
13369 }
13370 return false;
13371 }
13372
13375 {
13376 float ret = 1.0;
13379 ret *= GetHealth01();
13380
13381 return ret;
13382 }
13383
13384 #ifdef DEVELOPER
13385 override void SetDebugItem()
13386 {
13387 super.SetDebugItem();
13388 _itemBase = this;
13389 }
13390
13392 {
13393 string text = super.GetDebugText();
13394
13396 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13397
13398 return text;
13399 }
13400 #endif
13401
13403 {
13404 return true;
13405 }
13406
13408
13410
13412 {
13415 }
13416
13417
13425
13441}
13442
13444{
13446 if (entity)
13447 {
13448 bool is_item = entity.IsInherited(
ItemBase);
13449 if (is_item && full_quantity)
13450 {
13453 }
13454 }
13455 else
13456 {
13458 return NULL;
13459 }
13460 return entity;
13461}
13462
13464{
13465 if (item)
13466 {
13467 if (health > 0)
13468 item.SetHealth("", "", health);
13469
13470 if (item.CanHaveTemperature())
13471 {
13473 if (item.CanFreeze())
13474 item.SetFrozen(false);
13475 }
13476
13477 if (item.HasEnergyManager())
13478 {
13479 if (quantity >= 0)
13480 {
13481 item.GetCompEM().SetEnergy0To1(quantity);
13482 }
13483 else
13484 {
13486 }
13487 }
13488 else if (item.IsMagazine())
13489 {
13490 Magazine mag = Magazine.Cast(item);
13491 if (quantity >= 0)
13492 {
13493 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13494 }
13495 else
13496 {
13498 }
13499
13500 }
13501 else
13502 {
13503 if (quantity >= 0)
13504 {
13505 item.SetQuantityNormalized(quantity, false);
13506 }
13507 else
13508 {
13510 }
13511
13512 }
13513 }
13514}
13515
13516#ifdef DEVELOPER
13518#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.