Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter.
8712{
8714 {
8715 return true;
8716 }
8717};
8718
8719
8720
8722{
8726
8728
8731
8732
8733
8734
8735
8744
8750
8755
8760
8781 protected bool m_IsResultOfSplit
8782
8784
8789
8790
8791
8793
8797
8798
8799
8801
8804
8805
8806
8812
8813
8821
8824
8825
8827
8828
8830
8831
8836
8837
8842
8843
8845
8846
8848 {
8853
8854 if (!
GetGame().IsDedicatedServer())
8855 {
8857 {
8859
8861 {
8863 }
8864 }
8865
8868 }
8869
8870 m_OldLocation = null;
8871
8873 {
8875 }
8876
8877 if (ConfigIsExisting("headSelectionsToHide"))
8878 {
8881 }
8882
8884 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8885 {
8887 }
8888
8890
8891 m_IsResultOfSplit = false;
8892
8894 }
8895
8897 {
8898 super.InitItemVariables();
8899
8905 m_Count = ConfigGetInt(
"count");
8906
8909
8914
8917
8922
8934
8938
8939
8942 if (ConfigIsExisting("canBeSplit"))
8943 {
8946 }
8947
8949 if (ConfigIsExisting("itemBehaviour"))
8951
8952
8955 RegisterNetSyncVariableInt("m_VarLiquidType");
8956 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8957
8958 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8959 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8960 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8961
8962 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8963 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8964 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8965 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8966
8967 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8968 RegisterNetSyncVariableBool("m_IsTakeable");
8969 RegisterNetSyncVariableBool("m_IsHologram");
8970
8973 {
8976 }
8977
8979
8981 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8983
8984 }
8985
8987 {
8989 }
8990
8992 {
8995 {
9000 }
9001 }
9002
9003 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9004 {
9006 {
9009 }
9010
9012 }
9013
9015 {
9021 }
9022
9024
9026 {
9028
9029 if (!action)
9030 {
9031 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9032 return;
9033 }
9034
9036 if (!ai)
9037 {
9039 return;
9040 }
9041
9043 if (!action_array)
9044 {
9045 action_array = new array<ActionBase_Basic>;
9047 }
9048 if (LogManager.IsActionLogEnable())
9049 {
9050 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9051 }
9052
9053 if (action_array.Find(action) != -1)
9054 {
9055 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9056 }
9057 else
9058 {
9059 action_array.Insert(action);
9060 }
9061 }
9062
9064 {
9066 ActionBase action = player.GetActionManager().GetAction(actionName);
9069
9070 if (action_array)
9071 {
9072 action_array.RemoveItem(action);
9073 }
9074 }
9075
9076
9077
9079 {
9080 ActionOverrideData overrideData = new ActionOverrideData();
9084
9086 if (!actionMap)
9087 {
9090 }
9091
9092 actionMap.Insert(this.
Type(), overrideData);
9093
9094 }
9095
9097
9099
9100
9102 {
9105
9108
9109 string config_to_search = "CfgVehicles";
9110 string muzzle_owner_config;
9111
9113 {
9114 if (IsInherited(Weapon))
9115 config_to_search = "CfgWeapons";
9116
9117 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9118
9119 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9120
9122
9123 if (config_OnFire_subclass_count > 0)
9124 {
9125 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9126
9127 for (int i = 0; i < config_OnFire_subclass_count; i++)
9128 {
9129 string particle_class = "";
9131 string config_OnFire_entry = config_OnFire_class + particle_class;
9132 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9133 WPOF_array.Insert(WPOF);
9134 }
9135
9136
9138 }
9139 }
9140
9142 {
9143 config_to_search = "CfgWeapons";
9144 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9145
9146 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9147
9149
9150 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9151 {
9152 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9153
9154 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9155 {
9156 string particle_class2 = "";
9158 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9159 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9160 WPOBE_array.Insert(WPOBE);
9161 }
9162
9163
9165 }
9166 }
9167 }
9168
9169
9171 {
9174
9176 {
9177 string config_to_search = "CfgVehicles";
9178
9179 if (IsInherited(Weapon))
9180 config_to_search = "CfgWeapons";
9181
9182 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9183 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9184
9185 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9186 {
9187
9189
9191 {
9193 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9195 return;
9196 }
9197
9200
9201
9202
9204 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9205
9206 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9207 {
9208 string particle_class = "";
9210 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9212
9213 if (entry_type == CT_CLASS)
9214 {
9215 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9216 WPOOH_array.Insert(WPOF);
9217 }
9218 }
9219
9220
9222 }
9223 }
9224 }
9225
9227 {
9229 }
9230
9232 {
9234 {
9236
9239
9242
9243 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9244 }
9245 }
9246
9248 {
9250 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9251
9253 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9254
9256 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9257
9259 {
9261 }
9262 }
9263
9265 {
9267 }
9268
9270 {
9273 else
9275
9277 {
9280 }
9281 else
9282 {
9285
9288 }
9289
9291 }
9292
9294 {
9296 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9297 }
9298
9300 {
9302 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9304 }
9305
9307 {
9309 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9310 }
9311
9313 {
9316
9317 OverheatingParticle OP = new OverheatingParticle();
9322
9324 }
9325
9327 {
9330
9331 return -1;
9332 }
9333
9335 {
9337 {
9340
9341 for (int i = count; i > 0; --i)
9342 {
9343 int id = i - 1;
9346
9349
9350 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9351 {
9352 if (p)
9353 {
9356 }
9357 }
9358 }
9359 }
9360 }
9361
9363 {
9365 {
9367 {
9368 int id = i - 1;
9370
9371 if (OP)
9372 {
9374
9375 if (p)
9376 {
9378 }
9379
9380 delete OP;
9381 }
9382 }
9383
9386 }
9387 }
9388
9391 {
9392 return 0.0;
9393 }
9394
9395
9397 {
9398 return 250;
9399 }
9400
9402 {
9403 return 0;
9404 }
9405
9408 {
9410 return true;
9411
9412 return false;
9413 }
9414
9417 {
9420
9422 {
9424 }
9425 else
9426 {
9427
9429 }
9430
9432 }
9433
9440 {
9441 return -1;
9442 }
9443
9444
9445
9446
9448 {
9450 {
9452 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9453
9454 if (r_index >= 0)
9455 {
9456 InventoryLocation r_il = new InventoryLocation;
9457 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9458
9459 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9462 {
9463 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9464 }
9466 {
9467 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9468 }
9469
9470 }
9471
9472 player.GetHumanInventory().ClearUserReservedLocation(this);
9473 }
9474
9477 }
9478
9479
9480
9481
9483 {
9484 return ItemBase.m_DebugActionsMask;
9485 }
9486
9488 {
9489 return ItemBase.m_DebugActionsMask & mask;
9490 }
9491
9493 {
9494 ItemBase.m_DebugActionsMask = mask;
9495 }
9496
9498 {
9499 ItemBase.m_DebugActionsMask |= mask;
9500 }
9501
9503 {
9504 ItemBase.m_DebugActionsMask &= ~mask;
9505 }
9506
9508 {
9510 {
9512 }
9513 else
9514 {
9516 }
9517 }
9518
9519
9521 {
9522 if (GetEconomyProfile())
9523 {
9524 float q_max = GetEconomyProfile().GetQuantityMax();
9525 if (q_max > 0)
9526 {
9527 float q_min = GetEconomyProfile().GetQuantityMin();
9528 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9529
9531 {
9532 ComponentEnergyManager comp = GetCompEM();
9534 {
9536 }
9537 }
9539 {
9541
9542 }
9543
9544 }
9545 }
9546 }
9547
9550 {
9551 EntityAI parent = GetHierarchyParent();
9552
9553 if (parent)
9554 {
9555 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9556 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9557 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9558 }
9559 }
9560
9563 {
9564 EntityAI parent = GetHierarchyParent();
9565
9566 if (parent)
9567 {
9568 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9569 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9570 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9571 }
9572 }
9573
9575 {
9576
9577
9578
9579
9581
9583 {
9584 if (ScriptInputUserData.CanStoreInputUserData())
9585 {
9586 ScriptInputUserData ctx = new ScriptInputUserData;
9592 ctx.
Write(use_stack_max);
9595
9597 {
9598 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9599 }
9600 }
9601 }
9602 else if (!
GetGame().IsMultiplayer())
9603 {
9605 }
9606 }
9607
9609 {
9611 }
9612
9614 {
9616 }
9617
9619 {
9621 }
9622
9624 {
9625
9626 return false;
9627 }
9628
9630 {
9631 return false;
9632 }
9633
9637 {
9638 return false;
9639 }
9640
9642 {
9643 return "";
9644 }
9645
9647
9649 {
9650 return false;
9651 }
9652
9654 {
9655 return true;
9656 }
9657
9658
9659
9661 {
9662 return true;
9663 }
9664
9666 {
9667 return true;
9668 }
9669
9671 {
9672 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9674 }
9675
9677 {
9679 }
9680
9682 {
9684 if (!is_being_placed)
9686 SetSynchDirty();
9687 }
9688
9689
9691
9693 {
9695 }
9696
9698 {
9700 }
9701
9703 {
9704 return 1;
9705 }
9706
9708 {
9709 return false;
9710 }
9711
9713 {
9715 SetSynchDirty();
9716 }
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9753 {
9754 super.OnMovedInsideCargo(container);
9755
9756 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9757 }
9758
9759 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9760 {
9761 super.EEItemLocationChanged(oldLoc,newLoc);
9762
9763 PlayerBase new_player = null;
9764 PlayerBase old_player = null;
9765
9766 if (newLoc.GetParent())
9767 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9768
9769 if (oldLoc.GetParent())
9770 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9771
9773 {
9774 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9775
9776 if (r_index >= 0)
9777 {
9778 InventoryLocation r_il = new InventoryLocation;
9779 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9780
9781 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9784 {
9785 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9786 }
9788 {
9789 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9790 }
9791
9792 }
9793 }
9794
9796 {
9797 if (new_player)
9798 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9799
9800 if (new_player == old_player)
9801 {
9802
9803 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9804 {
9806 {
9807 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9808 {
9809 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9810 }
9811 }
9812 else
9813 {
9814 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9815 }
9816 }
9817
9818 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9819 {
9820 int type = oldLoc.GetType();
9822 {
9823 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9824 }
9826 {
9827 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9828 }
9829 }
9830 if (!m_OldLocation)
9831 {
9832 m_OldLocation = new InventoryLocation;
9833 }
9834 m_OldLocation.Copy(oldLoc);
9835 }
9836 else
9837 {
9838 if (m_OldLocation)
9839 {
9840 m_OldLocation.Reset();
9841 }
9842 }
9843
9845 }
9846 else
9847 {
9848 if (new_player)
9849 {
9850 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9851 if (res_index >= 0)
9852 {
9853 InventoryLocation il = new InventoryLocation;
9854 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9856 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9859 {
9860 il.
GetParent().GetOnReleaseLock().Invoke(it);
9861 }
9863 {
9865 }
9866
9867 }
9868 }
9870 {
9871
9873 }
9874
9875 if (m_OldLocation)
9876 {
9877 m_OldLocation.Reset();
9878 }
9879 }
9880 }
9881
9882 override void EOnContact(IEntity other, Contact extra)
9883 {
9885 {
9886 int liquidType = -1;
9888 if (impactSpeed > 0.0)
9889 {
9891 #ifndef SERVER
9893 #else
9895 SetSynchDirty();
9896 #endif
9898 }
9899 }
9900
9901 #ifdef SERVER
9902 if (GetCompEM() && GetCompEM().IsPlugged())
9903 {
9904 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9905 GetCompEM().UnplugThis();
9906 }
9907 #endif
9908 }
9909
9911
9913 {
9915 }
9916
9918 {
9919
9920 }
9921
9923 {
9924 super.OnItemLocationChanged(old_owner, new_owner);
9925
9926 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9927 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9928
9929 if (!relatedPlayer && playerNew)
9930 relatedPlayer = playerNew;
9931
9932 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9933 {
9935 if (actionMgr)
9936 {
9937 ActionBase currentAction = actionMgr.GetRunningAction();
9938 if (currentAction)
9940 }
9941 }
9942
9943 Man ownerPlayerOld = null;
9944 Man ownerPlayerNew = null;
9945
9946 if (old_owner)
9947 {
9948 if (old_owner.
IsMan())
9949 {
9950 ownerPlayerOld = Man.Cast(old_owner);
9951 }
9952 else
9953 {
9954 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9955 }
9956 }
9957 else
9958 {
9960 {
9962
9963 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9964 {
9965 GetCompEM().UnplugThis();
9966 }
9967 }
9968 }
9969
9970 if (new_owner)
9971 {
9972 if (new_owner.
IsMan())
9973 {
9974 ownerPlayerNew = Man.Cast(new_owner);
9975 }
9976 else
9977 {
9978 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9979 }
9980 }
9981
9982 if (ownerPlayerOld != ownerPlayerNew)
9983 {
9984 if (ownerPlayerOld)
9985 {
9986 array<EntityAI> subItemsExit = new array<EntityAI>;
9988 for (int i = 0; i < subItemsExit.Count(); i++)
9989 {
9992 }
9993 }
9994
9995 if (ownerPlayerNew)
9996 {
9997 array<EntityAI> subItemsEnter = new array<EntityAI>;
9999 for (int j = 0; j < subItemsEnter.Count(); j++)
10000 {
10003 }
10004 }
10005 }
10006 else if (ownerPlayerNew != null)
10007 {
10008 PlayerBase nplayer;
10009 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10010 {
10011 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10013 for (int k = 0; k < subItemsUpdate.Count(); k++)
10014 {
10016 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10017 }
10018 }
10019 }
10020
10021 if (old_owner)
10022 old_owner.OnChildItemRemoved(this);
10023 if (new_owner)
10024 new_owner.OnChildItemReceived(this);
10025 }
10026
10027
10029 {
10030 super.EEDelete(parent);
10031 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10032 if (player)
10033 {
10035
10036 if (player.IsAlive())
10037 {
10038 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10039 if (r_index >= 0)
10040 {
10041 InventoryLocation r_il = new InventoryLocation;
10042 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10043
10044 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10047 {
10048 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10049 }
10051 {
10052 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10053 }
10054
10055 }
10056
10057 player.RemoveQuickBarEntityShortcut(this);
10058 }
10059 }
10060 }
10061
10063 {
10064 super.EEKilled(killer);
10065
10068 {
10069 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10070 {
10071 if (IsMagazine())
10072 {
10073 if (Magazine.Cast(this).GetAmmoCount() > 0)
10074 {
10076 }
10077 }
10078 else
10079 {
10081 }
10082 }
10083 }
10084 }
10085
10087 {
10088 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10089
10090 super.OnWasAttached(parent, slot_id);
10091
10094
10096 }
10097
10099 {
10100 super.OnWasDetached(parent, slot_id);
10101
10104 }
10105
10107 {
10108 int idx;
10111
10112 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10113 if (inventory_slots.Count() < 1)
10114 {
10115 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10116 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10117 }
10118 else
10119 {
10120 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10121 }
10122
10123 idx = inventory_slots.Find(slot);
10124 if (idx < 0)
10125 return "";
10126
10127 return attach_types.Get(idx);
10128 }
10129
10131 {
10132 int idx = -1;
10133 string slot;
10134
10137
10138 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10139 if (inventory_slots.Count() < 1)
10140 {
10141 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10142 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10143 }
10144 else
10145 {
10146 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10147 if (detach_types.Count() < 1)
10148 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10149 }
10150
10151 for (int i = 0; i < inventory_slots.Count(); i++)
10152 {
10153 slot = inventory_slots.Get(i);
10154 }
10155
10156 if (slot != "")
10157 {
10158 if (detach_types.Count() == 1)
10159 idx = 0;
10160 else
10161 idx = inventory_slots.Find(slot);
10162 }
10163 if (idx < 0)
10164 return "";
10165
10166 return detach_types.Get(idx);
10167 }
10168
10170 {
10171
10173
10174
10175 float min_time = 1;
10176 float max_time = 3;
10177 float delay = Math.RandomFloat(min_time, max_time);
10178
10179 explode_timer.Run(delay, this, "DoAmmoExplosion");
10180 }
10181
10183 {
10184 Magazine magazine = Magazine.Cast(this);
10185 int pop_sounds_count = 6;
10186 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10187
10188
10189 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10190 string sound_name = pop_sounds[ sound_idx ];
10192
10193
10194 magazine.ServerAddAmmoCount(-1);
10195
10196
10197 float min_temp_to_explode = 100;
10198
10199 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10200 {
10202 }
10203 }
10204
10205
10206 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10207 {
10208 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10209
10210 const int CHANCE_DAMAGE_CARGO = 4;
10211 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10212 const int CHANCE_DAMAGE_NOTHING = 2;
10213
10215 {
10216 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10217 int chances;
10218 int rnd;
10219
10220 if (GetInventory().GetCargo())
10221 {
10222 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10223 rnd = Math.RandomInt(0,chances);
10224
10225 if (rnd < CHANCE_DAMAGE_CARGO)
10226 {
10228 }
10229 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10230 {
10232 }
10233 }
10234 else
10235 {
10236 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10237 rnd = Math.RandomInt(0,chances);
10238
10239 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10240 {
10242 }
10243 }
10244 }
10245 }
10246
10248 {
10249 if (GetInventory().GetCargo())
10250 {
10251 int item_count = GetInventory().GetCargo().GetItemCount();
10252 if (item_count > 0)
10253 {
10254 int random_pick = Math.RandomInt(0, item_count);
10256 if (!item.IsExplosive())
10257 {
10258 item.AddHealth("","",damage);
10259 return true;
10260 }
10261 }
10262 }
10263 return false;
10264 }
10265
10267 {
10268 int attachment_count = GetInventory().AttachmentCount();
10269 if (attachment_count > 0)
10270 {
10271 int random_pick = Math.RandomInt(0, attachment_count);
10272 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10273 if (!attachment.IsExplosive())
10274 {
10275 attachment.AddHealth("","",damage);
10276 return true;
10277 }
10278 }
10279 return false;
10280 }
10281
10283 {
10285 }
10286
10288 {
10290 return GetInventory().CanRemoveEntity();
10291
10292 return false;
10293 }
10294
10296 {
10297
10299 return false;
10300
10301
10303 return false;
10304
10305
10306
10308 if (delta == 0)
10309 return false;
10310
10311
10312 return true;
10313 }
10314
10316 {
10318 {
10319 if (ScriptInputUserData.CanStoreInputUserData())
10320 {
10321 ScriptInputUserData ctx = new ScriptInputUserData;
10326 ctx.
Write(destination_entity);
10328 ctx.
Write(slot_id);
10330 }
10331 }
10332 else if (!
GetGame().IsMultiplayer())
10333 {
10335 }
10336 }
10337
10339 {
10340 float split_quantity_new;
10344 InventoryLocation loc = new InventoryLocation;
10345
10346 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10347 {
10349 split_quantity_new = stack_max;
10350 else
10352
10354 {
10355 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
10366 {
10367 if (quantity > stack_max)
10368 split_quantity_new = stack_max;
10369 else
10370 split_quantity_new = quantity;
10371
10373 {
10375 {
10378 }
10379
10380 if (new_item)
10381 {
10382 new_item.SetResultOfSplit(true);
10383 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10385 new_item.
SetQuantity(split_quantity_new,
false,
true);
10386 }
10387 }
10388 }
10389 else
10390 {
10391 if (stack_max != 0)
10392 {
10394 {
10396 }
10397
10398 if (split_quantity_new == 0)
10399 {
10400 if (!
GetGame().IsMultiplayer())
10401 player.PhysicalPredictiveDropItem(this);
10402 else
10403 player.ServerDropEntity(this);
10404 return;
10405 }
10406
10408 {
10410
10411 if (new_item)
10412 {
10413 new_item.SetResultOfSplit(true);
10414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10417 new_item.PlaceOnSurface();
10418 }
10419 }
10420 }
10421 }
10422 }
10423
10425 {
10426 float split_quantity_new;
10430 InventoryLocation loc = new InventoryLocation;
10431
10432 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10433 {
10435 split_quantity_new = stack_max;
10436 else
10438
10440 {
10441 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10442 if (new_item)
10443 {
10444 new_item.SetResultOfSplit(true);
10445 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10447 new_item.
SetQuantity(split_quantity_new,
false,
true);
10448 }
10449 }
10450 }
10451 else if (destination_entity && slot_id == -1)
10452 {
10453 if (quantity > stack_max)
10454 split_quantity_new = stack_max;
10455 else
10456 split_quantity_new = quantity;
10457
10459 {
10461 {
10464 }
10465
10466 if (new_item)
10467 {
10468 new_item.SetResultOfSplit(true);
10469 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10471 new_item.
SetQuantity(split_quantity_new,
false,
true);
10472 }
10473 }
10474 }
10475 else
10476 {
10477 if (stack_max != 0)
10478 {
10480 {
10482 }
10483
10485 {
10487
10488 if (new_item)
10489 {
10490 new_item.SetResultOfSplit(true);
10491 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10494 new_item.PlaceOnSurface();
10495 }
10496 }
10497 }
10498 }
10499 }
10500
10502 {
10504 {
10505 if (ScriptInputUserData.CanStoreInputUserData())
10506 {
10507 ScriptInputUserData ctx = new ScriptInputUserData;
10512 dst.WriteToContext(ctx);
10514 }
10515 }
10516 else if (!
GetGame().IsMultiplayer())
10517 {
10519 }
10520 }
10521
10523 {
10525 {
10526 if (ScriptInputUserData.CanStoreInputUserData())
10527 {
10528 ScriptInputUserData ctx = new ScriptInputUserData;
10533 ctx.
Write(destination_entity);
10539 }
10540 }
10541 else if (!
GetGame().IsMultiplayer())
10542 {
10544 }
10545 }
10546
10548 {
10550 }
10551
10553 {
10555 float split_quantity_new;
10557 if (dst.IsValid())
10558 {
10559 int slot_id = dst.GetSlot();
10561
10562 if (quantity > stack_max)
10563 split_quantity_new = stack_max;
10564 else
10565 split_quantity_new = quantity;
10566
10568 {
10570
10571 if (new_item)
10572 {
10573 new_item.SetResultOfSplit(true);
10574 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10576 new_item.
SetQuantity(split_quantity_new,
false,
true);
10577 }
10578
10579 return new_item;
10580 }
10581 }
10582
10583 return null;
10584 }
10585
10587 {
10589 float split_quantity_new;
10591 if (destination_entity)
10592 {
10594 if (quantity > stackable)
10595 split_quantity_new = stackable;
10596 else
10597 split_quantity_new = quantity;
10598
10600 {
10601 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10602 if (new_item)
10603 {
10604 new_item.SetResultOfSplit(true);
10605 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10607 new_item.
SetQuantity(split_quantity_new,
false,
true);
10608 }
10609 }
10610 }
10611 }
10612
10614 {
10616 {
10617 if (ScriptInputUserData.CanStoreInputUserData())
10618 {
10619 ScriptInputUserData ctx = new ScriptInputUserData;
10624 ItemBase destination_entity =
this;
10625 ctx.
Write(destination_entity);
10629 }
10630 }
10631 else if (!
GetGame().IsMultiplayer())
10632 {
10634 }
10635 }
10636
10638 {
10640 float split_quantity_new;
10642 if (player)
10643 {
10645 if (quantity > stackable)
10646 split_quantity_new = stackable;
10647 else
10648 split_quantity_new = quantity;
10649
10651 {
10652 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10653 new_item =
ItemBase.Cast(in_hands);
10654 if (new_item)
10655 {
10656 new_item.SetResultOfSplit(true);
10657 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10659 new_item.SetQuantity(split_quantity_new, false, true);
10660 }
10661 }
10662 }
10663 }
10664
10666 {
10668 float split_quantity_new = Math.Floor(quantity * 0.5);
10669
10671 return;
10672
10674
10675 if (new_item)
10676 {
10677 if (new_item.GetQuantityMax() < split_quantity_new)
10678 {
10679 split_quantity_new = new_item.GetQuantityMax();
10680 }
10681
10682 new_item.SetResultOfSplit(true);
10683 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10684
10686 {
10689 }
10690 else
10691 {
10693 new_item.
SetQuantity(split_quantity_new,
false,
true);
10694 }
10695 }
10696 }
10697
10699 {
10701 float split_quantity_new = Math.Floor(quantity / 2);
10702
10704 return;
10705
10706 InventoryLocation invloc = new InventoryLocation;
10708
10710 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10711
10712 if (new_item)
10713 {
10714 if (new_item.GetQuantityMax() < split_quantity_new)
10715 {
10716 split_quantity_new = new_item.GetQuantityMax();
10717 }
10719 {
10722 }
10723 else if (split_quantity_new > 1)
10724 {
10726 new_item.
SetQuantity(split_quantity_new,
false,
true);
10727 }
10728 }
10729 }
10730
10733 {
10734 SetWeightDirty();
10736
10737 if (parent)
10738 parent.OnAttachmentQuantityChangedEx(this, delta);
10739
10741 {
10743 {
10745 }
10747 {
10748 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10750 }
10751 }
10752
10753 }
10754
10757 {
10758
10759 }
10760
10763 {
10765 }
10766
10768 {
10769 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10770
10772 {
10773 if (newLevel == GameConstants.STATE_RUINED)
10774 {
10776 EntityAI parent = GetHierarchyParent();
10777 if (parent && parent.IsFireplace())
10778 {
10779 CargoBase cargo = GetInventory().GetCargo();
10780 if (cargo)
10781 {
10783 {
10785 }
10786 }
10787 }
10788 }
10789
10791 {
10792
10794 return;
10795 }
10796
10797 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10798 {
10800 }
10801 }
10802 }
10803
10804
10806 {
10807 super.OnRightClick();
10808
10810 {
10812 {
10813 if (ScriptInputUserData.CanStoreInputUserData())
10814 {
10815 EntityAI root = GetHierarchyRoot();
10816 Man playerOwner = GetHierarchyRootPlayer();
10817 InventoryLocation dst = new InventoryLocation;
10818
10819
10820 if (!playerOwner && root && root == this)
10821 {
10823 }
10824 else
10825 {
10826
10827 GetInventory().GetCurrentInventoryLocation(dst);
10829 {
10832 {
10834 }
10835 else
10836 {
10838
10839
10840 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10841 {
10843 }
10844 else
10845 {
10846 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10847 }
10848 }
10849 }
10850 }
10851
10852 ScriptInputUserData ctx = new ScriptInputUserData;
10860 }
10861 }
10862 else if (!
GetGame().IsMultiplayer())
10863 {
10865 }
10866 }
10867 }
10868
10870 {
10871 if (root)
10872 {
10873 vector m4[4];
10874 root.GetTransform(m4);
10875 dst.SetGround(this, m4);
10876 }
10877 else
10878 {
10879 GetInventory().GetCurrentInventoryLocation(dst);
10880 }
10881 }
10882
10883 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10884 {
10885
10886 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10887 return false;
10888
10889 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10890 return false;
10891
10892
10894 return false;
10895
10896
10897 Magazine mag = Magazine.Cast(this);
10898 if (mag)
10899 {
10900 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10901 return false;
10902
10903 if (stack_max_limit)
10904 {
10905 Magazine other_mag = Magazine.Cast(other_item);
10906 if (other_item)
10907 {
10908 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10909 return false;
10910 }
10911
10912 }
10913 }
10914 else
10915 {
10916
10918 return false;
10919
10921 return false;
10922 }
10923
10924 PlayerBase player = null;
10925 if (CastTo(player, GetHierarchyRootPlayer()))
10926 {
10927 if (player.GetInventory().HasAttachment(this))
10928 return false;
10929
10930 if (player.IsItemsToDelete())
10931 return false;
10932 }
10933
10934 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10935 return false;
10936
10937 int slotID;
10939 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10940 return false;
10941
10942 return true;
10943 }
10944
10946 {
10948 }
10949
10951 {
10952 return m_IsResultOfSplit;
10953 }
10954
10956 {
10957 m_IsResultOfSplit = value;
10958 }
10959
10961 {
10963 }
10964
10966 {
10967 float other_item_quantity = other_item.GetQuantity();
10968 float this_free_space;
10969
10971
10973
10974 if (other_item_quantity > this_free_space)
10975 {
10976 return this_free_space;
10977 }
10978 else
10979 {
10980 return other_item_quantity;
10981 }
10982 }
10983
10985 {
10987 }
10988
10990 {
10992 return;
10993
10994 if (!IsMagazine() && other_item)
10995 {
10997 if (quantity_used != 0)
10998 {
10999 float hp1 = GetHealth01("","");
11000 float hp2 = other_item.GetHealth01("","");
11001 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11002 hpResult = hpResult / (
GetQuantity() + quantity_used);
11003
11004 hpResult *= GetMaxHealth();
11005 Math.Round(hpResult);
11006 SetHealth("", "Health", hpResult);
11007
11009 other_item.AddQuantity(-quantity_used);
11010 }
11011 }
11013 }
11014
11016 {
11017 #ifdef SERVER
11018 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11019 GetHierarchyParent().IncreaseLifetimeUp();
11020 #endif
11021 };
11022
11024 {
11025 PlayerBase p = PlayerBase.Cast(player);
11026
11027 array<int> recipesIds = p.m_Recipes;
11028 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11029 if (moduleRecipesManager)
11030 {
11031 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11032 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11033 }
11034
11035 for (int i = 0;i < recipesIds.Count(); i++)
11036 {
11037 int key = recipesIds.Get(i);
11038 string recipeName = moduleRecipesManager.GetRecipeName(key);
11040 }
11041 }
11042
11043
11044 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11045 {
11046 super.GetDebugActions(outputList);
11047
11048
11054
11055
11060
11065
11066
11070
11071
11073 {
11077 }
11078
11081
11082
11086
11088
11089 InventoryLocation loc = new InventoryLocation();
11090 GetInventory().GetCurrentInventoryLocation(loc);
11092 {
11093 if (Gizmo_IsSupported())
11096 }
11097
11099 }
11100
11101
11102
11103
11105 {
11106 super.OnAction(action_id, player, ctx);
11107
11109 {
11110 switch (action_id)
11111 {
11114 return true;
11117 return true;
11118 }
11119 }
11120
11122 {
11123 switch (action_id)
11124 {
11126 Delete();
11127 return true;
11128 }
11129 }
11130
11131 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11132 {
11133 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11134 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11135 PlayerBase p = PlayerBase.Cast(player);
11136 if (
EActions.RECIPES_RANGE_START < 1000)
11137 {
11138 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11139 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11140 }
11141 }
11142 #ifndef SERVER
11143 else if (action_id ==
EActions.WATCH_PLAYER)
11144 {
11145 PluginDeveloper.SetDeveloperItemClientEx(player);
11146 }
11147 #endif
11149 {
11150 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11151 {
11152 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11153 OnDebugButtonPressServer(id + 1);
11154 }
11155
11156 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11157 {
11158 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11160 }
11161
11162 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11163 {
11164 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11166 }
11167
11168 else if (action_id ==
EActions.ADD_QUANTITY)
11169 {
11170 if (IsMagazine())
11171 {
11172 Magazine mag = Magazine.Cast(this);
11173 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11174 }
11175 else
11176 {
11178 }
11179
11180 if (m_EM)
11181 {
11182 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11183 }
11184
11185 }
11186
11187 else if (action_id ==
EActions.REMOVE_QUANTITY)
11188 {
11189 if (IsMagazine())
11190 {
11191 Magazine mag2 = Magazine.Cast(this);
11192 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11193 }
11194 else
11195 {
11197 }
11198 if (m_EM)
11199 {
11200 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11201 }
11202
11203 }
11204
11205 else if (action_id ==
EActions.SET_QUANTITY_0)
11206 {
11208
11209 if (m_EM)
11210 {
11211 m_EM.SetEnergy(0);
11212 }
11213 }
11214
11215 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11216 {
11218
11219 if (m_EM)
11220 {
11221 m_EM.SetEnergy(m_EM.GetEnergyMax());
11222 }
11223 }
11224
11225 else if (action_id ==
EActions.ADD_HEALTH)
11226 {
11227 AddHealth("","",GetMaxHealth("","Health")/5);
11228 }
11229 else if (action_id ==
EActions.REMOVE_HEALTH)
11230 {
11231 AddHealth("","",-GetMaxHealth("","Health")/5);
11232 }
11233 else if (action_id ==
EActions.DESTROY_HEALTH)
11234 {
11235 SetHealth01("","",0);
11236 }
11237 else if (action_id ==
EActions.WATCH_ITEM)
11238 {
11240 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11241 #ifdef DEVELOPER
11242 SetDebugDeveloper_item(this);
11243 #endif
11244 }
11245
11246 else if (action_id ==
EActions.ADD_TEMPERATURE)
11247 {
11248 AddTemperature(20);
11249
11250 }
11251
11252 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11253 {
11254 AddTemperature(-20);
11255
11256 }
11257
11258 else if (action_id ==
EActions.FLIP_FROZEN)
11259 {
11260 SetFrozen(!GetIsFrozen());
11261
11262 }
11263
11264 else if (action_id ==
EActions.ADD_WETNESS)
11265 {
11267
11268 }
11269
11270 else if (action_id ==
EActions.REMOVE_WETNESS)
11271 {
11273
11274 }
11275
11276 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11277 {
11280
11281
11282 }
11283
11284 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11285 {
11288 }
11289
11290 else if (action_id ==
EActions.MAKE_SPECIAL)
11291 {
11292 auto debugParams = DebugSpawnParams.WithPlayer(player);
11293 OnDebugSpawnEx(debugParams);
11294 }
11295
11296 }
11297
11298
11299 return false;
11300 }
11301
11302
11303
11304
11308
11311
11312
11313
11315 {
11316 return false;
11317 }
11318
11319
11321 {
11322 return true;
11323 }
11324
11325
11327 {
11328 return true;
11329 }
11330
11331
11332
11334 {
11335 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11337 }
11338
11341 {
11342 return null;
11343 }
11344
11346 {
11347 return false;
11348 }
11349
11351 {
11352 return false;
11353 }
11354
11358
11359
11361 {
11362 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11363 return module_repairing.CanRepair(this, item_repair_kit);
11364 }
11365
11366
11367 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11368 {
11369 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11370 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11371 }
11372
11373
11375 {
11376
11377
11378
11379
11380
11381
11382
11383
11384 return 1;
11385 }
11386
11387
11388
11390 {
11392 }
11393
11394
11395
11397 {
11399 }
11400
11401
11410 {
11411 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11412
11413 if (player)
11414 {
11415 player.MessageStatus(text);
11416 }
11417 }
11418
11419
11428 {
11429 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11430
11431 if (player)
11432 {
11433 player.MessageAction(text);
11434 }
11435 }
11436
11437
11446 {
11447 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11448
11449 if (player)
11450 {
11451 player.MessageFriendly(text);
11452 }
11453 }
11454
11455
11464 {
11465 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11466
11467 if (player)
11468 {
11469 player.MessageImportant(text);
11470 }
11471 }
11472
11474 {
11475 return true;
11476 }
11477
11478
11479 override bool KindOf(
string tag)
11480 {
11481 bool found = false;
11482 string item_name = this.
GetType();
11485
11486 int array_size = item_tag_array.Count();
11487 for (int i = 0; i < array_size; i++)
11488 {
11489 if (item_tag_array.Get(i) == tag)
11490 {
11491 found = true;
11492 break;
11493 }
11494 }
11495 return found;
11496 }
11497
11498
11500 {
11501
11502 super.OnRPC(sender, rpc_type,ctx);
11503
11504
11505 switch (rpc_type)
11506 {
11507 #ifndef SERVER
11508 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11509 Param2<bool, string> p = new Param2<bool, string>(false, "");
11510
11512 return;
11513
11514 bool play = p.param1;
11515 string soundSet = p.param2;
11516
11517 if (play)
11518 {
11520 {
11522 {
11524 }
11525 }
11526 else
11527 {
11529 }
11530 }
11531 else
11532 {
11534 }
11535
11536 break;
11537 #endif
11538
11539 }
11540
11542 {
11544 }
11545 }
11546
11547
11548
11549
11551 {
11552 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11553 return plugin.GetID(
name);
11554 }
11555
11557 {
11558 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11559 return plugin.GetName(id);
11560 }
11561
11564 {
11565
11566
11567 int varFlags;
11568 if (!ctx.
Read(varFlags))
11569 return;
11570
11571 if (varFlags & ItemVariableFlags.FLOAT)
11572 {
11574 }
11575 }
11576
11578 {
11579
11580 super.SerializeNumericalVars(floats_out);
11581
11582
11583
11585 {
11587 }
11588
11590 {
11592 }
11593
11595 {
11597 }
11598
11600 {
11605 }
11606
11608 {
11610 }
11611 }
11612
11614 {
11615
11616 super.DeSerializeNumericalVars(floats);
11617
11618
11619 int index = 0;
11620 int mask = Math.Round(floats.Get(index));
11621
11622 index++;
11623
11625 {
11627 {
11629 }
11630 else
11631 {
11632 float quantity = floats.Get(index);
11633 SetQuantity(quantity,
true,
false,
false,
false);
11634 }
11635 index++;
11636 }
11637
11639 {
11640 float wet = floats.Get(index);
11642 index++;
11643 }
11644
11646 {
11647 int liquidtype = Math.Round(floats.Get(index));
11649 index++;
11650 }
11651
11653 {
11655 index++;
11657 index++;
11659 index++;
11661 index++;
11662 }
11663
11665 {
11666 int cleanness = Math.Round(floats.Get(index));
11668 index++;
11669 }
11670 }
11671
11673 {
11674 super.WriteVarsToCTX(ctx);
11675
11676
11678 {
11680 }
11681
11683 {
11685 }
11686
11688 {
11690 }
11691
11693 {
11694 int r,g,b,a;
11700 }
11701
11703 {
11705 }
11706 }
11707
11709 {
11710 if (!super.ReadVarsFromCTX(ctx,version))
11711 return false;
11712
11713 int intValue;
11714 float value;
11715
11716 if (version < 140)
11717 {
11718 if (!ctx.
Read(intValue))
11719 return false;
11720
11721 m_VariablesMask = intValue;
11722 }
11723
11725 {
11726 if (!ctx.
Read(value))
11727 return false;
11728
11730 {
11732 }
11733 else
11734 {
11736 }
11737 }
11738
11739 if (version < 140)
11740 {
11742 {
11743 if (!ctx.
Read(value))
11744 return false;
11745 SetTemperatureDirect(value);
11746 }
11747 }
11748
11750 {
11751 if (!ctx.
Read(value))
11752 return false;
11754 }
11755
11757 {
11758 if (!ctx.
Read(intValue))
11759 return false;
11761 }
11762
11764 {
11765 int r,g,b,a;
11767 return false;
11769 return false;
11771 return false;
11773 return false;
11774
11776 }
11777
11779 {
11780 if (!ctx.
Read(intValue))
11781 return false;
11783 }
11784
11785 if (version >= 138 && version < 140)
11786 {
11788 {
11789 if (!ctx.
Read(intValue))
11790 return false;
11791 SetFrozen(intValue);
11792 }
11793 }
11794
11795 return true;
11796 }
11797
11798
11800 {
11803 {
11805 }
11806
11807 if (!super.OnStoreLoad(ctx, version))
11808 {
11810 return false;
11811 }
11812
11813 if (version >= 114)
11814 {
11815 bool hasQuickBarIndexSaved;
11816
11817 if (!ctx.
Read(hasQuickBarIndexSaved))
11818 {
11820 return false;
11821 }
11822
11823 if (hasQuickBarIndexSaved)
11824 {
11825 int itmQBIndex;
11826
11827
11828 if (!ctx.
Read(itmQBIndex))
11829 {
11831 return false;
11832 }
11833
11834 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11835 if (itmQBIndex != -1 && parentPlayer)
11836 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11837 }
11838 }
11839 else
11840 {
11841
11842 PlayerBase player;
11843 int itemQBIndex;
11844 if (version ==
int.
MAX)
11845 {
11846 if (!ctx.
Read(itemQBIndex))
11847 {
11849 return false;
11850 }
11851 }
11852 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11853 {
11854
11855 if (!ctx.
Read(itemQBIndex))
11856 {
11858 return false;
11859 }
11860 if (itemQBIndex != -1 && player)
11861 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11862 }
11863 }
11864
11865 if (version < 140)
11866 {
11867
11868 if (!LoadVariables(ctx, version))
11869 {
11871 return false;
11872 }
11873 }
11874
11875
11877 {
11879 return false;
11880 }
11881 if (version >= 132)
11882 {
11884 if (raib)
11885 {
11887 {
11889 return false;
11890 }
11891 }
11892 }
11893
11895 return true;
11896 }
11897
11898
11899
11901 {
11902 super.OnStoreSave(ctx);
11903
11904 PlayerBase player;
11905 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11906 {
11908
11909 int itemQBIndex = -1;
11910 itemQBIndex = player.FindQuickBarEntityIndex(this);
11911 ctx.
Write(itemQBIndex);
11912 }
11913 else
11914 {
11916 }
11917
11919
11921 if (raib)
11922 {
11924 }
11925 }
11926
11927
11929 {
11930 super.AfterStoreLoad();
11931
11933 {
11935 }
11936
11938 {
11941 }
11942 }
11943
11945 {
11946 super.EEOnAfterLoad();
11947
11949 {
11951 }
11952
11955 }
11956
11958 {
11959 return false;
11960 }
11961
11962
11963
11965 {
11967 {
11968 #ifdef PLATFORM_CONSOLE
11969
11971 {
11973 if (menu)
11974 {
11976 }
11977 }
11978 #endif
11979 }
11980
11982 {
11985 }
11986
11988 {
11989 SetWeightDirty();
11991 }
11993 {
11996 }
11997
11999 {
12002 }
12004 {
12007 }
12008
12009 super.OnVariablesSynchronized();
12010 }
12011
12012
12013
12015 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12016 {
12017 if (!IsServerCheck(allow_client))
12018 return false;
12019
12021 return false;
12022
12025
12026 if (value <= (min + 0.001))
12027 value = min;
12028
12029 if (value == min)
12030 {
12031 if (destroy_config)
12032 {
12033 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12034 if (dstr)
12035 {
12037 this.Delete();
12038 return true;
12039 }
12040 }
12041 else if (destroy_forced)
12042 {
12044 this.Delete();
12045 return true;
12046 }
12047
12049 }
12050
12053
12055 {
12057
12058 if (delta)
12060 }
12061
12063
12064 return false;
12065 }
12066
12067
12069 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12070 {
12072 }
12073
12075 {
12078 }
12079
12081 {
12084 }
12085
12087 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12088 {
12089 float value_clamped = Math.Clamp(value, 0, 1);
12091 SetQuantity(result, destroy_config, destroy_forced);
12092 }
12093
12094
12097 {
12099 }
12100
12102 {
12104 }
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12116 {
12117 int slot = -1;
12118 if (GetInventory())
12119 {
12120 InventoryLocation il = new InventoryLocation;
12121 GetInventory().GetCurrentInventoryLocation(il);
12123 }
12124
12126 }
12127
12129 {
12130 float quantity_max = 0;
12131
12133 {
12134 if (attSlotID != -1)
12135 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12136
12137 if (quantity_max <= 0)
12139 }
12140
12141 if (quantity_max <= 0)
12143
12144 return quantity_max;
12145 }
12146
12148 {
12150 }
12151
12153 {
12155 }
12156
12157
12159 {
12161 }
12162
12164 {
12166 }
12167
12169 {
12171 }
12172
12173
12175 {
12176
12177 float weightEx = GetWeightEx();
12178 float special = GetInventoryAndCargoWeight();
12179 return weightEx - special;
12180 }
12181
12182
12184 {
12186 }
12187
12189 {
12191 {
12192 #ifdef DEVELOPER
12193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12194 {
12195 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12197 }
12198 #endif
12199
12200 return GetQuantity() * GetConfigWeightModified();
12201 }
12202 else if (HasEnergyManager())
12203 {
12204 #ifdef DEVELOPER
12205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12206 {
12207 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12208 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12209 }
12210 #endif
12211 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12212 }
12213 else
12214 {
12215 #ifdef DEVELOPER
12216 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12217 {
12218 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12219 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12220 }
12221 #endif
12222 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12223 }
12224 }
12225
12228 {
12229 int item_count = 0;
12231
12232 if (GetInventory().GetCargo() != NULL)
12233 {
12234 item_count = GetInventory().GetCargo().GetItemCount();
12235 }
12236
12237 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12238 {
12239 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12240 if (item)
12241 item_count += item.GetNumberOfItems();
12242 }
12243 return item_count;
12244 }
12245
12248 {
12249 float weight = 0;
12250 float wetness = 1;
12251 if (include_wetness)
12254 {
12255 weight = wetness * m_ConfigWeight;
12256 }
12258 {
12259 weight = 1;
12260 }
12261 return weight;
12262 }
12263
12264
12265
12267 {
12268 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12269 {
12270 GameInventory inv = GetInventory();
12271 array<EntityAI> items = new array<EntityAI>;
12273 for (int i = 0; i < items.Count(); i++)
12274 {
12276 if (item)
12277 {
12279 }
12280 }
12281 }
12282 }
12283
12284
12285
12286
12288 {
12289 float energy = 0;
12290 if (HasEnergyManager())
12291 {
12292 energy = GetCompEM().GetEnergy();
12293 }
12294 return energy;
12295 }
12296
12297
12299 {
12300 super.OnEnergyConsumed();
12301
12303 }
12304
12306 {
12307 super.OnEnergyAdded();
12308
12310 }
12311
12312
12314 {
12315 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12316 {
12318 {
12319 float energy_0to1 = GetCompEM().GetEnergy0To1();
12321 }
12322 }
12323 }
12324
12325
12327 {
12328 return ConfigGetFloat("heatIsolation");
12329 }
12330
12332 {
12334 }
12335
12337 {
12338 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12339 if (
GetGame().ConfigIsExisting(paramPath))
12341
12342 return 0.0;
12343 }
12344
12346 {
12347 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12348 if (
GetGame().ConfigIsExisting(paramPath))
12350
12351 return 0.0;
12352 }
12353
12354 override void SetWet(
float value,
bool allow_client =
false)
12355 {
12356 if (!IsServerCheck(allow_client))
12357 return;
12358
12361
12363
12364 m_VarWet = Math.Clamp(value, min, max);
12365
12367 {
12370 }
12371 }
12372
12373 override void AddWet(
float value)
12374 {
12376 }
12377
12379 {
12381 }
12382
12384 {
12386 }
12387
12389 {
12391 }
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12403 override void OnWetChanged(
float newVal,
float oldVal)
12404 {
12407 if (newLevel != oldLevel)
12408 {
12410 }
12411 }
12412
12414 {
12415 SetWeightDirty();
12416 }
12417
12419 {
12420 return GetWetLevelInternal(
m_VarWet);
12421 }
12422
12423
12424
12426 {
12428 }
12429
12431 {
12433 }
12434
12436 {
12438 }
12439
12441 {
12443 }
12444
12445
12446
12448 {
12449 if (ConfigIsExisting("itemModelLength"))
12450 {
12451 return ConfigGetFloat("itemModelLength");
12452 }
12453 return 0;
12454 }
12455
12457 {
12458 if (ConfigIsExisting("itemAttachOffset"))
12459 {
12460 return ConfigGetFloat("itemAttachOffset");
12461 }
12462 return 0;
12463 }
12464
12465 override void SetCleanness(
int value,
bool allow_client =
false)
12466 {
12467 if (!IsServerCheck(allow_client))
12468 return;
12469
12471
12473
12476 }
12477
12479 {
12481 }
12482
12484 {
12485 return true;
12486 }
12487
12488
12489
12490
12492 {
12494 }
12495
12497 {
12499 }
12500
12501
12502
12503
12504 override void SetColor(
int r,
int g,
int b,
int a)
12505 {
12511 }
12513 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12514 {
12519 }
12520
12522 {
12524 }
12525
12528 {
12529 int r,g,b,a;
12531 r = r/255;
12532 g = g/255;
12533 b = b/255;
12534 a = a/255;
12535 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12536 }
12537
12538
12539
12540 override void SetLiquidType(
int value,
bool allow_client =
false)
12541 {
12542 if (!IsServerCheck(allow_client))
12543 return;
12544
12549 }
12550
12552 {
12553 return ConfigGetInt("varLiquidTypeInit");
12554 }
12555
12557 {
12559 }
12560
12562 {
12564 SetFrozen(false);
12565 }
12566
12569 {
12570 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12571 }
12572
12573
12576 {
12577 PlayerBase nplayer;
12578 if (PlayerBase.CastTo(nplayer, player))
12579 {
12581
12582 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12583 }
12584 }
12585
12586
12589 {
12590 PlayerBase nplayer;
12591 if (PlayerBase.CastTo(nplayer,player))
12592 {
12593
12594 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12595
12596 }
12597
12598
12599 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12600
12601
12602 if (HasEnergyManager())
12603 {
12604 GetCompEM().UpdatePlugState();
12605 }
12606 }
12607
12608
12610 {
12611 super.OnPlacementStarted(player);
12612
12614 }
12615
12616 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12617 {
12619 {
12620 m_AdminLog.OnPlacementComplete(player,
this);
12621 }
12622
12623 super.OnPlacementComplete(player, position, orientation);
12624 }
12625
12626
12627
12628
12629
12631 {
12633 {
12634 return true;
12635 }
12636 else
12637 {
12638 return false;
12639 }
12640 }
12641
12642
12644 {
12646 {
12648 }
12649 }
12650
12651
12653 {
12655 }
12656
12658 {
12660 }
12661
12662 override void InsertAgent(
int agent,
float count = 1)
12663 {
12664 if (count < 1)
12665 return;
12666
12668 }
12669
12672 {
12674 }
12675
12676
12678 {
12680 }
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12724 {
12726 return false;
12727 return true;
12728 }
12729
12731 {
12732
12734 }
12735
12736
12739 {
12740 super.CheckForRoofLimited(timeTresholdMS);
12741
12743 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12744 {
12745 m_PreviousRoofTestTime = time;
12746 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12747 }
12748 }
12749
12750
12752 {
12754 {
12755 return 0;
12756 }
12757
12758 if (GetInventory().GetAttachmentSlotsCount() != 0)
12759 {
12760 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12761 if (filter)
12762 return filter.GetProtectionLevel(type, false, system);
12763 else
12764 return 0;
12765 }
12766
12767 string subclassPath, entryName;
12768
12769 switch (type)
12770 {
12772 entryName = "biological";
12773 break;
12775 entryName = "chemical";
12776 break;
12777 default:
12778 entryName = "biological";
12779 break;
12780 }
12781
12782 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12783
12785 }
12786
12787
12788
12791 {
12792 if (!IsMagazine())
12794
12796 }
12797
12798
12799
12800
12801
12806 {
12807 return true;
12808 }
12809
12811 {
12813 }
12814
12815
12816
12817
12818
12820 {
12821 if (parent)
12822 {
12823 if (parent.IsInherited(DayZInfected))
12824 return true;
12825
12826 if (!parent.IsRuined())
12827 return true;
12828 }
12829
12830 return true;
12831 }
12832
12834 {
12835 if (!super.CanPutAsAttachment(parent))
12836 {
12837 return false;
12838 }
12839
12840 if (!IsRuined() && !parent.IsRuined())
12841 {
12842 return true;
12843 }
12844
12845 return false;
12846 }
12847
12849 {
12850
12851
12852
12853
12854 return super.CanReceiveItemIntoCargo(item);
12855 }
12856
12858 {
12859
12860
12861
12862
12863 GameInventory attachmentInv = attachment.GetInventory();
12865 {
12866 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12867 return false;
12868 }
12869
12870 InventoryLocation loc = new InventoryLocation();
12871 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12872 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12873 return false;
12874
12875 return super.CanReceiveAttachment(attachment, slotId);
12876 }
12877
12879 {
12880 if (!super.CanReleaseAttachment(attachment))
12881 return false;
12882
12883 return GetInventory().AreChildrenAccessible();
12884 }
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12907 {
12908 int id = muzzle_owner.GetMuzzleID();
12909 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12910
12911 if (WPOF_array)
12912 {
12913 for (int i = 0; i < WPOF_array.Count(); i++)
12914 {
12915 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12916
12917 if (WPOF)
12918 {
12919 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12920 }
12921 }
12922 }
12923 }
12924
12925
12927 {
12928 int id = muzzle_owner.GetMuzzleID();
12930
12931 if (WPOBE_array)
12932 {
12933 for (int i = 0; i < WPOBE_array.Count(); i++)
12934 {
12935 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12936
12937 if (WPOBE)
12938 {
12939 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12940 }
12941 }
12942 }
12943 }
12944
12945
12947 {
12948 int id = muzzle_owner.GetMuzzleID();
12949 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12950
12951 if (WPOOH_array)
12952 {
12953 for (int i = 0; i < WPOOH_array.Count(); i++)
12954 {
12955 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12956
12957 if (WPOOH)
12958 {
12959 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12960 }
12961 }
12962 }
12963 }
12964
12965
12967 {
12968 int id = muzzle_owner.GetMuzzleID();
12969 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12970
12971 if (WPOOH_array)
12972 {
12973 for (int i = 0; i < WPOOH_array.Count(); i++)
12974 {
12975 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12976
12977 if (WPOOH)
12978 {
12979 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12980 }
12981 }
12982 }
12983 }
12984
12985
12987 {
12988 int id = muzzle_owner.GetMuzzleID();
12989 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12990
12991 if (WPOOH_array)
12992 {
12993 for (int i = 0; i < WPOOH_array.Count(); i++)
12994 {
12995 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12996
12997 if (WPOOH)
12998 {
12999 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13000 }
13001 }
13002 }
13003 }
13004
13005
13006
13008 {
13010 {
13011 return true;
13012 }
13013
13014 return false;
13015 }
13016
13018 {
13020 {
13021 return true;
13022 }
13023
13024 return false;
13025 }
13026
13028 {
13030 {
13031 return true;
13032 }
13033
13034 return false;
13035 }
13036
13038 {
13039 return false;
13040 }
13041
13044 {
13045 return UATimeSpent.DEFAULT_DEPLOY;
13046 }
13047
13048
13049
13050
13052 {
13054 SetSynchDirty();
13055 }
13056
13058 {
13060 }
13061
13062
13064 {
13065 return false;
13066 }
13067
13070 {
13071 string att_type = "None";
13072
13073 if (ConfigIsExisting("soundAttType"))
13074 {
13075 att_type = ConfigGetString("soundAttType");
13076 }
13077
13079 }
13080
13082 {
13084 }
13085
13086
13087
13088
13089
13095
13097 {
13100
13102 }
13103
13104
13106 {
13108 return;
13109
13111
13114
13117
13118 SoundParameters params = new SoundParameters();
13122 }
13123
13124
13126 {
13128 return;
13129
13131 SetSynchDirty();
13132
13135 }
13136
13137
13139 {
13141 return;
13142
13144 SetSynchDirty();
13145
13148 }
13149
13151 {
13153 }
13154
13156 {
13158 }
13159
13162 {
13163 if (!
GetGame().IsDedicatedServer())
13164 {
13165 if (ConfigIsExisting("attachSoundSet"))
13166 {
13167 string cfg_path = "";
13168 string soundset = "";
13169 string type_name =
GetType();
13170
13173 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13174 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13175
13176 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13177 {
13178 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13179 {
13180 if (cfg_slot_array[i] == slot_type)
13181 {
13182 soundset = cfg_soundset_array[i];
13183 break;
13184 }
13185 }
13186 }
13187
13188 if (soundset != "")
13189 {
13190 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13192 }
13193 }
13194 }
13195 }
13196
13198 {
13199
13200 }
13201
13202 void OnApply(PlayerBase player);
13203
13205 {
13206 return 1.0;
13207 };
13208
13210 {
13212 }
13213
13215 {
13217 }
13218
13220
13222 {
13223 SetDynamicPhysicsLifeTime(0.01);
13225 }
13226
13228 {
13229 array<string> zone_names = new array<string>;
13230 GetDamageZones(zone_names);
13231 for (int i = 0; i < zone_names.Count(); i++)
13232 {
13233 SetHealthMax(zone_names.Get(i),"Health");
13234 }
13235 SetHealthMax("","Health");
13236 }
13237
13240 {
13241 float global_health = GetHealth01("","Health");
13242 array<string> zones = new array<string>;
13243 GetDamageZones(zones);
13244
13245 for (int i = 0; i < zones.Count(); i++)
13246 {
13247 SetHealth01(zones.Get(i),"Health",global_health);
13248 }
13249 }
13250
13253 {
13254 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13255 }
13256
13258 {
13259 if (!hasRootAsPlayer)
13260 {
13261 if (refParentIB)
13262 {
13263
13264 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13265 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13266
13267 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13268 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13269
13272 }
13273 else
13274 {
13275
13278 }
13279 }
13280 }
13281
13283 {
13285 {
13286 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13287 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13288 {
13289 float heatPermCoef = 1.0;
13291 while (ent)
13292 {
13293 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13294 ent = ent.GetHierarchyParent();
13295 }
13296
13297 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13298 }
13299 }
13300 }
13301
13303 {
13304
13305 EntityAI parent = GetHierarchyParent();
13306 if (!parent)
13307 {
13308 hasParent = false;
13309 hasRootAsPlayer = false;
13310 }
13311 else
13312 {
13313 hasParent = true;
13314 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13315 refParentIB =
ItemBase.Cast(parent);
13316 }
13317 }
13318
13319 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13320 {
13321
13322 }
13323
13325 {
13326
13327 return false;
13328 }
13329
13331 {
13332
13333
13334 return false;
13335 }
13336
13338 {
13339
13340 return false;
13341 }
13342
13345 {
13346 return !GetIsFrozen() &&
IsOpen();
13347 }
13348
13350 {
13351 bool hasParent = false, hasRootAsPlayer = false;
13353
13354 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13355 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13356
13357 if (wwtu || foodDecay)
13358 {
13362
13363 if (processWetness || processTemperature || processDecay)
13364 {
13366
13367 if (processWetness)
13368 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13369
13370 if (processTemperature)
13372
13373 if (processDecay)
13374 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13375 }
13376 }
13377 }
13378
13381 {
13383 }
13384
13386 {
13389
13390 return super.GetTemperatureFreezeThreshold();
13391 }
13392
13394 {
13397
13398 return super.GetTemperatureThawThreshold();
13399 }
13400
13402 {
13405
13406 return super.GetItemOverheatThreshold();
13407 }
13408
13410 {
13412 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13413
13414 return super.GetTemperatureFreezeTime();
13415 }
13416
13418 {
13420 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13421
13422 return super.GetTemperatureThawTime();
13423 }
13424
13429
13431 {
13432 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13433 }
13434
13436 {
13437 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13438 }
13439
13442 {
13444 }
13445
13447 {
13449 }
13450
13452 {
13454 }
13455
13458 {
13459 return null;
13460 }
13461
13464 {
13465 return false;
13466 }
13467
13469 {
13471 {
13474 if (!trg)
13475 {
13477 explosive = this;
13478 }
13479
13480 explosive.PairRemote(trg);
13482
13483 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13484 trg.SetPersistentPairID(persistentID);
13485 explosive.SetPersistentPairID(persistentID);
13486
13487 return true;
13488 }
13489 return false;
13490 }
13491
13494 {
13495 float ret = 1.0;
13498 ret *= GetHealth01();
13499
13500 return ret;
13501 }
13502
13503 #ifdef DEVELOPER
13504 override void SetDebugItem()
13505 {
13506 super.SetDebugItem();
13507 _itemBase = this;
13508 }
13509
13511 {
13512 string text = super.GetDebugText();
13513
13515 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13516
13517 return text;
13518 }
13519 #endif
13520
13522 {
13523 return true;
13524 }
13525
13527
13529
13531 {
13534 }
13535
13536
13544
13560}
13561
13563{
13565 if (entity)
13566 {
13567 bool is_item = entity.IsInherited(
ItemBase);
13568 if (is_item && full_quantity)
13569 {
13572 }
13573 }
13574 else
13575 {
13577 return NULL;
13578 }
13579 return entity;
13580}
13581
13583{
13584 if (item)
13585 {
13586 if (health > 0)
13587 item.SetHealth("", "", health);
13588
13589 if (item.CanHaveTemperature())
13590 {
13592 if (item.CanFreeze())
13593 item.SetFrozen(false);
13594 }
13595
13596 if (item.HasEnergyManager())
13597 {
13598 if (quantity >= 0)
13599 {
13600 item.GetCompEM().SetEnergy0To1(quantity);
13601 }
13602 else
13603 {
13605 }
13606 }
13607 else if (item.IsMagazine())
13608 {
13609 Magazine mag = Magazine.Cast(item);
13610 if (quantity >= 0)
13611 {
13612 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13613 }
13614 else
13615 {
13617 }
13618
13619 }
13620 else
13621 {
13622 if (quantity >= 0)
13623 {
13624 item.SetQuantityNormalized(quantity, false);
13625 }
13626 else
13627 {
13629 }
13630
13631 }
13632 }
13633}
13634
13635#ifdef DEVELOPER
13637#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.