To be called on moving item within character's inventory; 'player' should never be null.
8705{
8707 {
8708 return true;
8709 }
8710};
8711
8712
8713
8715{
8719
8721
8724
8725
8726
8727
8728
8737
8743
8748
8753
8774 protected bool m_IsResultOfSplit
8775
8777
8782
8783
8784
8786
8790
8791
8792
8794
8797
8798
8799
8805
8806
8814
8817
8818
8820
8821
8823
8824
8829
8830
8835
8836
8838
8839
8841 {
8846
8847 if (!
GetGame().IsDedicatedServer())
8848 {
8850 {
8852
8854 {
8856 }
8857 }
8858
8861 }
8862
8863 m_OldLocation = null;
8864
8866 {
8868 }
8869
8870 if (ConfigIsExisting("headSelectionsToHide"))
8871 {
8874 }
8875
8877 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8878 {
8880 }
8881
8883
8884 m_IsResultOfSplit = false;
8885
8887 }
8888
8890 {
8891 super.InitItemVariables();
8892
8898 m_Count = ConfigGetInt(
"count");
8899
8902
8907
8910
8915
8927
8931
8932
8935 if (ConfigIsExisting("canBeSplit"))
8936 {
8939 }
8940
8942 if (ConfigIsExisting("itemBehaviour"))
8944
8945
8948 RegisterNetSyncVariableInt("m_VarLiquidType");
8949 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8950
8951 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8952 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8953 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8954
8955 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8956 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8957 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8958 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8959
8960 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8961 RegisterNetSyncVariableBool("m_IsTakeable");
8962 RegisterNetSyncVariableBool("m_IsHologram");
8963
8966 {
8969 }
8970
8972
8974 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8976
8977 }
8978
8980 {
8982 }
8983
8985 {
8988 {
8993 }
8994 }
8995
8996 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8997 {
8999 {
9002 }
9003
9005 }
9006
9008 {
9014 }
9015
9017
9019 {
9021
9022 if (!action)
9023 {
9024 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9025 return;
9026 }
9027
9029 if (!ai)
9030 {
9032 return;
9033 }
9034
9036 if (!action_array)
9037 {
9038 action_array = new array<ActionBase_Basic>;
9040 }
9041 if (LogManager.IsActionLogEnable())
9042 {
9043 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9044 }
9045
9046 if (action_array.Find(action) != -1)
9047 {
9048 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9049 }
9050 else
9051 {
9052 action_array.Insert(action);
9053 }
9054 }
9055
9057 {
9059 ActionBase action = player.GetActionManager().GetAction(actionName);
9062
9063 if (action_array)
9064 {
9065 action_array.RemoveItem(action);
9066 }
9067 }
9068
9069
9070
9072 {
9073 ActionOverrideData overrideData = new ActionOverrideData();
9077
9079 if (!actionMap)
9080 {
9083 }
9084
9085 actionMap.Insert(this.
Type(), overrideData);
9086
9087 }
9088
9090
9092
9093
9095 {
9098
9101
9102 string config_to_search = "CfgVehicles";
9103 string muzzle_owner_config;
9104
9106 {
9107 if (IsInherited(Weapon))
9108 config_to_search = "CfgWeapons";
9109
9110 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9111
9112 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9113
9115
9116 if (config_OnFire_subclass_count > 0)
9117 {
9118 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9119
9120 for (int i = 0; i < config_OnFire_subclass_count; i++)
9121 {
9122 string particle_class = "";
9124 string config_OnFire_entry = config_OnFire_class + particle_class;
9125 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9126 WPOF_array.Insert(WPOF);
9127 }
9128
9129
9131 }
9132 }
9133
9135 {
9136 config_to_search = "CfgWeapons";
9137 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9138
9139 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9140
9142
9143 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9144 {
9145 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9146
9147 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9148 {
9149 string particle_class2 = "";
9151 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9152 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9153 WPOBE_array.Insert(WPOBE);
9154 }
9155
9156
9158 }
9159 }
9160 }
9161
9162
9164 {
9167
9169 {
9170 string config_to_search = "CfgVehicles";
9171
9172 if (IsInherited(Weapon))
9173 config_to_search = "CfgWeapons";
9174
9175 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9176 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9177
9178 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9179 {
9180
9182
9184 {
9186 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9188 return;
9189 }
9190
9193
9194
9195
9197 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9198
9199 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9200 {
9201 string particle_class = "";
9203 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9205
9206 if (entry_type == CT_CLASS)
9207 {
9208 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9209 WPOOH_array.Insert(WPOF);
9210 }
9211 }
9212
9213
9215 }
9216 }
9217 }
9218
9220 {
9222 }
9223
9225 {
9227 {
9229
9232
9235
9236 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9237 }
9238 }
9239
9241 {
9243 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9244
9246 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9247
9249 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9250
9252 {
9254 }
9255 }
9256
9258 {
9260 }
9261
9263 {
9266 else
9268
9270 {
9273 }
9274 else
9275 {
9278
9281 }
9282
9284 }
9285
9287 {
9289 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9290 }
9291
9293 {
9295 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9297 }
9298
9300 {
9302 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9303 }
9304
9306 {
9309
9310 OverheatingParticle OP = new OverheatingParticle();
9315
9317 }
9318
9320 {
9323
9324 return -1;
9325 }
9326
9328 {
9330 {
9333
9334 for (int i = count; i > 0; --i)
9335 {
9336 int id = i - 1;
9339
9342
9343 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9344 {
9345 if (p)
9346 {
9349 }
9350 }
9351 }
9352 }
9353 }
9354
9356 {
9358 {
9360 {
9361 int id = i - 1;
9363
9364 if (OP)
9365 {
9367
9368 if (p)
9369 {
9371 }
9372
9373 delete OP;
9374 }
9375 }
9376
9379 }
9380 }
9381
9384 {
9385 return 0.0;
9386 }
9387
9388
9390 {
9391 return 250;
9392 }
9393
9395 {
9396 return 0;
9397 }
9398
9401 {
9403 return true;
9404
9405 return false;
9406 }
9407
9410 {
9413
9415 {
9417 }
9418 else
9419 {
9420
9422 }
9423
9425 }
9426
9433 {
9434 return -1;
9435 }
9436
9437
9438
9439
9441 {
9443 {
9445 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9446
9447 if (r_index >= 0)
9448 {
9449 InventoryLocation r_il = new InventoryLocation;
9450 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9451
9452 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9455 {
9456 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9457 }
9459 {
9460 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9461 }
9462
9463 }
9464
9465 player.GetHumanInventory().ClearUserReservedLocation(this);
9466 }
9467
9470 }
9471
9472
9473
9474
9476 {
9477 return ItemBase.m_DebugActionsMask;
9478 }
9479
9481 {
9482 return ItemBase.m_DebugActionsMask & mask;
9483 }
9484
9486 {
9487 ItemBase.m_DebugActionsMask = mask;
9488 }
9489
9491 {
9492 ItemBase.m_DebugActionsMask |= mask;
9493 }
9494
9496 {
9497 ItemBase.m_DebugActionsMask &= ~mask;
9498 }
9499
9501 {
9503 {
9505 }
9506 else
9507 {
9509 }
9510 }
9511
9512
9514 {
9515 if (GetEconomyProfile())
9516 {
9517 float q_max = GetEconomyProfile().GetQuantityMax();
9518 if (q_max > 0)
9519 {
9520 float q_min = GetEconomyProfile().GetQuantityMin();
9521 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9522
9524 {
9525 ComponentEnergyManager comp = GetCompEM();
9527 {
9529 }
9530 }
9532 {
9534
9535 }
9536
9537 }
9538 }
9539 }
9540
9543 {
9544 EntityAI parent = GetHierarchyParent();
9545
9546 if (parent)
9547 {
9548 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9549 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9550 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9551 }
9552 }
9553
9556 {
9557 EntityAI parent = GetHierarchyParent();
9558
9559 if (parent)
9560 {
9561 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9562 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9563 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9564 }
9565 }
9566
9568 {
9569
9570
9571
9572
9574
9576 {
9577 if (ScriptInputUserData.CanStoreInputUserData())
9578 {
9579 ScriptInputUserData ctx = new ScriptInputUserData;
9585 ctx.
Write(use_stack_max);
9588
9590 {
9591 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9592 }
9593 }
9594 }
9595 else if (!
GetGame().IsMultiplayer())
9596 {
9598 }
9599 }
9600
9602 {
9604 }
9605
9607 {
9609 }
9610
9612 {
9614 }
9615
9617 {
9618
9619 return false;
9620 }
9621
9623 {
9624 return false;
9625 }
9626
9630 {
9631 return false;
9632 }
9633
9635 {
9636 return "";
9637 }
9638
9640
9642 {
9643 return false;
9644 }
9645
9647 {
9648 return true;
9649 }
9650
9651
9652
9654 {
9655 return true;
9656 }
9657
9659 {
9660 return true;
9661 }
9662
9664 {
9665 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9667 }
9668
9670 {
9672 }
9673
9675 {
9677 if (!is_being_placed)
9679 SetSynchDirty();
9680 }
9681
9682
9684
9686 {
9688 }
9689
9691 {
9693 }
9694
9696 {
9697 return 1;
9698 }
9699
9701 {
9702 return false;
9703 }
9704
9706 {
9708 SetSynchDirty();
9709 }
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9746 {
9747 super.OnMovedInsideCargo(container);
9748
9749 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9750 }
9751
9752 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9753 {
9754 super.EEItemLocationChanged(oldLoc,newLoc);
9755
9756 PlayerBase new_player = null;
9757 PlayerBase old_player = null;
9758
9759 if (newLoc.GetParent())
9760 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9761
9762 if (oldLoc.GetParent())
9763 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9764
9766 {
9767 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9768
9769 if (r_index >= 0)
9770 {
9771 InventoryLocation r_il = new InventoryLocation;
9772 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9773
9774 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9777 {
9778 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9779 }
9781 {
9782 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9783 }
9784
9785 }
9786 }
9787
9789 {
9790 if (new_player)
9791 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9792
9793 if (new_player == old_player)
9794 {
9795
9796 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9797 {
9799 {
9800 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9801 {
9802 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9803 }
9804 }
9805 else
9806 {
9807 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9808 }
9809 }
9810
9811 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9812 {
9813 int type = oldLoc.GetType();
9815 {
9816 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9817 }
9819 {
9820 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9821 }
9822 }
9823 if (!m_OldLocation)
9824 {
9825 m_OldLocation = new InventoryLocation;
9826 }
9827 m_OldLocation.Copy(oldLoc);
9828 }
9829 else
9830 {
9831 if (m_OldLocation)
9832 {
9833 m_OldLocation.Reset();
9834 }
9835 }
9836
9838 }
9839 else
9840 {
9841 if (new_player)
9842 {
9843 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9844 if (res_index >= 0)
9845 {
9846 InventoryLocation il = new InventoryLocation;
9847 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9849 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9852 {
9853 il.
GetParent().GetOnReleaseLock().Invoke(it);
9854 }
9856 {
9858 }
9859
9860 }
9861 }
9863 {
9864
9866 }
9867
9868 if (m_OldLocation)
9869 {
9870 m_OldLocation.Reset();
9871 }
9872 }
9873 }
9874
9875 override void EOnContact(IEntity other, Contact extra)
9876 {
9878 {
9879 int liquidType = -1;
9881 if (impactSpeed > 0.0)
9882 {
9884 #ifndef SERVER
9886 #else
9888 SetSynchDirty();
9889 #endif
9891 }
9892 }
9893
9894 #ifdef SERVER
9895 if (GetCompEM() && GetCompEM().IsPlugged())
9896 {
9897 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9898 GetCompEM().UnplugThis();
9899 }
9900 #endif
9901 }
9902
9904
9906 {
9908 }
9909
9911 {
9912
9913 }
9914
9916 {
9917 super.OnItemLocationChanged(old_owner, new_owner);
9918
9919 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9920 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9921
9922 if (!relatedPlayer && playerNew)
9923 relatedPlayer = playerNew;
9924
9925 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9926 {
9928 if (actionMgr)
9929 {
9930 ActionBase currentAction = actionMgr.GetRunningAction();
9931 if (currentAction)
9933 }
9934 }
9935
9936 Man ownerPlayerOld = null;
9937 Man ownerPlayerNew = null;
9938
9939 if (old_owner)
9940 {
9941 if (old_owner.
IsMan())
9942 {
9943 ownerPlayerOld = Man.Cast(old_owner);
9944 }
9945 else
9946 {
9947 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9948 }
9949 }
9950 else
9951 {
9953 {
9955
9956 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9957 {
9958 GetCompEM().UnplugThis();
9959 }
9960 }
9961 }
9962
9963 if (new_owner)
9964 {
9965 if (new_owner.
IsMan())
9966 {
9967 ownerPlayerNew = Man.Cast(new_owner);
9968 }
9969 else
9970 {
9971 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9972 }
9973 }
9974
9975 if (ownerPlayerOld != ownerPlayerNew)
9976 {
9977 if (ownerPlayerOld)
9978 {
9979 array<EntityAI> subItemsExit = new array<EntityAI>;
9981 for (int i = 0; i < subItemsExit.Count(); i++)
9982 {
9985 }
9986 }
9987
9988 if (ownerPlayerNew)
9989 {
9990 array<EntityAI> subItemsEnter = new array<EntityAI>;
9992 for (int j = 0; j < subItemsEnter.Count(); j++)
9993 {
9996 }
9997 }
9998 }
9999 else if (ownerPlayerNew != null)
10000 {
10001 PlayerBase nplayer;
10002 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10003 {
10004 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10006 for (int k = 0; k < subItemsUpdate.Count(); k++)
10007 {
10009 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10010 }
10011 }
10012 }
10013
10014 if (old_owner)
10015 old_owner.OnChildItemRemoved(this);
10016 if (new_owner)
10017 new_owner.OnChildItemReceived(this);
10018 }
10019
10020
10022 {
10023 super.EEDelete(parent);
10024 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10025 if (player)
10026 {
10028
10029 if (player.IsAlive())
10030 {
10031 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10032 if (r_index >= 0)
10033 {
10034 InventoryLocation r_il = new InventoryLocation;
10035 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10036
10037 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10040 {
10041 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10042 }
10044 {
10045 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10046 }
10047
10048 }
10049
10050 player.RemoveQuickBarEntityShortcut(this);
10051 }
10052 }
10053 }
10054
10056 {
10057 super.EEKilled(killer);
10058
10061 {
10062 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10063 {
10064 if (IsMagazine())
10065 {
10066 if (Magazine.Cast(this).GetAmmoCount() > 0)
10067 {
10069 }
10070 }
10071 else
10072 {
10074 }
10075 }
10076 }
10077 }
10078
10080 {
10081 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10082
10083 super.OnWasAttached(parent, slot_id);
10084
10087
10089 }
10090
10092 {
10093 super.OnWasDetached(parent, slot_id);
10094
10097 }
10098
10100 {
10101 int idx;
10104
10105 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10106 if (inventory_slots.Count() < 1)
10107 {
10108 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10109 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10110 }
10111 else
10112 {
10113 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10114 }
10115
10116 idx = inventory_slots.Find(slot);
10117 if (idx < 0)
10118 return "";
10119
10120 return attach_types.Get(idx);
10121 }
10122
10124 {
10125 int idx = -1;
10126 string slot;
10127
10130
10131 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10132 if (inventory_slots.Count() < 1)
10133 {
10134 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10135 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10136 }
10137 else
10138 {
10139 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10140 if (detach_types.Count() < 1)
10141 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10142 }
10143
10144 for (int i = 0; i < inventory_slots.Count(); i++)
10145 {
10146 slot = inventory_slots.Get(i);
10147 }
10148
10149 if (slot != "")
10150 {
10151 if (detach_types.Count() == 1)
10152 idx = 0;
10153 else
10154 idx = inventory_slots.Find(slot);
10155 }
10156 if (idx < 0)
10157 return "";
10158
10159 return detach_types.Get(idx);
10160 }
10161
10163 {
10164
10166
10167
10168 float min_time = 1;
10169 float max_time = 3;
10170 float delay = Math.RandomFloat(min_time, max_time);
10171
10172 explode_timer.Run(delay, this, "DoAmmoExplosion");
10173 }
10174
10176 {
10177 Magazine magazine = Magazine.Cast(this);
10178 int pop_sounds_count = 6;
10179 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10180
10181
10182 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10183 string sound_name = pop_sounds[ sound_idx ];
10185
10186
10187 magazine.ServerAddAmmoCount(-1);
10188
10189
10190 float min_temp_to_explode = 100;
10191
10192 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10193 {
10195 }
10196 }
10197
10198
10199 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10200 {
10201 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10202
10203 const int CHANCE_DAMAGE_CARGO = 4;
10204 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10205 const int CHANCE_DAMAGE_NOTHING = 2;
10206
10208 {
10209 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10210 int chances;
10211 int rnd;
10212
10213 if (GetInventory().GetCargo())
10214 {
10215 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10216 rnd = Math.RandomInt(0,chances);
10217
10218 if (rnd < CHANCE_DAMAGE_CARGO)
10219 {
10221 }
10222 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10223 {
10225 }
10226 }
10227 else
10228 {
10229 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10230 rnd = Math.RandomInt(0,chances);
10231
10232 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10233 {
10235 }
10236 }
10237 }
10238 }
10239
10241 {
10242 if (GetInventory().GetCargo())
10243 {
10244 int item_count = GetInventory().GetCargo().GetItemCount();
10245 if (item_count > 0)
10246 {
10247 int random_pick = Math.RandomInt(0, item_count);
10249 if (!item.IsExplosive())
10250 {
10251 item.AddHealth("","",damage);
10252 return true;
10253 }
10254 }
10255 }
10256 return false;
10257 }
10258
10260 {
10261 int attachment_count = GetInventory().AttachmentCount();
10262 if (attachment_count > 0)
10263 {
10264 int random_pick = Math.RandomInt(0, attachment_count);
10265 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10266 if (!attachment.IsExplosive())
10267 {
10268 attachment.AddHealth("","",damage);
10269 return true;
10270 }
10271 }
10272 return false;
10273 }
10274
10276 {
10278 }
10279
10281 {
10283 return GetInventory().CanRemoveEntity();
10284
10285 return false;
10286 }
10287
10289 {
10290
10292 return false;
10293
10294
10296 return false;
10297
10298
10299
10301 if (delta == 0)
10302 return false;
10303
10304
10305 return true;
10306 }
10307
10309 {
10311 {
10312 if (ScriptInputUserData.CanStoreInputUserData())
10313 {
10314 ScriptInputUserData ctx = new ScriptInputUserData;
10319 ctx.
Write(destination_entity);
10321 ctx.
Write(slot_id);
10323 }
10324 }
10325 else if (!
GetGame().IsMultiplayer())
10326 {
10328 }
10329 }
10330
10332 {
10333 float split_quantity_new;
10337 InventoryLocation loc = new InventoryLocation;
10338
10339 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10340 {
10342 split_quantity_new = stack_max;
10343 else
10345
10347 {
10348 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10349 if (new_item)
10350 {
10351 new_item.SetResultOfSplit(true);
10352 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10354 new_item.
SetQuantity(split_quantity_new,
false,
true);
10355 }
10356 }
10357 }
10358 else if (destination_entity && slot_id == -1)
10359 {
10360 if (quantity > stack_max)
10361 split_quantity_new = stack_max;
10362 else
10363 split_quantity_new = quantity;
10364
10366 {
10368 {
10371 }
10372
10373 if (new_item)
10374 {
10375 new_item.SetResultOfSplit(true);
10376 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10378 new_item.
SetQuantity(split_quantity_new,
false,
true);
10379 }
10380 }
10381 }
10382 else
10383 {
10384 if (stack_max != 0)
10385 {
10387 {
10389 }
10390
10391 if (split_quantity_new == 0)
10392 {
10393 if (!
GetGame().IsMultiplayer())
10394 player.PhysicalPredictiveDropItem(this);
10395 else
10396 player.ServerDropEntity(this);
10397 return;
10398 }
10399
10401 {
10403
10404 if (new_item)
10405 {
10406 new_item.SetResultOfSplit(true);
10407 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10410 new_item.PlaceOnSurface();
10411 }
10412 }
10413 }
10414 }
10415 }
10416
10418 {
10419 float split_quantity_new;
10423 InventoryLocation loc = new InventoryLocation;
10424
10425 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10426 {
10428 split_quantity_new = stack_max;
10429 else
10431
10433 {
10434 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10435 if (new_item)
10436 {
10437 new_item.SetResultOfSplit(true);
10438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10440 new_item.
SetQuantity(split_quantity_new,
false,
true);
10441 }
10442 }
10443 }
10444 else if (destination_entity && slot_id == -1)
10445 {
10446 if (quantity > stack_max)
10447 split_quantity_new = stack_max;
10448 else
10449 split_quantity_new = quantity;
10450
10452 {
10454 {
10457 }
10458
10459 if (new_item)
10460 {
10461 new_item.SetResultOfSplit(true);
10462 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10464 new_item.
SetQuantity(split_quantity_new,
false,
true);
10465 }
10466 }
10467 }
10468 else
10469 {
10470 if (stack_max != 0)
10471 {
10473 {
10475 }
10476
10478 {
10480
10481 if (new_item)
10482 {
10483 new_item.SetResultOfSplit(true);
10484 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10487 new_item.PlaceOnSurface();
10488 }
10489 }
10490 }
10491 }
10492 }
10493
10495 {
10497 {
10498 if (ScriptInputUserData.CanStoreInputUserData())
10499 {
10500 ScriptInputUserData ctx = new ScriptInputUserData;
10505 dst.WriteToContext(ctx);
10507 }
10508 }
10509 else if (!
GetGame().IsMultiplayer())
10510 {
10512 }
10513 }
10514
10516 {
10518 {
10519 if (ScriptInputUserData.CanStoreInputUserData())
10520 {
10521 ScriptInputUserData ctx = new ScriptInputUserData;
10526 ctx.
Write(destination_entity);
10532 }
10533 }
10534 else if (!
GetGame().IsMultiplayer())
10535 {
10537 }
10538 }
10539
10541 {
10543 }
10544
10546 {
10548 float split_quantity_new;
10550 if (dst.IsValid())
10551 {
10552 int slot_id = dst.GetSlot();
10554
10555 if (quantity > stack_max)
10556 split_quantity_new = stack_max;
10557 else
10558 split_quantity_new = quantity;
10559
10561 {
10563
10564 if (new_item)
10565 {
10566 new_item.SetResultOfSplit(true);
10567 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10569 new_item.
SetQuantity(split_quantity_new,
false,
true);
10570 }
10571
10572 return new_item;
10573 }
10574 }
10575
10576 return null;
10577 }
10578
10580 {
10582 float split_quantity_new;
10584 if (destination_entity)
10585 {
10587 if (quantity > stackable)
10588 split_quantity_new = stackable;
10589 else
10590 split_quantity_new = quantity;
10591
10593 {
10594 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10595 if (new_item)
10596 {
10597 new_item.SetResultOfSplit(true);
10598 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10600 new_item.
SetQuantity(split_quantity_new,
false,
true);
10601 }
10602 }
10603 }
10604 }
10605
10607 {
10609 {
10610 if (ScriptInputUserData.CanStoreInputUserData())
10611 {
10612 ScriptInputUserData ctx = new ScriptInputUserData;
10617 ItemBase destination_entity =
this;
10618 ctx.
Write(destination_entity);
10622 }
10623 }
10624 else if (!
GetGame().IsMultiplayer())
10625 {
10627 }
10628 }
10629
10631 {
10633 float split_quantity_new;
10635 if (player)
10636 {
10638 if (quantity > stackable)
10639 split_quantity_new = stackable;
10640 else
10641 split_quantity_new = quantity;
10642
10644 {
10645 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10646 new_item =
ItemBase.Cast(in_hands);
10647 if (new_item)
10648 {
10649 new_item.SetResultOfSplit(true);
10650 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10652 new_item.SetQuantity(split_quantity_new, false, true);
10653 }
10654 }
10655 }
10656 }
10657
10659 {
10661 float split_quantity_new = Math.Floor(quantity * 0.5);
10662
10664 return;
10665
10667
10668 if (new_item)
10669 {
10670 if (new_item.GetQuantityMax() < split_quantity_new)
10671 {
10672 split_quantity_new = new_item.GetQuantityMax();
10673 }
10674
10675 new_item.SetResultOfSplit(true);
10676 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10677
10679 {
10682 }
10683 else
10684 {
10686 new_item.
SetQuantity(split_quantity_new,
false,
true);
10687 }
10688 }
10689 }
10690
10692 {
10694 float split_quantity_new = Math.Floor(quantity / 2);
10695
10697 return;
10698
10699 InventoryLocation invloc = new InventoryLocation;
10701
10703 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10704
10705 if (new_item)
10706 {
10707 if (new_item.GetQuantityMax() < split_quantity_new)
10708 {
10709 split_quantity_new = new_item.GetQuantityMax();
10710 }
10712 {
10715 }
10716 else if (split_quantity_new > 1)
10717 {
10719 new_item.
SetQuantity(split_quantity_new,
false,
true);
10720 }
10721 }
10722 }
10723
10726 {
10727 SetWeightDirty();
10729
10730 if (parent)
10731 parent.OnAttachmentQuantityChangedEx(this, delta);
10732
10734 {
10736 {
10738 }
10740 {
10741 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10743 }
10744 }
10745
10746 }
10747
10750 {
10751
10752 }
10753
10756 {
10758 }
10759
10761 {
10762 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10763
10765 {
10766 if (newLevel == GameConstants.STATE_RUINED)
10767 {
10769 EntityAI parent = GetHierarchyParent();
10770 if (parent && parent.IsFireplace())
10771 {
10772 CargoBase cargo = GetInventory().GetCargo();
10773 if (cargo)
10774 {
10776 {
10778 }
10779 }
10780 }
10781 }
10782
10784 {
10785
10787 return;
10788 }
10789
10790 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10791 {
10793 }
10794 }
10795 }
10796
10797
10799 {
10800 super.OnRightClick();
10801
10803 {
10805 {
10806 if (ScriptInputUserData.CanStoreInputUserData())
10807 {
10808 EntityAI root = GetHierarchyRoot();
10809 Man playerOwner = GetHierarchyRootPlayer();
10810 InventoryLocation dst = new InventoryLocation;
10811
10812
10813 if (!playerOwner && root && root == this)
10814 {
10816 }
10817 else
10818 {
10819
10820 GetInventory().GetCurrentInventoryLocation(dst);
10822 {
10825 {
10827 }
10828 else
10829 {
10831
10832
10833 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10834 {
10836 }
10837 else
10838 {
10839 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10840 }
10841 }
10842 }
10843 }
10844
10845 ScriptInputUserData ctx = new ScriptInputUserData;
10853 }
10854 }
10855 else if (!
GetGame().IsMultiplayer())
10856 {
10858 }
10859 }
10860 }
10861
10863 {
10864 if (root)
10865 {
10866 vector m4[4];
10867 root.GetTransform(m4);
10868 dst.SetGround(this, m4);
10869 }
10870 else
10871 {
10872 GetInventory().GetCurrentInventoryLocation(dst);
10873 }
10874 }
10875
10876 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10877 {
10878
10879 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10880 return false;
10881
10882 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10883 return false;
10884
10885
10887 return false;
10888
10889
10890 Magazine mag = Magazine.Cast(this);
10891 if (mag)
10892 {
10893 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10894 return false;
10895
10896 if (stack_max_limit)
10897 {
10898 Magazine other_mag = Magazine.Cast(other_item);
10899 if (other_item)
10900 {
10901 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10902 return false;
10903 }
10904
10905 }
10906 }
10907 else
10908 {
10909
10911 return false;
10912
10914 return false;
10915 }
10916
10917 PlayerBase player = null;
10918 if (CastTo(player, GetHierarchyRootPlayer()))
10919 {
10920 if (player.GetInventory().HasAttachment(this))
10921 return false;
10922
10923 if (player.IsItemsToDelete())
10924 return false;
10925 }
10926
10927 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10928 return false;
10929
10930 int slotID;
10932 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10933 return false;
10934
10935 return true;
10936 }
10937
10939 {
10941 }
10942
10944 {
10945 return m_IsResultOfSplit;
10946 }
10947
10949 {
10950 m_IsResultOfSplit = value;
10951 }
10952
10954 {
10956 }
10957
10959 {
10960 float other_item_quantity = other_item.GetQuantity();
10961 float this_free_space;
10962
10964
10966
10967 if (other_item_quantity > this_free_space)
10968 {
10969 return this_free_space;
10970 }
10971 else
10972 {
10973 return other_item_quantity;
10974 }
10975 }
10976
10978 {
10980 }
10981
10983 {
10985 return;
10986
10987 if (!IsMagazine() && other_item)
10988 {
10990 if (quantity_used != 0)
10991 {
10992 float hp1 = GetHealth01("","");
10993 float hp2 = other_item.GetHealth01("","");
10994 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10995 hpResult = hpResult / (
GetQuantity() + quantity_used);
10996
10997 hpResult *= GetMaxHealth();
10998 Math.Round(hpResult);
10999 SetHealth("", "Health", hpResult);
11000
11002 other_item.AddQuantity(-quantity_used);
11003 }
11004 }
11006 }
11007
11009 {
11010 #ifdef SERVER
11011 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11012 GetHierarchyParent().IncreaseLifetimeUp();
11013 #endif
11014 };
11015
11017 {
11018 PlayerBase p = PlayerBase.Cast(player);
11019
11020 array<int> recipesIds = p.m_Recipes;
11021 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11022 if (moduleRecipesManager)
11023 {
11024 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11025 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11026 }
11027
11028 for (int i = 0;i < recipesIds.Count(); i++)
11029 {
11030 int key = recipesIds.Get(i);
11031 string recipeName = moduleRecipesManager.GetRecipeName(key);
11033 }
11034 }
11035
11036
11037 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11038 {
11039 super.GetDebugActions(outputList);
11040
11041
11047
11048
11053
11058
11059
11063
11064
11066 {
11070 }
11071
11074
11075
11079
11081
11082 InventoryLocation loc = new InventoryLocation();
11083 GetInventory().GetCurrentInventoryLocation(loc);
11085 {
11086 if (Gizmo_IsSupported())
11089 }
11090
11092 }
11093
11094
11095
11096
11098 {
11099 super.OnAction(action_id, player, ctx);
11100
11102 {
11103 switch (action_id)
11104 {
11107 return true;
11110 return true;
11111 }
11112 }
11113
11115 {
11116 switch (action_id)
11117 {
11119 Delete();
11120 return true;
11121 }
11122 }
11123
11124 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11125 {
11126 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11127 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11128 PlayerBase p = PlayerBase.Cast(player);
11129 if (
EActions.RECIPES_RANGE_START < 1000)
11130 {
11131 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11132 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11133 }
11134 }
11135 #ifndef SERVER
11136 else if (action_id ==
EActions.WATCH_PLAYER)
11137 {
11138 PluginDeveloper.SetDeveloperItemClientEx(player);
11139 }
11140 #endif
11142 {
11143 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11144 {
11145 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11146 OnDebugButtonPressServer(id + 1);
11147 }
11148
11149 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11150 {
11151 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11153 }
11154
11155 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11156 {
11157 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11159 }
11160
11161 else if (action_id ==
EActions.ADD_QUANTITY)
11162 {
11163 if (IsMagazine())
11164 {
11165 Magazine mag = Magazine.Cast(this);
11166 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11167 }
11168 else
11169 {
11171 }
11172
11173 if (m_EM)
11174 {
11175 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11176 }
11177
11178 }
11179
11180 else if (action_id ==
EActions.REMOVE_QUANTITY)
11181 {
11182 if (IsMagazine())
11183 {
11184 Magazine mag2 = Magazine.Cast(this);
11185 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11186 }
11187 else
11188 {
11190 }
11191 if (m_EM)
11192 {
11193 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11194 }
11195
11196 }
11197
11198 else if (action_id ==
EActions.SET_QUANTITY_0)
11199 {
11201
11202 if (m_EM)
11203 {
11204 m_EM.SetEnergy(0);
11205 }
11206 }
11207
11208 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11209 {
11211
11212 if (m_EM)
11213 {
11214 m_EM.SetEnergy(m_EM.GetEnergyMax());
11215 }
11216 }
11217
11218 else if (action_id ==
EActions.ADD_HEALTH)
11219 {
11220 AddHealth("","",GetMaxHealth("","Health")/5);
11221 }
11222 else if (action_id ==
EActions.REMOVE_HEALTH)
11223 {
11224 AddHealth("","",-GetMaxHealth("","Health")/5);
11225 }
11226 else if (action_id ==
EActions.DESTROY_HEALTH)
11227 {
11228 SetHealth01("","",0);
11229 }
11230 else if (action_id ==
EActions.WATCH_ITEM)
11231 {
11233 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11234 #ifdef DEVELOPER
11235 SetDebugDeveloper_item(this);
11236 #endif
11237 }
11238
11239 else if (action_id ==
EActions.ADD_TEMPERATURE)
11240 {
11241 AddTemperature(20);
11242
11243 }
11244
11245 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11246 {
11247 AddTemperature(-20);
11248
11249 }
11250
11251 else if (action_id ==
EActions.FLIP_FROZEN)
11252 {
11253 SetFrozen(!GetIsFrozen());
11254
11255 }
11256
11257 else if (action_id ==
EActions.ADD_WETNESS)
11258 {
11260
11261 }
11262
11263 else if (action_id ==
EActions.REMOVE_WETNESS)
11264 {
11266
11267 }
11268
11269 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11270 {
11273
11274
11275 }
11276
11277 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11278 {
11281 }
11282
11283 else if (action_id ==
EActions.MAKE_SPECIAL)
11284 {
11285 auto debugParams = DebugSpawnParams.WithPlayer(player);
11286 OnDebugSpawnEx(debugParams);
11287 }
11288
11289 }
11290
11291
11292 return false;
11293 }
11294
11295
11296
11297
11301
11304
11305
11306
11308 {
11309 return false;
11310 }
11311
11312
11314 {
11315 return true;
11316 }
11317
11318
11320 {
11321 return true;
11322 }
11323
11324
11325
11327 {
11328 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11330 }
11331
11334 {
11335 return null;
11336 }
11337
11339 {
11340 return false;
11341 }
11342
11344 {
11345 return false;
11346 }
11347
11351
11352
11354 {
11355 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11356 return module_repairing.CanRepair(this, item_repair_kit);
11357 }
11358
11359
11360 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11361 {
11362 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11363 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11364 }
11365
11366
11368 {
11369
11370
11371
11372
11373
11374
11375
11376
11377 return 1;
11378 }
11379
11380
11381
11383 {
11385 }
11386
11387
11388
11390 {
11392 }
11393
11394
11403 {
11404 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11405
11406 if (player)
11407 {
11408 player.MessageStatus(text);
11409 }
11410 }
11411
11412
11421 {
11422 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11423
11424 if (player)
11425 {
11426 player.MessageAction(text);
11427 }
11428 }
11429
11430
11439 {
11440 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11441
11442 if (player)
11443 {
11444 player.MessageFriendly(text);
11445 }
11446 }
11447
11448
11457 {
11458 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11459
11460 if (player)
11461 {
11462 player.MessageImportant(text);
11463 }
11464 }
11465
11467 {
11468 return true;
11469 }
11470
11471
11472 override bool KindOf(
string tag)
11473 {
11474 bool found = false;
11475 string item_name = this.
GetType();
11478
11479 int array_size = item_tag_array.Count();
11480 for (int i = 0; i < array_size; i++)
11481 {
11482 if (item_tag_array.Get(i) == tag)
11483 {
11484 found = true;
11485 break;
11486 }
11487 }
11488 return found;
11489 }
11490
11491
11493 {
11494
11495 super.OnRPC(sender, rpc_type,ctx);
11496
11497
11498 switch (rpc_type)
11499 {
11500 #ifndef SERVER
11501 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11502 Param2<bool, string> p = new Param2<bool, string>(false, "");
11503
11505 return;
11506
11507 bool play = p.param1;
11508 string soundSet = p.param2;
11509
11510 if (play)
11511 {
11513 {
11515 {
11517 }
11518 }
11519 else
11520 {
11522 }
11523 }
11524 else
11525 {
11527 }
11528
11529 break;
11530 #endif
11531
11532 }
11533
11535 {
11537 }
11538 }
11539
11540
11541
11542
11544 {
11545 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11546 return plugin.GetID(
name);
11547 }
11548
11550 {
11551 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11552 return plugin.GetName(id);
11553 }
11554
11557 {
11558
11559
11560 int varFlags;
11561 if (!ctx.
Read(varFlags))
11562 return;
11563
11564 if (varFlags & ItemVariableFlags.FLOAT)
11565 {
11567 }
11568 }
11569
11571 {
11572
11573 super.SerializeNumericalVars(floats_out);
11574
11575
11576
11578 {
11580 }
11581
11583 {
11585 }
11586
11588 {
11590 }
11591
11593 {
11598 }
11599
11601 {
11603 }
11604 }
11605
11607 {
11608
11609 super.DeSerializeNumericalVars(floats);
11610
11611
11612 int index = 0;
11613 int mask = Math.Round(floats.Get(index));
11614
11615 index++;
11616
11618 {
11620 {
11622 }
11623 else
11624 {
11625 float quantity = floats.Get(index);
11626 SetQuantity(quantity,
true,
false,
false,
false);
11627 }
11628 index++;
11629 }
11630
11632 {
11633 float wet = floats.Get(index);
11635 index++;
11636 }
11637
11639 {
11640 int liquidtype = Math.Round(floats.Get(index));
11642 index++;
11643 }
11644
11646 {
11648 index++;
11650 index++;
11652 index++;
11654 index++;
11655 }
11656
11658 {
11659 int cleanness = Math.Round(floats.Get(index));
11661 index++;
11662 }
11663 }
11664
11666 {
11667 super.WriteVarsToCTX(ctx);
11668
11669
11671 {
11673 }
11674
11676 {
11678 }
11679
11681 {
11683 }
11684
11686 {
11687 int r,g,b,a;
11693 }
11694
11696 {
11698 }
11699 }
11700
11702 {
11703 if (!super.ReadVarsFromCTX(ctx,version))
11704 return false;
11705
11706 int intValue;
11707 float value;
11708
11709 if (version < 140)
11710 {
11711 if (!ctx.
Read(intValue))
11712 return false;
11713
11714 m_VariablesMask = intValue;
11715 }
11716
11718 {
11719 if (!ctx.
Read(value))
11720 return false;
11721
11723 {
11725 }
11726 else
11727 {
11729 }
11730 }
11731
11732 if (version < 140)
11733 {
11735 {
11736 if (!ctx.
Read(value))
11737 return false;
11738 SetTemperatureDirect(value);
11739 }
11740 }
11741
11743 {
11744 if (!ctx.
Read(value))
11745 return false;
11747 }
11748
11750 {
11751 if (!ctx.
Read(intValue))
11752 return false;
11754 }
11755
11757 {
11758 int r,g,b,a;
11760 return false;
11762 return false;
11764 return false;
11766 return false;
11767
11769 }
11770
11772 {
11773 if (!ctx.
Read(intValue))
11774 return false;
11776 }
11777
11778 if (version >= 138 && version < 140)
11779 {
11781 {
11782 if (!ctx.
Read(intValue))
11783 return false;
11784 SetFrozen(intValue);
11785 }
11786 }
11787
11788 return true;
11789 }
11790
11791
11793 {
11796 {
11798 }
11799
11800 if (!super.OnStoreLoad(ctx, version))
11801 {
11803 return false;
11804 }
11805
11806 if (version >= 114)
11807 {
11808 bool hasQuickBarIndexSaved;
11809
11810 if (!ctx.
Read(hasQuickBarIndexSaved))
11811 {
11813 return false;
11814 }
11815
11816 if (hasQuickBarIndexSaved)
11817 {
11818 int itmQBIndex;
11819
11820
11821 if (!ctx.
Read(itmQBIndex))
11822 {
11824 return false;
11825 }
11826
11827 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11828 if (itmQBIndex != -1 && parentPlayer)
11829 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11830 }
11831 }
11832 else
11833 {
11834
11835 PlayerBase player;
11836 int itemQBIndex;
11837 if (version ==
int.
MAX)
11838 {
11839 if (!ctx.
Read(itemQBIndex))
11840 {
11842 return false;
11843 }
11844 }
11845 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11846 {
11847
11848 if (!ctx.
Read(itemQBIndex))
11849 {
11851 return false;
11852 }
11853 if (itemQBIndex != -1 && player)
11854 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11855 }
11856 }
11857
11858 if (version < 140)
11859 {
11860
11861 if (!LoadVariables(ctx, version))
11862 {
11864 return false;
11865 }
11866 }
11867
11868
11870 {
11872 return false;
11873 }
11874 if (version >= 132)
11875 {
11877 if (raib)
11878 {
11880 {
11882 return false;
11883 }
11884 }
11885 }
11886
11888 return true;
11889 }
11890
11891
11892
11894 {
11895 super.OnStoreSave(ctx);
11896
11897 PlayerBase player;
11898 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11899 {
11901
11902 int itemQBIndex = -1;
11903 itemQBIndex = player.FindQuickBarEntityIndex(this);
11904 ctx.
Write(itemQBIndex);
11905 }
11906 else
11907 {
11909 }
11910
11912
11914 if (raib)
11915 {
11917 }
11918 }
11919
11920
11922 {
11923 super.AfterStoreLoad();
11924
11926 {
11928 }
11929
11931 {
11934 }
11935 }
11936
11938 {
11939 super.EEOnAfterLoad();
11940
11942 {
11944 }
11945
11948 }
11949
11951 {
11952 return false;
11953 }
11954
11955
11956
11958 {
11960 {
11961 #ifdef PLATFORM_CONSOLE
11962
11964 {
11966 if (menu)
11967 {
11969 }
11970 }
11971 #endif
11972 }
11973
11975 {
11978 }
11979
11981 {
11982 SetWeightDirty();
11984 }
11986 {
11989 }
11990
11992 {
11995 }
11997 {
12000 }
12001
12002 super.OnVariablesSynchronized();
12003 }
12004
12005
12006
12008 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12009 {
12010 if (!IsServerCheck(allow_client))
12011 return false;
12012
12014 return false;
12015
12018
12019 if (value <= (min + 0.001))
12020 value = min;
12021
12022 if (value == min)
12023 {
12024 if (destroy_config)
12025 {
12026 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12027 if (dstr)
12028 {
12030 this.Delete();
12031 return true;
12032 }
12033 }
12034 else if (destroy_forced)
12035 {
12037 this.Delete();
12038 return true;
12039 }
12040
12042 }
12043
12046
12048 {
12050
12051 if (delta)
12053 }
12054
12056
12057 return false;
12058 }
12059
12060
12062 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12063 {
12065 }
12066
12068 {
12071 }
12072
12074 {
12077 }
12078
12080 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12081 {
12082 float value_clamped = Math.Clamp(value, 0, 1);
12084 SetQuantity(result, destroy_config, destroy_forced);
12085 }
12086
12087
12090 {
12092 }
12093
12095 {
12097 }
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12109 {
12110 int slot = -1;
12111 if (GetInventory())
12112 {
12113 InventoryLocation il = new InventoryLocation;
12114 GetInventory().GetCurrentInventoryLocation(il);
12116 }
12117
12119 }
12120
12122 {
12123 float quantity_max = 0;
12124
12126 {
12127 if (attSlotID != -1)
12128 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12129
12130 if (quantity_max <= 0)
12132 }
12133
12134 if (quantity_max <= 0)
12136
12137 return quantity_max;
12138 }
12139
12141 {
12143 }
12144
12146 {
12148 }
12149
12150
12152 {
12154 }
12155
12157 {
12159 }
12160
12162 {
12164 }
12165
12166
12168 {
12169
12170 float weightEx = GetWeightEx();
12171 float special = GetInventoryAndCargoWeight();
12172 return weightEx - special;
12173 }
12174
12175
12177 {
12179 }
12180
12182 {
12184 {
12185 #ifdef DEVELOPER
12186 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12187 {
12188 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12190 }
12191 #endif
12192
12193 return GetQuantity() * GetConfigWeightModified();
12194 }
12195 else if (HasEnergyManager())
12196 {
12197 #ifdef DEVELOPER
12198 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12199 {
12200 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12201 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12202 }
12203 #endif
12204 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12205 }
12206 else
12207 {
12208 #ifdef DEVELOPER
12209 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12210 {
12211 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12212 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12213 }
12214 #endif
12215 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12216 }
12217 }
12218
12221 {
12222 int item_count = 0;
12224
12225 if (GetInventory().GetCargo() != NULL)
12226 {
12227 item_count = GetInventory().GetCargo().GetItemCount();
12228 }
12229
12230 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12231 {
12232 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12233 if (item)
12234 item_count += item.GetNumberOfItems();
12235 }
12236 return item_count;
12237 }
12238
12241 {
12242 float weight = 0;
12243 float wetness = 1;
12244 if (include_wetness)
12247 {
12248 weight = wetness * m_ConfigWeight;
12249 }
12251 {
12252 weight = 1;
12253 }
12254 return weight;
12255 }
12256
12257
12258
12260 {
12261 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12262 {
12263 GameInventory inv = GetInventory();
12264 array<EntityAI> items = new array<EntityAI>;
12266 for (int i = 0; i < items.Count(); i++)
12267 {
12269 if (item)
12270 {
12272 }
12273 }
12274 }
12275 }
12276
12277
12278
12279
12281 {
12282 float energy = 0;
12283 if (HasEnergyManager())
12284 {
12285 energy = GetCompEM().GetEnergy();
12286 }
12287 return energy;
12288 }
12289
12290
12292 {
12293 super.OnEnergyConsumed();
12294
12296 }
12297
12299 {
12300 super.OnEnergyAdded();
12301
12303 }
12304
12305
12307 {
12308 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12309 {
12311 {
12312 float energy_0to1 = GetCompEM().GetEnergy0To1();
12314 }
12315 }
12316 }
12317
12318
12320 {
12321 return ConfigGetFloat("heatIsolation");
12322 }
12323
12325 {
12327 }
12328
12330 {
12331 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12332 if (
GetGame().ConfigIsExisting(paramPath))
12334
12335 return 0.0;
12336 }
12337
12339 {
12340 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12341 if (
GetGame().ConfigIsExisting(paramPath))
12343
12344 return 0.0;
12345 }
12346
12347 override void SetWet(
float value,
bool allow_client =
false)
12348 {
12349 if (!IsServerCheck(allow_client))
12350 return;
12351
12354
12356
12357 m_VarWet = Math.Clamp(value, min, max);
12358
12360 {
12363 }
12364 }
12365
12366 override void AddWet(
float value)
12367 {
12369 }
12370
12372 {
12374 }
12375
12377 {
12379 }
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12392 {
12394 }
12395
12396 override void OnWetChanged(
float newVal,
float oldVal)
12397 {
12400 if (newLevel != oldLevel)
12401 {
12403 }
12404 }
12405
12407 {
12408 SetWeightDirty();
12409 }
12410
12412 {
12413 return GetWetLevelInternal(
m_VarWet);
12414 }
12415
12416
12417
12419 {
12421 }
12422
12424 {
12426 }
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12438
12439
12441 {
12442 if (ConfigIsExisting("itemModelLength"))
12443 {
12444 return ConfigGetFloat("itemModelLength");
12445 }
12446 return 0;
12447 }
12448
12450 {
12451 if (ConfigIsExisting("itemAttachOffset"))
12452 {
12453 return ConfigGetFloat("itemAttachOffset");
12454 }
12455 return 0;
12456 }
12457
12458 override void SetCleanness(
int value,
bool allow_client =
false)
12459 {
12460 if (!IsServerCheck(allow_client))
12461 return;
12462
12464
12466
12469 }
12470
12472 {
12474 }
12475
12477 {
12478 return true;
12479 }
12480
12481
12482
12483
12485 {
12487 }
12488
12490 {
12492 }
12493
12494
12495
12496
12497 override void SetColor(
int r,
int g,
int b,
int a)
12498 {
12504 }
12506 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12507 {
12512 }
12513
12515 {
12517 }
12518
12521 {
12522 int r,g,b,a;
12524 r = r/255;
12525 g = g/255;
12526 b = b/255;
12527 a = a/255;
12528 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12529 }
12530
12531
12532
12533 override void SetLiquidType(
int value,
bool allow_client =
false)
12534 {
12535 if (!IsServerCheck(allow_client))
12536 return;
12537
12542 }
12543
12545 {
12546 return ConfigGetInt("varLiquidTypeInit");
12547 }
12548
12550 {
12552 }
12553
12555 {
12557 SetFrozen(false);
12558 }
12559
12562 {
12563 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12564 }
12565
12566
12569 {
12570 PlayerBase nplayer;
12571 if (PlayerBase.CastTo(nplayer, player))
12572 {
12574
12575 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12576 }
12577 }
12578
12579
12582 {
12583 PlayerBase nplayer;
12584 if (PlayerBase.CastTo(nplayer,player))
12585 {
12586
12587 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12588
12589 }
12590
12591
12592 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12593
12594
12595 if (HasEnergyManager())
12596 {
12597 GetCompEM().UpdatePlugState();
12598 }
12599 }
12600
12601
12603 {
12604 super.OnPlacementStarted(player);
12605
12607 }
12608
12609 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12610 {
12612 {
12613 m_AdminLog.OnPlacementComplete(player,
this);
12614 }
12615
12616 super.OnPlacementComplete(player, position, orientation);
12617 }
12618
12619
12620
12621
12622
12624 {
12626 {
12627 return true;
12628 }
12629 else
12630 {
12631 return false;
12632 }
12633 }
12634
12635
12637 {
12639 {
12641 }
12642 }
12643
12644
12646 {
12648 }
12649
12651 {
12653 }
12654
12655 override void InsertAgent(
int agent,
float count = 1)
12656 {
12657 if (count < 1)
12658 return;
12659
12661 }
12662
12665 {
12667 }
12668
12669
12671 {
12673 }
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12717 {
12719 return false;
12720 return true;
12721 }
12722
12724 {
12725
12727 }
12728
12729
12732 {
12733 super.CheckForRoofLimited(timeTresholdMS);
12734
12736 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12737 {
12738 m_PreviousRoofTestTime = time;
12739 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12740 }
12741 }
12742
12743
12745 {
12747 {
12748 return 0;
12749 }
12750
12751 if (GetInventory().GetAttachmentSlotsCount() != 0)
12752 {
12753 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12754 if (filter)
12755 return filter.GetProtectionLevel(type, false, system);
12756 else
12757 return 0;
12758 }
12759
12760 string subclassPath, entryName;
12761
12762 switch (type)
12763 {
12765 entryName = "biological";
12766 break;
12768 entryName = "chemical";
12769 break;
12770 default:
12771 entryName = "biological";
12772 break;
12773 }
12774
12775 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12776
12778 }
12779
12780
12781
12784 {
12785 if (!IsMagazine())
12787
12789 }
12790
12791
12792
12793
12794
12799 {
12800 return true;
12801 }
12802
12804 {
12806 }
12807
12808
12809
12810
12811
12813 {
12814 if (parent)
12815 {
12816 if (parent.IsInherited(DayZInfected))
12817 return true;
12818
12819 if (!parent.IsRuined())
12820 return true;
12821 }
12822
12823 return true;
12824 }
12825
12827 {
12828 if (!super.CanPutAsAttachment(parent))
12829 {
12830 return false;
12831 }
12832
12833 if (!IsRuined() && !parent.IsRuined())
12834 {
12835 return true;
12836 }
12837
12838 return false;
12839 }
12840
12842 {
12843
12844
12845
12846
12847 return super.CanReceiveItemIntoCargo(item);
12848 }
12849
12851 {
12852
12853
12854
12855
12856 GameInventory attachmentInv = attachment.GetInventory();
12858 {
12859 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12860 return false;
12861 }
12862
12863 InventoryLocation loc = new InventoryLocation();
12864 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12865 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12866 return false;
12867
12868 return super.CanReceiveAttachment(attachment, slotId);
12869 }
12870
12872 {
12873 if (!super.CanReleaseAttachment(attachment))
12874 return false;
12875
12876 return GetInventory().AreChildrenAccessible();
12877 }
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12900 {
12901 int id = muzzle_owner.GetMuzzleID();
12902 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12903
12904 if (WPOF_array)
12905 {
12906 for (int i = 0; i < WPOF_array.Count(); i++)
12907 {
12908 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12909
12910 if (WPOF)
12911 {
12912 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12913 }
12914 }
12915 }
12916 }
12917
12918
12920 {
12921 int id = muzzle_owner.GetMuzzleID();
12923
12924 if (WPOBE_array)
12925 {
12926 for (int i = 0; i < WPOBE_array.Count(); i++)
12927 {
12928 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12929
12930 if (WPOBE)
12931 {
12932 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12933 }
12934 }
12935 }
12936 }
12937
12938
12940 {
12941 int id = muzzle_owner.GetMuzzleID();
12942 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12943
12944 if (WPOOH_array)
12945 {
12946 for (int i = 0; i < WPOOH_array.Count(); i++)
12947 {
12948 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12949
12950 if (WPOOH)
12951 {
12952 WPOOH.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.OnUpdate(weapon, 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.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12993 }
12994 }
12995 }
12996 }
12997
12998
12999
13001 {
13003 {
13004 return true;
13005 }
13006
13007 return false;
13008 }
13009
13011 {
13013 {
13014 return true;
13015 }
13016
13017 return false;
13018 }
13019
13021 {
13023 {
13024 return true;
13025 }
13026
13027 return false;
13028 }
13029
13031 {
13032 return false;
13033 }
13034
13037 {
13038 return UATimeSpent.DEFAULT_DEPLOY;
13039 }
13040
13041
13042
13043
13045 {
13047 SetSynchDirty();
13048 }
13049
13051 {
13053 }
13054
13055
13057 {
13058 return false;
13059 }
13060
13063 {
13064 string att_type = "None";
13065
13066 if (ConfigIsExisting("soundAttType"))
13067 {
13068 att_type = ConfigGetString("soundAttType");
13069 }
13070
13072 }
13073
13075 {
13077 }
13078
13079
13080
13081
13082
13088
13090 {
13093
13095 }
13096
13097
13099 {
13101 return;
13102
13104
13107
13110
13111 SoundParameters params = new SoundParameters();
13115 }
13116
13117
13119 {
13121 return;
13122
13124 SetSynchDirty();
13125
13128 }
13129
13130
13132 {
13134 return;
13135
13137 SetSynchDirty();
13138
13141 }
13142
13144 {
13146 }
13147
13149 {
13151 }
13152
13155 {
13156 if (!
GetGame().IsDedicatedServer())
13157 {
13158 if (ConfigIsExisting("attachSoundSet"))
13159 {
13160 string cfg_path = "";
13161 string soundset = "";
13162 string type_name =
GetType();
13163
13166 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13167 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13168
13169 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13170 {
13171 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13172 {
13173 if (cfg_slot_array[i] == slot_type)
13174 {
13175 soundset = cfg_soundset_array[i];
13176 break;
13177 }
13178 }
13179 }
13180
13181 if (soundset != "")
13182 {
13183 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13185 }
13186 }
13187 }
13188 }
13189
13191 {
13192
13193 }
13194
13195 void OnApply(PlayerBase player);
13196
13198 {
13199 return 1.0;
13200 };
13201
13203 {
13205 }
13206
13208 {
13210 }
13211
13213
13215 {
13216 SetDynamicPhysicsLifeTime(0.01);
13218 }
13219
13221 {
13222 array<string> zone_names = new array<string>;
13223 GetDamageZones(zone_names);
13224 for (int i = 0; i < zone_names.Count(); i++)
13225 {
13226 SetHealthMax(zone_names.Get(i),"Health");
13227 }
13228 SetHealthMax("","Health");
13229 }
13230
13233 {
13234 float global_health = GetHealth01("","Health");
13235 array<string> zones = new array<string>;
13236 GetDamageZones(zones);
13237
13238 for (int i = 0; i < zones.Count(); i++)
13239 {
13240 SetHealth01(zones.Get(i),"Health",global_health);
13241 }
13242 }
13243
13246 {
13247 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13248 }
13249
13251 {
13252 if (!hasRootAsPlayer)
13253 {
13254 if (refParentIB)
13255 {
13256
13257 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13258 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13259
13260 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13261 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13262
13265 }
13266 else
13267 {
13268
13271 }
13272 }
13273 }
13274
13276 {
13278 {
13279 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13280 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13281 {
13282 float heatPermCoef = 1.0;
13284 while (ent)
13285 {
13286 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13287 ent = ent.GetHierarchyParent();
13288 }
13289
13290 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13291 }
13292 }
13293 }
13294
13296 {
13297
13298 EntityAI parent = GetHierarchyParent();
13299 if (!parent)
13300 {
13301 hasParent = false;
13302 hasRootAsPlayer = false;
13303 }
13304 else
13305 {
13306 hasParent = true;
13307 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13308 refParentIB =
ItemBase.Cast(parent);
13309 }
13310 }
13311
13312 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13313 {
13314
13315 }
13316
13318 {
13319
13320 return false;
13321 }
13322
13324 {
13325
13326
13327 return false;
13328 }
13329
13331 {
13332
13333 return false;
13334 }
13335
13338 {
13339 return !GetIsFrozen() &&
IsOpen();
13340 }
13341
13343 {
13344 bool hasParent = false, hasRootAsPlayer = false;
13346
13347 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13348 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13349
13350 if (wwtu || foodDecay)
13351 {
13355
13356 if (processWetness || processTemperature || processDecay)
13357 {
13359
13360 if (processWetness)
13361 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13362
13363 if (processTemperature)
13365
13366 if (processDecay)
13367 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13368 }
13369 }
13370 }
13371
13374 {
13376 }
13377
13379 {
13382
13383 return super.GetTemperatureFreezeThreshold();
13384 }
13385
13387 {
13390
13391 return super.GetTemperatureThawThreshold();
13392 }
13393
13395 {
13398
13399 return super.GetItemOverheatThreshold();
13400 }
13401
13403 {
13405 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13406
13407 return super.GetTemperatureFreezeTime();
13408 }
13409
13411 {
13413 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13414
13415 return super.GetTemperatureThawTime();
13416 }
13417
13422
13424 {
13425 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13426 }
13427
13429 {
13430 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13431 }
13432
13435 {
13437 }
13438
13440 {
13442 }
13443
13445 {
13447 }
13448
13451 {
13452 return null;
13453 }
13454
13457 {
13458 return false;
13459 }
13460
13462 {
13464 {
13467 if (!trg)
13468 {
13470 explosive = this;
13471 }
13472
13473 explosive.PairRemote(trg);
13475
13476 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13477 trg.SetPersistentPairID(persistentID);
13478 explosive.SetPersistentPairID(persistentID);
13479
13480 return true;
13481 }
13482 return false;
13483 }
13484
13487 {
13488 float ret = 1.0;
13491 ret *= GetHealth01();
13492
13493 return ret;
13494 }
13495
13496 #ifdef DEVELOPER
13497 override void SetDebugItem()
13498 {
13499 super.SetDebugItem();
13500 _itemBase = this;
13501 }
13502
13504 {
13505 string text = super.GetDebugText();
13506
13508 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13509
13510 return text;
13511 }
13512 #endif
13513
13515 {
13516 return true;
13517 }
13518
13520
13522
13524 {
13527 }
13528
13529
13537
13553}
13554
13556{
13558 if (entity)
13559 {
13560 bool is_item = entity.IsInherited(
ItemBase);
13561 if (is_item && full_quantity)
13562 {
13565 }
13566 }
13567 else
13568 {
13570 return NULL;
13571 }
13572 return entity;
13573}
13574
13576{
13577 if (item)
13578 {
13579 if (health > 0)
13580 item.SetHealth("", "", health);
13581
13582 if (item.CanHaveTemperature())
13583 {
13585 if (item.CanFreeze())
13586 item.SetFrozen(false);
13587 }
13588
13589 if (item.HasEnergyManager())
13590 {
13591 if (quantity >= 0)
13592 {
13593 item.GetCompEM().SetEnergy0To1(quantity);
13594 }
13595 else
13596 {
13598 }
13599 }
13600 else if (item.IsMagazine())
13601 {
13602 Magazine mag = Magazine.Cast(item);
13603 if (quantity >= 0)
13604 {
13605 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13606 }
13607 else
13608 {
13610 }
13611
13612 }
13613 else
13614 {
13615 if (quantity >= 0)
13616 {
13617 item.SetQuantityNormalized(quantity, false);
13618 }
13619 else
13620 {
13622 }
13623
13624 }
13625 }
13626}
13627
13628#ifdef DEVELOPER
13630#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.