8602{
8604 {
8605 return true;
8606 }
8607};
8608
8609
8610
8612{
8616
8618
8621
8622
8623
8624
8625
8634
8640
8645
8650
8671 protected bool m_IsResultOfSplit
8672
8674
8679
8680
8681
8683
8687
8688
8689
8691
8694
8695
8696
8702
8703
8711
8714
8715
8717
8718
8720
8721
8726
8727
8732
8733
8735
8736
8738 {
8743
8744 if (!
GetGame().IsDedicatedServer())
8745 {
8747 {
8749
8751 {
8753 }
8754 }
8755
8758 }
8759
8760 m_OldLocation = null;
8761
8763 {
8765 }
8766
8767 if (ConfigIsExisting("headSelectionsToHide"))
8768 {
8771 }
8772
8774 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8775 {
8777 }
8778
8780
8781 m_IsResultOfSplit = false;
8782
8784 }
8785
8787 {
8788 super.InitItemVariables();
8789
8795 m_Count = ConfigGetInt(
"count");
8796
8799
8804
8807
8812
8824
8828
8829
8832 if (ConfigIsExisting("canBeSplit"))
8833 {
8836 }
8837
8839 if (ConfigIsExisting("itemBehaviour"))
8841
8842
8845 RegisterNetSyncVariableInt("m_VarLiquidType");
8846 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8847
8848 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8849 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8850 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8851
8852 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8853 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8854 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8855 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8856
8857 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8858 RegisterNetSyncVariableBool("m_IsTakeable");
8859 RegisterNetSyncVariableBool("m_IsHologram");
8860
8863 {
8866 }
8867
8869
8871 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8873
8874 }
8875
8877 {
8879 }
8880
8882 {
8885 {
8890 }
8891 }
8892
8893 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8894 {
8896 {
8899 }
8900
8902 }
8903
8905 {
8911 }
8912
8914
8916 {
8918
8919 if (!action)
8920 {
8921 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8922 return;
8923 }
8924
8926 if (!ai)
8927 {
8929 return;
8930 }
8931
8933 if (!action_array)
8934 {
8935 action_array = new array<ActionBase_Basic>;
8937 }
8938 if (LogManager.IsActionLogEnable())
8939 {
8940 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8941 }
8942
8943 if (action_array.Find(action) != -1)
8944 {
8945 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8946 }
8947 else
8948 {
8949 action_array.Insert(action);
8950 }
8951 }
8952
8954 {
8956 ActionBase action = player.GetActionManager().GetAction(actionName);
8959
8960 if (action_array)
8961 {
8962 action_array.RemoveItem(action);
8963 }
8964 }
8965
8966
8967
8969 {
8970 ActionOverrideData overrideData = new ActionOverrideData();
8974
8976 if (!actionMap)
8977 {
8980 }
8981
8982 actionMap.Insert(this.
Type(), overrideData);
8983
8984 }
8985
8987
8989
8990
8992 {
8995
8998
8999 string config_to_search = "CfgVehicles";
9000 string muzzle_owner_config;
9001
9003 {
9004 if (IsInherited(Weapon))
9005 config_to_search = "CfgWeapons";
9006
9007 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9008
9009 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9010
9012
9013 if (config_OnFire_subclass_count > 0)
9014 {
9015 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9016
9017 for (int i = 0; i < config_OnFire_subclass_count; i++)
9018 {
9019 string particle_class = "";
9021 string config_OnFire_entry = config_OnFire_class + particle_class;
9022 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9023 WPOF_array.Insert(WPOF);
9024 }
9025
9026
9028 }
9029 }
9030
9032 {
9033 config_to_search = "CfgWeapons";
9034 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9035
9036 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9037
9039
9040 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9041 {
9042 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9043
9044 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9045 {
9046 string particle_class2 = "";
9048 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9049 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9050 WPOBE_array.Insert(WPOBE);
9051 }
9052
9053
9055 }
9056 }
9057 }
9058
9059
9061 {
9064
9066 {
9067 string config_to_search = "CfgVehicles";
9068
9069 if (IsInherited(Weapon))
9070 config_to_search = "CfgWeapons";
9071
9072 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9073 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9074
9075 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9076 {
9077
9079
9081 {
9083 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9085 return;
9086 }
9087
9090
9091
9092
9094 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9095
9096 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9097 {
9098 string particle_class = "";
9100 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9102
9103 if (entry_type == CT_CLASS)
9104 {
9105 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9106 WPOOH_array.Insert(WPOF);
9107 }
9108 }
9109
9110
9112 }
9113 }
9114 }
9115
9117 {
9119 }
9120
9122 {
9124 {
9126
9129
9132
9133 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9134 }
9135 }
9136
9138 {
9140 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9141
9143 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9144
9146 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9147
9149 {
9151 }
9152 }
9153
9155 {
9157 }
9158
9160 {
9163 else
9165
9167 {
9170 }
9171 else
9172 {
9175
9178 }
9179
9181 }
9182
9184 {
9186 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9187 }
9188
9190 {
9192 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9194 }
9195
9197 {
9199 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9200 }
9201
9203 {
9206
9207 OverheatingParticle OP = new OverheatingParticle();
9212
9214 }
9215
9217 {
9220
9221 return -1;
9222 }
9223
9225 {
9227 {
9230
9231 for (int i = count; i > 0; --i)
9232 {
9233 int id = i - 1;
9236
9239
9240 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9241 {
9242 if (p)
9243 {
9246 }
9247 }
9248 }
9249 }
9250 }
9251
9253 {
9255 {
9257 {
9258 int id = i - 1;
9260
9261 if (OP)
9262 {
9264
9265 if (p)
9266 {
9268 }
9269
9270 delete OP;
9271 }
9272 }
9273
9276 }
9277 }
9278
9281 {
9282 return 0.0;
9283 }
9284
9285
9287 {
9288 return 250;
9289 }
9290
9292 {
9293 return 0;
9294 }
9295
9298 {
9300 return true;
9301
9302 return false;
9303 }
9304
9307 {
9310
9312 {
9314 }
9315 else
9316 {
9317
9319 }
9320
9322 }
9323
9330 {
9331 return -1;
9332 }
9333
9334
9335
9336
9338 {
9340 {
9342 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9343
9344 if (r_index >= 0)
9345 {
9346 InventoryLocation r_il = new InventoryLocation;
9347 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9348
9349 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9352 {
9353 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9354 }
9356 {
9357 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9358 }
9359
9360 }
9361
9362 player.GetHumanInventory().ClearUserReservedLocation(this);
9363 }
9364
9367 }
9368
9369
9370
9371
9373 {
9374 return ItemBase.m_DebugActionsMask;
9375 }
9376
9378 {
9379 return ItemBase.m_DebugActionsMask & mask;
9380 }
9381
9383 {
9384 ItemBase.m_DebugActionsMask = mask;
9385 }
9386
9388 {
9389 ItemBase.m_DebugActionsMask |= mask;
9390 }
9391
9393 {
9394 ItemBase.m_DebugActionsMask &= ~mask;
9395 }
9396
9398 {
9400 {
9402 }
9403 else
9404 {
9406 }
9407 }
9408
9409
9411 {
9412 if (GetEconomyProfile())
9413 {
9414 float q_max = GetEconomyProfile().GetQuantityMax();
9415 if (q_max > 0)
9416 {
9417 float q_min = GetEconomyProfile().GetQuantityMin();
9418 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9419
9421 {
9422 ComponentEnergyManager comp = GetCompEM();
9424 {
9426 }
9427 }
9429 {
9431
9432 }
9433
9434 }
9435 }
9436 }
9437
9440 {
9441 EntityAI parent = GetHierarchyParent();
9442
9443 if (parent)
9444 {
9445 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9446 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9447 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9448 }
9449 }
9450
9453 {
9454 EntityAI parent = GetHierarchyParent();
9455
9456 if (parent)
9457 {
9458 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9459 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9460 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9461 }
9462 }
9463
9465 {
9466
9467
9468
9469
9471
9473 {
9474 if (ScriptInputUserData.CanStoreInputUserData())
9475 {
9476 ScriptInputUserData ctx = new ScriptInputUserData;
9482 ctx.
Write(use_stack_max);
9485
9487 {
9488 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9489 }
9490 }
9491 }
9492 else if (!
GetGame().IsMultiplayer())
9493 {
9495 }
9496 }
9497
9499 {
9501 }
9502
9504 {
9506 }
9507
9509 {
9511 }
9512
9514 {
9515
9516 return false;
9517 }
9518
9520 {
9521 return false;
9522 }
9523
9527 {
9528 return false;
9529 }
9530
9532 {
9533 return "";
9534 }
9535
9537
9539 {
9540 return false;
9541 }
9542
9544 {
9545 return true;
9546 }
9547
9548
9549
9551 {
9552 return true;
9553 }
9554
9556 {
9557 return true;
9558 }
9559
9561 {
9562 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 if (!is_being_placed)
9576 SetSynchDirty();
9577 }
9578
9579
9581
9583 {
9585 }
9586
9588 {
9590 }
9591
9593 {
9594 return 1;
9595 }
9596
9598 {
9599 return false;
9600 }
9601
9603 {
9605 SetSynchDirty();
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
9633
9634
9635
9636
9637
9638
9639
9640
9641
9643 {
9644 super.OnMovedInsideCargo(container);
9645
9646 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9647 }
9648
9649 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9650 {
9651 super.EEItemLocationChanged(oldLoc,newLoc);
9652
9653 PlayerBase new_player = null;
9654 PlayerBase old_player = null;
9655
9656 if (newLoc.GetParent())
9657 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9658
9659 if (oldLoc.GetParent())
9660 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9661
9663 {
9664 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9665
9666 if (r_index >= 0)
9667 {
9668 InventoryLocation r_il = new InventoryLocation;
9669 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9670
9671 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9674 {
9675 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9676 }
9678 {
9679 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9680 }
9681
9682 }
9683 }
9684
9686 {
9687 if (new_player)
9688 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9689
9690 if (new_player == old_player)
9691 {
9692
9693 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9694 {
9696 {
9697 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9698 {
9699 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9700 }
9701 }
9702 else
9703 {
9704 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9705 }
9706 }
9707
9708 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9709 {
9710 int type = oldLoc.GetType();
9712 {
9713 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9714 }
9716 {
9717 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9718 }
9719 }
9720 if (!m_OldLocation)
9721 {
9722 m_OldLocation = new InventoryLocation;
9723 }
9724 m_OldLocation.Copy(oldLoc);
9725 }
9726 else
9727 {
9728 if (m_OldLocation)
9729 {
9730 m_OldLocation.Reset();
9731 }
9732 }
9733
9735 }
9736 else
9737 {
9738 if (new_player)
9739 {
9740 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9741 if (res_index >= 0)
9742 {
9743 InventoryLocation il = new InventoryLocation;
9744 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9746 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9749 {
9750 il.
GetParent().GetOnReleaseLock().Invoke(it);
9751 }
9753 {
9755 }
9756
9757 }
9758 }
9760 {
9761
9763 }
9764
9765 if (m_OldLocation)
9766 {
9767 m_OldLocation.Reset();
9768 }
9769 }
9770 }
9771
9772 override void EOnContact(IEntity other, Contact extra)
9773 {
9775 {
9776 int liquidType = -1;
9778 if (impactSpeed > 0.0)
9779 {
9781 #ifndef SERVER
9783 #else
9785 SetSynchDirty();
9786 #endif
9788 }
9789 }
9790
9791 #ifdef SERVER
9792 if (GetCompEM() && GetCompEM().IsPlugged())
9793 {
9794 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9795 GetCompEM().UnplugThis();
9796 }
9797 #endif
9798 }
9799
9801
9803 {
9805 }
9806
9808 {
9809
9810 }
9811
9813 {
9814 super.OnItemLocationChanged(old_owner, new_owner);
9815
9816 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9817 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9818
9819 if (!relatedPlayer && playerNew)
9820 relatedPlayer = playerNew;
9821
9822 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9823 {
9825 if (actionMgr)
9826 {
9827 ActionBase currentAction = actionMgr.GetRunningAction();
9828 if (currentAction)
9830 }
9831 }
9832
9833 Man ownerPlayerOld = null;
9834 Man ownerPlayerNew = null;
9835
9836 if (old_owner)
9837 {
9838 if (old_owner.
IsMan())
9839 {
9840 ownerPlayerOld = Man.Cast(old_owner);
9841 }
9842 else
9843 {
9844 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9845 }
9846 }
9847 else
9848 {
9850 {
9852
9853 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9854 {
9855 GetCompEM().UnplugThis();
9856 }
9857 }
9858 }
9859
9860 if (new_owner)
9861 {
9862 if (new_owner.
IsMan())
9863 {
9864 ownerPlayerNew = Man.Cast(new_owner);
9865 }
9866 else
9867 {
9868 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9869 }
9870 }
9871
9872 if (ownerPlayerOld != ownerPlayerNew)
9873 {
9874 if (ownerPlayerOld)
9875 {
9876 array<EntityAI> subItemsExit = new array<EntityAI>;
9878 for (int i = 0; i < subItemsExit.Count(); i++)
9879 {
9882 }
9883 }
9884
9885 if (ownerPlayerNew)
9886 {
9887 array<EntityAI> subItemsEnter = new array<EntityAI>;
9889 for (int j = 0; j < subItemsEnter.Count(); j++)
9890 {
9893 }
9894 }
9895 }
9896 else if (ownerPlayerNew != null)
9897 {
9898 PlayerBase nplayer;
9899 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9900 {
9901 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9903 for (int k = 0; k < subItemsUpdate.Count(); k++)
9904 {
9906 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9907 }
9908 }
9909 }
9910
9911 if (old_owner)
9912 old_owner.OnChildItemRemoved(this);
9913 if (new_owner)
9914 new_owner.OnChildItemReceived(this);
9915 }
9916
9917
9919 {
9920 super.EEDelete(parent);
9921 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9922 if (player)
9923 {
9925
9926 if (player.IsAlive())
9927 {
9928 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9929 if (r_index >= 0)
9930 {
9931 InventoryLocation r_il = new InventoryLocation;
9932 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9933
9934 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9937 {
9938 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9939 }
9941 {
9942 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9943 }
9944
9945 }
9946
9947 player.RemoveQuickBarEntityShortcut(this);
9948 }
9949 }
9950 }
9951
9953 {
9954 super.EEKilled(killer);
9955
9958 {
9959 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9960 {
9961 if (IsMagazine())
9962 {
9963 if (Magazine.Cast(this).GetAmmoCount() > 0)
9964 {
9966 }
9967 }
9968 else
9969 {
9971 }
9972 }
9973 }
9974 }
9975
9977 {
9978 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9979
9980 super.OnWasAttached(parent, slot_id);
9981
9984
9986 }
9987
9989 {
9990 super.OnWasDetached(parent, slot_id);
9991
9994 }
9995
9997 {
9998 int idx;
10001
10002 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10003 if (inventory_slots.Count() < 1)
10004 {
10005 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10006 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10007 }
10008 else
10009 {
10010 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10011 }
10012
10013 idx = inventory_slots.Find(slot);
10014 if (idx < 0)
10015 return "";
10016
10017 return attach_types.Get(idx);
10018 }
10019
10021 {
10022 int idx = -1;
10023 string slot;
10024
10027
10028 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10029 if (inventory_slots.Count() < 1)
10030 {
10031 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10032 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10033 }
10034 else
10035 {
10036 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10037 if (detach_types.Count() < 1)
10038 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10039 }
10040
10041 for (int i = 0; i < inventory_slots.Count(); i++)
10042 {
10043 slot = inventory_slots.Get(i);
10044 }
10045
10046 if (slot != "")
10047 {
10048 if (detach_types.Count() == 1)
10049 idx = 0;
10050 else
10051 idx = inventory_slots.Find(slot);
10052 }
10053 if (idx < 0)
10054 return "";
10055
10056 return detach_types.Get(idx);
10057 }
10058
10060 {
10061
10063
10064
10065 float min_time = 1;
10066 float max_time = 3;
10067 float delay = Math.RandomFloat(min_time, max_time);
10068
10069 explode_timer.Run(delay, this, "DoAmmoExplosion");
10070 }
10071
10073 {
10074 Magazine magazine = Magazine.Cast(this);
10075 int pop_sounds_count = 6;
10076 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10077
10078
10079 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10080 string sound_name = pop_sounds[ sound_idx ];
10082
10083
10084 magazine.ServerAddAmmoCount(-1);
10085
10086
10087 float min_temp_to_explode = 100;
10088
10089 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10090 {
10092 }
10093 }
10094
10095
10096 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10097 {
10098 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10099
10100 const int CHANCE_DAMAGE_CARGO = 4;
10101 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10102 const int CHANCE_DAMAGE_NOTHING = 2;
10103
10105 {
10106 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10107 int chances;
10108 int rnd;
10109
10110 if (GetInventory().GetCargo())
10111 {
10112 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10113 rnd = Math.RandomInt(0,chances);
10114
10115 if (rnd < CHANCE_DAMAGE_CARGO)
10116 {
10118 }
10119 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10120 {
10122 }
10123 }
10124 else
10125 {
10126 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10127 rnd = Math.RandomInt(0,chances);
10128
10129 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10130 {
10132 }
10133 }
10134 }
10135 }
10136
10138 {
10139 if (GetInventory().GetCargo())
10140 {
10141 int item_count = GetInventory().GetCargo().GetItemCount();
10142 if (item_count > 0)
10143 {
10144 int random_pick = Math.RandomInt(0, item_count);
10146 if (!item.IsExplosive())
10147 {
10148 item.AddHealth("","",damage);
10149 return true;
10150 }
10151 }
10152 }
10153 return false;
10154 }
10155
10157 {
10158 int attachment_count = GetInventory().AttachmentCount();
10159 if (attachment_count > 0)
10160 {
10161 int random_pick = Math.RandomInt(0, attachment_count);
10162 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10163 if (!attachment.IsExplosive())
10164 {
10165 attachment.AddHealth("","",damage);
10166 return true;
10167 }
10168 }
10169 return false;
10170 }
10171
10173 {
10175 }
10176
10178 {
10180 return GetInventory().CanRemoveEntity();
10181
10182 return false;
10183 }
10184
10186 {
10187
10189 return false;
10190
10191
10193 return false;
10194
10195
10196
10198 if (delta == 0)
10199 return false;
10200
10201
10202 return true;
10203 }
10204
10206 {
10208 {
10209 if (ScriptInputUserData.CanStoreInputUserData())
10210 {
10211 ScriptInputUserData ctx = new ScriptInputUserData;
10216 ctx.
Write(destination_entity);
10218 ctx.
Write(slot_id);
10220 }
10221 }
10222 else if (!
GetGame().IsMultiplayer())
10223 {
10225 }
10226 }
10227
10229 {
10230 float split_quantity_new;
10234 InventoryLocation loc = new InventoryLocation;
10235
10236 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10237 {
10239 split_quantity_new = stack_max;
10240 else
10242
10244 {
10245 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10246 if (new_item)
10247 {
10248 new_item.SetResultOfSplit(true);
10249 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10251 new_item.
SetQuantity(split_quantity_new,
false,
true);
10252 }
10253 }
10254 }
10255 else if (destination_entity && slot_id == -1)
10256 {
10257 if (quantity > stack_max)
10258 split_quantity_new = stack_max;
10259 else
10260 split_quantity_new = quantity;
10261
10263 {
10265 {
10268 }
10269
10270 if (new_item)
10271 {
10272 new_item.SetResultOfSplit(true);
10273 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10275 new_item.
SetQuantity(split_quantity_new,
false,
true);
10276 }
10277 }
10278 }
10279 else
10280 {
10281 if (stack_max != 0)
10282 {
10284 {
10286 }
10287
10288 if (split_quantity_new == 0)
10289 {
10290 if (!
GetGame().IsMultiplayer())
10291 player.PhysicalPredictiveDropItem(this);
10292 else
10293 player.ServerDropEntity(this);
10294 return;
10295 }
10296
10298 {
10300
10301 if (new_item)
10302 {
10303 new_item.SetResultOfSplit(true);
10304 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10307 new_item.PlaceOnSurface();
10308 }
10309 }
10310 }
10311 }
10312 }
10313
10315 {
10316 float split_quantity_new;
10320 InventoryLocation loc = new InventoryLocation;
10321
10322 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10323 {
10325 split_quantity_new = stack_max;
10326 else
10328
10330 {
10331 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10332 if (new_item)
10333 {
10334 new_item.SetResultOfSplit(true);
10335 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10337 new_item.
SetQuantity(split_quantity_new,
false,
true);
10338 }
10339 }
10340 }
10341 else if (destination_entity && slot_id == -1)
10342 {
10343 if (quantity > stack_max)
10344 split_quantity_new = stack_max;
10345 else
10346 split_quantity_new = quantity;
10347
10349 {
10351 {
10354 }
10355
10356 if (new_item)
10357 {
10358 new_item.SetResultOfSplit(true);
10359 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10361 new_item.
SetQuantity(split_quantity_new,
false,
true);
10362 }
10363 }
10364 }
10365 else
10366 {
10367 if (stack_max != 0)
10368 {
10370 {
10372 }
10373
10375 {
10377
10378 if (new_item)
10379 {
10380 new_item.SetResultOfSplit(true);
10381 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10384 new_item.PlaceOnSurface();
10385 }
10386 }
10387 }
10388 }
10389 }
10390
10392 {
10394 {
10395 if (ScriptInputUserData.CanStoreInputUserData())
10396 {
10397 ScriptInputUserData ctx = new ScriptInputUserData;
10402 dst.WriteToContext(ctx);
10404 }
10405 }
10406 else if (!
GetGame().IsMultiplayer())
10407 {
10409 }
10410 }
10411
10413 {
10415 {
10416 if (ScriptInputUserData.CanStoreInputUserData())
10417 {
10418 ScriptInputUserData ctx = new ScriptInputUserData;
10423 ctx.
Write(destination_entity);
10429 }
10430 }
10431 else if (!
GetGame().IsMultiplayer())
10432 {
10434 }
10435 }
10436
10438 {
10440 }
10441
10443 {
10445 float split_quantity_new;
10447 if (dst.IsValid())
10448 {
10449 int slot_id = dst.GetSlot();
10451
10452 if (quantity > stack_max)
10453 split_quantity_new = stack_max;
10454 else
10455 split_quantity_new = quantity;
10456
10458 {
10460
10461 if (new_item)
10462 {
10463 new_item.SetResultOfSplit(true);
10464 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10466 new_item.
SetQuantity(split_quantity_new,
false,
true);
10467 }
10468
10469 return new_item;
10470 }
10471 }
10472
10473 return null;
10474 }
10475
10477 {
10479 float split_quantity_new;
10481 if (destination_entity)
10482 {
10484 if (quantity > stackable)
10485 split_quantity_new = stackable;
10486 else
10487 split_quantity_new = quantity;
10488
10490 {
10491 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10492 if (new_item)
10493 {
10494 new_item.SetResultOfSplit(true);
10495 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10497 new_item.
SetQuantity(split_quantity_new,
false,
true);
10498 }
10499 }
10500 }
10501 }
10502
10504 {
10506 {
10507 if (ScriptInputUserData.CanStoreInputUserData())
10508 {
10509 ScriptInputUserData ctx = new ScriptInputUserData;
10514 ItemBase destination_entity =
this;
10515 ctx.
Write(destination_entity);
10519 }
10520 }
10521 else if (!
GetGame().IsMultiplayer())
10522 {
10524 }
10525 }
10526
10528 {
10530 float split_quantity_new;
10532 if (player)
10533 {
10535 if (quantity > stackable)
10536 split_quantity_new = stackable;
10537 else
10538 split_quantity_new = quantity;
10539
10541 {
10542 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10543 new_item =
ItemBase.Cast(in_hands);
10544 if (new_item)
10545 {
10546 new_item.SetResultOfSplit(true);
10547 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10549 new_item.SetQuantity(split_quantity_new, false, true);
10550 }
10551 }
10552 }
10553 }
10554
10556 {
10558 float split_quantity_new = Math.Floor(quantity * 0.5);
10559
10561 return;
10562
10564
10565 if (new_item)
10566 {
10567 if (new_item.GetQuantityMax() < split_quantity_new)
10568 {
10569 split_quantity_new = new_item.GetQuantityMax();
10570 }
10571
10572 new_item.SetResultOfSplit(true);
10573 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10574
10576 {
10579 }
10580 else
10581 {
10583 new_item.
SetQuantity(split_quantity_new,
false,
true);
10584 }
10585 }
10586 }
10587
10589 {
10591 float split_quantity_new = Math.Floor(quantity / 2);
10592
10594 return;
10595
10596 InventoryLocation invloc = new InventoryLocation;
10598
10600 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10601
10602 if (new_item)
10603 {
10604 if (new_item.GetQuantityMax() < split_quantity_new)
10605 {
10606 split_quantity_new = new_item.GetQuantityMax();
10607 }
10609 {
10612 }
10613 else if (split_quantity_new > 1)
10614 {
10616 new_item.
SetQuantity(split_quantity_new,
false,
true);
10617 }
10618 }
10619 }
10620
10623 {
10624 SetWeightDirty();
10626
10627 if (parent)
10628 parent.OnAttachmentQuantityChangedEx(this, delta);
10629
10631 {
10633 {
10635 }
10637 {
10638 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10640 }
10641 }
10642
10643 }
10644
10647 {
10648
10649 }
10650
10653 {
10655 }
10656
10658 {
10659 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10660
10662 {
10663 if (newLevel == GameConstants.STATE_RUINED)
10664 {
10666 EntityAI parent = GetHierarchyParent();
10667 if (parent && parent.IsFireplace())
10668 {
10669 CargoBase cargo = GetInventory().GetCargo();
10670 if (cargo)
10671 {
10673 {
10675 }
10676 }
10677 }
10678 }
10679
10681 {
10682
10684 return;
10685 }
10686
10687 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10688 {
10690 }
10691 }
10692 }
10693
10694
10696 {
10697 super.OnRightClick();
10698
10700 {
10702 {
10703 if (ScriptInputUserData.CanStoreInputUserData())
10704 {
10705 EntityAI root = GetHierarchyRoot();
10706 Man playerOwner = GetHierarchyRootPlayer();
10707 InventoryLocation dst = new InventoryLocation;
10708
10709
10710 if (!playerOwner && root && root == this)
10711 {
10713 }
10714 else
10715 {
10716
10717 GetInventory().GetCurrentInventoryLocation(dst);
10719 {
10722 {
10724 }
10725 else
10726 {
10728
10729
10730 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10731 {
10733 }
10734 else
10735 {
10736 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10737 }
10738 }
10739 }
10740 }
10741
10742 ScriptInputUserData ctx = new ScriptInputUserData;
10750 }
10751 }
10752 else if (!
GetGame().IsMultiplayer())
10753 {
10755 }
10756 }
10757 }
10758
10760 {
10761 if (root)
10762 {
10763 vector m4[4];
10764 root.GetTransform(m4);
10765 dst.SetGround(this, m4);
10766 }
10767 else
10768 {
10769 GetInventory().GetCurrentInventoryLocation(dst);
10770 }
10771 }
10772
10773 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10774 {
10775
10776 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10777 return false;
10778
10779 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10780 return false;
10781
10782
10784 return false;
10785
10786
10787 Magazine mag = Magazine.Cast(this);
10788 if (mag)
10789 {
10790 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10791 return false;
10792
10793 if (stack_max_limit)
10794 {
10795 Magazine other_mag = Magazine.Cast(other_item);
10796 if (other_item)
10797 {
10798 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10799 return false;
10800 }
10801
10802 }
10803 }
10804 else
10805 {
10806
10808 return false;
10809
10811 return false;
10812 }
10813
10814 PlayerBase player = null;
10815 if (CastTo(player, GetHierarchyRootPlayer()))
10816 {
10817 if (player.GetInventory().HasAttachment(this))
10818 return false;
10819
10820 if (player.IsItemsToDelete())
10821 return false;
10822 }
10823
10824 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10825 return false;
10826
10827 int slotID;
10829 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10830 return false;
10831
10832 return true;
10833 }
10834
10836 {
10838 }
10839
10841 {
10842 return m_IsResultOfSplit;
10843 }
10844
10846 {
10847 m_IsResultOfSplit = value;
10848 }
10849
10851 {
10853 }
10854
10856 {
10857 float other_item_quantity = other_item.GetQuantity();
10858 float this_free_space;
10859
10861
10863
10864 if (other_item_quantity > this_free_space)
10865 {
10866 return this_free_space;
10867 }
10868 else
10869 {
10870 return other_item_quantity;
10871 }
10872 }
10873
10875 {
10877 }
10878
10880 {
10882 return;
10883
10884 if (!IsMagazine() && other_item)
10885 {
10887 if (quantity_used != 0)
10888 {
10889 float hp1 = GetHealth01("","");
10890 float hp2 = other_item.GetHealth01("","");
10891 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10892 hpResult = hpResult / (
GetQuantity() + quantity_used);
10893
10894 hpResult *= GetMaxHealth();
10895 Math.Round(hpResult);
10896 SetHealth("", "Health", hpResult);
10897
10899 other_item.AddQuantity(-quantity_used);
10900 }
10901 }
10903 }
10904
10906 {
10907 #ifdef SERVER
10908 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10909 GetHierarchyParent().IncreaseLifetimeUp();
10910 #endif
10911 };
10912
10914 {
10915 PlayerBase p = PlayerBase.Cast(player);
10916
10917 array<int> recipesIds = p.m_Recipes;
10918 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10919 if (moduleRecipesManager)
10920 {
10921 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10922 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10923 }
10924
10925 for (int i = 0;i < recipesIds.Count(); i++)
10926 {
10927 int key = recipesIds.Get(i);
10928 string recipeName = moduleRecipesManager.GetRecipeName(key);
10930 }
10931 }
10932
10933
10934 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10935 {
10936 super.GetDebugActions(outputList);
10937
10938
10944
10945
10950
10955
10956
10960
10961
10963 {
10967 }
10968
10971
10972
10976
10978
10979 InventoryLocation loc = new InventoryLocation();
10980 GetInventory().GetCurrentInventoryLocation(loc);
10982 {
10983 if (Gizmo_IsSupported())
10986 }
10987
10989 }
10990
10991
10992
10993
10995 {
10996 super.OnAction(action_id, player, ctx);
10997
10999 {
11000 switch (action_id)
11001 {
11004 return true;
11007 return true;
11008 }
11009 }
11010
11012 {
11013 switch (action_id)
11014 {
11016 Delete();
11017 return true;
11018 }
11019 }
11020
11021 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11022 {
11023 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11024 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11025 PlayerBase p = PlayerBase.Cast(player);
11026 if (
EActions.RECIPES_RANGE_START < 1000)
11027 {
11028 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11029 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11030 }
11031 }
11032 #ifndef SERVER
11033 else if (action_id ==
EActions.WATCH_PLAYER)
11034 {
11035 PluginDeveloper.SetDeveloperItemClientEx(player);
11036 }
11037 #endif
11039 {
11040 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11041 {
11042 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11043 OnDebugButtonPressServer(id + 1);
11044 }
11045
11046 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11047 {
11048 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11050 }
11051
11052 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11053 {
11054 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11056 }
11057
11058 else if (action_id ==
EActions.ADD_QUANTITY)
11059 {
11060 if (IsMagazine())
11061 {
11062 Magazine mag = Magazine.Cast(this);
11063 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11064 }
11065 else
11066 {
11068 }
11069
11070 if (m_EM)
11071 {
11072 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11073 }
11074
11075 }
11076
11077 else if (action_id ==
EActions.REMOVE_QUANTITY)
11078 {
11079 if (IsMagazine())
11080 {
11081 Magazine mag2 = Magazine.Cast(this);
11082 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11083 }
11084 else
11085 {
11087 }
11088 if (m_EM)
11089 {
11090 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11091 }
11092
11093 }
11094
11095 else if (action_id ==
EActions.SET_QUANTITY_0)
11096 {
11098
11099 if (m_EM)
11100 {
11101 m_EM.SetEnergy(0);
11102 }
11103 }
11104
11105 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11106 {
11108
11109 if (m_EM)
11110 {
11111 m_EM.SetEnergy(m_EM.GetEnergyMax());
11112 }
11113 }
11114
11115 else if (action_id ==
EActions.ADD_HEALTH)
11116 {
11117 AddHealth("","",GetMaxHealth("","Health")/5);
11118 }
11119 else if (action_id ==
EActions.REMOVE_HEALTH)
11120 {
11121 AddHealth("","",-GetMaxHealth("","Health")/5);
11122 }
11123 else if (action_id ==
EActions.DESTROY_HEALTH)
11124 {
11125 SetHealth01("","",0);
11126 }
11127 else if (action_id ==
EActions.WATCH_ITEM)
11128 {
11130 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11131 #ifdef DEVELOPER
11132 SetDebugDeveloper_item(this);
11133 #endif
11134 }
11135
11136 else if (action_id ==
EActions.ADD_TEMPERATURE)
11137 {
11138 AddTemperature(20);
11139
11140 }
11141
11142 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11143 {
11144 AddTemperature(-20);
11145
11146 }
11147
11148 else if (action_id ==
EActions.FLIP_FROZEN)
11149 {
11150 SetFrozen(!GetIsFrozen());
11151
11152 }
11153
11154 else if (action_id ==
EActions.ADD_WETNESS)
11155 {
11157
11158 }
11159
11160 else if (action_id ==
EActions.REMOVE_WETNESS)
11161 {
11163
11164 }
11165
11166 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11167 {
11170
11171
11172 }
11173
11174 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11175 {
11178 }
11179
11180 else if (action_id ==
EActions.MAKE_SPECIAL)
11181 {
11182 auto debugParams = DebugSpawnParams.WithPlayer(player);
11183 OnDebugSpawnEx(debugParams);
11184 }
11185
11186 }
11187
11188
11189 return false;
11190 }
11191
11192
11193
11194
11198
11201
11202
11203
11205 {
11206 return false;
11207 }
11208
11209
11211 {
11212 return true;
11213 }
11214
11215
11217 {
11218 return true;
11219 }
11220
11221
11222
11224 {
11225 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11227 }
11228
11231 {
11232 return null;
11233 }
11234
11236 {
11237 return false;
11238 }
11239
11241 {
11242 return false;
11243 }
11244
11248
11249
11251 {
11252 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11253 return module_repairing.CanRepair(this, item_repair_kit);
11254 }
11255
11256
11257 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11258 {
11259 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11260 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11261 }
11262
11263
11265 {
11266
11267
11268
11269
11270
11271
11272
11273
11274 return 1;
11275 }
11276
11277
11278
11280 {
11282 }
11283
11284
11285
11287 {
11289 }
11290
11291
11300 {
11301 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11302
11303 if (player)
11304 {
11305 player.MessageStatus(text);
11306 }
11307 }
11308
11309
11318 {
11319 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11320
11321 if (player)
11322 {
11323 player.MessageAction(text);
11324 }
11325 }
11326
11327
11336 {
11337 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11338
11339 if (player)
11340 {
11341 player.MessageFriendly(text);
11342 }
11343 }
11344
11345
11354 {
11355 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11356
11357 if (player)
11358 {
11359 player.MessageImportant(text);
11360 }
11361 }
11362
11364 {
11365 return true;
11366 }
11367
11368
11369 override bool KindOf(
string tag)
11370 {
11371 bool found = false;
11372 string item_name = this.
GetType();
11375
11376 int array_size = item_tag_array.Count();
11377 for (int i = 0; i < array_size; i++)
11378 {
11379 if (item_tag_array.Get(i) == tag)
11380 {
11381 found = true;
11382 break;
11383 }
11384 }
11385 return found;
11386 }
11387
11388
11390 {
11391
11392 super.OnRPC(sender, rpc_type,ctx);
11393
11394
11395 switch (rpc_type)
11396 {
11397 #ifndef SERVER
11398 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11399 Param2<bool, string> p = new Param2<bool, string>(false, "");
11400
11402 return;
11403
11404 bool play = p.param1;
11405 string soundSet = p.param2;
11406
11407 if (play)
11408 {
11410 {
11412 {
11414 }
11415 }
11416 else
11417 {
11419 }
11420 }
11421 else
11422 {
11424 }
11425
11426 break;
11427 #endif
11428
11429 }
11430
11432 {
11434 }
11435 }
11436
11437
11438
11439
11441 {
11442 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11443 return plugin.GetID(
name);
11444 }
11445
11447 {
11448 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11449 return plugin.GetName(id);
11450 }
11451
11454 {
11455
11456
11457 int varFlags;
11458 if (!ctx.
Read(varFlags))
11459 return;
11460
11461 if (varFlags & ItemVariableFlags.FLOAT)
11462 {
11464 }
11465 }
11466
11468 {
11469
11470 super.SerializeNumericalVars(floats_out);
11471
11472
11473
11475 {
11477 }
11478
11480 {
11482 }
11483
11485 {
11487 }
11488
11490 {
11495 }
11496
11498 {
11500 }
11501 }
11502
11504 {
11505
11506 super.DeSerializeNumericalVars(floats);
11507
11508
11509 int index = 0;
11510 int mask = Math.Round(floats.Get(index));
11511
11512 index++;
11513
11515 {
11517 {
11519 }
11520 else
11521 {
11522 float quantity = floats.Get(index);
11523 SetQuantity(quantity,
true,
false,
false,
false);
11524 }
11525 index++;
11526 }
11527
11529 {
11530 float wet = floats.Get(index);
11532 index++;
11533 }
11534
11536 {
11537 int liquidtype = Math.Round(floats.Get(index));
11539 index++;
11540 }
11541
11543 {
11545 index++;
11547 index++;
11549 index++;
11551 index++;
11552 }
11553
11555 {
11556 int cleanness = Math.Round(floats.Get(index));
11558 index++;
11559 }
11560 }
11561
11563 {
11564 super.WriteVarsToCTX(ctx);
11565
11566
11568 {
11570 }
11571
11573 {
11575 }
11576
11578 {
11580 }
11581
11583 {
11584 int r,g,b,a;
11590 }
11591
11593 {
11595 }
11596 }
11597
11599 {
11600 if (!super.ReadVarsFromCTX(ctx,version))
11601 return false;
11602
11603 int intValue;
11604 float value;
11605
11606 if (version < 140)
11607 {
11608 if (!ctx.
Read(intValue))
11609 return false;
11610
11611 m_VariablesMask = intValue;
11612 }
11613
11615 {
11616 if (!ctx.
Read(value))
11617 return false;
11618
11620 {
11622 }
11623 else
11624 {
11626 }
11627 }
11628
11629 if (version < 140)
11630 {
11632 {
11633 if (!ctx.
Read(value))
11634 return false;
11635 SetTemperatureDirect(value);
11636 }
11637 }
11638
11640 {
11641 if (!ctx.
Read(value))
11642 return false;
11644 }
11645
11647 {
11648 if (!ctx.
Read(intValue))
11649 return false;
11651 }
11652
11654 {
11655 int r,g,b,a;
11657 return false;
11659 return false;
11661 return false;
11663 return false;
11664
11666 }
11667
11669 {
11670 if (!ctx.
Read(intValue))
11671 return false;
11673 }
11674
11675 if (version >= 138 && version < 140)
11676 {
11678 {
11679 if (!ctx.
Read(intValue))
11680 return false;
11681 SetFrozen(intValue);
11682 }
11683 }
11684
11685 return true;
11686 }
11687
11688
11690 {
11693 {
11695 }
11696
11697 if (!super.OnStoreLoad(ctx, version))
11698 {
11700 return false;
11701 }
11702
11703 if (version >= 114)
11704 {
11705 bool hasQuickBarIndexSaved;
11706
11707 if (!ctx.
Read(hasQuickBarIndexSaved))
11708 {
11710 return false;
11711 }
11712
11713 if (hasQuickBarIndexSaved)
11714 {
11715 int itmQBIndex;
11716
11717
11718 if (!ctx.
Read(itmQBIndex))
11719 {
11721 return false;
11722 }
11723
11724 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11725 if (itmQBIndex != -1 && parentPlayer)
11726 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11727 }
11728 }
11729 else
11730 {
11731
11732 PlayerBase player;
11733 int itemQBIndex;
11734 if (version ==
int.
MAX)
11735 {
11736 if (!ctx.
Read(itemQBIndex))
11737 {
11739 return false;
11740 }
11741 }
11742 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11743 {
11744
11745 if (!ctx.
Read(itemQBIndex))
11746 {
11748 return false;
11749 }
11750 if (itemQBIndex != -1 && player)
11751 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11752 }
11753 }
11754
11755 if (version < 140)
11756 {
11757
11758 if (!LoadVariables(ctx, version))
11759 {
11761 return false;
11762 }
11763 }
11764
11765
11767 {
11769 return false;
11770 }
11771 if (version >= 132)
11772 {
11774 if (raib)
11775 {
11777 {
11779 return false;
11780 }
11781 }
11782 }
11783
11785 return true;
11786 }
11787
11788
11789
11791 {
11792 super.OnStoreSave(ctx);
11793
11794 PlayerBase player;
11795 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11796 {
11798
11799 int itemQBIndex = -1;
11800 itemQBIndex = player.FindQuickBarEntityIndex(this);
11801 ctx.
Write(itemQBIndex);
11802 }
11803 else
11804 {
11806 }
11807
11809
11811 if (raib)
11812 {
11814 }
11815 }
11816
11817
11819 {
11820 super.AfterStoreLoad();
11821
11823 {
11825 }
11826
11828 {
11831 }
11832 }
11833
11835 {
11836 super.EEOnAfterLoad();
11837
11839 {
11841 }
11842
11845 }
11846
11848 {
11849 return false;
11850 }
11851
11852
11853
11855 {
11857 {
11858 #ifdef PLATFORM_CONSOLE
11859
11861 {
11863 if (menu)
11864 {
11866 }
11867 }
11868 #endif
11869 }
11870
11872 {
11875 }
11876
11878 {
11879 SetWeightDirty();
11881 }
11883 {
11886 }
11887
11889 {
11892 }
11894 {
11897 }
11898
11899 super.OnVariablesSynchronized();
11900 }
11901
11902
11903
11905 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11906 {
11907 if (!IsServerCheck(allow_client))
11908 return false;
11909
11911 return false;
11912
11915
11916 if (value <= (min + 0.001))
11917 value = min;
11918
11919 if (value == min)
11920 {
11921 if (destroy_config)
11922 {
11923 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11924 if (dstr)
11925 {
11927 this.Delete();
11928 return true;
11929 }
11930 }
11931 else if (destroy_forced)
11932 {
11934 this.Delete();
11935 return true;
11936 }
11937
11939 }
11940
11943
11945 {
11947
11948 if (delta)
11950 }
11951
11953
11954 return false;
11955 }
11956
11957
11959 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11960 {
11962 }
11963
11965 {
11968 }
11969
11971 {
11974 }
11975
11977 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11978 {
11979 float value_clamped = Math.Clamp(value, 0, 1);
11981 SetQuantity(result, destroy_config, destroy_forced);
11982 }
11983
11984
11987 {
11989 }
11990
11992 {
11994 }
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12006 {
12007 int slot = -1;
12008 if (GetInventory())
12009 {
12010 InventoryLocation il = new InventoryLocation;
12011 GetInventory().GetCurrentInventoryLocation(il);
12013 }
12014
12016 }
12017
12019 {
12020 float quantity_max = 0;
12021
12023 {
12024 if (attSlotID != -1)
12025 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12026
12027 if (quantity_max <= 0)
12029 }
12030
12031 if (quantity_max <= 0)
12033
12034 return quantity_max;
12035 }
12036
12038 {
12040 }
12041
12043 {
12045 }
12046
12047
12049 {
12051 }
12052
12054 {
12056 }
12057
12059 {
12061 }
12062
12063
12065 {
12066
12067 float weightEx = GetWeightEx();
12068 float special = GetInventoryAndCargoWeight();
12069 return weightEx - special;
12070 }
12071
12072
12074 {
12076 }
12077
12079 {
12081 {
12082 #ifdef DEVELOPER
12083 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12084 {
12085 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12087 }
12088 #endif
12089
12090 return GetQuantity() * GetConfigWeightModified();
12091 }
12092 else if (HasEnergyManager())
12093 {
12094 #ifdef DEVELOPER
12095 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12096 {
12097 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12098 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12099 }
12100 #endif
12101 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12102 }
12103 else
12104 {
12105 #ifdef DEVELOPER
12106 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12107 {
12108 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12109 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12110 }
12111 #endif
12112 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12113 }
12114 }
12115
12118 {
12119 int item_count = 0;
12121
12122 if (GetInventory().GetCargo() != NULL)
12123 {
12124 item_count = GetInventory().GetCargo().GetItemCount();
12125 }
12126
12127 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12128 {
12129 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12130 if (item)
12131 item_count += item.GetNumberOfItems();
12132 }
12133 return item_count;
12134 }
12135
12138 {
12139 float weight = 0;
12140 float wetness = 1;
12141 if (include_wetness)
12144 {
12145 weight = wetness * m_ConfigWeight;
12146 }
12148 {
12149 weight = 1;
12150 }
12151 return weight;
12152 }
12153
12154
12155
12157 {
12158 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12159 {
12160 GameInventory inv = GetInventory();
12161 array<EntityAI> items = new array<EntityAI>;
12163 for (int i = 0; i < items.Count(); i++)
12164 {
12166 if (item)
12167 {
12169 }
12170 }
12171 }
12172 }
12173
12174
12175
12176
12178 {
12179 float energy = 0;
12180 if (HasEnergyManager())
12181 {
12182 energy = GetCompEM().GetEnergy();
12183 }
12184 return energy;
12185 }
12186
12187
12189 {
12190 super.OnEnergyConsumed();
12191
12193 }
12194
12196 {
12197 super.OnEnergyAdded();
12198
12200 }
12201
12202
12204 {
12205 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12206 {
12208 {
12209 float energy_0to1 = GetCompEM().GetEnergy0To1();
12211 }
12212 }
12213 }
12214
12215
12217 {
12218 return ConfigGetFloat("heatIsolation");
12219 }
12220
12222 {
12224 }
12225
12227 {
12228 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12229 if (
GetGame().ConfigIsExisting(paramPath))
12231
12232 return 0.0;
12233 }
12234
12236 {
12237 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12238 if (
GetGame().ConfigIsExisting(paramPath))
12240
12241 return 0.0;
12242 }
12243
12244 override void SetWet(
float value,
bool allow_client =
false)
12245 {
12246 if (!IsServerCheck(allow_client))
12247 return;
12248
12251
12253
12254 m_VarWet = Math.Clamp(value, min, max);
12255
12257 {
12260 }
12261 }
12262
12263 override void AddWet(
float value)
12264 {
12266 }
12267
12269 {
12271 }
12272
12274 {
12276 }
12277
12279 {
12281 }
12282
12284 {
12286 }
12287
12289 {
12291 }
12292
12293 override void OnWetChanged(
float newVal,
float oldVal)
12294 {
12297 if (newLevel != oldLevel)
12298 {
12300 }
12301 }
12302
12304 {
12305 SetWeightDirty();
12306 }
12307
12309 {
12310 return GetWetLevelInternal(
m_VarWet);
12311 }
12312
12313
12314
12316 {
12318 }
12319
12321 {
12323 }
12324
12326 {
12328 }
12329
12331 {
12333 }
12334
12335
12336
12338 {
12339 if (ConfigIsExisting("itemModelLength"))
12340 {
12341 return ConfigGetFloat("itemModelLength");
12342 }
12343 return 0;
12344 }
12345
12347 {
12348 if (ConfigIsExisting("itemAttachOffset"))
12349 {
12350 return ConfigGetFloat("itemAttachOffset");
12351 }
12352 return 0;
12353 }
12354
12355 override void SetCleanness(
int value,
bool allow_client =
false)
12356 {
12357 if (!IsServerCheck(allow_client))
12358 return;
12359
12361
12363
12366 }
12367
12369 {
12371 }
12372
12374 {
12375 return true;
12376 }
12377
12378
12379
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12391
12392
12393
12394 override void SetColor(
int r,
int g,
int b,
int a)
12395 {
12401 }
12403 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12404 {
12409 }
12410
12412 {
12414 }
12415
12418 {
12419 int r,g,b,a;
12421 r = r/255;
12422 g = g/255;
12423 b = b/255;
12424 a = a/255;
12425 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12426 }
12427
12428
12429
12430 override void SetLiquidType(
int value,
bool allow_client =
false)
12431 {
12432 if (!IsServerCheck(allow_client))
12433 return;
12434
12439 }
12440
12442 {
12443 return ConfigGetInt("varLiquidTypeInit");
12444 }
12445
12447 {
12449 }
12450
12452 {
12454 SetFrozen(false);
12455 }
12456
12459 {
12460 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12461 }
12462
12463
12466 {
12467 PlayerBase nplayer;
12468 if (PlayerBase.CastTo(nplayer, player))
12469 {
12471
12472 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12473 }
12474 }
12475
12476
12479 {
12480 PlayerBase nplayer;
12481 if (PlayerBase.CastTo(nplayer,player))
12482 {
12483
12484 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12485
12486 }
12487
12488
12489 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12490
12491
12492 if (HasEnergyManager())
12493 {
12494 GetCompEM().UpdatePlugState();
12495 }
12496 }
12497
12498
12500 {
12501 super.OnPlacementStarted(player);
12502
12504 }
12505
12506 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12507 {
12509 {
12510 m_AdminLog.OnPlacementComplete(player,
this);
12511 }
12512
12513 super.OnPlacementComplete(player, position, orientation);
12514 }
12515
12516
12517
12518
12519
12521 {
12523 {
12524 return true;
12525 }
12526 else
12527 {
12528 return false;
12529 }
12530 }
12531
12532
12534 {
12536 {
12538 }
12539 }
12540
12541
12543 {
12545 }
12546
12548 {
12550 }
12551
12552 override void InsertAgent(
int agent,
float count = 1)
12553 {
12554 if (count < 1)
12555 return;
12556
12558 }
12559
12562 {
12564 }
12565
12566
12568 {
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
12604
12605
12606
12607
12608
12609
12610
12611
12612
12614 {
12616 return false;
12617 return true;
12618 }
12619
12621 {
12622
12624 }
12625
12626
12629 {
12630 super.CheckForRoofLimited(timeTresholdMS);
12631
12633 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12634 {
12635 m_PreviousRoofTestTime = time;
12636 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12637 }
12638 }
12639
12640
12642 {
12644 {
12645 return 0;
12646 }
12647
12648 if (GetInventory().GetAttachmentSlotsCount() != 0)
12649 {
12650 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12651 if (filter)
12652 return filter.GetProtectionLevel(type, false, system);
12653 else
12654 return 0;
12655 }
12656
12657 string subclassPath, entryName;
12658
12659 switch (type)
12660 {
12662 entryName = "biological";
12663 break;
12665 entryName = "chemical";
12666 break;
12667 default:
12668 entryName = "biological";
12669 break;
12670 }
12671
12672 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12673
12675 }
12676
12677
12678
12681 {
12682 if (!IsMagazine())
12684
12686 }
12687
12688
12689
12690
12691
12696 {
12697 return true;
12698 }
12699
12701 {
12703 }
12704
12705
12706
12707
12708
12710 {
12711 if (parent)
12712 {
12713 if (parent.IsInherited(DayZInfected))
12714 return true;
12715
12716 if (!parent.IsRuined())
12717 return true;
12718 }
12719
12720 return true;
12721 }
12722
12724 {
12725 if (!super.CanPutAsAttachment(parent))
12726 {
12727 return false;
12728 }
12729
12730 if (!IsRuined() && !parent.IsRuined())
12731 {
12732 return true;
12733 }
12734
12735 return false;
12736 }
12737
12739 {
12740
12741
12742
12743
12744 return super.CanReceiveItemIntoCargo(item);
12745 }
12746
12748 {
12749
12750
12751
12752
12753 GameInventory attachmentInv = attachment.GetInventory();
12755 {
12756 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12757 return false;
12758 }
12759
12760 InventoryLocation loc = new InventoryLocation();
12761 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12762 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12763 return false;
12764
12765 return super.CanReceiveAttachment(attachment, slotId);
12766 }
12767
12769 {
12770 if (!super.CanReleaseAttachment(attachment))
12771 return false;
12772
12773 return GetInventory().AreChildrenAccessible();
12774 }
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12797 {
12798 int id = muzzle_owner.GetMuzzleID();
12799 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12800
12801 if (WPOF_array)
12802 {
12803 for (int i = 0; i < WPOF_array.Count(); i++)
12804 {
12805 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12806
12807 if (WPOF)
12808 {
12809 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12810 }
12811 }
12812 }
12813 }
12814
12815
12817 {
12818 int id = muzzle_owner.GetMuzzleID();
12820
12821 if (WPOBE_array)
12822 {
12823 for (int i = 0; i < WPOBE_array.Count(); i++)
12824 {
12825 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12826
12827 if (WPOBE)
12828 {
12829 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12830 }
12831 }
12832 }
12833 }
12834
12835
12837 {
12838 int id = muzzle_owner.GetMuzzleID();
12839 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12840
12841 if (WPOOH_array)
12842 {
12843 for (int i = 0; i < WPOOH_array.Count(); i++)
12844 {
12845 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12846
12847 if (WPOOH)
12848 {
12849 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12850 }
12851 }
12852 }
12853 }
12854
12855
12857 {
12858 int id = muzzle_owner.GetMuzzleID();
12859 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12860
12861 if (WPOOH_array)
12862 {
12863 for (int i = 0; i < WPOOH_array.Count(); i++)
12864 {
12865 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12866
12867 if (WPOOH)
12868 {
12869 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12870 }
12871 }
12872 }
12873 }
12874
12875
12877 {
12878 int id = muzzle_owner.GetMuzzleID();
12879 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12880
12881 if (WPOOH_array)
12882 {
12883 for (int i = 0; i < WPOOH_array.Count(); i++)
12884 {
12885 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12886
12887 if (WPOOH)
12888 {
12889 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12890 }
12891 }
12892 }
12893 }
12894
12895
12896
12898 {
12900 {
12901 return true;
12902 }
12903
12904 return false;
12905 }
12906
12908 {
12910 {
12911 return true;
12912 }
12913
12914 return false;
12915 }
12916
12918 {
12920 {
12921 return true;
12922 }
12923
12924 return false;
12925 }
12926
12928 {
12929 return false;
12930 }
12931
12934 {
12935 return UATimeSpent.DEFAULT_DEPLOY;
12936 }
12937
12938
12939
12940
12942 {
12944 SetSynchDirty();
12945 }
12946
12948 {
12950 }
12951
12952
12954 {
12955 return false;
12956 }
12957
12960 {
12961 string att_type = "None";
12962
12963 if (ConfigIsExisting("soundAttType"))
12964 {
12965 att_type = ConfigGetString("soundAttType");
12966 }
12967
12969 }
12970
12972 {
12974 }
12975
12976
12977
12978
12979
12985
12987 {
12990
12992 }
12993
12994
12996 {
12998 return;
12999
13001
13004
13007
13008 SoundParameters params = new SoundParameters();
13012 }
13013
13014
13016 {
13018 return;
13019
13021 SetSynchDirty();
13022
13025 }
13026
13027
13029 {
13031 return;
13032
13034 SetSynchDirty();
13035
13038 }
13039
13041 {
13043 }
13044
13046 {
13048 }
13049
13052 {
13053 if (!
GetGame().IsDedicatedServer())
13054 {
13055 if (ConfigIsExisting("attachSoundSet"))
13056 {
13057 string cfg_path = "";
13058 string soundset = "";
13059 string type_name =
GetType();
13060
13063 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13064 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13065
13066 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13067 {
13068 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13069 {
13070 if (cfg_slot_array[i] == slot_type)
13071 {
13072 soundset = cfg_soundset_array[i];
13073 break;
13074 }
13075 }
13076 }
13077
13078 if (soundset != "")
13079 {
13080 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13082 }
13083 }
13084 }
13085 }
13086
13088 {
13089
13090 }
13091
13092 void OnApply(PlayerBase player);
13093
13095 {
13096 return 1.0;
13097 };
13098
13100 {
13102 }
13103
13105 {
13107 }
13108
13110
13112 {
13113 SetDynamicPhysicsLifeTime(0.01);
13115 }
13116
13118 {
13119 array<string> zone_names = new array<string>;
13120 GetDamageZones(zone_names);
13121 for (int i = 0; i < zone_names.Count(); i++)
13122 {
13123 SetHealthMax(zone_names.Get(i),"Health");
13124 }
13125 SetHealthMax("","Health");
13126 }
13127
13130 {
13131 float global_health = GetHealth01("","Health");
13132 array<string> zones = new array<string>;
13133 GetDamageZones(zones);
13134
13135 for (int i = 0; i < zones.Count(); i++)
13136 {
13137 SetHealth01(zones.Get(i),"Health",global_health);
13138 }
13139 }
13140
13143 {
13144 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13145 }
13146
13148 {
13149 if (!hasRootAsPlayer)
13150 {
13151 if (refParentIB)
13152 {
13153
13154 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13155 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13156
13157 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13158 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13159
13162 }
13163 else
13164 {
13165
13168 }
13169 }
13170 }
13171
13173 {
13175 {
13176 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13177 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13178 {
13179 float heatPermCoef = 1.0;
13181 while (ent)
13182 {
13183 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13184 ent = ent.GetHierarchyParent();
13185 }
13186
13187 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13188 }
13189 }
13190 }
13191
13193 {
13194
13195 EntityAI parent = GetHierarchyParent();
13196 if (!parent)
13197 {
13198 hasParent = false;
13199 hasRootAsPlayer = false;
13200 }
13201 else
13202 {
13203 hasParent = true;
13204 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13205 refParentIB =
ItemBase.Cast(parent);
13206 }
13207 }
13208
13209 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13210 {
13211
13212 }
13213
13215 {
13216
13217 return false;
13218 }
13219
13221 {
13222
13223
13224 return false;
13225 }
13226
13228 {
13229
13230 return false;
13231 }
13232
13235 {
13236 return !GetIsFrozen() &&
IsOpen();
13237 }
13238
13240 {
13241 bool hasParent = false, hasRootAsPlayer = false;
13243
13244 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13245 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13246
13247 if (wwtu || foodDecay)
13248 {
13252
13253 if (processWetness || processTemperature || processDecay)
13254 {
13256
13257 if (processWetness)
13258 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13259
13260 if (processTemperature)
13262
13263 if (processDecay)
13264 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13265 }
13266 }
13267 }
13268
13271 {
13273 }
13274
13276 {
13279
13280 return super.GetTemperatureFreezeThreshold();
13281 }
13282
13284 {
13287
13288 return super.GetTemperatureThawThreshold();
13289 }
13290
13292 {
13295
13296 return super.GetItemOverheatThreshold();
13297 }
13298
13300 {
13302 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13303
13304 return super.GetTemperatureFreezeTime();
13305 }
13306
13308 {
13310 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13311
13312 return super.GetTemperatureThawTime();
13313 }
13314
13319
13321 {
13322 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13323 }
13324
13326 {
13327 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13328 }
13329
13332 {
13334 }
13335
13337 {
13339 }
13340
13342 {
13344 }
13345
13348 {
13349 return null;
13350 }
13351
13354 {
13355 return false;
13356 }
13357
13359 {
13361 {
13364 if (!trg)
13365 {
13367 explosive = this;
13368 }
13369
13370 explosive.PairRemote(trg);
13372
13373 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13374 trg.SetPersistentPairID(persistentID);
13375 explosive.SetPersistentPairID(persistentID);
13376
13377 return true;
13378 }
13379 return false;
13380 }
13381
13384 {
13385 float ret = 1.0;
13388 ret *= GetHealth01();
13389
13390 return ret;
13391 }
13392
13393 #ifdef DEVELOPER
13394 override void SetDebugItem()
13395 {
13396 super.SetDebugItem();
13397 _itemBase = this;
13398 }
13399
13401 {
13402 string text = super.GetDebugText();
13403
13405 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13406
13407 return text;
13408 }
13409 #endif
13410
13412 {
13413 return true;
13414 }
13415
13417
13419
13421 {
13424 }
13425
13426
13434
13450}
13451
13453{
13455 if (entity)
13456 {
13457 bool is_item = entity.IsInherited(
ItemBase);
13458 if (is_item && full_quantity)
13459 {
13462 }
13463 }
13464 else
13465 {
13467 return NULL;
13468 }
13469 return entity;
13470}
13471
13473{
13474 if (item)
13475 {
13476 if (health > 0)
13477 item.SetHealth("", "", health);
13478
13479 if (item.CanHaveTemperature())
13480 {
13482 if (item.CanFreeze())
13483 item.SetFrozen(false);
13484 }
13485
13486 if (item.HasEnergyManager())
13487 {
13488 if (quantity >= 0)
13489 {
13490 item.GetCompEM().SetEnergy0To1(quantity);
13491 }
13492 else
13493 {
13495 }
13496 }
13497 else if (item.IsMagazine())
13498 {
13499 Magazine mag = Magazine.Cast(item);
13500 if (quantity >= 0)
13501 {
13502 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13503 }
13504 else
13505 {
13507 }
13508
13509 }
13510 else
13511 {
13512 if (quantity >= 0)
13513 {
13514 item.SetQuantityNormalized(quantity, false);
13515 }
13516 else
13517 {
13519 }
13520
13521 }
13522 }
13523}
13524
13525#ifdef DEVELOPER
13527#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.