Event called on item when it is removed from the player(Man) inventory, passes the old owner as a parameter.
8725{
8727 {
8728 return true;
8729 }
8730};
8731
8732
8733
8735{
8739
8741
8744
8745
8746
8747
8748
8757
8763
8768
8773
8794 protected bool m_IsResultOfSplit
8795
8797
8802
8803
8804
8806
8810
8811
8812
8814
8817
8818
8819
8825
8826
8834
8837
8838
8840
8841
8843
8844
8849
8850
8855
8856
8858
8859
8861 {
8866
8867 if (!
GetGame().IsDedicatedServer())
8868 {
8870 {
8872
8874 {
8876 }
8877 }
8878
8881 }
8882
8883 m_OldLocation = null;
8884
8886 {
8888 }
8889
8890 if (ConfigIsExisting("headSelectionsToHide"))
8891 {
8894 }
8895
8897 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8898 {
8900 }
8901
8903
8904 m_IsResultOfSplit = false;
8905
8907 }
8908
8910 {
8911 super.InitItemVariables();
8912
8918 m_Count = ConfigGetInt(
"count");
8919
8922
8927
8930
8935
8947
8951
8952
8955 if (ConfigIsExisting("canBeSplit"))
8956 {
8959 }
8960
8962 if (ConfigIsExisting("itemBehaviour"))
8964
8965
8968 RegisterNetSyncVariableInt("m_VarLiquidType");
8969 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8970
8971 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8972 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8973 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8974
8975 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8976 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8977 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8978 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8979
8980 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8981 RegisterNetSyncVariableBool("m_IsTakeable");
8982 RegisterNetSyncVariableBool("m_IsHologram");
8983
8986 {
8989 }
8990
8992
8994 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8996
8997 }
8998
9000 {
9002 }
9003
9005 {
9008 {
9013 }
9014 }
9015
9016 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9017 {
9019 {
9022 }
9023
9025 }
9026
9028 {
9034 }
9035
9037
9039 {
9041
9042 if (!action)
9043 {
9044 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9045 return;
9046 }
9047
9049 if (!ai)
9050 {
9052 return;
9053 }
9054
9056 if (!action_array)
9057 {
9058 action_array = new array<ActionBase_Basic>;
9060 }
9061 if (LogManager.IsActionLogEnable())
9062 {
9063 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9064 }
9065
9066 if (action_array.Find(action) != -1)
9067 {
9068 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9069 }
9070 else
9071 {
9072 action_array.Insert(action);
9073 }
9074 }
9075
9077 {
9079 ActionBase action = player.GetActionManager().GetAction(actionName);
9082
9083 if (action_array)
9084 {
9085 action_array.RemoveItem(action);
9086 }
9087 }
9088
9089
9090
9092 {
9093 ActionOverrideData overrideData = new ActionOverrideData();
9097
9099 if (!actionMap)
9100 {
9103 }
9104
9105 actionMap.Insert(this.
Type(), overrideData);
9106
9107 }
9108
9110
9112
9113
9115 {
9118
9121
9122 string config_to_search = "CfgVehicles";
9123 string muzzle_owner_config;
9124
9126 {
9127 if (IsInherited(Weapon))
9128 config_to_search = "CfgWeapons";
9129
9130 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9131
9132 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9133
9135
9136 if (config_OnFire_subclass_count > 0)
9137 {
9138 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9139
9140 for (int i = 0; i < config_OnFire_subclass_count; i++)
9141 {
9142 string particle_class = "";
9144 string config_OnFire_entry = config_OnFire_class + particle_class;
9145 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9146 WPOF_array.Insert(WPOF);
9147 }
9148
9149
9151 }
9152 }
9153
9155 {
9156 config_to_search = "CfgWeapons";
9157 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9158
9159 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9160
9162
9163 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9164 {
9165 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9166
9167 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9168 {
9169 string particle_class2 = "";
9171 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9172 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9173 WPOBE_array.Insert(WPOBE);
9174 }
9175
9176
9178 }
9179 }
9180 }
9181
9182
9184 {
9187
9189 {
9190 string config_to_search = "CfgVehicles";
9191
9192 if (IsInherited(Weapon))
9193 config_to_search = "CfgWeapons";
9194
9195 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9196 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9197
9198 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9199 {
9200
9202
9204 {
9206 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9208 return;
9209 }
9210
9213
9214
9215
9217 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9218
9219 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9220 {
9221 string particle_class = "";
9223 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9225
9226 if (entry_type == CT_CLASS)
9227 {
9228 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9229 WPOOH_array.Insert(WPOF);
9230 }
9231 }
9232
9233
9235 }
9236 }
9237 }
9238
9240 {
9242 }
9243
9245 {
9247 {
9249
9252
9255
9256 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9257 }
9258 }
9259
9261 {
9263 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9264
9266 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9267
9269 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9270
9272 {
9274 }
9275 }
9276
9278 {
9280 }
9281
9283 {
9286 else
9288
9290 {
9293 }
9294 else
9295 {
9298
9301 }
9302
9304 }
9305
9307 {
9309 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9310 }
9311
9313 {
9315 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9317 }
9318
9320 {
9322 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9323 }
9324
9326 {
9329
9330 OverheatingParticle OP = new OverheatingParticle();
9335
9337 }
9338
9340 {
9343
9344 return -1;
9345 }
9346
9348 {
9350 {
9353
9354 for (int i = count; i > 0; --i)
9355 {
9356 int id = i - 1;
9359
9362
9363 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9364 {
9365 if (p)
9366 {
9369 }
9370 }
9371 }
9372 }
9373 }
9374
9376 {
9378 {
9380 {
9381 int id = i - 1;
9383
9384 if (OP)
9385 {
9387
9388 if (p)
9389 {
9391 }
9392
9393 delete OP;
9394 }
9395 }
9396
9399 }
9400 }
9401
9404 {
9405 return 0.0;
9406 }
9407
9408
9410 {
9411 return 250;
9412 }
9413
9415 {
9416 return 0;
9417 }
9418
9421 {
9423 return true;
9424
9425 return false;
9426 }
9427
9430 {
9433
9435 {
9437 }
9438 else
9439 {
9440
9442 }
9443
9445 }
9446
9453 {
9454 return -1;
9455 }
9456
9457
9458
9459
9461 {
9463 {
9465 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9466
9467 if (r_index >= 0)
9468 {
9469 InventoryLocation r_il = new InventoryLocation;
9470 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9471
9472 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9475 {
9476 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9477 }
9479 {
9480 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9481 }
9482
9483 }
9484
9485 player.GetHumanInventory().ClearUserReservedLocation(this);
9486 }
9487
9490 }
9491
9492
9493
9494
9496 {
9497 return ItemBase.m_DebugActionsMask;
9498 }
9499
9501 {
9502 return ItemBase.m_DebugActionsMask & mask;
9503 }
9504
9506 {
9507 ItemBase.m_DebugActionsMask = mask;
9508 }
9509
9511 {
9512 ItemBase.m_DebugActionsMask |= mask;
9513 }
9514
9516 {
9517 ItemBase.m_DebugActionsMask &= ~mask;
9518 }
9519
9521 {
9523 {
9525 }
9526 else
9527 {
9529 }
9530 }
9531
9532
9534 {
9535 if (GetEconomyProfile())
9536 {
9537 float q_max = GetEconomyProfile().GetQuantityMax();
9538 if (q_max > 0)
9539 {
9540 float q_min = GetEconomyProfile().GetQuantityMin();
9541 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9542
9544 {
9545 ComponentEnergyManager comp = GetCompEM();
9547 {
9549 }
9550 }
9552 {
9554
9555 }
9556
9557 }
9558 }
9559 }
9560
9563 {
9564 EntityAI parent = GetHierarchyParent();
9565
9566 if (parent)
9567 {
9568 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9569 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9570 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9571 }
9572 }
9573
9576 {
9577 EntityAI parent = GetHierarchyParent();
9578
9579 if (parent)
9580 {
9581 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9582 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9583 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9584 }
9585 }
9586
9588 {
9589
9590
9591
9592
9594
9596 {
9597 if (ScriptInputUserData.CanStoreInputUserData())
9598 {
9599 ScriptInputUserData ctx = new ScriptInputUserData;
9605 ctx.
Write(use_stack_max);
9608
9610 {
9611 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9612 }
9613 }
9614 }
9615 else if (!
GetGame().IsMultiplayer())
9616 {
9618 }
9619 }
9620
9622 {
9624 }
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9637 {
9638
9639 return false;
9640 }
9641
9643 {
9644 return false;
9645 }
9646
9650 {
9651 return false;
9652 }
9653
9655 {
9656 return "";
9657 }
9658
9660
9662 {
9663 return false;
9664 }
9665
9667 {
9668 return true;
9669 }
9670
9671
9672
9674 {
9675 return true;
9676 }
9677
9679 {
9680 return true;
9681 }
9682
9684 {
9685 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9687 }
9688
9690 {
9692 }
9693
9695 {
9697 if (!is_being_placed)
9699 SetSynchDirty();
9700 }
9701
9702
9704
9706 {
9708 }
9709
9711 {
9713 }
9714
9716 {
9717 return 1;
9718 }
9719
9721 {
9722 return false;
9723 }
9724
9726 {
9728 SetSynchDirty();
9729 }
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9766 {
9767 super.OnMovedInsideCargo(container);
9768
9769 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9770 }
9771
9772 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9773 {
9774 super.EEItemLocationChanged(oldLoc,newLoc);
9775
9776 PlayerBase new_player = null;
9777 PlayerBase old_player = null;
9778
9779 if (newLoc.GetParent())
9780 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9781
9782 if (oldLoc.GetParent())
9783 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9784
9786 {
9787 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9788
9789 if (r_index >= 0)
9790 {
9791 InventoryLocation r_il = new InventoryLocation;
9792 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9793
9794 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9797 {
9798 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9799 }
9801 {
9802 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9803 }
9804
9805 }
9806 }
9807
9809 {
9810 if (new_player)
9811 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9812
9813 if (new_player == old_player)
9814 {
9815
9816 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9817 {
9819 {
9820 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9821 {
9822 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9823 }
9824 }
9825 else
9826 {
9827 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9828 }
9829 }
9830
9831 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9832 {
9833 int type = oldLoc.GetType();
9835 {
9836 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9837 }
9839 {
9840 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9841 }
9842 }
9843 if (!m_OldLocation)
9844 {
9845 m_OldLocation = new InventoryLocation;
9846 }
9847 m_OldLocation.Copy(oldLoc);
9848 }
9849 else
9850 {
9851 if (m_OldLocation)
9852 {
9853 m_OldLocation.Reset();
9854 }
9855 }
9856
9858 }
9859 else
9860 {
9861 if (new_player)
9862 {
9863 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9864 if (res_index >= 0)
9865 {
9866 InventoryLocation il = new InventoryLocation;
9867 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9869 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9872 {
9873 il.
GetParent().GetOnReleaseLock().Invoke(it);
9874 }
9876 {
9878 }
9879
9880 }
9881 }
9883 {
9884
9886 }
9887
9888 if (m_OldLocation)
9889 {
9890 m_OldLocation.Reset();
9891 }
9892 }
9893 }
9894
9895 override void EOnContact(IEntity other, Contact extra)
9896 {
9898 {
9899 int liquidType = -1;
9901 if (impactSpeed > 0.0)
9902 {
9904 #ifndef SERVER
9906 #else
9908 SetSynchDirty();
9909 #endif
9911 }
9912 }
9913
9914 #ifdef SERVER
9915 if (GetCompEM() && GetCompEM().IsPlugged())
9916 {
9917 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9918 GetCompEM().UnplugThis();
9919 }
9920 #endif
9921 }
9922
9924
9926 {
9928 }
9929
9931 {
9932
9933 }
9934
9936 {
9937 super.OnItemLocationChanged(old_owner, new_owner);
9938
9939 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9940 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9941
9942 if (!relatedPlayer && playerNew)
9943 relatedPlayer = playerNew;
9944
9945 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9946 {
9948 if (actionMgr)
9949 {
9950 ActionBase currentAction = actionMgr.GetRunningAction();
9951 if (currentAction)
9953 }
9954 }
9955
9956 Man ownerPlayerOld = null;
9957 Man ownerPlayerNew = null;
9958
9959 if (old_owner)
9960 {
9961 if (old_owner.
IsMan())
9962 {
9963 ownerPlayerOld = Man.Cast(old_owner);
9964 }
9965 else
9966 {
9967 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9968 }
9969 }
9970 else
9971 {
9973 {
9975
9976 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9977 {
9978 GetCompEM().UnplugThis();
9979 }
9980 }
9981 }
9982
9983 if (new_owner)
9984 {
9985 if (new_owner.
IsMan())
9986 {
9987 ownerPlayerNew = Man.Cast(new_owner);
9988 }
9989 else
9990 {
9991 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9992 }
9993 }
9994
9995 if (ownerPlayerOld != ownerPlayerNew)
9996 {
9997 if (ownerPlayerOld)
9998 {
9999 array<EntityAI> subItemsExit = new array<EntityAI>;
10001 for (int i = 0; i < subItemsExit.Count(); i++)
10002 {
10005 }
10006 }
10007
10008 if (ownerPlayerNew)
10009 {
10010 array<EntityAI> subItemsEnter = new array<EntityAI>;
10012 for (int j = 0; j < subItemsEnter.Count(); j++)
10013 {
10016 }
10017 }
10018 }
10019 else if (ownerPlayerNew != null)
10020 {
10021 PlayerBase nplayer;
10022 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10023 {
10024 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10026 for (int k = 0; k < subItemsUpdate.Count(); k++)
10027 {
10029 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10030 }
10031 }
10032 }
10033
10034 if (old_owner)
10035 old_owner.OnChildItemRemoved(this);
10036 if (new_owner)
10037 new_owner.OnChildItemReceived(this);
10038 }
10039
10040
10042 {
10043 super.EEDelete(parent);
10044 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10045 if (player)
10046 {
10048
10049 if (player.IsAlive())
10050 {
10051 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10052 if (r_index >= 0)
10053 {
10054 InventoryLocation r_il = new InventoryLocation;
10055 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10056
10057 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10060 {
10061 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10062 }
10064 {
10065 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10066 }
10067
10068 }
10069
10070 player.RemoveQuickBarEntityShortcut(this);
10071 }
10072 }
10073 }
10074
10076 {
10077 super.EEKilled(killer);
10078
10081 {
10082 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10083 {
10084 if (IsMagazine())
10085 {
10086 if (Magazine.Cast(this).GetAmmoCount() > 0)
10087 {
10089 }
10090 }
10091 else
10092 {
10094 }
10095 }
10096 }
10097 }
10098
10100 {
10101 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10102
10103 super.OnWasAttached(parent, slot_id);
10104
10107
10109 }
10110
10112 {
10113 super.OnWasDetached(parent, slot_id);
10114
10117 }
10118
10120 {
10121 int idx;
10124
10125 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10126 if (inventory_slots.Count() < 1)
10127 {
10128 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10129 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10130 }
10131 else
10132 {
10133 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10134 }
10135
10136 idx = inventory_slots.Find(slot);
10137 if (idx < 0)
10138 return "";
10139
10140 return attach_types.Get(idx);
10141 }
10142
10144 {
10145 int idx = -1;
10146 string slot;
10147
10150
10151 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10152 if (inventory_slots.Count() < 1)
10153 {
10154 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10155 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10156 }
10157 else
10158 {
10159 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10160 if (detach_types.Count() < 1)
10161 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10162 }
10163
10164 for (int i = 0; i < inventory_slots.Count(); i++)
10165 {
10166 slot = inventory_slots.Get(i);
10167 }
10168
10169 if (slot != "")
10170 {
10171 if (detach_types.Count() == 1)
10172 idx = 0;
10173 else
10174 idx = inventory_slots.Find(slot);
10175 }
10176 if (idx < 0)
10177 return "";
10178
10179 return detach_types.Get(idx);
10180 }
10181
10183 {
10184
10186
10187
10188 float min_time = 1;
10189 float max_time = 3;
10190 float delay = Math.RandomFloat(min_time, max_time);
10191
10192 explode_timer.Run(delay, this, "DoAmmoExplosion");
10193 }
10194
10196 {
10197 Magazine magazine = Magazine.Cast(this);
10198 int pop_sounds_count = 6;
10199 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10200
10201
10202 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10203 string sound_name = pop_sounds[ sound_idx ];
10205
10206
10207 magazine.ServerAddAmmoCount(-1);
10208
10209
10210 float min_temp_to_explode = 100;
10211
10212 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10213 {
10215 }
10216 }
10217
10218
10219 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10220 {
10221 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10222
10223 const int CHANCE_DAMAGE_CARGO = 4;
10224 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10225 const int CHANCE_DAMAGE_NOTHING = 2;
10226
10228 {
10229 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10230 int chances;
10231 int rnd;
10232
10233 if (GetInventory().GetCargo())
10234 {
10235 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10236 rnd = Math.RandomInt(0,chances);
10237
10238 if (rnd < CHANCE_DAMAGE_CARGO)
10239 {
10241 }
10242 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10243 {
10245 }
10246 }
10247 else
10248 {
10249 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10250 rnd = Math.RandomInt(0,chances);
10251
10252 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10253 {
10255 }
10256 }
10257 }
10258 }
10259
10261 {
10262 if (GetInventory().GetCargo())
10263 {
10264 int item_count = GetInventory().GetCargo().GetItemCount();
10265 if (item_count > 0)
10266 {
10267 int random_pick = Math.RandomInt(0, item_count);
10269 if (!item.IsExplosive())
10270 {
10271 item.AddHealth("","",damage);
10272 return true;
10273 }
10274 }
10275 }
10276 return false;
10277 }
10278
10280 {
10281 int attachment_count = GetInventory().AttachmentCount();
10282 if (attachment_count > 0)
10283 {
10284 int random_pick = Math.RandomInt(0, attachment_count);
10285 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10286 if (!attachment.IsExplosive())
10287 {
10288 attachment.AddHealth("","",damage);
10289 return true;
10290 }
10291 }
10292 return false;
10293 }
10294
10296 {
10298 }
10299
10301 {
10303 return GetInventory().CanRemoveEntity();
10304
10305 return false;
10306 }
10307
10309 {
10310
10312 return false;
10313
10314
10316 return false;
10317
10318
10319
10321 if (delta == 0)
10322 return false;
10323
10324
10325 return true;
10326 }
10327
10329 {
10331 {
10332 if (ScriptInputUserData.CanStoreInputUserData())
10333 {
10334 ScriptInputUserData ctx = new ScriptInputUserData;
10339 ctx.
Write(destination_entity);
10341 ctx.
Write(slot_id);
10343 }
10344 }
10345 else if (!
GetGame().IsMultiplayer())
10346 {
10348 }
10349 }
10350
10352 {
10353 float split_quantity_new;
10357 InventoryLocation loc = new InventoryLocation;
10358
10359 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10360 {
10362 split_quantity_new = stack_max;
10363 else
10365
10367 {
10368 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10369 if (new_item)
10370 {
10371 new_item.SetResultOfSplit(true);
10372 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10374 new_item.
SetQuantity(split_quantity_new,
false,
true);
10375 }
10376 }
10377 }
10378 else if (destination_entity && slot_id == -1)
10379 {
10380 if (quantity > stack_max)
10381 split_quantity_new = stack_max;
10382 else
10383 split_quantity_new = quantity;
10384
10386 {
10388 {
10391 }
10392
10393 if (new_item)
10394 {
10395 new_item.SetResultOfSplit(true);
10396 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10398 new_item.
SetQuantity(split_quantity_new,
false,
true);
10399 }
10400 }
10401 }
10402 else
10403 {
10404 if (stack_max != 0)
10405 {
10407 {
10409 }
10410
10411 if (split_quantity_new == 0)
10412 {
10413 if (!
GetGame().IsMultiplayer())
10414 player.PhysicalPredictiveDropItem(this);
10415 else
10416 player.ServerDropEntity(this);
10417 return;
10418 }
10419
10421 {
10423
10424 if (new_item)
10425 {
10426 new_item.SetResultOfSplit(true);
10427 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10430 new_item.PlaceOnSurface();
10431 }
10432 }
10433 }
10434 }
10435 }
10436
10438 {
10439 float split_quantity_new;
10443 InventoryLocation loc = new InventoryLocation;
10444
10445 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10446 {
10448 split_quantity_new = stack_max;
10449 else
10451
10453 {
10454 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10455 if (new_item)
10456 {
10457 new_item.SetResultOfSplit(true);
10458 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10460 new_item.
SetQuantity(split_quantity_new,
false,
true);
10461 }
10462 }
10463 }
10464 else if (destination_entity && slot_id == -1)
10465 {
10466 if (quantity > stack_max)
10467 split_quantity_new = stack_max;
10468 else
10469 split_quantity_new = quantity;
10470
10472 {
10474 {
10477 }
10478
10479 if (new_item)
10480 {
10481 new_item.SetResultOfSplit(true);
10482 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10484 new_item.
SetQuantity(split_quantity_new,
false,
true);
10485 }
10486 }
10487 }
10488 else
10489 {
10490 if (stack_max != 0)
10491 {
10493 {
10495 }
10496
10498 {
10500
10501 if (new_item)
10502 {
10503 new_item.SetResultOfSplit(true);
10504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10507 new_item.PlaceOnSurface();
10508 }
10509 }
10510 }
10511 }
10512 }
10513
10515 {
10517 {
10518 if (ScriptInputUserData.CanStoreInputUserData())
10519 {
10520 ScriptInputUserData ctx = new ScriptInputUserData;
10525 dst.WriteToContext(ctx);
10527 }
10528 }
10529 else if (!
GetGame().IsMultiplayer())
10530 {
10532 }
10533 }
10534
10536 {
10538 {
10539 if (ScriptInputUserData.CanStoreInputUserData())
10540 {
10541 ScriptInputUserData ctx = new ScriptInputUserData;
10546 ctx.
Write(destination_entity);
10552 }
10553 }
10554 else if (!
GetGame().IsMultiplayer())
10555 {
10557 }
10558 }
10559
10561 {
10563 }
10564
10566 {
10568 float split_quantity_new;
10570 if (dst.IsValid())
10571 {
10572 int slot_id = dst.GetSlot();
10574
10575 if (quantity > stack_max)
10576 split_quantity_new = stack_max;
10577 else
10578 split_quantity_new = quantity;
10579
10581 {
10583
10584 if (new_item)
10585 {
10586 new_item.SetResultOfSplit(true);
10587 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10589 new_item.
SetQuantity(split_quantity_new,
false,
true);
10590 }
10591
10592 return new_item;
10593 }
10594 }
10595
10596 return null;
10597 }
10598
10600 {
10602 float split_quantity_new;
10604 if (destination_entity)
10605 {
10607 if (quantity > stackable)
10608 split_quantity_new = stackable;
10609 else
10610 split_quantity_new = quantity;
10611
10613 {
10614 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10615 if (new_item)
10616 {
10617 new_item.SetResultOfSplit(true);
10618 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10620 new_item.
SetQuantity(split_quantity_new,
false,
true);
10621 }
10622 }
10623 }
10624 }
10625
10627 {
10629 {
10630 if (ScriptInputUserData.CanStoreInputUserData())
10631 {
10632 ScriptInputUserData ctx = new ScriptInputUserData;
10637 ItemBase destination_entity =
this;
10638 ctx.
Write(destination_entity);
10642 }
10643 }
10644 else if (!
GetGame().IsMultiplayer())
10645 {
10647 }
10648 }
10649
10651 {
10653 float split_quantity_new;
10655 if (player)
10656 {
10658 if (quantity > stackable)
10659 split_quantity_new = stackable;
10660 else
10661 split_quantity_new = quantity;
10662
10664 {
10665 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10666 new_item =
ItemBase.Cast(in_hands);
10667 if (new_item)
10668 {
10669 new_item.SetResultOfSplit(true);
10670 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10672 new_item.SetQuantity(split_quantity_new, false, true);
10673 }
10674 }
10675 }
10676 }
10677
10679 {
10681 float split_quantity_new = Math.Floor(quantity * 0.5);
10682
10684 return;
10685
10687
10688 if (new_item)
10689 {
10690 if (new_item.GetQuantityMax() < split_quantity_new)
10691 {
10692 split_quantity_new = new_item.GetQuantityMax();
10693 }
10694
10695 new_item.SetResultOfSplit(true);
10696 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10697
10699 {
10702 }
10703 else
10704 {
10706 new_item.
SetQuantity(split_quantity_new,
false,
true);
10707 }
10708 }
10709 }
10710
10712 {
10714 float split_quantity_new = Math.Floor(quantity / 2);
10715
10717 return;
10718
10719 InventoryLocation invloc = new InventoryLocation;
10721
10723 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10724
10725 if (new_item)
10726 {
10727 if (new_item.GetQuantityMax() < split_quantity_new)
10728 {
10729 split_quantity_new = new_item.GetQuantityMax();
10730 }
10732 {
10735 }
10736 else if (split_quantity_new > 1)
10737 {
10739 new_item.
SetQuantity(split_quantity_new,
false,
true);
10740 }
10741 }
10742 }
10743
10746 {
10747 SetWeightDirty();
10749
10750 if (parent)
10751 parent.OnAttachmentQuantityChangedEx(this, delta);
10752
10754 {
10756 {
10758 }
10760 {
10761 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10763 }
10764 }
10765
10766 }
10767
10770 {
10771
10772 }
10773
10776 {
10778 }
10779
10781 {
10782 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10783
10785 {
10786 if (newLevel == GameConstants.STATE_RUINED)
10787 {
10789 EntityAI parent = GetHierarchyParent();
10790 if (parent && parent.IsFireplace())
10791 {
10792 CargoBase cargo = GetInventory().GetCargo();
10793 if (cargo)
10794 {
10796 {
10798 }
10799 }
10800 }
10801 }
10802
10804 {
10805
10807 return;
10808 }
10809
10810 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10811 {
10813 }
10814 }
10815 }
10816
10817
10819 {
10820 super.OnRightClick();
10821
10823 {
10825 {
10826 if (ScriptInputUserData.CanStoreInputUserData())
10827 {
10828 EntityAI root = GetHierarchyRoot();
10829 Man playerOwner = GetHierarchyRootPlayer();
10830 InventoryLocation dst = new InventoryLocation;
10831
10832
10833 if (!playerOwner && root && root == this)
10834 {
10836 }
10837 else
10838 {
10839
10840 GetInventory().GetCurrentInventoryLocation(dst);
10842 {
10845 {
10847 }
10848 else
10849 {
10851
10852
10853 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10854 {
10856 }
10857 else
10858 {
10859 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10860 }
10861 }
10862 }
10863 }
10864
10865 ScriptInputUserData ctx = new ScriptInputUserData;
10873 }
10874 }
10875 else if (!
GetGame().IsMultiplayer())
10876 {
10878 }
10879 }
10880 }
10881
10883 {
10884 if (root)
10885 {
10886 vector m4[4];
10887 root.GetTransform(m4);
10888 dst.SetGround(this, m4);
10889 }
10890 else
10891 {
10892 GetInventory().GetCurrentInventoryLocation(dst);
10893 }
10894 }
10895
10896 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10897 {
10898
10899 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10900 return false;
10901
10902 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10903 return false;
10904
10905
10907 return false;
10908
10909
10910 Magazine mag = Magazine.Cast(this);
10911 if (mag)
10912 {
10913 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10914 return false;
10915
10916 if (stack_max_limit)
10917 {
10918 Magazine other_mag = Magazine.Cast(other_item);
10919 if (other_item)
10920 {
10921 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10922 return false;
10923 }
10924
10925 }
10926 }
10927 else
10928 {
10929
10931 return false;
10932
10934 return false;
10935 }
10936
10937 PlayerBase player = null;
10938 if (CastTo(player, GetHierarchyRootPlayer()))
10939 {
10940 if (player.GetInventory().HasAttachment(this))
10941 return false;
10942
10943 if (player.IsItemsToDelete())
10944 return false;
10945 }
10946
10947 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10948 return false;
10949
10950 int slotID;
10952 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10953 return false;
10954
10955 return true;
10956 }
10957
10959 {
10961 }
10962
10964 {
10965 return m_IsResultOfSplit;
10966 }
10967
10969 {
10970 m_IsResultOfSplit = value;
10971 }
10972
10974 {
10976 }
10977
10979 {
10980 float other_item_quantity = other_item.GetQuantity();
10981 float this_free_space;
10982
10984
10986
10987 if (other_item_quantity > this_free_space)
10988 {
10989 return this_free_space;
10990 }
10991 else
10992 {
10993 return other_item_quantity;
10994 }
10995 }
10996
10998 {
11000 }
11001
11003 {
11005 return;
11006
11007 if (!IsMagazine() && other_item)
11008 {
11010 if (quantity_used != 0)
11011 {
11012 float hp1 = GetHealth01("","");
11013 float hp2 = other_item.GetHealth01("","");
11014 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11015 hpResult = hpResult / (
GetQuantity() + quantity_used);
11016
11017 hpResult *= GetMaxHealth();
11018 Math.Round(hpResult);
11019 SetHealth("", "Health", hpResult);
11020
11022 other_item.AddQuantity(-quantity_used);
11023 }
11024 }
11026 }
11027
11029 {
11030 #ifdef SERVER
11031 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11032 GetHierarchyParent().IncreaseLifetimeUp();
11033 #endif
11034 };
11035
11037 {
11038 PlayerBase p = PlayerBase.Cast(player);
11039
11040 array<int> recipesIds = p.m_Recipes;
11041 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11042 if (moduleRecipesManager)
11043 {
11044 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11045 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11046 }
11047
11048 for (int i = 0;i < recipesIds.Count(); i++)
11049 {
11050 int key = recipesIds.Get(i);
11051 string recipeName = moduleRecipesManager.GetRecipeName(key);
11053 }
11054 }
11055
11056
11057 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11058 {
11059 super.GetDebugActions(outputList);
11060
11061
11067
11068
11073
11078
11079
11083
11084
11086 {
11090 }
11091
11094
11095
11099
11101
11102 InventoryLocation loc = new InventoryLocation();
11103 GetInventory().GetCurrentInventoryLocation(loc);
11105 {
11106 if (Gizmo_IsSupported())
11109 }
11110
11112 }
11113
11114
11115
11116
11118 {
11119 super.OnAction(action_id, player, ctx);
11120
11122 {
11123 switch (action_id)
11124 {
11127 return true;
11130 return true;
11131 }
11132 }
11133
11135 {
11136 switch (action_id)
11137 {
11139 Delete();
11140 return true;
11141 }
11142 }
11143
11144 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11145 {
11146 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11147 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11148 PlayerBase p = PlayerBase.Cast(player);
11149 if (
EActions.RECIPES_RANGE_START < 1000)
11150 {
11151 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11152 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11153 }
11154 }
11155 #ifndef SERVER
11156 else if (action_id ==
EActions.WATCH_PLAYER)
11157 {
11158 PluginDeveloper.SetDeveloperItemClientEx(player);
11159 }
11160 #endif
11162 {
11163 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11164 {
11165 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11166 OnDebugButtonPressServer(id + 1);
11167 }
11168
11169 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11170 {
11171 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11173 }
11174
11175 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11176 {
11177 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11179 }
11180
11181 else if (action_id ==
EActions.ADD_QUANTITY)
11182 {
11183 if (IsMagazine())
11184 {
11185 Magazine mag = Magazine.Cast(this);
11186 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11187 }
11188 else
11189 {
11191 }
11192
11193 if (m_EM)
11194 {
11195 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11196 }
11197
11198 }
11199
11200 else if (action_id ==
EActions.REMOVE_QUANTITY)
11201 {
11202 if (IsMagazine())
11203 {
11204 Magazine mag2 = Magazine.Cast(this);
11205 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11206 }
11207 else
11208 {
11210 }
11211 if (m_EM)
11212 {
11213 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11214 }
11215
11216 }
11217
11218 else if (action_id ==
EActions.SET_QUANTITY_0)
11219 {
11221
11222 if (m_EM)
11223 {
11224 m_EM.SetEnergy(0);
11225 }
11226 }
11227
11228 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11229 {
11231
11232 if (m_EM)
11233 {
11234 m_EM.SetEnergy(m_EM.GetEnergyMax());
11235 }
11236 }
11237
11238 else if (action_id ==
EActions.ADD_HEALTH)
11239 {
11240 AddHealth("","",GetMaxHealth("","Health")/5);
11241 }
11242 else if (action_id ==
EActions.REMOVE_HEALTH)
11243 {
11244 AddHealth("","",-GetMaxHealth("","Health")/5);
11245 }
11246 else if (action_id ==
EActions.DESTROY_HEALTH)
11247 {
11248 SetHealth01("","",0);
11249 }
11250 else if (action_id ==
EActions.WATCH_ITEM)
11251 {
11253 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11254 #ifdef DEVELOPER
11255 SetDebugDeveloper_item(this);
11256 #endif
11257 }
11258
11259 else if (action_id ==
EActions.ADD_TEMPERATURE)
11260 {
11261 AddTemperature(20);
11262
11263 }
11264
11265 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11266 {
11267 AddTemperature(-20);
11268
11269 }
11270
11271 else if (action_id ==
EActions.FLIP_FROZEN)
11272 {
11273 SetFrozen(!GetIsFrozen());
11274
11275 }
11276
11277 else if (action_id ==
EActions.ADD_WETNESS)
11278 {
11280
11281 }
11282
11283 else if (action_id ==
EActions.REMOVE_WETNESS)
11284 {
11286
11287 }
11288
11289 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11290 {
11293
11294
11295 }
11296
11297 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11298 {
11301 }
11302
11303 else if (action_id ==
EActions.MAKE_SPECIAL)
11304 {
11305 auto debugParams = DebugSpawnParams.WithPlayer(player);
11306 OnDebugSpawnEx(debugParams);
11307 }
11308
11309 }
11310
11311
11312 return false;
11313 }
11314
11315
11316
11317
11321
11324
11325
11326
11328 {
11329 return false;
11330 }
11331
11332
11334 {
11335 return true;
11336 }
11337
11338
11340 {
11341 return true;
11342 }
11343
11344
11345
11347 {
11348 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11350 }
11351
11354 {
11355 return null;
11356 }
11357
11359 {
11360 return false;
11361 }
11362
11364 {
11365 return false;
11366 }
11367
11371
11372
11374 {
11375 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11376 return module_repairing.CanRepair(this, item_repair_kit);
11377 }
11378
11379
11380 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11381 {
11382 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11383 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11384 }
11385
11386
11388 {
11389
11390
11391
11392
11393
11394
11395
11396
11397 return 1;
11398 }
11399
11400
11401
11403 {
11405 }
11406
11407
11408
11410 {
11412 }
11413
11414
11423 {
11424 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11425
11426 if (player)
11427 {
11428 player.MessageStatus(text);
11429 }
11430 }
11431
11432
11441 {
11442 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11443
11444 if (player)
11445 {
11446 player.MessageAction(text);
11447 }
11448 }
11449
11450
11459 {
11460 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11461
11462 if (player)
11463 {
11464 player.MessageFriendly(text);
11465 }
11466 }
11467
11468
11477 {
11478 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11479
11480 if (player)
11481 {
11482 player.MessageImportant(text);
11483 }
11484 }
11485
11487 {
11488 return true;
11489 }
11490
11491
11492 override bool KindOf(
string tag)
11493 {
11494 bool found = false;
11495 string item_name = this.
GetType();
11498
11499 int array_size = item_tag_array.Count();
11500 for (int i = 0; i < array_size; i++)
11501 {
11502 if (item_tag_array.Get(i) == tag)
11503 {
11504 found = true;
11505 break;
11506 }
11507 }
11508 return found;
11509 }
11510
11511
11513 {
11514
11515 super.OnRPC(sender, rpc_type,ctx);
11516
11517
11518 switch (rpc_type)
11519 {
11520 #ifndef SERVER
11521 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11522 Param2<bool, string> p = new Param2<bool, string>(false, "");
11523
11525 return;
11526
11527 bool play = p.param1;
11528 string soundSet = p.param2;
11529
11530 if (play)
11531 {
11533 {
11535 {
11537 }
11538 }
11539 else
11540 {
11542 }
11543 }
11544 else
11545 {
11547 }
11548
11549 break;
11550 #endif
11551
11552 }
11553
11555 {
11557 }
11558 }
11559
11560
11561
11562
11564 {
11565 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11566 return plugin.GetID(
name);
11567 }
11568
11570 {
11571 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11572 return plugin.GetName(id);
11573 }
11574
11577 {
11578
11579
11580 int varFlags;
11581 if (!ctx.
Read(varFlags))
11582 return;
11583
11584 if (varFlags & ItemVariableFlags.FLOAT)
11585 {
11587 }
11588 }
11589
11591 {
11592
11593 super.SerializeNumericalVars(floats_out);
11594
11595
11596
11598 {
11600 }
11601
11603 {
11605 }
11606
11608 {
11610 }
11611
11613 {
11618 }
11619
11621 {
11623 }
11624 }
11625
11627 {
11628
11629 super.DeSerializeNumericalVars(floats);
11630
11631
11632 int index = 0;
11633 int mask = Math.Round(floats.Get(index));
11634
11635 index++;
11636
11638 {
11640 {
11642 }
11643 else
11644 {
11645 float quantity = floats.Get(index);
11646 SetQuantity(quantity,
true,
false,
false,
false);
11647 }
11648 index++;
11649 }
11650
11652 {
11653 float wet = floats.Get(index);
11655 index++;
11656 }
11657
11659 {
11660 int liquidtype = Math.Round(floats.Get(index));
11662 index++;
11663 }
11664
11666 {
11668 index++;
11670 index++;
11672 index++;
11674 index++;
11675 }
11676
11678 {
11679 int cleanness = Math.Round(floats.Get(index));
11681 index++;
11682 }
11683 }
11684
11686 {
11687 super.WriteVarsToCTX(ctx);
11688
11689
11691 {
11693 }
11694
11696 {
11698 }
11699
11701 {
11703 }
11704
11706 {
11707 int r,g,b,a;
11713 }
11714
11716 {
11718 }
11719 }
11720
11722 {
11723 if (!super.ReadVarsFromCTX(ctx,version))
11724 return false;
11725
11726 int intValue;
11727 float value;
11728
11729 if (version < 140)
11730 {
11731 if (!ctx.
Read(intValue))
11732 return false;
11733
11734 m_VariablesMask = intValue;
11735 }
11736
11738 {
11739 if (!ctx.
Read(value))
11740 return false;
11741
11743 {
11745 }
11746 else
11747 {
11749 }
11750 }
11751
11752 if (version < 140)
11753 {
11755 {
11756 if (!ctx.
Read(value))
11757 return false;
11758 SetTemperatureDirect(value);
11759 }
11760 }
11761
11763 {
11764 if (!ctx.
Read(value))
11765 return false;
11767 }
11768
11770 {
11771 if (!ctx.
Read(intValue))
11772 return false;
11774 }
11775
11777 {
11778 int r,g,b,a;
11780 return false;
11782 return false;
11784 return false;
11786 return false;
11787
11789 }
11790
11792 {
11793 if (!ctx.
Read(intValue))
11794 return false;
11796 }
11797
11798 if (version >= 138 && version < 140)
11799 {
11801 {
11802 if (!ctx.
Read(intValue))
11803 return false;
11804 SetFrozen(intValue);
11805 }
11806 }
11807
11808 return true;
11809 }
11810
11811
11813 {
11816 {
11818 }
11819
11820 if (!super.OnStoreLoad(ctx, version))
11821 {
11823 return false;
11824 }
11825
11826 if (version >= 114)
11827 {
11828 bool hasQuickBarIndexSaved;
11829
11830 if (!ctx.
Read(hasQuickBarIndexSaved))
11831 {
11833 return false;
11834 }
11835
11836 if (hasQuickBarIndexSaved)
11837 {
11838 int itmQBIndex;
11839
11840
11841 if (!ctx.
Read(itmQBIndex))
11842 {
11844 return false;
11845 }
11846
11847 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11848 if (itmQBIndex != -1 && parentPlayer)
11849 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11850 }
11851 }
11852 else
11853 {
11854
11855 PlayerBase player;
11856 int itemQBIndex;
11857 if (version ==
int.
MAX)
11858 {
11859 if (!ctx.
Read(itemQBIndex))
11860 {
11862 return false;
11863 }
11864 }
11865 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11866 {
11867
11868 if (!ctx.
Read(itemQBIndex))
11869 {
11871 return false;
11872 }
11873 if (itemQBIndex != -1 && player)
11874 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11875 }
11876 }
11877
11878 if (version < 140)
11879 {
11880
11881 if (!LoadVariables(ctx, version))
11882 {
11884 return false;
11885 }
11886 }
11887
11888
11890 {
11892 return false;
11893 }
11894 if (version >= 132)
11895 {
11897 if (raib)
11898 {
11900 {
11902 return false;
11903 }
11904 }
11905 }
11906
11908 return true;
11909 }
11910
11911
11912
11914 {
11915 super.OnStoreSave(ctx);
11916
11917 PlayerBase player;
11918 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11919 {
11921
11922 int itemQBIndex = -1;
11923 itemQBIndex = player.FindQuickBarEntityIndex(this);
11924 ctx.
Write(itemQBIndex);
11925 }
11926 else
11927 {
11929 }
11930
11932
11934 if (raib)
11935 {
11937 }
11938 }
11939
11940
11942 {
11943 super.AfterStoreLoad();
11944
11946 {
11948 }
11949
11951 {
11954 }
11955 }
11956
11958 {
11959 super.EEOnAfterLoad();
11960
11962 {
11964 }
11965
11968 }
11969
11971 {
11972 return false;
11973 }
11974
11975
11976
11978 {
11980 {
11981 #ifdef PLATFORM_CONSOLE
11982
11984 {
11986 if (menu)
11987 {
11989 }
11990 }
11991 #endif
11992 }
11993
11995 {
11998 }
11999
12001 {
12002 SetWeightDirty();
12004 }
12006 {
12009 }
12010
12012 {
12015 }
12017 {
12020 }
12021
12022 super.OnVariablesSynchronized();
12023 }
12024
12025
12026
12028 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12029 {
12030 if (!IsServerCheck(allow_client))
12031 return false;
12032
12034 return false;
12035
12038
12039 if (value <= (min + 0.001))
12040 value = min;
12041
12042 if (value == min)
12043 {
12044 if (destroy_config)
12045 {
12046 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12047 if (dstr)
12048 {
12050 this.Delete();
12051 return true;
12052 }
12053 }
12054 else if (destroy_forced)
12055 {
12057 this.Delete();
12058 return true;
12059 }
12060
12062 }
12063
12066
12068 {
12070
12071 if (delta)
12073 }
12074
12076
12077 return false;
12078 }
12079
12080
12082 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12083 {
12085 }
12086
12088 {
12091 }
12092
12094 {
12097 }
12098
12100 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12101 {
12102 float value_clamped = Math.Clamp(value, 0, 1);
12104 SetQuantity(result, destroy_config, destroy_forced);
12105 }
12106
12107
12110 {
12112 }
12113
12115 {
12117 }
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12129 {
12130 int slot = -1;
12131 if (GetInventory())
12132 {
12133 InventoryLocation il = new InventoryLocation;
12134 GetInventory().GetCurrentInventoryLocation(il);
12136 }
12137
12139 }
12140
12142 {
12143 float quantity_max = 0;
12144
12146 {
12147 if (attSlotID != -1)
12148 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12149
12150 if (quantity_max <= 0)
12152 }
12153
12154 if (quantity_max <= 0)
12156
12157 return quantity_max;
12158 }
12159
12161 {
12163 }
12164
12166 {
12168 }
12169
12170
12172 {
12174 }
12175
12177 {
12179 }
12180
12182 {
12184 }
12185
12186
12188 {
12189
12190 float weightEx = GetWeightEx();
12191 float special = GetInventoryAndCargoWeight();
12192 return weightEx - special;
12193 }
12194
12195
12197 {
12199 }
12200
12202 {
12204 {
12205 #ifdef DEVELOPER
12206 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12207 {
12208 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12210 }
12211 #endif
12212
12213 return GetQuantity() * GetConfigWeightModified();
12214 }
12215 else if (HasEnergyManager())
12216 {
12217 #ifdef DEVELOPER
12218 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12219 {
12220 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12221 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12222 }
12223 #endif
12224 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12225 }
12226 else
12227 {
12228 #ifdef DEVELOPER
12229 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12230 {
12231 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12232 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12233 }
12234 #endif
12235 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12236 }
12237 }
12238
12241 {
12242 int item_count = 0;
12244
12245 if (GetInventory().GetCargo() != NULL)
12246 {
12247 item_count = GetInventory().GetCargo().GetItemCount();
12248 }
12249
12250 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12251 {
12252 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12253 if (item)
12254 item_count += item.GetNumberOfItems();
12255 }
12256 return item_count;
12257 }
12258
12261 {
12262 float weight = 0;
12263 float wetness = 1;
12264 if (include_wetness)
12267 {
12268 weight = wetness * m_ConfigWeight;
12269 }
12271 {
12272 weight = 1;
12273 }
12274 return weight;
12275 }
12276
12277
12278
12280 {
12281 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12282 {
12283 GameInventory inv = GetInventory();
12284 array<EntityAI> items = new array<EntityAI>;
12286 for (int i = 0; i < items.Count(); i++)
12287 {
12289 if (item)
12290 {
12292 }
12293 }
12294 }
12295 }
12296
12297
12298
12299
12301 {
12302 float energy = 0;
12303 if (HasEnergyManager())
12304 {
12305 energy = GetCompEM().GetEnergy();
12306 }
12307 return energy;
12308 }
12309
12310
12312 {
12313 super.OnEnergyConsumed();
12314
12316 }
12317
12319 {
12320 super.OnEnergyAdded();
12321
12323 }
12324
12325
12327 {
12328 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12329 {
12331 {
12332 float energy_0to1 = GetCompEM().GetEnergy0To1();
12334 }
12335 }
12336 }
12337
12338
12340 {
12341 return ConfigGetFloat("heatIsolation");
12342 }
12343
12345 {
12347 }
12348
12350 {
12351 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12352 if (
GetGame().ConfigIsExisting(paramPath))
12354
12355 return 0.0;
12356 }
12357
12359 {
12360 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12361 if (
GetGame().ConfigIsExisting(paramPath))
12363
12364 return 0.0;
12365 }
12366
12367 override void SetWet(
float value,
bool allow_client =
false)
12368 {
12369 if (!IsServerCheck(allow_client))
12370 return;
12371
12374
12376
12377 m_VarWet = Math.Clamp(value, min, max);
12378
12380 {
12383 }
12384 }
12385
12386 override void AddWet(
float value)
12387 {
12389 }
12390
12392 {
12394 }
12395
12397 {
12399 }
12400
12402 {
12404 }
12405
12407 {
12409 }
12410
12412 {
12414 }
12415
12416 override void OnWetChanged(
float newVal,
float oldVal)
12417 {
12420 if (newLevel != oldLevel)
12421 {
12423 }
12424 }
12425
12427 {
12428 SetWeightDirty();
12429 }
12430
12432 {
12433 return GetWetLevelInternal(
m_VarWet);
12434 }
12435
12436
12437
12439 {
12441 }
12442
12444 {
12446 }
12447
12449 {
12451 }
12452
12454 {
12456 }
12457
12458
12459
12461 {
12462 if (ConfigIsExisting("itemModelLength"))
12463 {
12464 return ConfigGetFloat("itemModelLength");
12465 }
12466 return 0;
12467 }
12468
12470 {
12471 if (ConfigIsExisting("itemAttachOffset"))
12472 {
12473 return ConfigGetFloat("itemAttachOffset");
12474 }
12475 return 0;
12476 }
12477
12478 override void SetCleanness(
int value,
bool allow_client =
false)
12479 {
12480 if (!IsServerCheck(allow_client))
12481 return;
12482
12484
12486
12489 }
12490
12492 {
12494 }
12495
12497 {
12498 return true;
12499 }
12500
12501
12502
12503
12505 {
12507 }
12508
12510 {
12512 }
12513
12514
12515
12516
12517 override void SetColor(
int r,
int g,
int b,
int a)
12518 {
12524 }
12526 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12527 {
12532 }
12533
12535 {
12537 }
12538
12541 {
12542 int r,g,b,a;
12544 r = r/255;
12545 g = g/255;
12546 b = b/255;
12547 a = a/255;
12548 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12549 }
12550
12551
12552
12553 override void SetLiquidType(
int value,
bool allow_client =
false)
12554 {
12555 if (!IsServerCheck(allow_client))
12556 return;
12557
12562 }
12563
12565 {
12566 return ConfigGetInt("varLiquidTypeInit");
12567 }
12568
12570 {
12572 }
12573
12575 {
12577 SetFrozen(false);
12578 }
12579
12582 {
12583 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12584 }
12585
12586
12589 {
12590 PlayerBase nplayer;
12591 if (PlayerBase.CastTo(nplayer, player))
12592 {
12594
12595 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12596 }
12597 }
12598
12599
12602 {
12603 PlayerBase nplayer;
12604 if (PlayerBase.CastTo(nplayer,player))
12605 {
12606
12607 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12608
12609 }
12610
12611
12612 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12613
12614
12615 if (HasEnergyManager())
12616 {
12617 GetCompEM().UpdatePlugState();
12618 }
12619 }
12620
12621
12623 {
12624 super.OnPlacementStarted(player);
12625
12627 }
12628
12629 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12630 {
12632 {
12633 m_AdminLog.OnPlacementComplete(player,
this);
12634 }
12635
12636 super.OnPlacementComplete(player, position, orientation);
12637 }
12638
12639
12640
12641
12642
12644 {
12646 {
12647 return true;
12648 }
12649 else
12650 {
12651 return false;
12652 }
12653 }
12654
12655
12657 {
12659 {
12661 }
12662 }
12663
12664
12666 {
12668 }
12669
12671 {
12673 }
12674
12675 override void InsertAgent(
int agent,
float count = 1)
12676 {
12677 if (count < 1)
12678 return;
12679
12681 }
12682
12685 {
12687 }
12688
12689
12691 {
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
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12737 {
12739 return false;
12740 return true;
12741 }
12742
12744 {
12745
12747 }
12748
12749
12752 {
12753 super.CheckForRoofLimited(timeTresholdMS);
12754
12756 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12757 {
12758 m_PreviousRoofTestTime = time;
12759 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12760 }
12761 }
12762
12763
12765 {
12767 {
12768 return 0;
12769 }
12770
12771 if (GetInventory().GetAttachmentSlotsCount() != 0)
12772 {
12773 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12774 if (filter)
12775 return filter.GetProtectionLevel(type, false, system);
12776 else
12777 return 0;
12778 }
12779
12780 string subclassPath, entryName;
12781
12782 switch (type)
12783 {
12785 entryName = "biological";
12786 break;
12788 entryName = "chemical";
12789 break;
12790 default:
12791 entryName = "biological";
12792 break;
12793 }
12794
12795 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12796
12798 }
12799
12800
12801
12804 {
12805 if (!IsMagazine())
12807
12809 }
12810
12811
12812
12813
12814
12819 {
12820 return true;
12821 }
12822
12824 {
12826 }
12827
12828
12829
12830
12831
12833 {
12834 if (parent)
12835 {
12836 if (parent.IsInherited(DayZInfected))
12837 return true;
12838
12839 if (!parent.IsRuined())
12840 return true;
12841 }
12842
12843 return true;
12844 }
12845
12847 {
12848 if (!super.CanPutAsAttachment(parent))
12849 {
12850 return false;
12851 }
12852
12853 if (!IsRuined() && !parent.IsRuined())
12854 {
12855 return true;
12856 }
12857
12858 return false;
12859 }
12860
12862 {
12863
12864
12865
12866
12867 return super.CanReceiveItemIntoCargo(item);
12868 }
12869
12871 {
12872
12873
12874
12875
12876 GameInventory attachmentInv = attachment.GetInventory();
12878 {
12879 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12880 return false;
12881 }
12882
12883 InventoryLocation loc = new InventoryLocation();
12884 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12885 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12886 return false;
12887
12888 return super.CanReceiveAttachment(attachment, slotId);
12889 }
12890
12892 {
12893 if (!super.CanReleaseAttachment(attachment))
12894 return false;
12895
12896 return GetInventory().AreChildrenAccessible();
12897 }
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12920 {
12921 int id = muzzle_owner.GetMuzzleID();
12922 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12923
12924 if (WPOF_array)
12925 {
12926 for (int i = 0; i < WPOF_array.Count(); i++)
12927 {
12928 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12929
12930 if (WPOF)
12931 {
12932 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12933 }
12934 }
12935 }
12936 }
12937
12938
12940 {
12941 int id = muzzle_owner.GetMuzzleID();
12943
12944 if (WPOBE_array)
12945 {
12946 for (int i = 0; i < WPOBE_array.Count(); i++)
12947 {
12948 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12949
12950 if (WPOBE)
12951 {
12952 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12953 }
12954 }
12955 }
12956 }
12957
12958
12960 {
12961 int id = muzzle_owner.GetMuzzleID();
12962 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12963
12964 if (WPOOH_array)
12965 {
12966 for (int i = 0; i < WPOOH_array.Count(); i++)
12967 {
12968 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12969
12970 if (WPOOH)
12971 {
12972 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12973 }
12974 }
12975 }
12976 }
12977
12978
12980 {
12981 int id = muzzle_owner.GetMuzzleID();
12982 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12983
12984 if (WPOOH_array)
12985 {
12986 for (int i = 0; i < WPOOH_array.Count(); i++)
12987 {
12988 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12989
12990 if (WPOOH)
12991 {
12992 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12993 }
12994 }
12995 }
12996 }
12997
12998
13000 {
13001 int id = muzzle_owner.GetMuzzleID();
13002 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13003
13004 if (WPOOH_array)
13005 {
13006 for (int i = 0; i < WPOOH_array.Count(); i++)
13007 {
13008 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13009
13010 if (WPOOH)
13011 {
13012 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13013 }
13014 }
13015 }
13016 }
13017
13018
13019
13021 {
13023 {
13024 return true;
13025 }
13026
13027 return false;
13028 }
13029
13031 {
13033 {
13034 return true;
13035 }
13036
13037 return false;
13038 }
13039
13041 {
13043 {
13044 return true;
13045 }
13046
13047 return false;
13048 }
13049
13051 {
13052 return false;
13053 }
13054
13057 {
13058 return UATimeSpent.DEFAULT_DEPLOY;
13059 }
13060
13061
13062
13063
13065 {
13067 SetSynchDirty();
13068 }
13069
13071 {
13073 }
13074
13075
13077 {
13078 return false;
13079 }
13080
13083 {
13084 string att_type = "None";
13085
13086 if (ConfigIsExisting("soundAttType"))
13087 {
13088 att_type = ConfigGetString("soundAttType");
13089 }
13090
13092 }
13093
13095 {
13097 }
13098
13099
13100
13101
13102
13108
13110 {
13113
13115 }
13116
13117
13119 {
13121 return;
13122
13124
13127
13130
13131 SoundParameters params = new SoundParameters();
13135 }
13136
13137
13139 {
13141 return;
13142
13144 SetSynchDirty();
13145
13148 }
13149
13150
13152 {
13154 return;
13155
13157 SetSynchDirty();
13158
13161 }
13162
13164 {
13166 }
13167
13169 {
13171 }
13172
13175 {
13176 if (!
GetGame().IsDedicatedServer())
13177 {
13178 if (ConfigIsExisting("attachSoundSet"))
13179 {
13180 string cfg_path = "";
13181 string soundset = "";
13182 string type_name =
GetType();
13183
13186 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13187 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13188
13189 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13190 {
13191 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13192 {
13193 if (cfg_slot_array[i] == slot_type)
13194 {
13195 soundset = cfg_soundset_array[i];
13196 break;
13197 }
13198 }
13199 }
13200
13201 if (soundset != "")
13202 {
13203 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13205 }
13206 }
13207 }
13208 }
13209
13211 {
13212
13213 }
13214
13215 void OnApply(PlayerBase player);
13216
13218 {
13219 return 1.0;
13220 };
13221
13223 {
13225 }
13226
13228 {
13230 }
13231
13233
13235 {
13236 SetDynamicPhysicsLifeTime(0.01);
13238 }
13239
13241 {
13242 array<string> zone_names = new array<string>;
13243 GetDamageZones(zone_names);
13244 for (int i = 0; i < zone_names.Count(); i++)
13245 {
13246 SetHealthMax(zone_names.Get(i),"Health");
13247 }
13248 SetHealthMax("","Health");
13249 }
13250
13253 {
13254 float global_health = GetHealth01("","Health");
13255 array<string> zones = new array<string>;
13256 GetDamageZones(zones);
13257
13258 for (int i = 0; i < zones.Count(); i++)
13259 {
13260 SetHealth01(zones.Get(i),"Health",global_health);
13261 }
13262 }
13263
13266 {
13267 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13268 }
13269
13271 {
13272 if (!hasRootAsPlayer)
13273 {
13274 if (refParentIB)
13275 {
13276
13277 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13278 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13279
13280 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13281 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13282
13285 }
13286 else
13287 {
13288
13291 }
13292 }
13293 }
13294
13296 {
13298 {
13299 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13300 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13301 {
13302 float heatPermCoef = 1.0;
13304 while (ent)
13305 {
13306 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13307 ent = ent.GetHierarchyParent();
13308 }
13309
13310 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13311 }
13312 }
13313 }
13314
13316 {
13317
13318 EntityAI parent = GetHierarchyParent();
13319 if (!parent)
13320 {
13321 hasParent = false;
13322 hasRootAsPlayer = false;
13323 }
13324 else
13325 {
13326 hasParent = true;
13327 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13328 refParentIB =
ItemBase.Cast(parent);
13329 }
13330 }
13331
13332 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13333 {
13334
13335 }
13336
13338 {
13339
13340 return false;
13341 }
13342
13344 {
13345
13346
13347 return false;
13348 }
13349
13351 {
13352
13353 return false;
13354 }
13355
13358 {
13359 return !GetIsFrozen() &&
IsOpen();
13360 }
13361
13363 {
13364 bool hasParent = false, hasRootAsPlayer = false;
13366
13367 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13368 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13369
13370 if (wwtu || foodDecay)
13371 {
13375
13376 if (processWetness || processTemperature || processDecay)
13377 {
13379
13380 if (processWetness)
13381 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13382
13383 if (processTemperature)
13385
13386 if (processDecay)
13387 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13388 }
13389 }
13390 }
13391
13394 {
13396 }
13397
13399 {
13402
13403 return super.GetTemperatureFreezeThreshold();
13404 }
13405
13407 {
13410
13411 return super.GetTemperatureThawThreshold();
13412 }
13413
13415 {
13418
13419 return super.GetItemOverheatThreshold();
13420 }
13421
13423 {
13425 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13426
13427 return super.GetTemperatureFreezeTime();
13428 }
13429
13431 {
13433 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13434
13435 return super.GetTemperatureThawTime();
13436 }
13437
13442
13444 {
13445 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13446 }
13447
13449 {
13450 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13451 }
13452
13455 {
13457 }
13458
13460 {
13462 }
13463
13465 {
13467 }
13468
13471 {
13472 return null;
13473 }
13474
13477 {
13478 return false;
13479 }
13480
13482 {
13484 {
13487 if (!trg)
13488 {
13490 explosive = this;
13491 }
13492
13493 explosive.PairRemote(trg);
13495
13496 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13497 trg.SetPersistentPairID(persistentID);
13498 explosive.SetPersistentPairID(persistentID);
13499
13500 return true;
13501 }
13502 return false;
13503 }
13504
13507 {
13508 float ret = 1.0;
13511 ret *= GetHealth01();
13512
13513 return ret;
13514 }
13515
13516 #ifdef DEVELOPER
13517 override void SetDebugItem()
13518 {
13519 super.SetDebugItem();
13520 _itemBase = this;
13521 }
13522
13524 {
13525 string text = super.GetDebugText();
13526
13528 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13529
13530 return text;
13531 }
13532 #endif
13533
13535 {
13536 return true;
13537 }
13538
13540
13542
13544 {
13547 }
13548
13549
13557
13573}
13574
13576{
13578 if (entity)
13579 {
13580 bool is_item = entity.IsInherited(
ItemBase);
13581 if (is_item && full_quantity)
13582 {
13585 }
13586 }
13587 else
13588 {
13590 return NULL;
13591 }
13592 return entity;
13593}
13594
13596{
13597 if (item)
13598 {
13599 if (health > 0)
13600 item.SetHealth("", "", health);
13601
13602 if (item.CanHaveTemperature())
13603 {
13605 if (item.CanFreeze())
13606 item.SetFrozen(false);
13607 }
13608
13609 if (item.HasEnergyManager())
13610 {
13611 if (quantity >= 0)
13612 {
13613 item.GetCompEM().SetEnergy0To1(quantity);
13614 }
13615 else
13616 {
13618 }
13619 }
13620 else if (item.IsMagazine())
13621 {
13622 Magazine mag = Magazine.Cast(item);
13623 if (quantity >= 0)
13624 {
13625 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13626 }
13627 else
13628 {
13630 }
13631
13632 }
13633 else
13634 {
13635 if (quantity >= 0)
13636 {
13637 item.SetQuantityNormalized(quantity, false);
13638 }
13639 else
13640 {
13642 }
13643
13644 }
13645 }
13646}
13647
13648#ifdef DEVELOPER
13650#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.