8875{
8877 {
8878 return true;
8879 }
8880};
8881
8882
8883
8885{
8889
8891
8894
8895
8896
8897
8898
8907
8913
8918
8923
8944 protected bool m_IsResultOfSplit
8945
8947
8952
8953
8954
8956
8960
8961
8962
8964
8967
8968
8969
8975
8976
8984
8987
8988
8990
8991
8993
8994
8999
9000
9005
9006
9008
9009
9011 {
9016
9017 if (!
GetGame().IsDedicatedServer())
9018 {
9020 {
9022
9024 {
9026 }
9027 }
9028
9031 }
9032
9033 m_OldLocation = null;
9034
9036 {
9038 }
9039
9040 if (ConfigIsExisting("headSelectionsToHide"))
9041 {
9044 }
9045
9047 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9048 {
9050 }
9051
9053
9054 m_IsResultOfSplit = false;
9055
9057 }
9058
9060 {
9061 super.InitItemVariables();
9062
9068 m_Count = ConfigGetInt(
"count");
9069
9072
9077
9080
9085
9097
9101
9102
9105 if (ConfigIsExisting("canBeSplit"))
9106 {
9109 }
9110
9112 if (ConfigIsExisting("itemBehaviour"))
9114
9115
9118 RegisterNetSyncVariableInt("m_VarLiquidType");
9119 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9120
9121 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9122 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9123 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9124
9125 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9126 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9127 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9128 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9129
9130 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9131 RegisterNetSyncVariableBool("m_IsTakeable");
9132 RegisterNetSyncVariableBool("m_IsHologram");
9133
9136 {
9139 }
9140
9142
9144 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9146
9147 }
9148
9150 {
9152 }
9153
9155 {
9158 {
9163 }
9164 }
9165
9166 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9167 {
9169 {
9172 }
9173
9175 }
9176
9178 {
9184 }
9185
9187
9189 {
9191
9192 if (!action)
9193 {
9194 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9195 return;
9196 }
9197
9199 if (!ai)
9200 {
9202 return;
9203 }
9204
9206 if (!action_array)
9207 {
9208 action_array = new array<ActionBase_Basic>;
9210 }
9211 if (LogManager.IsActionLogEnable())
9212 {
9213 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9214 }
9215
9216 if (action_array.Find(action) != -1)
9217 {
9218 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9219 }
9220 else
9221 {
9222 action_array.Insert(action);
9223 }
9224 }
9225
9227 {
9229 ActionBase action = player.GetActionManager().GetAction(actionName);
9232
9233 if (action_array)
9234 {
9235 action_array.RemoveItem(action);
9236 }
9237 }
9238
9239
9240
9242 {
9243 ActionOverrideData overrideData = new ActionOverrideData();
9247
9249 if (!actionMap)
9250 {
9253 }
9254
9255 actionMap.Insert(this.
Type(), overrideData);
9256
9257 }
9258
9260
9262
9263
9265 {
9268
9271
9272 string config_to_search = "CfgVehicles";
9273 string muzzle_owner_config;
9274
9276 {
9277 if (IsInherited(Weapon))
9278 config_to_search = "CfgWeapons";
9279
9280 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9281
9282 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9283
9285
9286 if (config_OnFire_subclass_count > 0)
9287 {
9288 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9289
9290 for (int i = 0; i < config_OnFire_subclass_count; i++)
9291 {
9292 string particle_class = "";
9294 string config_OnFire_entry = config_OnFire_class + particle_class;
9295 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9296 WPOF_array.Insert(WPOF);
9297 }
9298
9299
9301 }
9302 }
9303
9305 {
9306 config_to_search = "CfgWeapons";
9307 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9308
9309 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9310
9312
9313 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9314 {
9315 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9316
9317 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9318 {
9319 string particle_class2 = "";
9321 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9322 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9323 WPOBE_array.Insert(WPOBE);
9324 }
9325
9326
9328 }
9329 }
9330 }
9331
9332
9334 {
9337
9339 {
9340 string config_to_search = "CfgVehicles";
9341
9342 if (IsInherited(Weapon))
9343 config_to_search = "CfgWeapons";
9344
9345 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9346 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9347
9348 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9349 {
9350
9352
9354 {
9356 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9358 return;
9359 }
9360
9363
9364
9365
9367 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9368
9369 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9370 {
9371 string particle_class = "";
9373 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9375
9376 if (entry_type == CT_CLASS)
9377 {
9378 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9379 WPOOH_array.Insert(WPOF);
9380 }
9381 }
9382
9383
9385 }
9386 }
9387 }
9388
9390 {
9392 }
9393
9395 {
9397 {
9399
9402
9405
9406 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9407 }
9408 }
9409
9411 {
9413 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9414
9416 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9417
9419 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9420
9422 {
9424 }
9425 }
9426
9428 {
9430 }
9431
9433 {
9436 else
9438
9440 {
9443 }
9444 else
9445 {
9448
9451 }
9452
9454 }
9455
9457 {
9459 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9460 }
9461
9463 {
9465 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9467 }
9468
9470 {
9472 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9473 }
9474
9476 {
9479
9480 OverheatingParticle OP = new OverheatingParticle();
9485
9487 }
9488
9490 {
9493
9494 return -1;
9495 }
9496
9498 {
9500 {
9503
9504 for (int i = count; i > 0; --i)
9505 {
9506 int id = i - 1;
9509
9512
9513 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9514 {
9515 if (p)
9516 {
9519 }
9520 }
9521 }
9522 }
9523 }
9524
9526 {
9528 {
9530 {
9531 int id = i - 1;
9533
9534 if (OP)
9535 {
9537
9538 if (p)
9539 {
9541 }
9542
9543 delete OP;
9544 }
9545 }
9546
9549 }
9550 }
9551
9554 {
9555 return 0.0;
9556 }
9557
9558
9560 {
9561 return 250;
9562 }
9563
9565 {
9566 return 0;
9567 }
9568
9571 {
9573 return true;
9574
9575 return false;
9576 }
9577
9580 {
9583
9585 {
9587 }
9588 else
9589 {
9590
9592 }
9593
9595 }
9596
9603 {
9604 return -1;
9605 }
9606
9607
9608
9609
9611 {
9613 {
9615 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9616
9617 if (r_index >= 0)
9618 {
9619 InventoryLocation r_il = new InventoryLocation;
9620 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9621
9622 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9625 {
9626 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9627 }
9629 {
9630 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9631 }
9632
9633 }
9634
9635 player.GetHumanInventory().ClearUserReservedLocation(this);
9636 }
9637
9640 }
9641
9642
9643
9644
9646 {
9647 return ItemBase.m_DebugActionsMask;
9648 }
9649
9651 {
9652 return ItemBase.m_DebugActionsMask & mask;
9653 }
9654
9656 {
9657 ItemBase.m_DebugActionsMask = mask;
9658 }
9659
9661 {
9662 ItemBase.m_DebugActionsMask |= mask;
9663 }
9664
9666 {
9667 ItemBase.m_DebugActionsMask &= ~mask;
9668 }
9669
9671 {
9673 {
9675 }
9676 else
9677 {
9679 }
9680 }
9681
9682
9684 {
9685 if (GetEconomyProfile())
9686 {
9687 float q_max = GetEconomyProfile().GetQuantityMax();
9688 if (q_max > 0)
9689 {
9690 float q_min = GetEconomyProfile().GetQuantityMin();
9691 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9692
9694 {
9695 ComponentEnergyManager comp = GetCompEM();
9697 {
9699 }
9700 }
9702 {
9704
9705 }
9706
9707 }
9708 }
9709 }
9710
9713 {
9714 EntityAI parent = GetHierarchyParent();
9715
9716 if (parent)
9717 {
9718 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9719 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9720 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9721 }
9722 }
9723
9726 {
9727 EntityAI parent = GetHierarchyParent();
9728
9729 if (parent)
9730 {
9731 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9732 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9733 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9734 }
9735 }
9736
9738 {
9739
9740
9741
9742
9744
9746 {
9747 if (ScriptInputUserData.CanStoreInputUserData())
9748 {
9749 ScriptInputUserData ctx = new ScriptInputUserData;
9755 ctx.
Write(use_stack_max);
9758
9760 {
9761 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9762 }
9763 }
9764 }
9765 else if (!
GetGame().IsMultiplayer())
9766 {
9768 }
9769 }
9770
9772 {
9774 }
9775
9777 {
9779 }
9780
9782 {
9784 }
9785
9787 {
9788
9789 return false;
9790 }
9791
9793 {
9794 return false;
9795 }
9796
9800 {
9801 return false;
9802 }
9803
9805 {
9806 return "";
9807 }
9808
9810
9812 {
9813 return false;
9814 }
9815
9817 {
9818 return true;
9819 }
9820
9821
9822
9824 {
9825 return true;
9826 }
9827
9829 {
9830 return true;
9831 }
9832
9834 {
9835 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9837 }
9838
9840 {
9842 }
9843
9845 {
9847 if (!is_being_placed)
9849 SetSynchDirty();
9850 }
9851
9852
9854
9856 {
9858 }
9859
9861 {
9863 }
9864
9866 {
9867 return 1;
9868 }
9869
9871 {
9872 return false;
9873 }
9874
9876 {
9878 SetSynchDirty();
9879 }
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9916 {
9917 super.OnMovedInsideCargo(container);
9918
9919 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9920 }
9921
9922 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9923 {
9924 super.EEItemLocationChanged(oldLoc,newLoc);
9925
9926 PlayerBase new_player = null;
9927 PlayerBase old_player = null;
9928
9929 if (newLoc.GetParent())
9930 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9931
9932 if (oldLoc.GetParent())
9933 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9934
9936 {
9937 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9938
9939 if (r_index >= 0)
9940 {
9941 InventoryLocation r_il = new InventoryLocation;
9942 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9943
9944 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9947 {
9948 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9949 }
9951 {
9952 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9953 }
9954
9955 }
9956 }
9957
9959 {
9960 if (new_player)
9961 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9962
9963 if (new_player == old_player)
9964 {
9965
9966 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9967 {
9969 {
9970 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9971 {
9972 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9973 }
9974 }
9975 else
9976 {
9977 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9978 }
9979 }
9980
9981 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9982 {
9983 int type = oldLoc.GetType();
9985 {
9986 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9987 }
9989 {
9990 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9991 }
9992 }
9993 if (!m_OldLocation)
9994 {
9995 m_OldLocation = new InventoryLocation;
9996 }
9997 m_OldLocation.Copy(oldLoc);
9998 }
9999 else
10000 {
10001 if (m_OldLocation)
10002 {
10003 m_OldLocation.Reset();
10004 }
10005 }
10006
10008 }
10009 else
10010 {
10011 if (new_player)
10012 {
10013 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10014 if (res_index >= 0)
10015 {
10016 InventoryLocation il = new InventoryLocation;
10017 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10019 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10022 {
10023 il.
GetParent().GetOnReleaseLock().Invoke(it);
10024 }
10026 {
10028 }
10029
10030 }
10031 }
10033 {
10034
10036 }
10037
10038 if (m_OldLocation)
10039 {
10040 m_OldLocation.Reset();
10041 }
10042 }
10043 }
10044
10045 override void EOnContact(IEntity other, Contact extra)
10046 {
10048 {
10049 int liquidType = -1;
10051 if (impactSpeed > 0.0)
10052 {
10054 #ifndef SERVER
10056 #else
10058 SetSynchDirty();
10059 #endif
10061 }
10062 }
10063
10064 #ifdef SERVER
10065 if (GetCompEM() && GetCompEM().IsPlugged())
10066 {
10067 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10068 GetCompEM().UnplugThis();
10069 }
10070 #endif
10071 }
10072
10074
10076 {
10078 }
10079
10081 {
10082
10083 }
10084
10086 {
10087 super.OnItemLocationChanged(old_owner, new_owner);
10088
10089 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10090 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10091
10092 if (!relatedPlayer && playerNew)
10093 relatedPlayer = playerNew;
10094
10095 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10096 {
10098 if (actionMgr)
10099 {
10100 ActionBase currentAction = actionMgr.GetRunningAction();
10101 if (currentAction)
10103 }
10104 }
10105
10106 Man ownerPlayerOld = null;
10107 Man ownerPlayerNew = null;
10108
10109 if (old_owner)
10110 {
10111 if (old_owner.
IsMan())
10112 {
10113 ownerPlayerOld = Man.Cast(old_owner);
10114 }
10115 else
10116 {
10117 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10118 }
10119 }
10120 else
10121 {
10123 {
10125
10126 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10127 {
10128 GetCompEM().UnplugThis();
10129 }
10130 }
10131 }
10132
10133 if (new_owner)
10134 {
10135 if (new_owner.
IsMan())
10136 {
10137 ownerPlayerNew = Man.Cast(new_owner);
10138 }
10139 else
10140 {
10141 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10142 }
10143 }
10144
10145 if (ownerPlayerOld != ownerPlayerNew)
10146 {
10147 if (ownerPlayerOld)
10148 {
10149 array<EntityAI> subItemsExit = new array<EntityAI>;
10151 for (int i = 0; i < subItemsExit.Count(); i++)
10152 {
10155 }
10156 }
10157
10158 if (ownerPlayerNew)
10159 {
10160 array<EntityAI> subItemsEnter = new array<EntityAI>;
10162 for (int j = 0; j < subItemsEnter.Count(); j++)
10163 {
10166 }
10167 }
10168 }
10169 else if (ownerPlayerNew != null)
10170 {
10171 PlayerBase nplayer;
10172 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10173 {
10174 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10176 for (int k = 0; k < subItemsUpdate.Count(); k++)
10177 {
10179 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10180 }
10181 }
10182 }
10183
10184 if (old_owner)
10185 old_owner.OnChildItemRemoved(this);
10186 if (new_owner)
10187 new_owner.OnChildItemReceived(this);
10188 }
10189
10190
10192 {
10193 super.EEDelete(parent);
10194 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10195 if (player)
10196 {
10198
10199 if (player.IsAlive())
10200 {
10201 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10202 if (r_index >= 0)
10203 {
10204 InventoryLocation r_il = new InventoryLocation;
10205 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10206
10207 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10210 {
10211 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10212 }
10214 {
10215 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10216 }
10217
10218 }
10219
10220 player.RemoveQuickBarEntityShortcut(this);
10221 }
10222 }
10223 }
10224
10226 {
10227 super.EEKilled(killer);
10228
10231 {
10232 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10233 {
10234 if (IsMagazine())
10235 {
10236 if (Magazine.Cast(this).GetAmmoCount() > 0)
10237 {
10239 }
10240 }
10241 else
10242 {
10244 }
10245 }
10246 }
10247 }
10248
10250 {
10251 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10252
10253 super.OnWasAttached(parent, slot_id);
10254
10257
10259 }
10260
10262 {
10263 super.OnWasDetached(parent, slot_id);
10264
10267 }
10268
10270 {
10271 int idx;
10274
10275 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10276 if (inventory_slots.Count() < 1)
10277 {
10278 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10279 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10280 }
10281 else
10282 {
10283 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10284 }
10285
10286 idx = inventory_slots.Find(slot);
10287 if (idx < 0)
10288 return "";
10289
10290 return attach_types.Get(idx);
10291 }
10292
10294 {
10295 int idx = -1;
10296 string slot;
10297
10300
10301 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10302 if (inventory_slots.Count() < 1)
10303 {
10304 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10305 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10306 }
10307 else
10308 {
10309 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10310 if (detach_types.Count() < 1)
10311 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10312 }
10313
10314 for (int i = 0; i < inventory_slots.Count(); i++)
10315 {
10316 slot = inventory_slots.Get(i);
10317 }
10318
10319 if (slot != "")
10320 {
10321 if (detach_types.Count() == 1)
10322 idx = 0;
10323 else
10324 idx = inventory_slots.Find(slot);
10325 }
10326 if (idx < 0)
10327 return "";
10328
10329 return detach_types.Get(idx);
10330 }
10331
10333 {
10334
10336
10337
10338 float min_time = 1;
10339 float max_time = 3;
10340 float delay = Math.RandomFloat(min_time, max_time);
10341
10342 explode_timer.Run(delay, this, "DoAmmoExplosion");
10343 }
10344
10346 {
10347 Magazine magazine = Magazine.Cast(this);
10348 int pop_sounds_count = 6;
10349 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10350
10351
10352 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10353 string sound_name = pop_sounds[ sound_idx ];
10355
10356
10357 magazine.ServerAddAmmoCount(-1);
10358
10359
10360 float min_temp_to_explode = 100;
10361
10362 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10363 {
10365 }
10366 }
10367
10368
10369 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10370 {
10371 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10372
10373 const int CHANCE_DAMAGE_CARGO = 4;
10374 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10375 const int CHANCE_DAMAGE_NOTHING = 2;
10376
10378 {
10379 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10380 int chances;
10381 int rnd;
10382
10383 if (GetInventory().GetCargo())
10384 {
10385 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10386 rnd = Math.RandomInt(0,chances);
10387
10388 if (rnd < CHANCE_DAMAGE_CARGO)
10389 {
10391 }
10392 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10393 {
10395 }
10396 }
10397 else
10398 {
10399 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10400 rnd = Math.RandomInt(0,chances);
10401
10402 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10403 {
10405 }
10406 }
10407 }
10408 }
10409
10411 {
10412 if (GetInventory().GetCargo())
10413 {
10414 int item_count = GetInventory().GetCargo().GetItemCount();
10415 if (item_count > 0)
10416 {
10417 int random_pick = Math.RandomInt(0, item_count);
10419 if (!item.IsExplosive())
10420 {
10421 item.AddHealth("","",damage);
10422 return true;
10423 }
10424 }
10425 }
10426 return false;
10427 }
10428
10430 {
10431 int attachment_count = GetInventory().AttachmentCount();
10432 if (attachment_count > 0)
10433 {
10434 int random_pick = Math.RandomInt(0, attachment_count);
10435 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10436 if (!attachment.IsExplosive())
10437 {
10438 attachment.AddHealth("","",damage);
10439 return true;
10440 }
10441 }
10442 return false;
10443 }
10444
10446 {
10448 }
10449
10451 {
10453 return GetInventory().CanRemoveEntity();
10454
10455 return false;
10456 }
10457
10459 {
10460
10462 return false;
10463
10464
10466 return false;
10467
10468
10469
10471 if (delta == 0)
10472 return false;
10473
10474
10475 return true;
10476 }
10477
10479 {
10481 {
10482 if (ScriptInputUserData.CanStoreInputUserData())
10483 {
10484 ScriptInputUserData ctx = new ScriptInputUserData;
10489 ctx.
Write(destination_entity);
10491 ctx.
Write(slot_id);
10493 }
10494 }
10495 else if (!
GetGame().IsMultiplayer())
10496 {
10498 }
10499 }
10500
10502 {
10503 float split_quantity_new;
10507 InventoryLocation loc = new InventoryLocation;
10508
10509 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10510 {
10512 split_quantity_new = stack_max;
10513 else
10515
10517 {
10518 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10519 if (new_item)
10520 {
10521 new_item.SetResultOfSplit(true);
10522 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10524 new_item.
SetQuantity(split_quantity_new,
false,
true);
10525 }
10526 }
10527 }
10528 else if (destination_entity && slot_id == -1)
10529 {
10530 if (quantity > stack_max)
10531 split_quantity_new = stack_max;
10532 else
10533 split_quantity_new = quantity;
10534
10536 {
10538 {
10541 }
10542
10543 if (new_item)
10544 {
10545 new_item.SetResultOfSplit(true);
10546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10548 new_item.
SetQuantity(split_quantity_new,
false,
true);
10549 }
10550 }
10551 }
10552 else
10553 {
10554 if (stack_max != 0)
10555 {
10557 {
10559 }
10560
10561 if (split_quantity_new == 0)
10562 {
10563 if (!
GetGame().IsMultiplayer())
10564 player.PhysicalPredictiveDropItem(this);
10565 else
10566 player.ServerDropEntity(this);
10567 return;
10568 }
10569
10571 {
10573
10574 if (new_item)
10575 {
10576 new_item.SetResultOfSplit(true);
10577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10580 new_item.PlaceOnSurface();
10581 }
10582 }
10583 }
10584 }
10585 }
10586
10588 {
10589 float split_quantity_new;
10593 InventoryLocation loc = new InventoryLocation;
10594
10595 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10596 {
10598 split_quantity_new = stack_max;
10599 else
10601
10603 {
10604 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10605 if (new_item)
10606 {
10607 new_item.SetResultOfSplit(true);
10608 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10610 new_item.
SetQuantity(split_quantity_new,
false,
true);
10611 }
10612 }
10613 }
10614 else if (destination_entity && slot_id == -1)
10615 {
10616 if (quantity > stack_max)
10617 split_quantity_new = stack_max;
10618 else
10619 split_quantity_new = quantity;
10620
10622 {
10624 {
10627 }
10628
10629 if (new_item)
10630 {
10631 new_item.SetResultOfSplit(true);
10632 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10634 new_item.
SetQuantity(split_quantity_new,
false,
true);
10635 }
10636 }
10637 }
10638 else
10639 {
10640 if (stack_max != 0)
10641 {
10643 {
10645 }
10646
10648 {
10650
10651 if (new_item)
10652 {
10653 new_item.SetResultOfSplit(true);
10654 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10657 new_item.PlaceOnSurface();
10658 }
10659 }
10660 }
10661 }
10662 }
10663
10665 {
10667 {
10668 if (ScriptInputUserData.CanStoreInputUserData())
10669 {
10670 ScriptInputUserData ctx = new ScriptInputUserData;
10675 dst.WriteToContext(ctx);
10677 }
10678 }
10679 else if (!
GetGame().IsMultiplayer())
10680 {
10682 }
10683 }
10684
10686 {
10688 {
10689 if (ScriptInputUserData.CanStoreInputUserData())
10690 {
10691 ScriptInputUserData ctx = new ScriptInputUserData;
10696 ctx.
Write(destination_entity);
10702 }
10703 }
10704 else if (!
GetGame().IsMultiplayer())
10705 {
10707 }
10708 }
10709
10711 {
10713 }
10714
10716 {
10718 float split_quantity_new;
10720 if (dst.IsValid())
10721 {
10722 int slot_id = dst.GetSlot();
10724
10725 if (quantity > stack_max)
10726 split_quantity_new = stack_max;
10727 else
10728 split_quantity_new = quantity;
10729
10731 {
10733
10734 if (new_item)
10735 {
10736 new_item.SetResultOfSplit(true);
10737 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10739 new_item.
SetQuantity(split_quantity_new,
false,
true);
10740 }
10741
10742 return new_item;
10743 }
10744 }
10745
10746 return null;
10747 }
10748
10750 {
10752 float split_quantity_new;
10754 if (destination_entity)
10755 {
10757 if (quantity > stackable)
10758 split_quantity_new = stackable;
10759 else
10760 split_quantity_new = quantity;
10761
10763 {
10764 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10765 if (new_item)
10766 {
10767 new_item.SetResultOfSplit(true);
10768 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10770 new_item.
SetQuantity(split_quantity_new,
false,
true);
10771 }
10772 }
10773 }
10774 }
10775
10777 {
10779 {
10780 if (ScriptInputUserData.CanStoreInputUserData())
10781 {
10782 ScriptInputUserData ctx = new ScriptInputUserData;
10787 ItemBase destination_entity =
this;
10788 ctx.
Write(destination_entity);
10792 }
10793 }
10794 else if (!
GetGame().IsMultiplayer())
10795 {
10797 }
10798 }
10799
10801 {
10803 float split_quantity_new;
10805 if (player)
10806 {
10808 if (quantity > stackable)
10809 split_quantity_new = stackable;
10810 else
10811 split_quantity_new = quantity;
10812
10814 {
10815 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10816 new_item =
ItemBase.Cast(in_hands);
10817 if (new_item)
10818 {
10819 new_item.SetResultOfSplit(true);
10820 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10822 new_item.SetQuantity(split_quantity_new, false, true);
10823 }
10824 }
10825 }
10826 }
10827
10829 {
10831 float split_quantity_new = Math.Floor(quantity * 0.5);
10832
10834 return;
10835
10837
10838 if (new_item)
10839 {
10840 if (new_item.GetQuantityMax() < split_quantity_new)
10841 {
10842 split_quantity_new = new_item.GetQuantityMax();
10843 }
10844
10845 new_item.SetResultOfSplit(true);
10846 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10847
10849 {
10852 }
10853 else
10854 {
10856 new_item.
SetQuantity(split_quantity_new,
false,
true);
10857 }
10858 }
10859 }
10860
10862 {
10864 float split_quantity_new = Math.Floor(quantity / 2);
10865
10867 return;
10868
10869 InventoryLocation invloc = new InventoryLocation;
10871
10873 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10874
10875 if (new_item)
10876 {
10877 if (new_item.GetQuantityMax() < split_quantity_new)
10878 {
10879 split_quantity_new = new_item.GetQuantityMax();
10880 }
10882 {
10885 }
10886 else if (split_quantity_new > 1)
10887 {
10889 new_item.
SetQuantity(split_quantity_new,
false,
true);
10890 }
10891 }
10892 }
10893
10896 {
10897 SetWeightDirty();
10899
10900 if (parent)
10901 parent.OnAttachmentQuantityChangedEx(this, delta);
10902
10904 {
10906 {
10908 }
10910 {
10911 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10913 }
10914 }
10915
10916 }
10917
10920 {
10921
10922 }
10923
10926 {
10928 }
10929
10931 {
10932 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10933
10935 {
10936 if (newLevel == GameConstants.STATE_RUINED)
10937 {
10939 EntityAI parent = GetHierarchyParent();
10940 if (parent && parent.IsFireplace())
10941 {
10942 CargoBase cargo = GetInventory().GetCargo();
10943 if (cargo)
10944 {
10946 {
10948 }
10949 }
10950 }
10951 }
10952
10954 {
10955
10957 return;
10958 }
10959
10960 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10961 {
10963 }
10964 }
10965 }
10966
10967
10969 {
10970 super.OnRightClick();
10971
10973 {
10975 {
10976 if (ScriptInputUserData.CanStoreInputUserData())
10977 {
10978 EntityAI root = GetHierarchyRoot();
10979 Man playerOwner = GetHierarchyRootPlayer();
10980 InventoryLocation dst = new InventoryLocation;
10981
10982
10983 if (!playerOwner && root && root == this)
10984 {
10986 }
10987 else
10988 {
10989
10990 GetInventory().GetCurrentInventoryLocation(dst);
10992 {
10995 {
10997 }
10998 else
10999 {
11001
11002
11003 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11004 {
11006 }
11007 else
11008 {
11009 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11010 }
11011 }
11012 }
11013 }
11014
11015 ScriptInputUserData ctx = new ScriptInputUserData;
11023 }
11024 }
11025 else if (!
GetGame().IsMultiplayer())
11026 {
11028 }
11029 }
11030 }
11031
11033 {
11034 if (root)
11035 {
11036 vector m4[4];
11037 root.GetTransform(m4);
11038 dst.SetGround(this, m4);
11039 }
11040 else
11041 {
11042 GetInventory().GetCurrentInventoryLocation(dst);
11043 }
11044 }
11045
11046 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11047 {
11048
11049 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11050 return false;
11051
11052 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11053 return false;
11054
11055
11057 return false;
11058
11059
11060 Magazine mag = Magazine.Cast(this);
11061 if (mag)
11062 {
11063 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11064 return false;
11065
11066 if (stack_max_limit)
11067 {
11068 Magazine other_mag = Magazine.Cast(other_item);
11069 if (other_item)
11070 {
11071 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11072 return false;
11073 }
11074
11075 }
11076 }
11077 else
11078 {
11079
11081 return false;
11082
11084 return false;
11085 }
11086
11087 PlayerBase player = null;
11088 if (CastTo(player, GetHierarchyRootPlayer()))
11089 {
11090 if (player.GetInventory().HasAttachment(this))
11091 return false;
11092
11093 if (player.IsItemsToDelete())
11094 return false;
11095 }
11096
11097 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11098 return false;
11099
11100 int slotID;
11102 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11103 return false;
11104
11105 return true;
11106 }
11107
11109 {
11111 }
11112
11114 {
11115 return m_IsResultOfSplit;
11116 }
11117
11119 {
11120 m_IsResultOfSplit = value;
11121 }
11122
11124 {
11126 }
11127
11129 {
11130 float other_item_quantity = other_item.GetQuantity();
11131 float this_free_space;
11132
11134
11136
11137 if (other_item_quantity > this_free_space)
11138 {
11139 return this_free_space;
11140 }
11141 else
11142 {
11143 return other_item_quantity;
11144 }
11145 }
11146
11148 {
11150 }
11151
11153 {
11155 return;
11156
11157 if (!IsMagazine() && other_item)
11158 {
11160 if (quantity_used != 0)
11161 {
11162 float hp1 = GetHealth01("","");
11163 float hp2 = other_item.GetHealth01("","");
11164 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11165 hpResult = hpResult / (
GetQuantity() + quantity_used);
11166
11167 hpResult *= GetMaxHealth();
11168 Math.Round(hpResult);
11169 SetHealth("", "Health", hpResult);
11170
11172 other_item.AddQuantity(-quantity_used);
11173 }
11174 }
11176 }
11177
11179 {
11180 #ifdef SERVER
11181 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11182 GetHierarchyParent().IncreaseLifetimeUp();
11183 #endif
11184 };
11185
11187 {
11188 PlayerBase p = PlayerBase.Cast(player);
11189
11190 array<int> recipesIds = p.m_Recipes;
11191 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11192 if (moduleRecipesManager)
11193 {
11194 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11195 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11196 }
11197
11198 for (int i = 0;i < recipesIds.Count(); i++)
11199 {
11200 int key = recipesIds.Get(i);
11201 string recipeName = moduleRecipesManager.GetRecipeName(key);
11203 }
11204 }
11205
11206
11207 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11208 {
11209 super.GetDebugActions(outputList);
11210
11211
11217
11218
11223
11228
11229
11233
11234
11236 {
11240 }
11241
11244
11245
11249
11251
11252 InventoryLocation loc = new InventoryLocation();
11253 GetInventory().GetCurrentInventoryLocation(loc);
11255 {
11256 if (Gizmo_IsSupported())
11259 }
11260
11262 }
11263
11264
11265
11266
11268 {
11269 super.OnAction(action_id, player, ctx);
11270
11272 {
11273 switch (action_id)
11274 {
11277 return true;
11280 return true;
11281 }
11282 }
11283
11285 {
11286 switch (action_id)
11287 {
11289 Delete();
11290 return true;
11291 }
11292 }
11293
11294 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11295 {
11296 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11297 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11298 PlayerBase p = PlayerBase.Cast(player);
11299 if (
EActions.RECIPES_RANGE_START < 1000)
11300 {
11301 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11302 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11303 }
11304 }
11305 #ifndef SERVER
11306 else if (action_id ==
EActions.WATCH_PLAYER)
11307 {
11308 PluginDeveloper.SetDeveloperItemClientEx(player);
11309 }
11310 #endif
11312 {
11313 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11314 {
11315 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11316 OnDebugButtonPressServer(id + 1);
11317 }
11318
11319 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11320 {
11321 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11323 }
11324
11325 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11326 {
11327 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11329 }
11330
11331 else if (action_id ==
EActions.ADD_QUANTITY)
11332 {
11333 if (IsMagazine())
11334 {
11335 Magazine mag = Magazine.Cast(this);
11336 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11337 }
11338 else
11339 {
11341 }
11342
11343 if (m_EM)
11344 {
11345 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11346 }
11347
11348 }
11349
11350 else if (action_id ==
EActions.REMOVE_QUANTITY)
11351 {
11352 if (IsMagazine())
11353 {
11354 Magazine mag2 = Magazine.Cast(this);
11355 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11356 }
11357 else
11358 {
11360 }
11361 if (m_EM)
11362 {
11363 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11364 }
11365
11366 }
11367
11368 else if (action_id ==
EActions.SET_QUANTITY_0)
11369 {
11371
11372 if (m_EM)
11373 {
11374 m_EM.SetEnergy(0);
11375 }
11376 }
11377
11378 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11379 {
11381
11382 if (m_EM)
11383 {
11384 m_EM.SetEnergy(m_EM.GetEnergyMax());
11385 }
11386 }
11387
11388 else if (action_id ==
EActions.ADD_HEALTH)
11389 {
11390 AddHealth("","",GetMaxHealth("","Health")/5);
11391 }
11392 else if (action_id ==
EActions.REMOVE_HEALTH)
11393 {
11394 AddHealth("","",-GetMaxHealth("","Health")/5);
11395 }
11396 else if (action_id ==
EActions.DESTROY_HEALTH)
11397 {
11398 SetHealth01("","",0);
11399 }
11400 else if (action_id ==
EActions.WATCH_ITEM)
11401 {
11403 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11404 #ifdef DEVELOPER
11405 SetDebugDeveloper_item(this);
11406 #endif
11407 }
11408
11409 else if (action_id ==
EActions.ADD_TEMPERATURE)
11410 {
11411 AddTemperature(20);
11412
11413 }
11414
11415 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11416 {
11417 AddTemperature(-20);
11418
11419 }
11420
11421 else if (action_id ==
EActions.FLIP_FROZEN)
11422 {
11423 SetFrozen(!GetIsFrozen());
11424
11425 }
11426
11427 else if (action_id ==
EActions.ADD_WETNESS)
11428 {
11430
11431 }
11432
11433 else if (action_id ==
EActions.REMOVE_WETNESS)
11434 {
11436
11437 }
11438
11439 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11440 {
11443
11444
11445 }
11446
11447 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11448 {
11451 }
11452
11453 else if (action_id ==
EActions.MAKE_SPECIAL)
11454 {
11455 auto debugParams = DebugSpawnParams.WithPlayer(player);
11456 OnDebugSpawnEx(debugParams);
11457 }
11458
11459 }
11460
11461
11462 return false;
11463 }
11464
11465
11466
11467
11471
11474
11475
11476
11478 {
11479 return false;
11480 }
11481
11482
11484 {
11485 return true;
11486 }
11487
11488
11490 {
11491 return true;
11492 }
11493
11494
11495
11497 {
11498 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11500 }
11501
11504 {
11505 return null;
11506 }
11507
11509 {
11510 return false;
11511 }
11512
11514 {
11515 return false;
11516 }
11517
11521
11522
11524 {
11525 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11526 return module_repairing.CanRepair(this, item_repair_kit);
11527 }
11528
11529
11530 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11531 {
11532 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11533 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11534 }
11535
11536
11538 {
11539
11540
11541
11542
11543
11544
11545
11546
11547 return 1;
11548 }
11549
11550
11551
11553 {
11555 }
11556
11557
11558
11560 {
11562 }
11563
11564
11573 {
11574 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11575
11576 if (player)
11577 {
11578 player.MessageStatus(text);
11579 }
11580 }
11581
11582
11591 {
11592 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11593
11594 if (player)
11595 {
11596 player.MessageAction(text);
11597 }
11598 }
11599
11600
11609 {
11610 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11611
11612 if (player)
11613 {
11614 player.MessageFriendly(text);
11615 }
11616 }
11617
11618
11627 {
11628 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11629
11630 if (player)
11631 {
11632 player.MessageImportant(text);
11633 }
11634 }
11635
11637 {
11638 return true;
11639 }
11640
11641
11642 override bool KindOf(
string tag)
11643 {
11644 bool found = false;
11645 string item_name = this.
GetType();
11648
11649 int array_size = item_tag_array.Count();
11650 for (int i = 0; i < array_size; i++)
11651 {
11652 if (item_tag_array.Get(i) == tag)
11653 {
11654 found = true;
11655 break;
11656 }
11657 }
11658 return found;
11659 }
11660
11661
11663 {
11664
11665 super.OnRPC(sender, rpc_type,ctx);
11666
11667
11668 switch (rpc_type)
11669 {
11670 #ifndef SERVER
11671 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11672 Param2<bool, string> p = new Param2<bool, string>(false, "");
11673
11675 return;
11676
11677 bool play = p.param1;
11678 string soundSet = p.param2;
11679
11680 if (play)
11681 {
11683 {
11685 {
11687 }
11688 }
11689 else
11690 {
11692 }
11693 }
11694 else
11695 {
11697 }
11698
11699 break;
11700 #endif
11701
11702 }
11703
11705 {
11707 }
11708 }
11709
11710
11711
11712
11714 {
11715 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11716 return plugin.GetID(
name);
11717 }
11718
11720 {
11721 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11722 return plugin.GetName(id);
11723 }
11724
11727 {
11728
11729
11730 int varFlags;
11731 if (!ctx.
Read(varFlags))
11732 return;
11733
11734 if (varFlags & ItemVariableFlags.FLOAT)
11735 {
11737 }
11738 }
11739
11741 {
11742
11743 super.SerializeNumericalVars(floats_out);
11744
11745
11746
11748 {
11750 }
11751
11753 {
11755 }
11756
11758 {
11760 }
11761
11763 {
11768 }
11769
11771 {
11773 }
11774 }
11775
11777 {
11778
11779 super.DeSerializeNumericalVars(floats);
11780
11781
11782 int index = 0;
11783 int mask = Math.Round(floats.Get(index));
11784
11785 index++;
11786
11788 {
11790 {
11792 }
11793 else
11794 {
11795 float quantity = floats.Get(index);
11796 SetQuantity(quantity,
true,
false,
false,
false);
11797 }
11798 index++;
11799 }
11800
11802 {
11803 float wet = floats.Get(index);
11805 index++;
11806 }
11807
11809 {
11810 int liquidtype = Math.Round(floats.Get(index));
11812 index++;
11813 }
11814
11816 {
11818 index++;
11820 index++;
11822 index++;
11824 index++;
11825 }
11826
11828 {
11829 int cleanness = Math.Round(floats.Get(index));
11831 index++;
11832 }
11833 }
11834
11836 {
11837 super.WriteVarsToCTX(ctx);
11838
11839
11841 {
11843 }
11844
11846 {
11848 }
11849
11851 {
11853 }
11854
11856 {
11857 int r,g,b,a;
11863 }
11864
11866 {
11868 }
11869 }
11870
11872 {
11873 if (!super.ReadVarsFromCTX(ctx,version))
11874 return false;
11875
11876 int intValue;
11877 float value;
11878
11879 if (version < 140)
11880 {
11881 if (!ctx.
Read(intValue))
11882 return false;
11883
11884 m_VariablesMask = intValue;
11885 }
11886
11888 {
11889 if (!ctx.
Read(value))
11890 return false;
11891
11893 {
11895 }
11896 else
11897 {
11899 }
11900 }
11901
11902 if (version < 140)
11903 {
11905 {
11906 if (!ctx.
Read(value))
11907 return false;
11908 SetTemperatureDirect(value);
11909 }
11910 }
11911
11913 {
11914 if (!ctx.
Read(value))
11915 return false;
11917 }
11918
11920 {
11921 if (!ctx.
Read(intValue))
11922 return false;
11924 }
11925
11927 {
11928 int r,g,b,a;
11930 return false;
11932 return false;
11934 return false;
11936 return false;
11937
11939 }
11940
11942 {
11943 if (!ctx.
Read(intValue))
11944 return false;
11946 }
11947
11948 if (version >= 138 && version < 140)
11949 {
11951 {
11952 if (!ctx.
Read(intValue))
11953 return false;
11954 SetFrozen(intValue);
11955 }
11956 }
11957
11958 return true;
11959 }
11960
11961
11963 {
11966 {
11968 }
11969
11970 if (!super.OnStoreLoad(ctx, version))
11971 {
11973 return false;
11974 }
11975
11976 if (version >= 114)
11977 {
11978 bool hasQuickBarIndexSaved;
11979
11980 if (!ctx.
Read(hasQuickBarIndexSaved))
11981 {
11983 return false;
11984 }
11985
11986 if (hasQuickBarIndexSaved)
11987 {
11988 int itmQBIndex;
11989
11990
11991 if (!ctx.
Read(itmQBIndex))
11992 {
11994 return false;
11995 }
11996
11997 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11998 if (itmQBIndex != -1 && parentPlayer)
11999 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12000 }
12001 }
12002 else
12003 {
12004
12005 PlayerBase player;
12006 int itemQBIndex;
12007 if (version ==
int.
MAX)
12008 {
12009 if (!ctx.
Read(itemQBIndex))
12010 {
12012 return false;
12013 }
12014 }
12015 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12016 {
12017
12018 if (!ctx.
Read(itemQBIndex))
12019 {
12021 return false;
12022 }
12023 if (itemQBIndex != -1 && player)
12024 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12025 }
12026 }
12027
12028 if (version < 140)
12029 {
12030
12031 if (!LoadVariables(ctx, version))
12032 {
12034 return false;
12035 }
12036 }
12037
12038
12040 {
12042 return false;
12043 }
12044 if (version >= 132)
12045 {
12047 if (raib)
12048 {
12050 {
12052 return false;
12053 }
12054 }
12055 }
12056
12058 return true;
12059 }
12060
12061
12062
12064 {
12065 super.OnStoreSave(ctx);
12066
12067 PlayerBase player;
12068 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12069 {
12071
12072 int itemQBIndex = -1;
12073 itemQBIndex = player.FindQuickBarEntityIndex(this);
12074 ctx.
Write(itemQBIndex);
12075 }
12076 else
12077 {
12079 }
12080
12082
12084 if (raib)
12085 {
12087 }
12088 }
12089
12090
12092 {
12093 super.AfterStoreLoad();
12094
12096 {
12098 }
12099
12101 {
12104 }
12105 }
12106
12108 {
12109 super.EEOnAfterLoad();
12110
12112 {
12114 }
12115
12118 }
12119
12121 {
12122 return false;
12123 }
12124
12125
12126
12128 {
12130 {
12131 #ifdef PLATFORM_CONSOLE
12132
12134 {
12136 if (menu)
12137 {
12139 }
12140 }
12141 #endif
12142 }
12143
12145 {
12148 }
12149
12151 {
12152 SetWeightDirty();
12154 }
12156 {
12159 }
12160
12162 {
12165 }
12167 {
12170 }
12171
12172 super.OnVariablesSynchronized();
12173 }
12174
12175
12176
12178 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12179 {
12180 if (!IsServerCheck(allow_client))
12181 return false;
12182
12184 return false;
12185
12188
12189 if (value <= (min + 0.001))
12190 value = min;
12191
12192 if (value == min)
12193 {
12194 if (destroy_config)
12195 {
12196 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12197 if (dstr)
12198 {
12200 this.Delete();
12201 return true;
12202 }
12203 }
12204 else if (destroy_forced)
12205 {
12207 this.Delete();
12208 return true;
12209 }
12210
12212 }
12213
12216
12218 {
12220
12221 if (delta)
12223 }
12224
12226
12227 return false;
12228 }
12229
12230
12232 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12233 {
12235 }
12236
12238 {
12241 }
12242
12244 {
12247 }
12248
12250 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12251 {
12252 float value_clamped = Math.Clamp(value, 0, 1);
12254 SetQuantity(result, destroy_config, destroy_forced);
12255 }
12256
12257
12260 {
12262 }
12263
12265 {
12267 }
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12279 {
12280 int slot = -1;
12281 if (GetInventory())
12282 {
12283 InventoryLocation il = new InventoryLocation;
12284 GetInventory().GetCurrentInventoryLocation(il);
12286 }
12287
12289 }
12290
12292 {
12293 float quantity_max = 0;
12294
12296 {
12297 if (attSlotID != -1)
12298 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12299
12300 if (quantity_max <= 0)
12302 }
12303
12304 if (quantity_max <= 0)
12306
12307 return quantity_max;
12308 }
12309
12311 {
12313 }
12314
12316 {
12318 }
12319
12320
12322 {
12324 }
12325
12327 {
12329 }
12330
12332 {
12334 }
12335
12336
12338 {
12339
12340 float weightEx = GetWeightEx();
12341 float special = GetInventoryAndCargoWeight();
12342 return weightEx - special;
12343 }
12344
12345
12347 {
12349 }
12350
12352 {
12354 {
12355 #ifdef DEVELOPER
12356 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12357 {
12358 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12360 }
12361 #endif
12362
12363 return GetQuantity() * GetConfigWeightModified();
12364 }
12365 else if (HasEnergyManager())
12366 {
12367 #ifdef DEVELOPER
12368 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12369 {
12370 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12371 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12372 }
12373 #endif
12374 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12375 }
12376 else
12377 {
12378 #ifdef DEVELOPER
12379 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12380 {
12381 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12382 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12383 }
12384 #endif
12385 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12386 }
12387 }
12388
12391 {
12392 int item_count = 0;
12394
12395 if (GetInventory().GetCargo() != NULL)
12396 {
12397 item_count = GetInventory().GetCargo().GetItemCount();
12398 }
12399
12400 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12401 {
12402 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12403 if (item)
12404 item_count += item.GetNumberOfItems();
12405 }
12406 return item_count;
12407 }
12408
12411 {
12412 float weight = 0;
12413 float wetness = 1;
12414 if (include_wetness)
12417 {
12418 weight = wetness * m_ConfigWeight;
12419 }
12421 {
12422 weight = 1;
12423 }
12424 return weight;
12425 }
12426
12427
12428
12430 {
12431 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12432 {
12433 GameInventory inv = GetInventory();
12434 array<EntityAI> items = new array<EntityAI>;
12436 for (int i = 0; i < items.Count(); i++)
12437 {
12439 if (item)
12440 {
12442 }
12443 }
12444 }
12445 }
12446
12447
12448
12449
12451 {
12452 float energy = 0;
12453 if (HasEnergyManager())
12454 {
12455 energy = GetCompEM().GetEnergy();
12456 }
12457 return energy;
12458 }
12459
12460
12462 {
12463 super.OnEnergyConsumed();
12464
12466 }
12467
12469 {
12470 super.OnEnergyAdded();
12471
12473 }
12474
12475
12477 {
12478 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12479 {
12481 {
12482 float energy_0to1 = GetCompEM().GetEnergy0To1();
12484 }
12485 }
12486 }
12487
12488
12490 {
12491 return ConfigGetFloat("heatIsolation");
12492 }
12493
12495 {
12497 }
12498
12500 {
12501 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12502 if (
GetGame().ConfigIsExisting(paramPath))
12504
12505 return 0.0;
12506 }
12507
12509 {
12510 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12511 if (
GetGame().ConfigIsExisting(paramPath))
12513
12514 return 0.0;
12515 }
12516
12517 override void SetWet(
float value,
bool allow_client =
false)
12518 {
12519 if (!IsServerCheck(allow_client))
12520 return;
12521
12524
12526
12527 m_VarWet = Math.Clamp(value, min, max);
12528
12530 {
12533 }
12534 }
12535
12536 override void AddWet(
float value)
12537 {
12539 }
12540
12542 {
12544 }
12545
12547 {
12549 }
12550
12552 {
12554 }
12555
12557 {
12559 }
12560
12562 {
12564 }
12565
12566 override void OnWetChanged(
float newVal,
float oldVal)
12567 {
12570 if (newLevel != oldLevel)
12571 {
12573 }
12574 }
12575
12577 {
12578 SetWeightDirty();
12579 }
12580
12582 {
12583 return GetWetLevelInternal(
m_VarWet);
12584 }
12585
12586
12587
12589 {
12591 }
12592
12594 {
12596 }
12597
12599 {
12601 }
12602
12604 {
12606 }
12607
12608
12609
12611 {
12612 if (ConfigIsExisting("itemModelLength"))
12613 {
12614 return ConfigGetFloat("itemModelLength");
12615 }
12616 return 0;
12617 }
12618
12620 {
12621 if (ConfigIsExisting("itemAttachOffset"))
12622 {
12623 return ConfigGetFloat("itemAttachOffset");
12624 }
12625 return 0;
12626 }
12627
12628 override void SetCleanness(
int value,
bool allow_client =
false)
12629 {
12630 if (!IsServerCheck(allow_client))
12631 return;
12632
12634
12636
12639 }
12640
12642 {
12644 }
12645
12647 {
12648 return true;
12649 }
12650
12651
12652
12653
12655 {
12657 }
12658
12660 {
12662 }
12663
12664
12665
12666
12667 override void SetColor(
int r,
int g,
int b,
int a)
12668 {
12674 }
12676 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12677 {
12682 }
12683
12685 {
12687 }
12688
12691 {
12692 int r,g,b,a;
12694 r = r/255;
12695 g = g/255;
12696 b = b/255;
12697 a = a/255;
12698 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12699 }
12700
12701
12702
12703 override void SetLiquidType(
int value,
bool allow_client =
false)
12704 {
12705 if (!IsServerCheck(allow_client))
12706 return;
12707
12712 }
12713
12715 {
12716 return ConfigGetInt("varLiquidTypeInit");
12717 }
12718
12720 {
12722 }
12723
12725 {
12727 SetFrozen(false);
12728 }
12729
12732 {
12733 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12734 }
12735
12736
12739 {
12740 PlayerBase nplayer;
12741 if (PlayerBase.CastTo(nplayer, player))
12742 {
12744
12745 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12746 }
12747 }
12748
12749
12752 {
12753 PlayerBase nplayer;
12754 if (PlayerBase.CastTo(nplayer,player))
12755 {
12756
12757 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12758
12759 }
12760
12761
12762 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12763
12764
12765 if (HasEnergyManager())
12766 {
12767 GetCompEM().UpdatePlugState();
12768 }
12769 }
12770
12771
12773 {
12774 super.OnPlacementStarted(player);
12775
12777 }
12778
12779 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12780 {
12782 {
12783 m_AdminLog.OnPlacementComplete(player,
this);
12784 }
12785
12786 super.OnPlacementComplete(player, position, orientation);
12787 }
12788
12789
12790
12791
12792
12794 {
12796 {
12797 return true;
12798 }
12799 else
12800 {
12801 return false;
12802 }
12803 }
12804
12805
12807 {
12809 {
12811 }
12812 }
12813
12814
12816 {
12818 }
12819
12821 {
12823 }
12824
12825 override void InsertAgent(
int agent,
float count = 1)
12826 {
12827 if (count < 1)
12828 return;
12829
12831 }
12832
12835 {
12837 }
12838
12839
12841 {
12843 }
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12887 {
12889 return false;
12890 return true;
12891 }
12892
12894 {
12895
12897 }
12898
12899
12902 {
12903 super.CheckForRoofLimited(timeTresholdMS);
12904
12906 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12907 {
12908 m_PreviousRoofTestTime = time;
12909 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12910 }
12911 }
12912
12913
12915 {
12917 {
12918 return 0;
12919 }
12920
12921 if (GetInventory().GetAttachmentSlotsCount() != 0)
12922 {
12923 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12924 if (filter)
12925 return filter.GetProtectionLevel(type, false, system);
12926 else
12927 return 0;
12928 }
12929
12930 string subclassPath, entryName;
12931
12932 switch (type)
12933 {
12935 entryName = "biological";
12936 break;
12938 entryName = "chemical";
12939 break;
12940 default:
12941 entryName = "biological";
12942 break;
12943 }
12944
12945 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12946
12948 }
12949
12950
12951
12954 {
12955 if (!IsMagazine())
12957
12959 }
12960
12961
12962
12963
12964
12969 {
12970 return true;
12971 }
12972
12974 {
12976 }
12977
12978
12979
12980
12981
12983 {
12984 if (parent)
12985 {
12986 if (parent.IsInherited(DayZInfected))
12987 return true;
12988
12989 if (!parent.IsRuined())
12990 return true;
12991 }
12992
12993 return true;
12994 }
12995
12997 {
12998 if (!super.CanPutAsAttachment(parent))
12999 {
13000 return false;
13001 }
13002
13003 if (!IsRuined() && !parent.IsRuined())
13004 {
13005 return true;
13006 }
13007
13008 return false;
13009 }
13010
13012 {
13013
13014
13015
13016
13017 return super.CanReceiveItemIntoCargo(item);
13018 }
13019
13021 {
13022
13023
13024
13025
13026 GameInventory attachmentInv = attachment.GetInventory();
13028 {
13029 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13030 return false;
13031 }
13032
13033 InventoryLocation loc = new InventoryLocation();
13034 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13035 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13036 return false;
13037
13038 return super.CanReceiveAttachment(attachment, slotId);
13039 }
13040
13042 {
13043 if (!super.CanReleaseAttachment(attachment))
13044 return false;
13045
13046 return GetInventory().AreChildrenAccessible();
13047 }
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13070 {
13071 int id = muzzle_owner.GetMuzzleID();
13072 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13073
13074 if (WPOF_array)
13075 {
13076 for (int i = 0; i < WPOF_array.Count(); i++)
13077 {
13078 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13079
13080 if (WPOF)
13081 {
13082 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13083 }
13084 }
13085 }
13086 }
13087
13088
13090 {
13091 int id = muzzle_owner.GetMuzzleID();
13093
13094 if (WPOBE_array)
13095 {
13096 for (int i = 0; i < WPOBE_array.Count(); i++)
13097 {
13098 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13099
13100 if (WPOBE)
13101 {
13102 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13103 }
13104 }
13105 }
13106 }
13107
13108
13110 {
13111 int id = muzzle_owner.GetMuzzleID();
13112 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13113
13114 if (WPOOH_array)
13115 {
13116 for (int i = 0; i < WPOOH_array.Count(); i++)
13117 {
13118 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13119
13120 if (WPOOH)
13121 {
13122 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13123 }
13124 }
13125 }
13126 }
13127
13128
13130 {
13131 int id = muzzle_owner.GetMuzzleID();
13132 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13133
13134 if (WPOOH_array)
13135 {
13136 for (int i = 0; i < WPOOH_array.Count(); i++)
13137 {
13138 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13139
13140 if (WPOOH)
13141 {
13142 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13143 }
13144 }
13145 }
13146 }
13147
13148
13150 {
13151 int id = muzzle_owner.GetMuzzleID();
13152 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13153
13154 if (WPOOH_array)
13155 {
13156 for (int i = 0; i < WPOOH_array.Count(); i++)
13157 {
13158 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13159
13160 if (WPOOH)
13161 {
13162 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13163 }
13164 }
13165 }
13166 }
13167
13168
13169
13171 {
13173 {
13174 return true;
13175 }
13176
13177 return false;
13178 }
13179
13181 {
13183 {
13184 return true;
13185 }
13186
13187 return false;
13188 }
13189
13191 {
13193 {
13194 return true;
13195 }
13196
13197 return false;
13198 }
13199
13201 {
13202 return false;
13203 }
13204
13207 {
13208 return UATimeSpent.DEFAULT_DEPLOY;
13209 }
13210
13211
13212
13213
13215 {
13217 SetSynchDirty();
13218 }
13219
13221 {
13223 }
13224
13225
13227 {
13228 return false;
13229 }
13230
13233 {
13234 string att_type = "None";
13235
13236 if (ConfigIsExisting("soundAttType"))
13237 {
13238 att_type = ConfigGetString("soundAttType");
13239 }
13240
13242 }
13243
13245 {
13247 }
13248
13249
13250
13251
13252
13258
13260 {
13263
13265 }
13266
13267
13269 {
13271 return;
13272
13274
13277
13280
13281 SoundParameters params = new SoundParameters();
13285 }
13286
13287
13289 {
13291 return;
13292
13294 SetSynchDirty();
13295
13298 }
13299
13300
13302 {
13304 return;
13305
13307 SetSynchDirty();
13308
13311 }
13312
13314 {
13316 }
13317
13319 {
13321 }
13322
13325 {
13326 if (!
GetGame().IsDedicatedServer())
13327 {
13328 if (ConfigIsExisting("attachSoundSet"))
13329 {
13330 string cfg_path = "";
13331 string soundset = "";
13332 string type_name =
GetType();
13333
13336 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13337 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13338
13339 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13340 {
13341 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13342 {
13343 if (cfg_slot_array[i] == slot_type)
13344 {
13345 soundset = cfg_soundset_array[i];
13346 break;
13347 }
13348 }
13349 }
13350
13351 if (soundset != "")
13352 {
13353 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13355 }
13356 }
13357 }
13358 }
13359
13361 {
13362
13363 }
13364
13365 void OnApply(PlayerBase player);
13366
13368 {
13369 return 1.0;
13370 };
13371
13373 {
13375 }
13376
13378 {
13380 }
13381
13383
13385 {
13386 SetDynamicPhysicsLifeTime(0.01);
13388 }
13389
13391 {
13392 array<string> zone_names = new array<string>;
13393 GetDamageZones(zone_names);
13394 for (int i = 0; i < zone_names.Count(); i++)
13395 {
13396 SetHealthMax(zone_names.Get(i),"Health");
13397 }
13398 SetHealthMax("","Health");
13399 }
13400
13403 {
13404 float global_health = GetHealth01("","Health");
13405 array<string> zones = new array<string>;
13406 GetDamageZones(zones);
13407
13408 for (int i = 0; i < zones.Count(); i++)
13409 {
13410 SetHealth01(zones.Get(i),"Health",global_health);
13411 }
13412 }
13413
13416 {
13417 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13418 }
13419
13421 {
13422 if (!hasRootAsPlayer)
13423 {
13424 if (refParentIB)
13425 {
13426
13427 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13428 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13429
13430 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13431 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13432
13435 }
13436 else
13437 {
13438
13441 }
13442 }
13443 }
13444
13446 {
13448 {
13449 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13450 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13451 {
13452 float heatPermCoef = 1.0;
13454 while (ent)
13455 {
13456 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13457 ent = ent.GetHierarchyParent();
13458 }
13459
13460 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13461 }
13462 }
13463 }
13464
13466 {
13467
13468 EntityAI parent = GetHierarchyParent();
13469 if (!parent)
13470 {
13471 hasParent = false;
13472 hasRootAsPlayer = false;
13473 }
13474 else
13475 {
13476 hasParent = true;
13477 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13478 refParentIB =
ItemBase.Cast(parent);
13479 }
13480 }
13481
13482 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13483 {
13484
13485 }
13486
13488 {
13489
13490 return false;
13491 }
13492
13494 {
13495
13496
13497 return false;
13498 }
13499
13501 {
13502
13503 return false;
13504 }
13505
13508 {
13509 return !GetIsFrozen() &&
IsOpen();
13510 }
13511
13513 {
13514 bool hasParent = false, hasRootAsPlayer = false;
13516
13517 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13518 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13519
13520 if (wwtu || foodDecay)
13521 {
13525
13526 if (processWetness || processTemperature || processDecay)
13527 {
13529
13530 if (processWetness)
13531 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13532
13533 if (processTemperature)
13535
13536 if (processDecay)
13537 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13538 }
13539 }
13540 }
13541
13544 {
13546 }
13547
13549 {
13552
13553 return super.GetTemperatureFreezeThreshold();
13554 }
13555
13557 {
13560
13561 return super.GetTemperatureThawThreshold();
13562 }
13563
13565 {
13568
13569 return super.GetItemOverheatThreshold();
13570 }
13571
13573 {
13575 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13576
13577 return super.GetTemperatureFreezeTime();
13578 }
13579
13581 {
13583 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13584
13585 return super.GetTemperatureThawTime();
13586 }
13587
13592
13594 {
13595 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13596 }
13597
13599 {
13600 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13601 }
13602
13605 {
13607 }
13608
13610 {
13612 }
13613
13615 {
13617 }
13618
13621 {
13622 return null;
13623 }
13624
13627 {
13628 return false;
13629 }
13630
13632 {
13634 {
13637 if (!trg)
13638 {
13640 explosive = this;
13641 }
13642
13643 explosive.PairRemote(trg);
13645
13646 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13647 trg.SetPersistentPairID(persistentID);
13648 explosive.SetPersistentPairID(persistentID);
13649
13650 return true;
13651 }
13652 return false;
13653 }
13654
13657 {
13658 float ret = 1.0;
13661 ret *= GetHealth01();
13662
13663 return ret;
13664 }
13665
13666 #ifdef DEVELOPER
13667 override void SetDebugItem()
13668 {
13669 super.SetDebugItem();
13670 _itemBase = this;
13671 }
13672
13674 {
13675 string text = super.GetDebugText();
13676
13678 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13679
13680 return text;
13681 }
13682 #endif
13683
13685 {
13686 return true;
13687 }
13688
13690
13692
13694 {
13697 }
13698
13699
13707
13723}
13724
13726{
13728 if (entity)
13729 {
13730 bool is_item = entity.IsInherited(
ItemBase);
13731 if (is_item && full_quantity)
13732 {
13735 }
13736 }
13737 else
13738 {
13740 return NULL;
13741 }
13742 return entity;
13743}
13744
13746{
13747 if (item)
13748 {
13749 if (health > 0)
13750 item.SetHealth("", "", health);
13751
13752 if (item.CanHaveTemperature())
13753 {
13755 if (item.CanFreeze())
13756 item.SetFrozen(false);
13757 }
13758
13759 if (item.HasEnergyManager())
13760 {
13761 if (quantity >= 0)
13762 {
13763 item.GetCompEM().SetEnergy0To1(quantity);
13764 }
13765 else
13766 {
13768 }
13769 }
13770 else if (item.IsMagazine())
13771 {
13772 Magazine mag = Magazine.Cast(item);
13773 if (quantity >= 0)
13774 {
13775 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13776 }
13777 else
13778 {
13780 }
13781
13782 }
13783 else
13784 {
13785 if (quantity >= 0)
13786 {
13787 item.SetQuantityNormalized(quantity, false);
13788 }
13789 else
13790 {
13792 }
13793
13794 }
13795 }
13796}
13797
13798#ifdef DEVELOPER
13800#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.