8799{
8801 {
8802 return true;
8803 }
8804};
8805
8806
8807
8809{
8813
8815
8818
8819
8820
8821
8822
8831
8837
8842
8847
8868 protected bool m_IsResultOfSplit
8869
8871
8876
8877
8878
8880
8884
8885
8886
8888
8891
8892
8893
8899
8900
8908
8911
8912
8914
8915
8917
8918
8923
8924
8929
8930
8932
8933
8935 {
8940
8941 if (!
GetGame().IsDedicatedServer())
8942 {
8944 {
8946
8948 {
8950 }
8951 }
8952
8955 }
8956
8957 m_OldLocation = null;
8958
8960 {
8962 }
8963
8964 if (ConfigIsExisting("headSelectionsToHide"))
8965 {
8968 }
8969
8971 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8972 {
8974 }
8975
8977
8978 m_IsResultOfSplit = false;
8979
8981 }
8982
8984 {
8985 super.InitItemVariables();
8986
8992 m_Count = ConfigGetInt(
"count");
8993
8996
9001
9004
9009
9021
9025
9026
9029 if (ConfigIsExisting("canBeSplit"))
9030 {
9033 }
9034
9036 if (ConfigIsExisting("itemBehaviour"))
9038
9039
9042 RegisterNetSyncVariableInt("m_VarLiquidType");
9043 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9044
9045 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9046 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9047 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9048
9049 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9050 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9051 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9052 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9053
9054 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9055 RegisterNetSyncVariableBool("m_IsTakeable");
9056 RegisterNetSyncVariableBool("m_IsHologram");
9057
9060 {
9063 }
9064
9066
9068 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9070
9071 }
9072
9074 {
9076 }
9077
9079 {
9082 {
9087 }
9088 }
9089
9090 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9091 {
9093 {
9096 }
9097
9099 }
9100
9102 {
9108 }
9109
9111
9113 {
9115
9116 if (!action)
9117 {
9118 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9119 return;
9120 }
9121
9123 if (!ai)
9124 {
9126 return;
9127 }
9128
9130 if (!action_array)
9131 {
9132 action_array = new array<ActionBase_Basic>;
9134 }
9135 if (LogManager.IsActionLogEnable())
9136 {
9137 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9138 }
9139
9140 if (action_array.Find(action) != -1)
9141 {
9142 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9143 }
9144 else
9145 {
9146 action_array.Insert(action);
9147 }
9148 }
9149
9151 {
9153 ActionBase action = player.GetActionManager().GetAction(actionName);
9156
9157 if (action_array)
9158 {
9159 action_array.RemoveItem(action);
9160 }
9161 }
9162
9163
9164
9166 {
9167 ActionOverrideData overrideData = new ActionOverrideData();
9171
9173 if (!actionMap)
9174 {
9177 }
9178
9179 actionMap.Insert(this.
Type(), overrideData);
9180
9181 }
9182
9184
9186
9187
9189 {
9192
9195
9196 string config_to_search = "CfgVehicles";
9197 string muzzle_owner_config;
9198
9200 {
9201 if (IsInherited(Weapon))
9202 config_to_search = "CfgWeapons";
9203
9204 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9205
9206 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9207
9209
9210 if (config_OnFire_subclass_count > 0)
9211 {
9212 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9213
9214 for (int i = 0; i < config_OnFire_subclass_count; i++)
9215 {
9216 string particle_class = "";
9218 string config_OnFire_entry = config_OnFire_class + particle_class;
9219 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9220 WPOF_array.Insert(WPOF);
9221 }
9222
9223
9225 }
9226 }
9227
9229 {
9230 config_to_search = "CfgWeapons";
9231 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9232
9233 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9234
9236
9237 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9238 {
9239 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9240
9241 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9242 {
9243 string particle_class2 = "";
9245 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9246 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9247 WPOBE_array.Insert(WPOBE);
9248 }
9249
9250
9252 }
9253 }
9254 }
9255
9256
9258 {
9261
9263 {
9264 string config_to_search = "CfgVehicles";
9265
9266 if (IsInherited(Weapon))
9267 config_to_search = "CfgWeapons";
9268
9269 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9270 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9271
9272 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9273 {
9274
9276
9278 {
9280 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9282 return;
9283 }
9284
9287
9288
9289
9291 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9292
9293 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9294 {
9295 string particle_class = "";
9297 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9299
9300 if (entry_type == CT_CLASS)
9301 {
9302 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9303 WPOOH_array.Insert(WPOF);
9304 }
9305 }
9306
9307
9309 }
9310 }
9311 }
9312
9314 {
9316 }
9317
9319 {
9321 {
9323
9326
9329
9330 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9331 }
9332 }
9333
9335 {
9337 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9338
9340 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9341
9343 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9344
9346 {
9348 }
9349 }
9350
9352 {
9354 }
9355
9357 {
9360 else
9362
9364 {
9367 }
9368 else
9369 {
9372
9375 }
9376
9378 }
9379
9381 {
9383 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9384 }
9385
9387 {
9389 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9391 }
9392
9394 {
9396 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9397 }
9398
9400 {
9403
9404 OverheatingParticle OP = new OverheatingParticle();
9409
9411 }
9412
9414 {
9417
9418 return -1;
9419 }
9420
9422 {
9424 {
9427
9428 for (int i = count; i > 0; --i)
9429 {
9430 int id = i - 1;
9433
9436
9437 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9438 {
9439 if (p)
9440 {
9443 }
9444 }
9445 }
9446 }
9447 }
9448
9450 {
9452 {
9454 {
9455 int id = i - 1;
9457
9458 if (OP)
9459 {
9461
9462 if (p)
9463 {
9465 }
9466
9467 delete OP;
9468 }
9469 }
9470
9473 }
9474 }
9475
9478 {
9479 return 0.0;
9480 }
9481
9482
9484 {
9485 return 250;
9486 }
9487
9489 {
9490 return 0;
9491 }
9492
9495 {
9497 return true;
9498
9499 return false;
9500 }
9501
9504 {
9507
9509 {
9511 }
9512 else
9513 {
9514
9516 }
9517
9519 }
9520
9527 {
9528 return -1;
9529 }
9530
9531
9532
9533
9535 {
9537 {
9539 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9540
9541 if (r_index >= 0)
9542 {
9543 InventoryLocation r_il = new InventoryLocation;
9544 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9545
9546 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9549 {
9550 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9551 }
9553 {
9554 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9555 }
9556
9557 }
9558
9559 player.GetHumanInventory().ClearUserReservedLocation(this);
9560 }
9561
9564 }
9565
9566
9567
9568
9570 {
9571 return ItemBase.m_DebugActionsMask;
9572 }
9573
9575 {
9576 return ItemBase.m_DebugActionsMask & mask;
9577 }
9578
9580 {
9581 ItemBase.m_DebugActionsMask = mask;
9582 }
9583
9585 {
9586 ItemBase.m_DebugActionsMask |= mask;
9587 }
9588
9590 {
9591 ItemBase.m_DebugActionsMask &= ~mask;
9592 }
9593
9595 {
9597 {
9599 }
9600 else
9601 {
9603 }
9604 }
9605
9606
9608 {
9609 if (GetEconomyProfile())
9610 {
9611 float q_max = GetEconomyProfile().GetQuantityMax();
9612 if (q_max > 0)
9613 {
9614 float q_min = GetEconomyProfile().GetQuantityMin();
9615 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9616
9618 {
9619 ComponentEnergyManager comp = GetCompEM();
9621 {
9623 }
9624 }
9626 {
9628
9629 }
9630
9631 }
9632 }
9633 }
9634
9637 {
9638 EntityAI parent = GetHierarchyParent();
9639
9640 if (parent)
9641 {
9642 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9643 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9644 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9645 }
9646 }
9647
9650 {
9651 EntityAI parent = GetHierarchyParent();
9652
9653 if (parent)
9654 {
9655 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9656 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9657 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9658 }
9659 }
9660
9662 {
9663
9664
9665
9666
9668
9670 {
9671 if (ScriptInputUserData.CanStoreInputUserData())
9672 {
9673 ScriptInputUserData ctx = new ScriptInputUserData;
9679 ctx.
Write(use_stack_max);
9682
9684 {
9685 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9686 }
9687 }
9688 }
9689 else if (!
GetGame().IsMultiplayer())
9690 {
9692 }
9693 }
9694
9696 {
9698 }
9699
9701 {
9703 }
9704
9706 {
9708 }
9709
9711 {
9712
9713 return false;
9714 }
9715
9717 {
9718 return false;
9719 }
9720
9724 {
9725 return false;
9726 }
9727
9729 {
9730 return "";
9731 }
9732
9734
9736 {
9737 return false;
9738 }
9739
9741 {
9742 return true;
9743 }
9744
9745
9746
9748 {
9749 return true;
9750 }
9751
9753 {
9754 return true;
9755 }
9756
9758 {
9759 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9761 }
9762
9764 {
9766 }
9767
9769 {
9771 if (!is_being_placed)
9773 SetSynchDirty();
9774 }
9775
9776
9778
9780 {
9782 }
9783
9785 {
9787 }
9788
9790 {
9791 return 1;
9792 }
9793
9795 {
9796 return false;
9797 }
9798
9800 {
9802 SetSynchDirty();
9803 }
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9840 {
9841 super.OnMovedInsideCargo(container);
9842
9843 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9844 }
9845
9846 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9847 {
9848 super.EEItemLocationChanged(oldLoc,newLoc);
9849
9850 PlayerBase new_player = null;
9851 PlayerBase old_player = null;
9852
9853 if (newLoc.GetParent())
9854 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9855
9856 if (oldLoc.GetParent())
9857 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9858
9860 {
9861 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9862
9863 if (r_index >= 0)
9864 {
9865 InventoryLocation r_il = new InventoryLocation;
9866 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9867
9868 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9871 {
9872 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9873 }
9875 {
9876 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9877 }
9878
9879 }
9880 }
9881
9883 {
9884 if (new_player)
9885 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9886
9887 if (new_player == old_player)
9888 {
9889
9890 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9891 {
9893 {
9894 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9895 {
9896 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9897 }
9898 }
9899 else
9900 {
9901 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9902 }
9903 }
9904
9905 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9906 {
9907 int type = oldLoc.GetType();
9909 {
9910 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9911 }
9913 {
9914 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9915 }
9916 }
9917 if (!m_OldLocation)
9918 {
9919 m_OldLocation = new InventoryLocation;
9920 }
9921 m_OldLocation.Copy(oldLoc);
9922 }
9923 else
9924 {
9925 if (m_OldLocation)
9926 {
9927 m_OldLocation.Reset();
9928 }
9929 }
9930
9932 }
9933 else
9934 {
9935 if (new_player)
9936 {
9937 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9938 if (res_index >= 0)
9939 {
9940 InventoryLocation il = new InventoryLocation;
9941 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9943 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9946 {
9947 il.
GetParent().GetOnReleaseLock().Invoke(it);
9948 }
9950 {
9952 }
9953
9954 }
9955 }
9957 {
9958
9960 }
9961
9962 if (m_OldLocation)
9963 {
9964 m_OldLocation.Reset();
9965 }
9966 }
9967 }
9968
9969 override void EOnContact(IEntity other, Contact extra)
9970 {
9972 {
9973 int liquidType = -1;
9975 if (impactSpeed > 0.0)
9976 {
9978 #ifndef SERVER
9980 #else
9982 SetSynchDirty();
9983 #endif
9985 }
9986 }
9987
9988 #ifdef SERVER
9989 if (GetCompEM() && GetCompEM().IsPlugged())
9990 {
9991 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9992 GetCompEM().UnplugThis();
9993 }
9994 #endif
9995 }
9996
9998
10000 {
10002 }
10003
10005 {
10006
10007 }
10008
10010 {
10011 super.OnItemLocationChanged(old_owner, new_owner);
10012
10013 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10014 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10015
10016 if (!relatedPlayer && playerNew)
10017 relatedPlayer = playerNew;
10018
10019 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10020 {
10022 if (actionMgr)
10023 {
10024 ActionBase currentAction = actionMgr.GetRunningAction();
10025 if (currentAction)
10027 }
10028 }
10029
10030 Man ownerPlayerOld = null;
10031 Man ownerPlayerNew = null;
10032
10033 if (old_owner)
10034 {
10035 if (old_owner.
IsMan())
10036 {
10037 ownerPlayerOld = Man.Cast(old_owner);
10038 }
10039 else
10040 {
10041 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10042 }
10043 }
10044 else
10045 {
10047 {
10049
10050 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10051 {
10052 GetCompEM().UnplugThis();
10053 }
10054 }
10055 }
10056
10057 if (new_owner)
10058 {
10059 if (new_owner.
IsMan())
10060 {
10061 ownerPlayerNew = Man.Cast(new_owner);
10062 }
10063 else
10064 {
10065 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10066 }
10067 }
10068
10069 if (ownerPlayerOld != ownerPlayerNew)
10070 {
10071 if (ownerPlayerOld)
10072 {
10073 array<EntityAI> subItemsExit = new array<EntityAI>;
10075 for (int i = 0; i < subItemsExit.Count(); i++)
10076 {
10079 }
10080 }
10081
10082 if (ownerPlayerNew)
10083 {
10084 array<EntityAI> subItemsEnter = new array<EntityAI>;
10086 for (int j = 0; j < subItemsEnter.Count(); j++)
10087 {
10090 }
10091 }
10092 }
10093 else if (ownerPlayerNew != null)
10094 {
10095 PlayerBase nplayer;
10096 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10097 {
10098 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10100 for (int k = 0; k < subItemsUpdate.Count(); k++)
10101 {
10103 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10104 }
10105 }
10106 }
10107
10108 if (old_owner)
10109 old_owner.OnChildItemRemoved(this);
10110 if (new_owner)
10111 new_owner.OnChildItemReceived(this);
10112 }
10113
10114
10116 {
10117 super.EEDelete(parent);
10118 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10119 if (player)
10120 {
10122
10123 if (player.IsAlive())
10124 {
10125 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10126 if (r_index >= 0)
10127 {
10128 InventoryLocation r_il = new InventoryLocation;
10129 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10130
10131 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10134 {
10135 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10136 }
10138 {
10139 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10140 }
10141
10142 }
10143
10144 player.RemoveQuickBarEntityShortcut(this);
10145 }
10146 }
10147 }
10148
10150 {
10151 super.EEKilled(killer);
10152
10155 {
10156 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10157 {
10158 if (IsMagazine())
10159 {
10160 if (Magazine.Cast(this).GetAmmoCount() > 0)
10161 {
10163 }
10164 }
10165 else
10166 {
10168 }
10169 }
10170 }
10171 }
10172
10174 {
10175 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10176
10177 super.OnWasAttached(parent, slot_id);
10178
10181
10183 }
10184
10186 {
10187 super.OnWasDetached(parent, slot_id);
10188
10191 }
10192
10194 {
10195 int idx;
10198
10199 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10200 if (inventory_slots.Count() < 1)
10201 {
10202 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10203 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10204 }
10205 else
10206 {
10207 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10208 }
10209
10210 idx = inventory_slots.Find(slot);
10211 if (idx < 0)
10212 return "";
10213
10214 return attach_types.Get(idx);
10215 }
10216
10218 {
10219 int idx = -1;
10220 string slot;
10221
10224
10225 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10226 if (inventory_slots.Count() < 1)
10227 {
10228 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10229 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10230 }
10231 else
10232 {
10233 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10234 if (detach_types.Count() < 1)
10235 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10236 }
10237
10238 for (int i = 0; i < inventory_slots.Count(); i++)
10239 {
10240 slot = inventory_slots.Get(i);
10241 }
10242
10243 if (slot != "")
10244 {
10245 if (detach_types.Count() == 1)
10246 idx = 0;
10247 else
10248 idx = inventory_slots.Find(slot);
10249 }
10250 if (idx < 0)
10251 return "";
10252
10253 return detach_types.Get(idx);
10254 }
10255
10257 {
10258
10260
10261
10262 float min_time = 1;
10263 float max_time = 3;
10264 float delay = Math.RandomFloat(min_time, max_time);
10265
10266 explode_timer.Run(delay, this, "DoAmmoExplosion");
10267 }
10268
10270 {
10271 Magazine magazine = Magazine.Cast(this);
10272 int pop_sounds_count = 6;
10273 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10274
10275
10276 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10277 string sound_name = pop_sounds[ sound_idx ];
10279
10280
10281 magazine.ServerAddAmmoCount(-1);
10282
10283
10284 float min_temp_to_explode = 100;
10285
10286 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10287 {
10289 }
10290 }
10291
10292
10293 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10294 {
10295 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10296
10297 const int CHANCE_DAMAGE_CARGO = 4;
10298 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10299 const int CHANCE_DAMAGE_NOTHING = 2;
10300
10302 {
10303 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10304 int chances;
10305 int rnd;
10306
10307 if (GetInventory().GetCargo())
10308 {
10309 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10310 rnd = Math.RandomInt(0,chances);
10311
10312 if (rnd < CHANCE_DAMAGE_CARGO)
10313 {
10315 }
10316 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10317 {
10319 }
10320 }
10321 else
10322 {
10323 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10324 rnd = Math.RandomInt(0,chances);
10325
10326 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10327 {
10329 }
10330 }
10331 }
10332 }
10333
10335 {
10336 if (GetInventory().GetCargo())
10337 {
10338 int item_count = GetInventory().GetCargo().GetItemCount();
10339 if (item_count > 0)
10340 {
10341 int random_pick = Math.RandomInt(0, item_count);
10343 if (!item.IsExplosive())
10344 {
10345 item.AddHealth("","",damage);
10346 return true;
10347 }
10348 }
10349 }
10350 return false;
10351 }
10352
10354 {
10355 int attachment_count = GetInventory().AttachmentCount();
10356 if (attachment_count > 0)
10357 {
10358 int random_pick = Math.RandomInt(0, attachment_count);
10359 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10360 if (!attachment.IsExplosive())
10361 {
10362 attachment.AddHealth("","",damage);
10363 return true;
10364 }
10365 }
10366 return false;
10367 }
10368
10370 {
10372 }
10373
10375 {
10377 return GetInventory().CanRemoveEntity();
10378
10379 return false;
10380 }
10381
10383 {
10384
10386 return false;
10387
10388
10390 return false;
10391
10392
10393
10395 if (delta == 0)
10396 return false;
10397
10398
10399 return true;
10400 }
10401
10403 {
10405 {
10406 if (ScriptInputUserData.CanStoreInputUserData())
10407 {
10408 ScriptInputUserData ctx = new ScriptInputUserData;
10413 ctx.
Write(destination_entity);
10415 ctx.
Write(slot_id);
10417 }
10418 }
10419 else if (!
GetGame().IsMultiplayer())
10420 {
10422 }
10423 }
10424
10426 {
10427 float split_quantity_new;
10431 InventoryLocation loc = new InventoryLocation;
10432
10433 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10434 {
10436 split_quantity_new = stack_max;
10437 else
10439
10441 {
10442 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10443 if (new_item)
10444 {
10445 new_item.SetResultOfSplit(true);
10446 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10448 new_item.
SetQuantity(split_quantity_new,
false,
true);
10449 }
10450 }
10451 }
10452 else if (destination_entity && slot_id == -1)
10453 {
10454 if (quantity > stack_max)
10455 split_quantity_new = stack_max;
10456 else
10457 split_quantity_new = quantity;
10458
10460 {
10462 {
10465 }
10466
10467 if (new_item)
10468 {
10469 new_item.SetResultOfSplit(true);
10470 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10472 new_item.
SetQuantity(split_quantity_new,
false,
true);
10473 }
10474 }
10475 }
10476 else
10477 {
10478 if (stack_max != 0)
10479 {
10481 {
10483 }
10484
10485 if (split_quantity_new == 0)
10486 {
10487 if (!
GetGame().IsMultiplayer())
10488 player.PhysicalPredictiveDropItem(this);
10489 else
10490 player.ServerDropEntity(this);
10491 return;
10492 }
10493
10495 {
10497
10498 if (new_item)
10499 {
10500 new_item.SetResultOfSplit(true);
10501 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10504 new_item.PlaceOnSurface();
10505 }
10506 }
10507 }
10508 }
10509 }
10510
10512 {
10513 float split_quantity_new;
10517 InventoryLocation loc = new InventoryLocation;
10518
10519 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10520 {
10522 split_quantity_new = stack_max;
10523 else
10525
10527 {
10528 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10529 if (new_item)
10530 {
10531 new_item.SetResultOfSplit(true);
10532 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10534 new_item.
SetQuantity(split_quantity_new,
false,
true);
10535 }
10536 }
10537 }
10538 else if (destination_entity && slot_id == -1)
10539 {
10540 if (quantity > stack_max)
10541 split_quantity_new = stack_max;
10542 else
10543 split_quantity_new = quantity;
10544
10546 {
10548 {
10551 }
10552
10553 if (new_item)
10554 {
10555 new_item.SetResultOfSplit(true);
10556 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10558 new_item.
SetQuantity(split_quantity_new,
false,
true);
10559 }
10560 }
10561 }
10562 else
10563 {
10564 if (stack_max != 0)
10565 {
10567 {
10569 }
10570
10572 {
10574
10575 if (new_item)
10576 {
10577 new_item.SetResultOfSplit(true);
10578 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10581 new_item.PlaceOnSurface();
10582 }
10583 }
10584 }
10585 }
10586 }
10587
10589 {
10591 {
10592 if (ScriptInputUserData.CanStoreInputUserData())
10593 {
10594 ScriptInputUserData ctx = new ScriptInputUserData;
10599 dst.WriteToContext(ctx);
10601 }
10602 }
10603 else if (!
GetGame().IsMultiplayer())
10604 {
10606 }
10607 }
10608
10610 {
10612 {
10613 if (ScriptInputUserData.CanStoreInputUserData())
10614 {
10615 ScriptInputUserData ctx = new ScriptInputUserData;
10620 ctx.
Write(destination_entity);
10626 }
10627 }
10628 else if (!
GetGame().IsMultiplayer())
10629 {
10631 }
10632 }
10633
10635 {
10637 }
10638
10640 {
10642 float split_quantity_new;
10644 if (dst.IsValid())
10645 {
10646 int slot_id = dst.GetSlot();
10648
10649 if (quantity > stack_max)
10650 split_quantity_new = stack_max;
10651 else
10652 split_quantity_new = quantity;
10653
10655 {
10657
10658 if (new_item)
10659 {
10660 new_item.SetResultOfSplit(true);
10661 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10663 new_item.
SetQuantity(split_quantity_new,
false,
true);
10664 }
10665
10666 return new_item;
10667 }
10668 }
10669
10670 return null;
10671 }
10672
10674 {
10676 float split_quantity_new;
10678 if (destination_entity)
10679 {
10681 if (quantity > stackable)
10682 split_quantity_new = stackable;
10683 else
10684 split_quantity_new = quantity;
10685
10687 {
10688 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10689 if (new_item)
10690 {
10691 new_item.SetResultOfSplit(true);
10692 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10694 new_item.
SetQuantity(split_quantity_new,
false,
true);
10695 }
10696 }
10697 }
10698 }
10699
10701 {
10703 {
10704 if (ScriptInputUserData.CanStoreInputUserData())
10705 {
10706 ScriptInputUserData ctx = new ScriptInputUserData;
10711 ItemBase destination_entity =
this;
10712 ctx.
Write(destination_entity);
10716 }
10717 }
10718 else if (!
GetGame().IsMultiplayer())
10719 {
10721 }
10722 }
10723
10725 {
10727 float split_quantity_new;
10729 if (player)
10730 {
10732 if (quantity > stackable)
10733 split_quantity_new = stackable;
10734 else
10735 split_quantity_new = quantity;
10736
10738 {
10739 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10740 new_item =
ItemBase.Cast(in_hands);
10741 if (new_item)
10742 {
10743 new_item.SetResultOfSplit(true);
10744 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10746 new_item.SetQuantity(split_quantity_new, false, true);
10747 }
10748 }
10749 }
10750 }
10751
10753 {
10755 float split_quantity_new = Math.Floor(quantity * 0.5);
10756
10758 return;
10759
10761
10762 if (new_item)
10763 {
10764 if (new_item.GetQuantityMax() < split_quantity_new)
10765 {
10766 split_quantity_new = new_item.GetQuantityMax();
10767 }
10768
10769 new_item.SetResultOfSplit(true);
10770 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10771
10773 {
10776 }
10777 else
10778 {
10780 new_item.
SetQuantity(split_quantity_new,
false,
true);
10781 }
10782 }
10783 }
10784
10786 {
10788 float split_quantity_new = Math.Floor(quantity / 2);
10789
10791 return;
10792
10793 InventoryLocation invloc = new InventoryLocation;
10795
10797 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10798
10799 if (new_item)
10800 {
10801 if (new_item.GetQuantityMax() < split_quantity_new)
10802 {
10803 split_quantity_new = new_item.GetQuantityMax();
10804 }
10806 {
10809 }
10810 else if (split_quantity_new > 1)
10811 {
10813 new_item.
SetQuantity(split_quantity_new,
false,
true);
10814 }
10815 }
10816 }
10817
10820 {
10821 SetWeightDirty();
10823
10824 if (parent)
10825 parent.OnAttachmentQuantityChangedEx(this, delta);
10826
10828 {
10830 {
10832 }
10834 {
10835 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10837 }
10838 }
10839
10840 }
10841
10844 {
10845
10846 }
10847
10850 {
10852 }
10853
10855 {
10856 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10857
10859 {
10860 if (newLevel == GameConstants.STATE_RUINED)
10861 {
10863 EntityAI parent = GetHierarchyParent();
10864 if (parent && parent.IsFireplace())
10865 {
10866 CargoBase cargo = GetInventory().GetCargo();
10867 if (cargo)
10868 {
10870 {
10872 }
10873 }
10874 }
10875 }
10876
10878 {
10879
10881 return;
10882 }
10883
10884 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10885 {
10887 }
10888 }
10889 }
10890
10891
10893 {
10894 super.OnRightClick();
10895
10897 {
10899 {
10900 if (ScriptInputUserData.CanStoreInputUserData())
10901 {
10902 EntityAI root = GetHierarchyRoot();
10903 Man playerOwner = GetHierarchyRootPlayer();
10904 InventoryLocation dst = new InventoryLocation;
10905
10906
10907 if (!playerOwner && root && root == this)
10908 {
10910 }
10911 else
10912 {
10913
10914 GetInventory().GetCurrentInventoryLocation(dst);
10916 {
10919 {
10921 }
10922 else
10923 {
10925
10926
10927 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10928 {
10930 }
10931 else
10932 {
10933 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10934 }
10935 }
10936 }
10937 }
10938
10939 ScriptInputUserData ctx = new ScriptInputUserData;
10947 }
10948 }
10949 else if (!
GetGame().IsMultiplayer())
10950 {
10952 }
10953 }
10954 }
10955
10957 {
10958 if (root)
10959 {
10960 vector m4[4];
10961 root.GetTransform(m4);
10962 dst.SetGround(this, m4);
10963 }
10964 else
10965 {
10966 GetInventory().GetCurrentInventoryLocation(dst);
10967 }
10968 }
10969
10970 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10971 {
10972
10973 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10974 return false;
10975
10976 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10977 return false;
10978
10979
10981 return false;
10982
10983
10984 Magazine mag = Magazine.Cast(this);
10985 if (mag)
10986 {
10987 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10988 return false;
10989
10990 if (stack_max_limit)
10991 {
10992 Magazine other_mag = Magazine.Cast(other_item);
10993 if (other_item)
10994 {
10995 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10996 return false;
10997 }
10998
10999 }
11000 }
11001 else
11002 {
11003
11005 return false;
11006
11008 return false;
11009 }
11010
11011 PlayerBase player = null;
11012 if (CastTo(player, GetHierarchyRootPlayer()))
11013 {
11014 if (player.GetInventory().HasAttachment(this))
11015 return false;
11016
11017 if (player.IsItemsToDelete())
11018 return false;
11019 }
11020
11021 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11022 return false;
11023
11024 int slotID;
11026 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11027 return false;
11028
11029 return true;
11030 }
11031
11033 {
11035 }
11036
11038 {
11039 return m_IsResultOfSplit;
11040 }
11041
11043 {
11044 m_IsResultOfSplit = value;
11045 }
11046
11048 {
11050 }
11051
11053 {
11054 float other_item_quantity = other_item.GetQuantity();
11055 float this_free_space;
11056
11058
11060
11061 if (other_item_quantity > this_free_space)
11062 {
11063 return this_free_space;
11064 }
11065 else
11066 {
11067 return other_item_quantity;
11068 }
11069 }
11070
11072 {
11074 }
11075
11077 {
11079 return;
11080
11081 if (!IsMagazine() && other_item)
11082 {
11084 if (quantity_used != 0)
11085 {
11086 float hp1 = GetHealth01("","");
11087 float hp2 = other_item.GetHealth01("","");
11088 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11089 hpResult = hpResult / (
GetQuantity() + quantity_used);
11090
11091 hpResult *= GetMaxHealth();
11092 Math.Round(hpResult);
11093 SetHealth("", "Health", hpResult);
11094
11096 other_item.AddQuantity(-quantity_used);
11097 }
11098 }
11100 }
11101
11103 {
11104 #ifdef SERVER
11105 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11106 GetHierarchyParent().IncreaseLifetimeUp();
11107 #endif
11108 };
11109
11111 {
11112 PlayerBase p = PlayerBase.Cast(player);
11113
11114 array<int> recipesIds = p.m_Recipes;
11115 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11116 if (moduleRecipesManager)
11117 {
11118 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11119 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11120 }
11121
11122 for (int i = 0;i < recipesIds.Count(); i++)
11123 {
11124 int key = recipesIds.Get(i);
11125 string recipeName = moduleRecipesManager.GetRecipeName(key);
11127 }
11128 }
11129
11130
11131 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11132 {
11133 super.GetDebugActions(outputList);
11134
11135
11141
11142
11147
11152
11153
11157
11158
11160 {
11164 }
11165
11168
11169
11173
11175
11176 InventoryLocation loc = new InventoryLocation();
11177 GetInventory().GetCurrentInventoryLocation(loc);
11179 {
11180 if (Gizmo_IsSupported())
11183 }
11184
11186 }
11187
11188
11189
11190
11192 {
11193 super.OnAction(action_id, player, ctx);
11194
11196 {
11197 switch (action_id)
11198 {
11201 return true;
11204 return true;
11205 }
11206 }
11207
11209 {
11210 switch (action_id)
11211 {
11213 Delete();
11214 return true;
11215 }
11216 }
11217
11218 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11219 {
11220 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11221 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11222 PlayerBase p = PlayerBase.Cast(player);
11223 if (
EActions.RECIPES_RANGE_START < 1000)
11224 {
11225 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11226 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11227 }
11228 }
11229 #ifndef SERVER
11230 else if (action_id ==
EActions.WATCH_PLAYER)
11231 {
11232 PluginDeveloper.SetDeveloperItemClientEx(player);
11233 }
11234 #endif
11236 {
11237 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11238 {
11239 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11240 OnDebugButtonPressServer(id + 1);
11241 }
11242
11243 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11244 {
11245 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11247 }
11248
11249 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11250 {
11251 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11253 }
11254
11255 else if (action_id ==
EActions.ADD_QUANTITY)
11256 {
11257 if (IsMagazine())
11258 {
11259 Magazine mag = Magazine.Cast(this);
11260 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11261 }
11262 else
11263 {
11265 }
11266
11267 if (m_EM)
11268 {
11269 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11270 }
11271
11272 }
11273
11274 else if (action_id ==
EActions.REMOVE_QUANTITY)
11275 {
11276 if (IsMagazine())
11277 {
11278 Magazine mag2 = Magazine.Cast(this);
11279 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11280 }
11281 else
11282 {
11284 }
11285 if (m_EM)
11286 {
11287 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11288 }
11289
11290 }
11291
11292 else if (action_id ==
EActions.SET_QUANTITY_0)
11293 {
11295
11296 if (m_EM)
11297 {
11298 m_EM.SetEnergy(0);
11299 }
11300 }
11301
11302 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11303 {
11305
11306 if (m_EM)
11307 {
11308 m_EM.SetEnergy(m_EM.GetEnergyMax());
11309 }
11310 }
11311
11312 else if (action_id ==
EActions.ADD_HEALTH)
11313 {
11314 AddHealth("","",GetMaxHealth("","Health")/5);
11315 }
11316 else if (action_id ==
EActions.REMOVE_HEALTH)
11317 {
11318 AddHealth("","",-GetMaxHealth("","Health")/5);
11319 }
11320 else if (action_id ==
EActions.DESTROY_HEALTH)
11321 {
11322 SetHealth01("","",0);
11323 }
11324 else if (action_id ==
EActions.WATCH_ITEM)
11325 {
11327 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11328 #ifdef DEVELOPER
11329 SetDebugDeveloper_item(this);
11330 #endif
11331 }
11332
11333 else if (action_id ==
EActions.ADD_TEMPERATURE)
11334 {
11335 AddTemperature(20);
11336
11337 }
11338
11339 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11340 {
11341 AddTemperature(-20);
11342
11343 }
11344
11345 else if (action_id ==
EActions.FLIP_FROZEN)
11346 {
11347 SetFrozen(!GetIsFrozen());
11348
11349 }
11350
11351 else if (action_id ==
EActions.ADD_WETNESS)
11352 {
11354
11355 }
11356
11357 else if (action_id ==
EActions.REMOVE_WETNESS)
11358 {
11360
11361 }
11362
11363 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11364 {
11367
11368
11369 }
11370
11371 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11372 {
11375 }
11376
11377 else if (action_id ==
EActions.MAKE_SPECIAL)
11378 {
11379 auto debugParams = DebugSpawnParams.WithPlayer(player);
11380 OnDebugSpawnEx(debugParams);
11381 }
11382
11383 }
11384
11385
11386 return false;
11387 }
11388
11389
11390
11391
11395
11398
11399
11400
11402 {
11403 return false;
11404 }
11405
11406
11408 {
11409 return true;
11410 }
11411
11412
11414 {
11415 return true;
11416 }
11417
11418
11419
11421 {
11422 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11424 }
11425
11428 {
11429 return null;
11430 }
11431
11433 {
11434 return false;
11435 }
11436
11438 {
11439 return false;
11440 }
11441
11445
11446
11448 {
11449 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11450 return module_repairing.CanRepair(this, item_repair_kit);
11451 }
11452
11453
11454 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11455 {
11456 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11457 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11458 }
11459
11460
11462 {
11463
11464
11465
11466
11467
11468
11469
11470
11471 return 1;
11472 }
11473
11474
11475
11477 {
11479 }
11480
11481
11482
11484 {
11486 }
11487
11488
11497 {
11498 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11499
11500 if (player)
11501 {
11502 player.MessageStatus(text);
11503 }
11504 }
11505
11506
11515 {
11516 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11517
11518 if (player)
11519 {
11520 player.MessageAction(text);
11521 }
11522 }
11523
11524
11533 {
11534 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11535
11536 if (player)
11537 {
11538 player.MessageFriendly(text);
11539 }
11540 }
11541
11542
11551 {
11552 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11553
11554 if (player)
11555 {
11556 player.MessageImportant(text);
11557 }
11558 }
11559
11561 {
11562 return true;
11563 }
11564
11565
11566 override bool KindOf(
string tag)
11567 {
11568 bool found = false;
11569 string item_name = this.
GetType();
11572
11573 int array_size = item_tag_array.Count();
11574 for (int i = 0; i < array_size; i++)
11575 {
11576 if (item_tag_array.Get(i) == tag)
11577 {
11578 found = true;
11579 break;
11580 }
11581 }
11582 return found;
11583 }
11584
11585
11587 {
11588
11589 super.OnRPC(sender, rpc_type,ctx);
11590
11591
11592 switch (rpc_type)
11593 {
11594 #ifndef SERVER
11595 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11596 Param2<bool, string> p = new Param2<bool, string>(false, "");
11597
11599 return;
11600
11601 bool play = p.param1;
11602 string soundSet = p.param2;
11603
11604 if (play)
11605 {
11607 {
11609 {
11611 }
11612 }
11613 else
11614 {
11616 }
11617 }
11618 else
11619 {
11621 }
11622
11623 break;
11624 #endif
11625
11626 }
11627
11629 {
11631 }
11632 }
11633
11634
11635
11636
11638 {
11639 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11640 return plugin.GetID(
name);
11641 }
11642
11644 {
11645 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11646 return plugin.GetName(id);
11647 }
11648
11651 {
11652
11653
11654 int varFlags;
11655 if (!ctx.
Read(varFlags))
11656 return;
11657
11658 if (varFlags & ItemVariableFlags.FLOAT)
11659 {
11661 }
11662 }
11663
11665 {
11666
11667 super.SerializeNumericalVars(floats_out);
11668
11669
11670
11672 {
11674 }
11675
11677 {
11679 }
11680
11682 {
11684 }
11685
11687 {
11692 }
11693
11695 {
11697 }
11698 }
11699
11701 {
11702
11703 super.DeSerializeNumericalVars(floats);
11704
11705
11706 int index = 0;
11707 int mask = Math.Round(floats.Get(index));
11708
11709 index++;
11710
11712 {
11714 {
11716 }
11717 else
11718 {
11719 float quantity = floats.Get(index);
11720 SetQuantity(quantity,
true,
false,
false,
false);
11721 }
11722 index++;
11723 }
11724
11726 {
11727 float wet = floats.Get(index);
11729 index++;
11730 }
11731
11733 {
11734 int liquidtype = Math.Round(floats.Get(index));
11736 index++;
11737 }
11738
11740 {
11742 index++;
11744 index++;
11746 index++;
11748 index++;
11749 }
11750
11752 {
11753 int cleanness = Math.Round(floats.Get(index));
11755 index++;
11756 }
11757 }
11758
11760 {
11761 super.WriteVarsToCTX(ctx);
11762
11763
11765 {
11767 }
11768
11770 {
11772 }
11773
11775 {
11777 }
11778
11780 {
11781 int r,g,b,a;
11787 }
11788
11790 {
11792 }
11793 }
11794
11796 {
11797 if (!super.ReadVarsFromCTX(ctx,version))
11798 return false;
11799
11800 int intValue;
11801 float value;
11802
11803 if (version < 140)
11804 {
11805 if (!ctx.
Read(intValue))
11806 return false;
11807
11808 m_VariablesMask = intValue;
11809 }
11810
11812 {
11813 if (!ctx.
Read(value))
11814 return false;
11815
11817 {
11819 }
11820 else
11821 {
11823 }
11824 }
11825
11826 if (version < 140)
11827 {
11829 {
11830 if (!ctx.
Read(value))
11831 return false;
11832 SetTemperatureDirect(value);
11833 }
11834 }
11835
11837 {
11838 if (!ctx.
Read(value))
11839 return false;
11841 }
11842
11844 {
11845 if (!ctx.
Read(intValue))
11846 return false;
11848 }
11849
11851 {
11852 int r,g,b,a;
11854 return false;
11856 return false;
11858 return false;
11860 return false;
11861
11863 }
11864
11866 {
11867 if (!ctx.
Read(intValue))
11868 return false;
11870 }
11871
11872 if (version >= 138 && version < 140)
11873 {
11875 {
11876 if (!ctx.
Read(intValue))
11877 return false;
11878 SetFrozen(intValue);
11879 }
11880 }
11881
11882 return true;
11883 }
11884
11885
11887 {
11890 {
11892 }
11893
11894 if (!super.OnStoreLoad(ctx, version))
11895 {
11897 return false;
11898 }
11899
11900 if (version >= 114)
11901 {
11902 bool hasQuickBarIndexSaved;
11903
11904 if (!ctx.
Read(hasQuickBarIndexSaved))
11905 {
11907 return false;
11908 }
11909
11910 if (hasQuickBarIndexSaved)
11911 {
11912 int itmQBIndex;
11913
11914
11915 if (!ctx.
Read(itmQBIndex))
11916 {
11918 return false;
11919 }
11920
11921 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11922 if (itmQBIndex != -1 && parentPlayer)
11923 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11924 }
11925 }
11926 else
11927 {
11928
11929 PlayerBase player;
11930 int itemQBIndex;
11931 if (version ==
int.
MAX)
11932 {
11933 if (!ctx.
Read(itemQBIndex))
11934 {
11936 return false;
11937 }
11938 }
11939 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11940 {
11941
11942 if (!ctx.
Read(itemQBIndex))
11943 {
11945 return false;
11946 }
11947 if (itemQBIndex != -1 && player)
11948 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11949 }
11950 }
11951
11952 if (version < 140)
11953 {
11954
11955 if (!LoadVariables(ctx, version))
11956 {
11958 return false;
11959 }
11960 }
11961
11962
11964 {
11966 return false;
11967 }
11968 if (version >= 132)
11969 {
11971 if (raib)
11972 {
11974 {
11976 return false;
11977 }
11978 }
11979 }
11980
11982 return true;
11983 }
11984
11985
11986
11988 {
11989 super.OnStoreSave(ctx);
11990
11991 PlayerBase player;
11992 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11993 {
11995
11996 int itemQBIndex = -1;
11997 itemQBIndex = player.FindQuickBarEntityIndex(this);
11998 ctx.
Write(itemQBIndex);
11999 }
12000 else
12001 {
12003 }
12004
12006
12008 if (raib)
12009 {
12011 }
12012 }
12013
12014
12016 {
12017 super.AfterStoreLoad();
12018
12020 {
12022 }
12023
12025 {
12028 }
12029 }
12030
12032 {
12033 super.EEOnAfterLoad();
12034
12036 {
12038 }
12039
12042 }
12043
12045 {
12046 return false;
12047 }
12048
12049
12050
12052 {
12054 {
12055 #ifdef PLATFORM_CONSOLE
12056
12058 {
12060 if (menu)
12061 {
12063 }
12064 }
12065 #endif
12066 }
12067
12069 {
12072 }
12073
12075 {
12076 SetWeightDirty();
12078 }
12080 {
12083 }
12084
12086 {
12089 }
12091 {
12094 }
12095
12096 super.OnVariablesSynchronized();
12097 }
12098
12099
12100
12102 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12103 {
12104 if (!IsServerCheck(allow_client))
12105 return false;
12106
12108 return false;
12109
12112
12113 if (value <= (min + 0.001))
12114 value = min;
12115
12116 if (value == min)
12117 {
12118 if (destroy_config)
12119 {
12120 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12121 if (dstr)
12122 {
12124 this.Delete();
12125 return true;
12126 }
12127 }
12128 else if (destroy_forced)
12129 {
12131 this.Delete();
12132 return true;
12133 }
12134
12136 }
12137
12140
12142 {
12144
12145 if (delta)
12147 }
12148
12150
12151 return false;
12152 }
12153
12154
12156 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12157 {
12159 }
12160
12162 {
12165 }
12166
12168 {
12171 }
12172
12174 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12175 {
12176 float value_clamped = Math.Clamp(value, 0, 1);
12178 SetQuantity(result, destroy_config, destroy_forced);
12179 }
12180
12181
12184 {
12186 }
12187
12189 {
12191 }
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12203 {
12204 int slot = -1;
12205 if (GetInventory())
12206 {
12207 InventoryLocation il = new InventoryLocation;
12208 GetInventory().GetCurrentInventoryLocation(il);
12210 }
12211
12213 }
12214
12216 {
12217 float quantity_max = 0;
12218
12220 {
12221 if (attSlotID != -1)
12222 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12223
12224 if (quantity_max <= 0)
12226 }
12227
12228 if (quantity_max <= 0)
12230
12231 return quantity_max;
12232 }
12233
12235 {
12237 }
12238
12240 {
12242 }
12243
12244
12246 {
12248 }
12249
12251 {
12253 }
12254
12256 {
12258 }
12259
12260
12262 {
12263
12264 float weightEx = GetWeightEx();
12265 float special = GetInventoryAndCargoWeight();
12266 return weightEx - special;
12267 }
12268
12269
12271 {
12273 }
12274
12276 {
12278 {
12279 #ifdef DEVELOPER
12280 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12281 {
12282 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12284 }
12285 #endif
12286
12287 return GetQuantity() * GetConfigWeightModified();
12288 }
12289 else if (HasEnergyManager())
12290 {
12291 #ifdef DEVELOPER
12292 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12293 {
12294 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12295 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12296 }
12297 #endif
12298 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12299 }
12300 else
12301 {
12302 #ifdef DEVELOPER
12303 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12304 {
12305 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12306 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12307 }
12308 #endif
12309 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12310 }
12311 }
12312
12315 {
12316 int item_count = 0;
12318
12319 if (GetInventory().GetCargo() != NULL)
12320 {
12321 item_count = GetInventory().GetCargo().GetItemCount();
12322 }
12323
12324 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12325 {
12326 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12327 if (item)
12328 item_count += item.GetNumberOfItems();
12329 }
12330 return item_count;
12331 }
12332
12335 {
12336 float weight = 0;
12337 float wetness = 1;
12338 if (include_wetness)
12341 {
12342 weight = wetness * m_ConfigWeight;
12343 }
12345 {
12346 weight = 1;
12347 }
12348 return weight;
12349 }
12350
12351
12352
12354 {
12355 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12356 {
12357 GameInventory inv = GetInventory();
12358 array<EntityAI> items = new array<EntityAI>;
12360 for (int i = 0; i < items.Count(); i++)
12361 {
12363 if (item)
12364 {
12366 }
12367 }
12368 }
12369 }
12370
12371
12372
12373
12375 {
12376 float energy = 0;
12377 if (HasEnergyManager())
12378 {
12379 energy = GetCompEM().GetEnergy();
12380 }
12381 return energy;
12382 }
12383
12384
12386 {
12387 super.OnEnergyConsumed();
12388
12390 }
12391
12393 {
12394 super.OnEnergyAdded();
12395
12397 }
12398
12399
12401 {
12402 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12403 {
12405 {
12406 float energy_0to1 = GetCompEM().GetEnergy0To1();
12408 }
12409 }
12410 }
12411
12412
12414 {
12415 return ConfigGetFloat("heatIsolation");
12416 }
12417
12419 {
12421 }
12422
12424 {
12425 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12426 if (
GetGame().ConfigIsExisting(paramPath))
12428
12429 return 0.0;
12430 }
12431
12433 {
12434 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12435 if (
GetGame().ConfigIsExisting(paramPath))
12437
12438 return 0.0;
12439 }
12440
12441 override void SetWet(
float value,
bool allow_client =
false)
12442 {
12443 if (!IsServerCheck(allow_client))
12444 return;
12445
12448
12450
12451 m_VarWet = Math.Clamp(value, min, max);
12452
12454 {
12457 }
12458 }
12459
12460 override void AddWet(
float value)
12461 {
12463 }
12464
12466 {
12468 }
12469
12471 {
12473 }
12474
12476 {
12478 }
12479
12481 {
12483 }
12484
12486 {
12488 }
12489
12490 override void OnWetChanged(
float newVal,
float oldVal)
12491 {
12494 if (newLevel != oldLevel)
12495 {
12497 }
12498 }
12499
12501 {
12502 SetWeightDirty();
12503 }
12504
12506 {
12507 return GetWetLevelInternal(
m_VarWet);
12508 }
12509
12510
12511
12513 {
12515 }
12516
12518 {
12520 }
12521
12523 {
12525 }
12526
12528 {
12530 }
12531
12532
12533
12535 {
12536 if (ConfigIsExisting("itemModelLength"))
12537 {
12538 return ConfigGetFloat("itemModelLength");
12539 }
12540 return 0;
12541 }
12542
12544 {
12545 if (ConfigIsExisting("itemAttachOffset"))
12546 {
12547 return ConfigGetFloat("itemAttachOffset");
12548 }
12549 return 0;
12550 }
12551
12552 override void SetCleanness(
int value,
bool allow_client =
false)
12553 {
12554 if (!IsServerCheck(allow_client))
12555 return;
12556
12558
12560
12563 }
12564
12566 {
12568 }
12569
12571 {
12572 return true;
12573 }
12574
12575
12576
12577
12579 {
12581 }
12582
12584 {
12586 }
12587
12588
12589
12590
12591 override void SetColor(
int r,
int g,
int b,
int a)
12592 {
12598 }
12600 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12601 {
12606 }
12607
12609 {
12611 }
12612
12615 {
12616 int r,g,b,a;
12618 r = r/255;
12619 g = g/255;
12620 b = b/255;
12621 a = a/255;
12622 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12623 }
12624
12625
12626
12627 override void SetLiquidType(
int value,
bool allow_client =
false)
12628 {
12629 if (!IsServerCheck(allow_client))
12630 return;
12631
12636 }
12637
12639 {
12640 return ConfigGetInt("varLiquidTypeInit");
12641 }
12642
12644 {
12646 }
12647
12649 {
12651 SetFrozen(false);
12652 }
12653
12656 {
12657 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12658 }
12659
12660
12663 {
12664 PlayerBase nplayer;
12665 if (PlayerBase.CastTo(nplayer, player))
12666 {
12668
12669 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12670 }
12671 }
12672
12673
12676 {
12677 PlayerBase nplayer;
12678 if (PlayerBase.CastTo(nplayer,player))
12679 {
12680
12681 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12682
12683 }
12684
12685
12686 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12687
12688
12689 if (HasEnergyManager())
12690 {
12691 GetCompEM().UpdatePlugState();
12692 }
12693 }
12694
12695
12697 {
12698 super.OnPlacementStarted(player);
12699
12701 }
12702
12703 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12704 {
12706 {
12707 m_AdminLog.OnPlacementComplete(player,
this);
12708 }
12709
12710 super.OnPlacementComplete(player, position, orientation);
12711 }
12712
12713
12714
12715
12716
12718 {
12720 {
12721 return true;
12722 }
12723 else
12724 {
12725 return false;
12726 }
12727 }
12728
12729
12731 {
12733 {
12735 }
12736 }
12737
12738
12740 {
12742 }
12743
12745 {
12747 }
12748
12749 override void InsertAgent(
int agent,
float count = 1)
12750 {
12751 if (count < 1)
12752 return;
12753
12755 }
12756
12759 {
12761 }
12762
12763
12765 {
12767 }
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12811 {
12813 return false;
12814 return true;
12815 }
12816
12818 {
12819
12821 }
12822
12823
12826 {
12827 super.CheckForRoofLimited(timeTresholdMS);
12828
12830 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12831 {
12832 m_PreviousRoofTestTime = time;
12833 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12834 }
12835 }
12836
12837
12839 {
12841 {
12842 return 0;
12843 }
12844
12845 if (GetInventory().GetAttachmentSlotsCount() != 0)
12846 {
12847 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12848 if (filter)
12849 return filter.GetProtectionLevel(type, false, system);
12850 else
12851 return 0;
12852 }
12853
12854 string subclassPath, entryName;
12855
12856 switch (type)
12857 {
12859 entryName = "biological";
12860 break;
12862 entryName = "chemical";
12863 break;
12864 default:
12865 entryName = "biological";
12866 break;
12867 }
12868
12869 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12870
12872 }
12873
12874
12875
12878 {
12879 if (!IsMagazine())
12881
12883 }
12884
12885
12886
12887
12888
12893 {
12894 return true;
12895 }
12896
12898 {
12900 }
12901
12902
12903
12904
12905
12907 {
12908 if (parent)
12909 {
12910 if (parent.IsInherited(DayZInfected))
12911 return true;
12912
12913 if (!parent.IsRuined())
12914 return true;
12915 }
12916
12917 return true;
12918 }
12919
12921 {
12922 if (!super.CanPutAsAttachment(parent))
12923 {
12924 return false;
12925 }
12926
12927 if (!IsRuined() && !parent.IsRuined())
12928 {
12929 return true;
12930 }
12931
12932 return false;
12933 }
12934
12936 {
12937
12938
12939
12940
12941 return super.CanReceiveItemIntoCargo(item);
12942 }
12943
12945 {
12946
12947
12948
12949
12950 GameInventory attachmentInv = attachment.GetInventory();
12952 {
12953 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12954 return false;
12955 }
12956
12957 InventoryLocation loc = new InventoryLocation();
12958 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12959 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12960 return false;
12961
12962 return super.CanReceiveAttachment(attachment, slotId);
12963 }
12964
12966 {
12967 if (!super.CanReleaseAttachment(attachment))
12968 return false;
12969
12970 return GetInventory().AreChildrenAccessible();
12971 }
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12994 {
12995 int id = muzzle_owner.GetMuzzleID();
12996 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12997
12998 if (WPOF_array)
12999 {
13000 for (int i = 0; i < WPOF_array.Count(); i++)
13001 {
13002 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13003
13004 if (WPOF)
13005 {
13006 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13007 }
13008 }
13009 }
13010 }
13011
13012
13014 {
13015 int id = muzzle_owner.GetMuzzleID();
13017
13018 if (WPOBE_array)
13019 {
13020 for (int i = 0; i < WPOBE_array.Count(); i++)
13021 {
13022 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13023
13024 if (WPOBE)
13025 {
13026 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13027 }
13028 }
13029 }
13030 }
13031
13032
13034 {
13035 int id = muzzle_owner.GetMuzzleID();
13036 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13037
13038 if (WPOOH_array)
13039 {
13040 for (int i = 0; i < WPOOH_array.Count(); i++)
13041 {
13042 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13043
13044 if (WPOOH)
13045 {
13046 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13047 }
13048 }
13049 }
13050 }
13051
13052
13054 {
13055 int id = muzzle_owner.GetMuzzleID();
13056 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13057
13058 if (WPOOH_array)
13059 {
13060 for (int i = 0; i < WPOOH_array.Count(); i++)
13061 {
13062 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13063
13064 if (WPOOH)
13065 {
13066 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13067 }
13068 }
13069 }
13070 }
13071
13072
13074 {
13075 int id = muzzle_owner.GetMuzzleID();
13076 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13077
13078 if (WPOOH_array)
13079 {
13080 for (int i = 0; i < WPOOH_array.Count(); i++)
13081 {
13082 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13083
13084 if (WPOOH)
13085 {
13086 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13087 }
13088 }
13089 }
13090 }
13091
13092
13093
13095 {
13097 {
13098 return true;
13099 }
13100
13101 return false;
13102 }
13103
13105 {
13107 {
13108 return true;
13109 }
13110
13111 return false;
13112 }
13113
13115 {
13117 {
13118 return true;
13119 }
13120
13121 return false;
13122 }
13123
13125 {
13126 return false;
13127 }
13128
13131 {
13132 return UATimeSpent.DEFAULT_DEPLOY;
13133 }
13134
13135
13136
13137
13139 {
13141 SetSynchDirty();
13142 }
13143
13145 {
13147 }
13148
13149
13151 {
13152 return false;
13153 }
13154
13157 {
13158 string att_type = "None";
13159
13160 if (ConfigIsExisting("soundAttType"))
13161 {
13162 att_type = ConfigGetString("soundAttType");
13163 }
13164
13166 }
13167
13169 {
13171 }
13172
13173
13174
13175
13176
13182
13184 {
13187
13189 }
13190
13191
13193 {
13195 return;
13196
13198
13201
13204
13205 SoundParameters params = new SoundParameters();
13209 }
13210
13211
13213 {
13215 return;
13216
13218 SetSynchDirty();
13219
13222 }
13223
13224
13226 {
13228 return;
13229
13231 SetSynchDirty();
13232
13235 }
13236
13238 {
13240 }
13241
13243 {
13245 }
13246
13249 {
13250 if (!
GetGame().IsDedicatedServer())
13251 {
13252 if (ConfigIsExisting("attachSoundSet"))
13253 {
13254 string cfg_path = "";
13255 string soundset = "";
13256 string type_name =
GetType();
13257
13260 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13261 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13262
13263 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13264 {
13265 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13266 {
13267 if (cfg_slot_array[i] == slot_type)
13268 {
13269 soundset = cfg_soundset_array[i];
13270 break;
13271 }
13272 }
13273 }
13274
13275 if (soundset != "")
13276 {
13277 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13279 }
13280 }
13281 }
13282 }
13283
13285 {
13286
13287 }
13288
13289 void OnApply(PlayerBase player);
13290
13292 {
13293 return 1.0;
13294 };
13295
13297 {
13299 }
13300
13302 {
13304 }
13305
13307
13309 {
13310 SetDynamicPhysicsLifeTime(0.01);
13312 }
13313
13315 {
13316 array<string> zone_names = new array<string>;
13317 GetDamageZones(zone_names);
13318 for (int i = 0; i < zone_names.Count(); i++)
13319 {
13320 SetHealthMax(zone_names.Get(i),"Health");
13321 }
13322 SetHealthMax("","Health");
13323 }
13324
13327 {
13328 float global_health = GetHealth01("","Health");
13329 array<string> zones = new array<string>;
13330 GetDamageZones(zones);
13331
13332 for (int i = 0; i < zones.Count(); i++)
13333 {
13334 SetHealth01(zones.Get(i),"Health",global_health);
13335 }
13336 }
13337
13340 {
13341 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13342 }
13343
13345 {
13346 if (!hasRootAsPlayer)
13347 {
13348 if (refParentIB)
13349 {
13350
13351 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13352 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13353
13354 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13355 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13356
13359 }
13360 else
13361 {
13362
13365 }
13366 }
13367 }
13368
13370 {
13372 {
13373 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13374 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13375 {
13376 float heatPermCoef = 1.0;
13378 while (ent)
13379 {
13380 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13381 ent = ent.GetHierarchyParent();
13382 }
13383
13384 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13385 }
13386 }
13387 }
13388
13390 {
13391
13392 EntityAI parent = GetHierarchyParent();
13393 if (!parent)
13394 {
13395 hasParent = false;
13396 hasRootAsPlayer = false;
13397 }
13398 else
13399 {
13400 hasParent = true;
13401 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13402 refParentIB =
ItemBase.Cast(parent);
13403 }
13404 }
13405
13406 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13407 {
13408
13409 }
13410
13412 {
13413
13414 return false;
13415 }
13416
13418 {
13419
13420
13421 return false;
13422 }
13423
13425 {
13426
13427 return false;
13428 }
13429
13432 {
13433 return !GetIsFrozen() &&
IsOpen();
13434 }
13435
13437 {
13438 bool hasParent = false, hasRootAsPlayer = false;
13440
13441 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13442 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13443
13444 if (wwtu || foodDecay)
13445 {
13449
13450 if (processWetness || processTemperature || processDecay)
13451 {
13453
13454 if (processWetness)
13455 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13456
13457 if (processTemperature)
13459
13460 if (processDecay)
13461 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13462 }
13463 }
13464 }
13465
13468 {
13470 }
13471
13473 {
13476
13477 return super.GetTemperatureFreezeThreshold();
13478 }
13479
13481 {
13484
13485 return super.GetTemperatureThawThreshold();
13486 }
13487
13489 {
13492
13493 return super.GetItemOverheatThreshold();
13494 }
13495
13497 {
13499 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13500
13501 return super.GetTemperatureFreezeTime();
13502 }
13503
13505 {
13507 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13508
13509 return super.GetTemperatureThawTime();
13510 }
13511
13516
13518 {
13519 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13520 }
13521
13523 {
13524 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13525 }
13526
13529 {
13531 }
13532
13534 {
13536 }
13537
13539 {
13541 }
13542
13545 {
13546 return null;
13547 }
13548
13551 {
13552 return false;
13553 }
13554
13556 {
13558 {
13561 if (!trg)
13562 {
13564 explosive = this;
13565 }
13566
13567 explosive.PairRemote(trg);
13569
13570 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13571 trg.SetPersistentPairID(persistentID);
13572 explosive.SetPersistentPairID(persistentID);
13573
13574 return true;
13575 }
13576 return false;
13577 }
13578
13581 {
13582 float ret = 1.0;
13585 ret *= GetHealth01();
13586
13587 return ret;
13588 }
13589
13590 #ifdef DEVELOPER
13591 override void SetDebugItem()
13592 {
13593 super.SetDebugItem();
13594 _itemBase = this;
13595 }
13596
13598 {
13599 string text = super.GetDebugText();
13600
13602 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13603
13604 return text;
13605 }
13606 #endif
13607
13609 {
13610 return true;
13611 }
13612
13614
13616
13618 {
13621 }
13622
13623
13631
13647}
13648
13650{
13652 if (entity)
13653 {
13654 bool is_item = entity.IsInherited(
ItemBase);
13655 if (is_item && full_quantity)
13656 {
13659 }
13660 }
13661 else
13662 {
13664 return NULL;
13665 }
13666 return entity;
13667}
13668
13670{
13671 if (item)
13672 {
13673 if (health > 0)
13674 item.SetHealth("", "", health);
13675
13676 if (item.CanHaveTemperature())
13677 {
13679 if (item.CanFreeze())
13680 item.SetFrozen(false);
13681 }
13682
13683 if (item.HasEnergyManager())
13684 {
13685 if (quantity >= 0)
13686 {
13687 item.GetCompEM().SetEnergy0To1(quantity);
13688 }
13689 else
13690 {
13692 }
13693 }
13694 else if (item.IsMagazine())
13695 {
13696 Magazine mag = Magazine.Cast(item);
13697 if (quantity >= 0)
13698 {
13699 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13700 }
13701 else
13702 {
13704 }
13705
13706 }
13707 else
13708 {
13709 if (quantity >= 0)
13710 {
13711 item.SetQuantityNormalized(quantity, false);
13712 }
13713 else
13714 {
13716 }
13717
13718 }
13719 }
13720}
13721
13722#ifdef DEVELOPER
13724#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.