8927{
8929 {
8930 return true;
8931 }
8932};
8933
8934
8935
8937{
8941
8943
8946
8947
8948
8949
8950
8959
8965
8970
8975
8996 protected bool m_IsResultOfSplit
8997
8999
9004
9005
9006
9008
9012
9013
9014
9016
9019
9020
9021
9027
9028
9036
9039
9040
9042
9043
9045
9046
9051
9052
9057
9058
9060
9061
9063 {
9068
9069 if (!
GetGame().IsDedicatedServer())
9070 {
9072 {
9074
9076 {
9078 }
9079 }
9080
9083 }
9084
9085 m_OldLocation = null;
9086
9088 {
9090 }
9091
9092 if (ConfigIsExisting("headSelectionsToHide"))
9093 {
9096 }
9097
9099 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9100 {
9102 }
9103
9105
9106 m_IsResultOfSplit = false;
9107
9109 }
9110
9112 {
9113 super.InitItemVariables();
9114
9120 m_Count = ConfigGetInt(
"count");
9121
9124
9129
9132
9137
9149
9153
9154
9157 if (ConfigIsExisting("canBeSplit"))
9158 {
9161 }
9162
9164 if (ConfigIsExisting("itemBehaviour"))
9166
9167
9170 RegisterNetSyncVariableInt("m_VarLiquidType");
9171 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9172
9173 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9174 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9175 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9176
9177 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9178 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9179 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9180 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9181
9182 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9183 RegisterNetSyncVariableBool("m_IsTakeable");
9184 RegisterNetSyncVariableBool("m_IsHologram");
9185
9188 {
9191 }
9192
9194
9196 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9198
9199 }
9200
9202 {
9204 }
9205
9207 {
9210 {
9215 }
9216 }
9217
9218 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9219 {
9221 {
9224 }
9225
9227 }
9228
9230 {
9236 }
9237
9239
9241 {
9243
9244 if (!action)
9245 {
9246 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9247 return;
9248 }
9249
9251 if (!ai)
9252 {
9254 return;
9255 }
9256
9258 if (!action_array)
9259 {
9260 action_array = new array<ActionBase_Basic>;
9262 }
9263 if (LogManager.IsActionLogEnable())
9264 {
9265 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9266 }
9267
9268 if (action_array.Find(action) != -1)
9269 {
9270 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9271 }
9272 else
9273 {
9274 action_array.Insert(action);
9275 }
9276 }
9277
9279 {
9281 ActionBase action = player.GetActionManager().GetAction(actionName);
9284
9285 if (action_array)
9286 {
9287 action_array.RemoveItem(action);
9288 }
9289 }
9290
9291
9292
9294 {
9295 ActionOverrideData overrideData = new ActionOverrideData();
9299
9301 if (!actionMap)
9302 {
9305 }
9306
9307 actionMap.Insert(this.
Type(), overrideData);
9308
9309 }
9310
9312
9314
9315
9317 {
9320
9323
9324 string config_to_search = "CfgVehicles";
9325 string muzzle_owner_config;
9326
9328 {
9329 if (IsInherited(Weapon))
9330 config_to_search = "CfgWeapons";
9331
9332 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9333
9334 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9335
9337
9338 if (config_OnFire_subclass_count > 0)
9339 {
9340 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9341
9342 for (int i = 0; i < config_OnFire_subclass_count; i++)
9343 {
9344 string particle_class = "";
9346 string config_OnFire_entry = config_OnFire_class + particle_class;
9347 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9348 WPOF_array.Insert(WPOF);
9349 }
9350
9351
9353 }
9354 }
9355
9357 {
9358 config_to_search = "CfgWeapons";
9359 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9360
9361 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9362
9364
9365 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9366 {
9367 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9368
9369 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9370 {
9371 string particle_class2 = "";
9373 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9374 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9375 WPOBE_array.Insert(WPOBE);
9376 }
9377
9378
9380 }
9381 }
9382 }
9383
9384
9386 {
9389
9391 {
9392 string config_to_search = "CfgVehicles";
9393
9394 if (IsInherited(Weapon))
9395 config_to_search = "CfgWeapons";
9396
9397 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9398 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9399
9400 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9401 {
9402
9404
9406 {
9408 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9410 return;
9411 }
9412
9415
9416
9417
9419 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9420
9421 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9422 {
9423 string particle_class = "";
9425 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9427
9428 if (entry_type == CT_CLASS)
9429 {
9430 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9431 WPOOH_array.Insert(WPOF);
9432 }
9433 }
9434
9435
9437 }
9438 }
9439 }
9440
9442 {
9444 }
9445
9447 {
9449 {
9451
9454
9457
9458 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9459 }
9460 }
9461
9463 {
9465 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9466
9468 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9469
9471 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9472
9474 {
9476 }
9477 }
9478
9480 {
9482 }
9483
9485 {
9488 else
9490
9492 {
9495 }
9496 else
9497 {
9500
9503 }
9504
9506 }
9507
9509 {
9511 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9512 }
9513
9515 {
9517 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9519 }
9520
9522 {
9524 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9525 }
9526
9528 {
9531
9532 OverheatingParticle OP = new OverheatingParticle();
9537
9539 }
9540
9542 {
9545
9546 return -1;
9547 }
9548
9550 {
9552 {
9555
9556 for (int i = count; i > 0; --i)
9557 {
9558 int id = i - 1;
9561
9564
9565 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9566 {
9567 if (p)
9568 {
9571 }
9572 }
9573 }
9574 }
9575 }
9576
9578 {
9580 {
9582 {
9583 int id = i - 1;
9585
9586 if (OP)
9587 {
9589
9590 if (p)
9591 {
9593 }
9594
9595 delete OP;
9596 }
9597 }
9598
9601 }
9602 }
9603
9606 {
9607 return 0.0;
9608 }
9609
9610
9612 {
9613 return 250;
9614 }
9615
9617 {
9618 return 0;
9619 }
9620
9623 {
9625 return true;
9626
9627 return false;
9628 }
9629
9632 {
9635
9637 {
9639 }
9640 else
9641 {
9642
9644 }
9645
9647 }
9648
9655 {
9656 return -1;
9657 }
9658
9659
9660
9661
9663 {
9665 {
9667 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9668
9669 if (r_index >= 0)
9670 {
9671 InventoryLocation r_il = new InventoryLocation;
9672 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9673
9674 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9677 {
9678 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9679 }
9681 {
9682 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9683 }
9684
9685 }
9686
9687 player.GetHumanInventory().ClearUserReservedLocation(this);
9688 }
9689
9692 }
9693
9694
9695
9696
9698 {
9699 return ItemBase.m_DebugActionsMask;
9700 }
9701
9703 {
9704 return ItemBase.m_DebugActionsMask & mask;
9705 }
9706
9708 {
9709 ItemBase.m_DebugActionsMask = mask;
9710 }
9711
9713 {
9714 ItemBase.m_DebugActionsMask |= mask;
9715 }
9716
9718 {
9719 ItemBase.m_DebugActionsMask &= ~mask;
9720 }
9721
9723 {
9725 {
9727 }
9728 else
9729 {
9731 }
9732 }
9733
9734
9736 {
9737 if (GetEconomyProfile())
9738 {
9739 float q_max = GetEconomyProfile().GetQuantityMax();
9740 if (q_max > 0)
9741 {
9742 float q_min = GetEconomyProfile().GetQuantityMin();
9743 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9744
9746 {
9747 ComponentEnergyManager comp = GetCompEM();
9749 {
9751 }
9752 }
9754 {
9756
9757 }
9758
9759 }
9760 }
9761 }
9762
9765 {
9766 EntityAI parent = GetHierarchyParent();
9767
9768 if (parent)
9769 {
9770 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9771 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9772 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9773 }
9774 }
9775
9778 {
9779 EntityAI parent = GetHierarchyParent();
9780
9781 if (parent)
9782 {
9783 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9784 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9785 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9786 }
9787 }
9788
9790 {
9791
9792
9793
9794
9796
9798 {
9799 if (ScriptInputUserData.CanStoreInputUserData())
9800 {
9801 ScriptInputUserData ctx = new ScriptInputUserData;
9807 ctx.
Write(use_stack_max);
9810
9812 {
9813 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9814 }
9815 }
9816 }
9817 else if (!
GetGame().IsMultiplayer())
9818 {
9820 }
9821 }
9822
9824 {
9826 }
9827
9829 {
9831 }
9832
9834 {
9836 }
9837
9839 {
9840
9841 return false;
9842 }
9843
9845 {
9846 return false;
9847 }
9848
9852 {
9853 return false;
9854 }
9855
9857 {
9858 return "";
9859 }
9860
9862
9864 {
9865 return false;
9866 }
9867
9869 {
9870 return true;
9871 }
9872
9873
9874
9876 {
9877 return true;
9878 }
9879
9881 {
9882 return true;
9883 }
9884
9886 {
9887 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9889 }
9890
9892 {
9894 }
9895
9897 {
9899 if (!is_being_placed)
9901 SetSynchDirty();
9902 }
9903
9904
9906
9908 {
9910 }
9911
9913 {
9915 }
9916
9918 {
9919 return 1;
9920 }
9921
9923 {
9924 return false;
9925 }
9926
9928 {
9930 SetSynchDirty();
9931 }
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9968 {
9969 super.OnMovedInsideCargo(container);
9970
9971 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9972 }
9973
9974 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9975 {
9976 super.EEItemLocationChanged(oldLoc,newLoc);
9977
9978 PlayerBase new_player = null;
9979 PlayerBase old_player = null;
9980
9981 if (newLoc.GetParent())
9982 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9983
9984 if (oldLoc.GetParent())
9985 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9986
9988 {
9989 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9990
9991 if (r_index >= 0)
9992 {
9993 InventoryLocation r_il = new InventoryLocation;
9994 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9995
9996 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9999 {
10000 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10001 }
10003 {
10004 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10005 }
10006
10007 }
10008 }
10009
10011 {
10012 if (new_player)
10013 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10014
10015 if (new_player == old_player)
10016 {
10017
10018 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10019 {
10021 {
10022 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10023 {
10024 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10025 }
10026 }
10027 else
10028 {
10029 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10030 }
10031 }
10032
10033 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10034 {
10035 int type = oldLoc.GetType();
10037 {
10038 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10039 }
10041 {
10042 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10043 }
10044 }
10045 if (!m_OldLocation)
10046 {
10047 m_OldLocation = new InventoryLocation;
10048 }
10049 m_OldLocation.Copy(oldLoc);
10050 }
10051 else
10052 {
10053 if (m_OldLocation)
10054 {
10055 m_OldLocation.Reset();
10056 }
10057 }
10058
10060 }
10061 else
10062 {
10063 if (new_player)
10064 {
10065 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10066 if (res_index >= 0)
10067 {
10068 InventoryLocation il = new InventoryLocation;
10069 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10071 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10074 {
10075 il.
GetParent().GetOnReleaseLock().Invoke(it);
10076 }
10078 {
10080 }
10081
10082 }
10083 }
10085 {
10086
10088 }
10089
10090 if (m_OldLocation)
10091 {
10092 m_OldLocation.Reset();
10093 }
10094 }
10095 }
10096
10097 override void EOnContact(IEntity other, Contact extra)
10098 {
10100 {
10101 int liquidType = -1;
10103 if (impactSpeed > 0.0)
10104 {
10106 #ifndef SERVER
10108 #else
10110 SetSynchDirty();
10111 #endif
10113 }
10114 }
10115
10116 #ifdef SERVER
10117 if (GetCompEM() && GetCompEM().IsPlugged())
10118 {
10119 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10120 GetCompEM().UnplugThis();
10121 }
10122 #endif
10123 }
10124
10126
10128 {
10130 }
10131
10133 {
10134
10135 }
10136
10138 {
10139 super.OnItemLocationChanged(old_owner, new_owner);
10140
10141 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10142 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10143
10144 if (!relatedPlayer && playerNew)
10145 relatedPlayer = playerNew;
10146
10147 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10148 {
10150 if (actionMgr)
10151 {
10152 ActionBase currentAction = actionMgr.GetRunningAction();
10153 if (currentAction)
10155 }
10156 }
10157
10158 Man ownerPlayerOld = null;
10159 Man ownerPlayerNew = null;
10160
10161 if (old_owner)
10162 {
10163 if (old_owner.
IsMan())
10164 {
10165 ownerPlayerOld = Man.Cast(old_owner);
10166 }
10167 else
10168 {
10169 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10170 }
10171 }
10172 else
10173 {
10175 {
10177
10178 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10179 {
10180 GetCompEM().UnplugThis();
10181 }
10182 }
10183 }
10184
10185 if (new_owner)
10186 {
10187 if (new_owner.
IsMan())
10188 {
10189 ownerPlayerNew = Man.Cast(new_owner);
10190 }
10191 else
10192 {
10193 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10194 }
10195 }
10196
10197 if (ownerPlayerOld != ownerPlayerNew)
10198 {
10199 if (ownerPlayerOld)
10200 {
10201 array<EntityAI> subItemsExit = new array<EntityAI>;
10203 for (int i = 0; i < subItemsExit.Count(); i++)
10204 {
10207 }
10208 }
10209
10210 if (ownerPlayerNew)
10211 {
10212 array<EntityAI> subItemsEnter = new array<EntityAI>;
10214 for (int j = 0; j < subItemsEnter.Count(); j++)
10215 {
10218 }
10219 }
10220 }
10221 else if (ownerPlayerNew != null)
10222 {
10223 PlayerBase nplayer;
10224 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10225 {
10226 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10228 for (int k = 0; k < subItemsUpdate.Count(); k++)
10229 {
10231 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10232 }
10233 }
10234 }
10235
10236 if (old_owner)
10237 old_owner.OnChildItemRemoved(this);
10238 if (new_owner)
10239 new_owner.OnChildItemReceived(this);
10240 }
10241
10242
10244 {
10245 super.EEDelete(parent);
10246 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10247 if (player)
10248 {
10250
10251 if (player.IsAlive())
10252 {
10253 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10254 if (r_index >= 0)
10255 {
10256 InventoryLocation r_il = new InventoryLocation;
10257 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10258
10259 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10262 {
10263 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10264 }
10266 {
10267 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10268 }
10269
10270 }
10271
10272 player.RemoveQuickBarEntityShortcut(this);
10273 }
10274 }
10275 }
10276
10278 {
10279 super.EEKilled(killer);
10280
10283 {
10284 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10285 {
10286 if (IsMagazine())
10287 {
10288 if (Magazine.Cast(this).GetAmmoCount() > 0)
10289 {
10291 }
10292 }
10293 else
10294 {
10296 }
10297 }
10298 }
10299 }
10300
10302 {
10303 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10304
10305 super.OnWasAttached(parent, slot_id);
10306
10309
10311 }
10312
10314 {
10315 super.OnWasDetached(parent, slot_id);
10316
10319 }
10320
10322 {
10323 int idx;
10326
10327 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10328 if (inventory_slots.Count() < 1)
10329 {
10330 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10331 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10332 }
10333 else
10334 {
10335 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10336 }
10337
10338 idx = inventory_slots.Find(slot);
10339 if (idx < 0)
10340 return "";
10341
10342 return attach_types.Get(idx);
10343 }
10344
10346 {
10347 int idx = -1;
10348 string slot;
10349
10352
10353 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10354 if (inventory_slots.Count() < 1)
10355 {
10356 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10357 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10358 }
10359 else
10360 {
10361 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10362 if (detach_types.Count() < 1)
10363 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10364 }
10365
10366 for (int i = 0; i < inventory_slots.Count(); i++)
10367 {
10368 slot = inventory_slots.Get(i);
10369 }
10370
10371 if (slot != "")
10372 {
10373 if (detach_types.Count() == 1)
10374 idx = 0;
10375 else
10376 idx = inventory_slots.Find(slot);
10377 }
10378 if (idx < 0)
10379 return "";
10380
10381 return detach_types.Get(idx);
10382 }
10383
10385 {
10386
10388
10389
10390 float min_time = 1;
10391 float max_time = 3;
10392 float delay = Math.RandomFloat(min_time, max_time);
10393
10394 explode_timer.Run(delay, this, "DoAmmoExplosion");
10395 }
10396
10398 {
10399 Magazine magazine = Magazine.Cast(this);
10400 int pop_sounds_count = 6;
10401 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10402
10403
10404 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10405 string sound_name = pop_sounds[ sound_idx ];
10407
10408
10409 magazine.ServerAddAmmoCount(-1);
10410
10411
10412 float min_temp_to_explode = 100;
10413
10414 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10415 {
10417 }
10418 }
10419
10420
10421 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10422 {
10423 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10424
10425 const int CHANCE_DAMAGE_CARGO = 4;
10426 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10427 const int CHANCE_DAMAGE_NOTHING = 2;
10428
10430 {
10431 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10432 int chances;
10433 int rnd;
10434
10435 if (GetInventory().GetCargo())
10436 {
10437 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10438 rnd = Math.RandomInt(0,chances);
10439
10440 if (rnd < CHANCE_DAMAGE_CARGO)
10441 {
10443 }
10444 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10445 {
10447 }
10448 }
10449 else
10450 {
10451 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10452 rnd = Math.RandomInt(0,chances);
10453
10454 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10455 {
10457 }
10458 }
10459 }
10460 }
10461
10463 {
10464 if (GetInventory().GetCargo())
10465 {
10466 int item_count = GetInventory().GetCargo().GetItemCount();
10467 if (item_count > 0)
10468 {
10469 int random_pick = Math.RandomInt(0, item_count);
10471 if (!item.IsExplosive())
10472 {
10473 item.AddHealth("","",damage);
10474 return true;
10475 }
10476 }
10477 }
10478 return false;
10479 }
10480
10482 {
10483 int attachment_count = GetInventory().AttachmentCount();
10484 if (attachment_count > 0)
10485 {
10486 int random_pick = Math.RandomInt(0, attachment_count);
10487 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10488 if (!attachment.IsExplosive())
10489 {
10490 attachment.AddHealth("","",damage);
10491 return true;
10492 }
10493 }
10494 return false;
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 return GetInventory().CanRemoveEntity();
10506
10507 return false;
10508 }
10509
10511 {
10512
10514 return false;
10515
10516
10518 return false;
10519
10520
10521
10523 if (delta == 0)
10524 return false;
10525
10526
10527 return true;
10528 }
10529
10531 {
10533 {
10534 if (ScriptInputUserData.CanStoreInputUserData())
10535 {
10536 ScriptInputUserData ctx = new ScriptInputUserData;
10541 ctx.
Write(destination_entity);
10543 ctx.
Write(slot_id);
10545 }
10546 }
10547 else if (!
GetGame().IsMultiplayer())
10548 {
10550 }
10551 }
10552
10554 {
10555 float split_quantity_new;
10559 InventoryLocation loc = new InventoryLocation;
10560
10561 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10562 {
10564 split_quantity_new = stack_max;
10565 else
10567
10569 {
10570 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10571 if (new_item)
10572 {
10573 new_item.SetResultOfSplit(true);
10574 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10576 new_item.
SetQuantity(split_quantity_new,
false,
true);
10577 }
10578 }
10579 }
10580 else if (destination_entity && slot_id == -1)
10581 {
10582 if (quantity > stack_max)
10583 split_quantity_new = stack_max;
10584 else
10585 split_quantity_new = quantity;
10586
10588 {
10590 {
10593 }
10594
10595 if (new_item)
10596 {
10597 new_item.SetResultOfSplit(true);
10598 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10600 new_item.
SetQuantity(split_quantity_new,
false,
true);
10601 }
10602 }
10603 }
10604 else
10605 {
10606 if (stack_max != 0)
10607 {
10609 {
10611 }
10612
10613 if (split_quantity_new == 0)
10614 {
10615 if (!
GetGame().IsMultiplayer())
10616 player.PhysicalPredictiveDropItem(this);
10617 else
10618 player.ServerDropEntity(this);
10619 return;
10620 }
10621
10623 {
10625
10626 if (new_item)
10627 {
10628 new_item.SetResultOfSplit(true);
10629 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10632 new_item.PlaceOnSurface();
10633 }
10634 }
10635 }
10636 }
10637 }
10638
10640 {
10641 float split_quantity_new;
10645 InventoryLocation loc = new InventoryLocation;
10646
10647 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10648 {
10650 split_quantity_new = stack_max;
10651 else
10653
10655 {
10656 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10657 if (new_item)
10658 {
10659 new_item.SetResultOfSplit(true);
10660 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10662 new_item.
SetQuantity(split_quantity_new,
false,
true);
10663 }
10664 }
10665 }
10666 else if (destination_entity && slot_id == -1)
10667 {
10668 if (quantity > stack_max)
10669 split_quantity_new = stack_max;
10670 else
10671 split_quantity_new = quantity;
10672
10674 {
10676 {
10679 }
10680
10681 if (new_item)
10682 {
10683 new_item.SetResultOfSplit(true);
10684 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10686 new_item.
SetQuantity(split_quantity_new,
false,
true);
10687 }
10688 }
10689 }
10690 else
10691 {
10692 if (stack_max != 0)
10693 {
10695 {
10697 }
10698
10700 {
10702
10703 if (new_item)
10704 {
10705 new_item.SetResultOfSplit(true);
10706 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10709 new_item.PlaceOnSurface();
10710 }
10711 }
10712 }
10713 }
10714 }
10715
10717 {
10719 {
10720 if (ScriptInputUserData.CanStoreInputUserData())
10721 {
10722 ScriptInputUserData ctx = new ScriptInputUserData;
10727 dst.WriteToContext(ctx);
10729 }
10730 }
10731 else if (!
GetGame().IsMultiplayer())
10732 {
10734 }
10735 }
10736
10738 {
10740 {
10741 if (ScriptInputUserData.CanStoreInputUserData())
10742 {
10743 ScriptInputUserData ctx = new ScriptInputUserData;
10748 ctx.
Write(destination_entity);
10754 }
10755 }
10756 else if (!
GetGame().IsMultiplayer())
10757 {
10759 }
10760 }
10761
10763 {
10765 }
10766
10768 {
10770 float split_quantity_new;
10772 if (dst.IsValid())
10773 {
10774 int slot_id = dst.GetSlot();
10776
10777 if (quantity > stack_max)
10778 split_quantity_new = stack_max;
10779 else
10780 split_quantity_new = quantity;
10781
10783 {
10785
10786 if (new_item)
10787 {
10788 new_item.SetResultOfSplit(true);
10789 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10791 new_item.
SetQuantity(split_quantity_new,
false,
true);
10792 }
10793
10794 return new_item;
10795 }
10796 }
10797
10798 return null;
10799 }
10800
10802 {
10804 float split_quantity_new;
10806 if (destination_entity)
10807 {
10809 if (quantity > stackable)
10810 split_quantity_new = stackable;
10811 else
10812 split_quantity_new = quantity;
10813
10815 {
10816 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
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 {
10832 if (ScriptInputUserData.CanStoreInputUserData())
10833 {
10834 ScriptInputUserData ctx = new ScriptInputUserData;
10839 ItemBase destination_entity =
this;
10840 ctx.
Write(destination_entity);
10844 }
10845 }
10846 else if (!
GetGame().IsMultiplayer())
10847 {
10849 }
10850 }
10851
10853 {
10855 float split_quantity_new;
10857 if (player)
10858 {
10860 if (quantity > stackable)
10861 split_quantity_new = stackable;
10862 else
10863 split_quantity_new = quantity;
10864
10866 {
10867 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10868 new_item =
ItemBase.Cast(in_hands);
10869 if (new_item)
10870 {
10871 new_item.SetResultOfSplit(true);
10872 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10874 new_item.SetQuantity(split_quantity_new, false, true);
10875 }
10876 }
10877 }
10878 }
10879
10881 {
10883 float split_quantity_new = Math.Floor(quantity * 0.5);
10884
10886 return;
10887
10889
10890 if (new_item)
10891 {
10892 if (new_item.GetQuantityMax() < split_quantity_new)
10893 {
10894 split_quantity_new = new_item.GetQuantityMax();
10895 }
10896
10897 new_item.SetResultOfSplit(true);
10898 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10899
10901 {
10904 }
10905 else
10906 {
10908 new_item.
SetQuantity(split_quantity_new,
false,
true);
10909 }
10910 }
10911 }
10912
10914 {
10916 float split_quantity_new = Math.Floor(quantity / 2);
10917
10919 return;
10920
10921 InventoryLocation invloc = new InventoryLocation;
10923
10925 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10926
10927 if (new_item)
10928 {
10929 if (new_item.GetQuantityMax() < split_quantity_new)
10930 {
10931 split_quantity_new = new_item.GetQuantityMax();
10932 }
10934 {
10937 }
10938 else if (split_quantity_new > 1)
10939 {
10941 new_item.
SetQuantity(split_quantity_new,
false,
true);
10942 }
10943 }
10944 }
10945
10948 {
10949 SetWeightDirty();
10951
10952 if (parent)
10953 parent.OnAttachmentQuantityChangedEx(this, delta);
10954
10956 {
10958 {
10960 }
10962 {
10963 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10965 }
10966 }
10967
10968 }
10969
10972 {
10973
10974 }
10975
10978 {
10980 }
10981
10983 {
10984 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10985
10987 {
10988 if (newLevel == GameConstants.STATE_RUINED)
10989 {
10991 EntityAI parent = GetHierarchyParent();
10992 if (parent && parent.IsFireplace())
10993 {
10994 CargoBase cargo = GetInventory().GetCargo();
10995 if (cargo)
10996 {
10998 {
11000 }
11001 }
11002 }
11003 }
11004
11006 {
11007
11009 return;
11010 }
11011
11012 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11013 {
11015 }
11016 }
11017 }
11018
11019
11021 {
11022 super.OnRightClick();
11023
11025 {
11027 {
11028 if (ScriptInputUserData.CanStoreInputUserData())
11029 {
11030 EntityAI root = GetHierarchyRoot();
11031 Man playerOwner = GetHierarchyRootPlayer();
11032 InventoryLocation dst = new InventoryLocation;
11033
11034
11035 if (!playerOwner && root && root == this)
11036 {
11038 }
11039 else
11040 {
11041
11042 GetInventory().GetCurrentInventoryLocation(dst);
11044 {
11047 {
11049 }
11050 else
11051 {
11053
11054
11055 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11056 {
11058 }
11059 else
11060 {
11061 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11062 }
11063 }
11064 }
11065 }
11066
11067 ScriptInputUserData ctx = new ScriptInputUserData;
11075 }
11076 }
11077 else if (!
GetGame().IsMultiplayer())
11078 {
11080 }
11081 }
11082 }
11083
11085 {
11086 if (root)
11087 {
11088 vector m4[4];
11089 root.GetTransform(m4);
11090 dst.SetGround(this, m4);
11091 }
11092 else
11093 {
11094 GetInventory().GetCurrentInventoryLocation(dst);
11095 }
11096 }
11097
11098 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11099 {
11100
11101 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11102 return false;
11103
11104 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11105 return false;
11106
11107
11109 return false;
11110
11111
11112 Magazine mag = Magazine.Cast(this);
11113 if (mag)
11114 {
11115 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11116 return false;
11117
11118 if (stack_max_limit)
11119 {
11120 Magazine other_mag = Magazine.Cast(other_item);
11121 if (other_item)
11122 {
11123 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11124 return false;
11125 }
11126
11127 }
11128 }
11129 else
11130 {
11131
11133 return false;
11134
11136 return false;
11137 }
11138
11139 PlayerBase player = null;
11140 if (CastTo(player, GetHierarchyRootPlayer()))
11141 {
11142 if (player.GetInventory().HasAttachment(this))
11143 return false;
11144
11145 if (player.IsItemsToDelete())
11146 return false;
11147 }
11148
11149 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11150 return false;
11151
11152 int slotID;
11154 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11155 return false;
11156
11157 return true;
11158 }
11159
11161 {
11163 }
11164
11166 {
11167 return m_IsResultOfSplit;
11168 }
11169
11171 {
11172 m_IsResultOfSplit = value;
11173 }
11174
11176 {
11178 }
11179
11181 {
11182 float other_item_quantity = other_item.GetQuantity();
11183 float this_free_space;
11184
11186
11188
11189 if (other_item_quantity > this_free_space)
11190 {
11191 return this_free_space;
11192 }
11193 else
11194 {
11195 return other_item_quantity;
11196 }
11197 }
11198
11200 {
11202 }
11203
11205 {
11207 return;
11208
11209 if (!IsMagazine() && other_item)
11210 {
11212 if (quantity_used != 0)
11213 {
11214 float hp1 = GetHealth01("","");
11215 float hp2 = other_item.GetHealth01("","");
11216 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11217 hpResult = hpResult / (
GetQuantity() + quantity_used);
11218
11219 hpResult *= GetMaxHealth();
11220 Math.Round(hpResult);
11221 SetHealth("", "Health", hpResult);
11222
11224 other_item.AddQuantity(-quantity_used);
11225 }
11226 }
11228 }
11229
11231 {
11232 #ifdef SERVER
11233 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11234 GetHierarchyParent().IncreaseLifetimeUp();
11235 #endif
11236 };
11237
11239 {
11240 PlayerBase p = PlayerBase.Cast(player);
11241
11242 array<int> recipesIds = p.m_Recipes;
11243 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11244 if (moduleRecipesManager)
11245 {
11246 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11247 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11248 }
11249
11250 for (int i = 0;i < recipesIds.Count(); i++)
11251 {
11252 int key = recipesIds.Get(i);
11253 string recipeName = moduleRecipesManager.GetRecipeName(key);
11255 }
11256 }
11257
11258
11259 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11260 {
11261 super.GetDebugActions(outputList);
11262
11263
11269
11270
11275
11280
11281
11285
11286
11288 {
11292 }
11293
11296
11297
11301
11303
11304 InventoryLocation loc = new InventoryLocation();
11305 GetInventory().GetCurrentInventoryLocation(loc);
11307 {
11308 if (Gizmo_IsSupported())
11311 }
11312
11314 }
11315
11316
11317
11318
11320 {
11321 super.OnAction(action_id, player, ctx);
11322
11324 {
11325 switch (action_id)
11326 {
11329 return true;
11332 return true;
11333 }
11334 }
11335
11337 {
11338 switch (action_id)
11339 {
11341 Delete();
11342 return true;
11343 }
11344 }
11345
11346 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11347 {
11348 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11349 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11350 PlayerBase p = PlayerBase.Cast(player);
11351 if (
EActions.RECIPES_RANGE_START < 1000)
11352 {
11353 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11354 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11355 }
11356 }
11357 #ifndef SERVER
11358 else if (action_id ==
EActions.WATCH_PLAYER)
11359 {
11360 PluginDeveloper.SetDeveloperItemClientEx(player);
11361 }
11362 #endif
11364 {
11365 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11366 {
11367 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11368 OnDebugButtonPressServer(id + 1);
11369 }
11370
11371 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11372 {
11373 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11375 }
11376
11377 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11378 {
11379 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11381 }
11382
11383 else if (action_id ==
EActions.ADD_QUANTITY)
11384 {
11385 if (IsMagazine())
11386 {
11387 Magazine mag = Magazine.Cast(this);
11388 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11389 }
11390 else
11391 {
11393 }
11394
11395 if (m_EM)
11396 {
11397 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11398 }
11399
11400 }
11401
11402 else if (action_id ==
EActions.REMOVE_QUANTITY)
11403 {
11404 if (IsMagazine())
11405 {
11406 Magazine mag2 = Magazine.Cast(this);
11407 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11408 }
11409 else
11410 {
11412 }
11413 if (m_EM)
11414 {
11415 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11416 }
11417
11418 }
11419
11420 else if (action_id ==
EActions.SET_QUANTITY_0)
11421 {
11423
11424 if (m_EM)
11425 {
11426 m_EM.SetEnergy(0);
11427 }
11428 }
11429
11430 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11431 {
11433
11434 if (m_EM)
11435 {
11436 m_EM.SetEnergy(m_EM.GetEnergyMax());
11437 }
11438 }
11439
11440 else if (action_id ==
EActions.ADD_HEALTH)
11441 {
11442 AddHealth("","",GetMaxHealth("","Health")/5);
11443 }
11444 else if (action_id ==
EActions.REMOVE_HEALTH)
11445 {
11446 AddHealth("","",-GetMaxHealth("","Health")/5);
11447 }
11448 else if (action_id ==
EActions.DESTROY_HEALTH)
11449 {
11450 SetHealth01("","",0);
11451 }
11452 else if (action_id ==
EActions.WATCH_ITEM)
11453 {
11455 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11456 #ifdef DEVELOPER
11457 SetDebugDeveloper_item(this);
11458 #endif
11459 }
11460
11461 else if (action_id ==
EActions.ADD_TEMPERATURE)
11462 {
11463 AddTemperature(20);
11464
11465 }
11466
11467 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11468 {
11469 AddTemperature(-20);
11470
11471 }
11472
11473 else if (action_id ==
EActions.FLIP_FROZEN)
11474 {
11475 SetFrozen(!GetIsFrozen());
11476
11477 }
11478
11479 else if (action_id ==
EActions.ADD_WETNESS)
11480 {
11482
11483 }
11484
11485 else if (action_id ==
EActions.REMOVE_WETNESS)
11486 {
11488
11489 }
11490
11491 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11492 {
11495
11496
11497 }
11498
11499 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11500 {
11503 }
11504
11505 else if (action_id ==
EActions.MAKE_SPECIAL)
11506 {
11507 auto debugParams = DebugSpawnParams.WithPlayer(player);
11508 OnDebugSpawnEx(debugParams);
11509 }
11510
11511 }
11512
11513
11514 return false;
11515 }
11516
11517
11518
11519
11523
11526
11527
11528
11530 {
11531 return false;
11532 }
11533
11534
11536 {
11537 return true;
11538 }
11539
11540
11542 {
11543 return true;
11544 }
11545
11546
11547
11549 {
11550 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11552 }
11553
11556 {
11557 return null;
11558 }
11559
11561 {
11562 return false;
11563 }
11564
11566 {
11567 return false;
11568 }
11569
11573
11574
11576 {
11577 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11578 return module_repairing.CanRepair(this, item_repair_kit);
11579 }
11580
11581
11582 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11583 {
11584 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11585 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11586 }
11587
11588
11590 {
11591
11592
11593
11594
11595
11596
11597
11598
11599 return 1;
11600 }
11601
11602
11603
11605 {
11607 }
11608
11609
11610
11612 {
11614 }
11615
11616
11625 {
11626 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11627
11628 if (player)
11629 {
11630 player.MessageStatus(text);
11631 }
11632 }
11633
11634
11643 {
11644 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11645
11646 if (player)
11647 {
11648 player.MessageAction(text);
11649 }
11650 }
11651
11652
11661 {
11662 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11663
11664 if (player)
11665 {
11666 player.MessageFriendly(text);
11667 }
11668 }
11669
11670
11679 {
11680 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11681
11682 if (player)
11683 {
11684 player.MessageImportant(text);
11685 }
11686 }
11687
11689 {
11690 return true;
11691 }
11692
11693
11694 override bool KindOf(
string tag)
11695 {
11696 bool found = false;
11697 string item_name = this.
GetType();
11700
11701 int array_size = item_tag_array.Count();
11702 for (int i = 0; i < array_size; i++)
11703 {
11704 if (item_tag_array.Get(i) == tag)
11705 {
11706 found = true;
11707 break;
11708 }
11709 }
11710 return found;
11711 }
11712
11713
11715 {
11716
11717 super.OnRPC(sender, rpc_type,ctx);
11718
11719
11720 switch (rpc_type)
11721 {
11722 #ifndef SERVER
11723 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11724 Param2<bool, string> p = new Param2<bool, string>(false, "");
11725
11727 return;
11728
11729 bool play = p.param1;
11730 string soundSet = p.param2;
11731
11732 if (play)
11733 {
11735 {
11737 {
11739 }
11740 }
11741 else
11742 {
11744 }
11745 }
11746 else
11747 {
11749 }
11750
11751 break;
11752 #endif
11753
11754 }
11755
11757 {
11759 }
11760 }
11761
11762
11763
11764
11766 {
11767 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11768 return plugin.GetID(
name);
11769 }
11770
11772 {
11773 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11774 return plugin.GetName(id);
11775 }
11776
11779 {
11780
11781
11782 int varFlags;
11783 if (!ctx.
Read(varFlags))
11784 return;
11785
11786 if (varFlags & ItemVariableFlags.FLOAT)
11787 {
11789 }
11790 }
11791
11793 {
11794
11795 super.SerializeNumericalVars(floats_out);
11796
11797
11798
11800 {
11802 }
11803
11805 {
11807 }
11808
11810 {
11812 }
11813
11815 {
11820 }
11821
11823 {
11825 }
11826 }
11827
11829 {
11830
11831 super.DeSerializeNumericalVars(floats);
11832
11833
11834 int index = 0;
11835 int mask = Math.Round(floats.Get(index));
11836
11837 index++;
11838
11840 {
11842 {
11844 }
11845 else
11846 {
11847 float quantity = floats.Get(index);
11848 SetQuantity(quantity,
true,
false,
false,
false);
11849 }
11850 index++;
11851 }
11852
11854 {
11855 float wet = floats.Get(index);
11857 index++;
11858 }
11859
11861 {
11862 int liquidtype = Math.Round(floats.Get(index));
11864 index++;
11865 }
11866
11868 {
11870 index++;
11872 index++;
11874 index++;
11876 index++;
11877 }
11878
11880 {
11881 int cleanness = Math.Round(floats.Get(index));
11883 index++;
11884 }
11885 }
11886
11888 {
11889 super.WriteVarsToCTX(ctx);
11890
11891
11893 {
11895 }
11896
11898 {
11900 }
11901
11903 {
11905 }
11906
11908 {
11909 int r,g,b,a;
11915 }
11916
11918 {
11920 }
11921 }
11922
11924 {
11925 if (!super.ReadVarsFromCTX(ctx,version))
11926 return false;
11927
11928 int intValue;
11929 float value;
11930
11931 if (version < 140)
11932 {
11933 if (!ctx.
Read(intValue))
11934 return false;
11935
11936 m_VariablesMask = intValue;
11937 }
11938
11940 {
11941 if (!ctx.
Read(value))
11942 return false;
11943
11945 {
11947 }
11948 else
11949 {
11951 }
11952 }
11953
11954 if (version < 140)
11955 {
11957 {
11958 if (!ctx.
Read(value))
11959 return false;
11960 SetTemperatureDirect(value);
11961 }
11962 }
11963
11965 {
11966 if (!ctx.
Read(value))
11967 return false;
11969 }
11970
11972 {
11973 if (!ctx.
Read(intValue))
11974 return false;
11976 }
11977
11979 {
11980 int r,g,b,a;
11982 return false;
11984 return false;
11986 return false;
11988 return false;
11989
11991 }
11992
11994 {
11995 if (!ctx.
Read(intValue))
11996 return false;
11998 }
11999
12000 if (version >= 138 && version < 140)
12001 {
12003 {
12004 if (!ctx.
Read(intValue))
12005 return false;
12006 SetFrozen(intValue);
12007 }
12008 }
12009
12010 return true;
12011 }
12012
12013
12015 {
12018 {
12020 }
12021
12022 if (!super.OnStoreLoad(ctx, version))
12023 {
12025 return false;
12026 }
12027
12028 if (version >= 114)
12029 {
12030 bool hasQuickBarIndexSaved;
12031
12032 if (!ctx.
Read(hasQuickBarIndexSaved))
12033 {
12035 return false;
12036 }
12037
12038 if (hasQuickBarIndexSaved)
12039 {
12040 int itmQBIndex;
12041
12042
12043 if (!ctx.
Read(itmQBIndex))
12044 {
12046 return false;
12047 }
12048
12049 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12050 if (itmQBIndex != -1 && parentPlayer)
12051 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12052 }
12053 }
12054 else
12055 {
12056
12057 PlayerBase player;
12058 int itemQBIndex;
12059 if (version ==
int.
MAX)
12060 {
12061 if (!ctx.
Read(itemQBIndex))
12062 {
12064 return false;
12065 }
12066 }
12067 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12068 {
12069
12070 if (!ctx.
Read(itemQBIndex))
12071 {
12073 return false;
12074 }
12075 if (itemQBIndex != -1 && player)
12076 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12077 }
12078 }
12079
12080 if (version < 140)
12081 {
12082
12083 if (!LoadVariables(ctx, version))
12084 {
12086 return false;
12087 }
12088 }
12089
12090
12092 {
12094 return false;
12095 }
12096 if (version >= 132)
12097 {
12099 if (raib)
12100 {
12102 {
12104 return false;
12105 }
12106 }
12107 }
12108
12110 return true;
12111 }
12112
12113
12114
12116 {
12117 super.OnStoreSave(ctx);
12118
12119 PlayerBase player;
12120 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12121 {
12123
12124 int itemQBIndex = -1;
12125 itemQBIndex = player.FindQuickBarEntityIndex(this);
12126 ctx.
Write(itemQBIndex);
12127 }
12128 else
12129 {
12131 }
12132
12134
12136 if (raib)
12137 {
12139 }
12140 }
12141
12142
12144 {
12145 super.AfterStoreLoad();
12146
12148 {
12150 }
12151
12153 {
12156 }
12157 }
12158
12160 {
12161 super.EEOnAfterLoad();
12162
12164 {
12166 }
12167
12170 }
12171
12173 {
12174 return false;
12175 }
12176
12177
12178
12180 {
12182 {
12183 #ifdef PLATFORM_CONSOLE
12184
12186 {
12188 if (menu)
12189 {
12191 }
12192 }
12193 #endif
12194 }
12195
12197 {
12200 }
12201
12203 {
12204 SetWeightDirty();
12206 }
12208 {
12211 }
12212
12214 {
12217 }
12219 {
12222 }
12223
12224 super.OnVariablesSynchronized();
12225 }
12226
12227
12228
12230 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12231 {
12232 if (!IsServerCheck(allow_client))
12233 return false;
12234
12236 return false;
12237
12240
12241 if (value <= (min + 0.001))
12242 value = min;
12243
12244 if (value == min)
12245 {
12246 if (destroy_config)
12247 {
12248 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12249 if (dstr)
12250 {
12252 this.Delete();
12253 return true;
12254 }
12255 }
12256 else if (destroy_forced)
12257 {
12259 this.Delete();
12260 return true;
12261 }
12262
12264 }
12265
12268
12270 {
12272
12273 if (delta)
12275 }
12276
12278
12279 return false;
12280 }
12281
12282
12284 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12285 {
12287 }
12288
12290 {
12293 }
12294
12296 {
12299 }
12300
12302 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12303 {
12304 float value_clamped = Math.Clamp(value, 0, 1);
12306 SetQuantity(result, destroy_config, destroy_forced);
12307 }
12308
12309
12312 {
12314 }
12315
12317 {
12319 }
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12331 {
12332 int slot = -1;
12333 if (GetInventory())
12334 {
12335 InventoryLocation il = new InventoryLocation;
12336 GetInventory().GetCurrentInventoryLocation(il);
12338 }
12339
12341 }
12342
12344 {
12345 float quantity_max = 0;
12346
12348 {
12349 if (attSlotID != -1)
12350 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12351
12352 if (quantity_max <= 0)
12354 }
12355
12356 if (quantity_max <= 0)
12358
12359 return quantity_max;
12360 }
12361
12363 {
12365 }
12366
12368 {
12370 }
12371
12372
12374 {
12376 }
12377
12379 {
12381 }
12382
12384 {
12386 }
12387
12388
12390 {
12391
12392 float weightEx = GetWeightEx();
12393 float special = GetInventoryAndCargoWeight();
12394 return weightEx - special;
12395 }
12396
12397
12399 {
12401 }
12402
12404 {
12406 {
12407 #ifdef DEVELOPER
12408 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12409 {
12410 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12412 }
12413 #endif
12414
12415 return GetQuantity() * GetConfigWeightModified();
12416 }
12417 else if (HasEnergyManager())
12418 {
12419 #ifdef DEVELOPER
12420 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12421 {
12422 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12423 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12424 }
12425 #endif
12426 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12427 }
12428 else
12429 {
12430 #ifdef DEVELOPER
12431 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12432 {
12433 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12434 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12435 }
12436 #endif
12437 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12438 }
12439 }
12440
12443 {
12444 int item_count = 0;
12446
12447 if (GetInventory().GetCargo() != NULL)
12448 {
12449 item_count = GetInventory().GetCargo().GetItemCount();
12450 }
12451
12452 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12453 {
12454 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12455 if (item)
12456 item_count += item.GetNumberOfItems();
12457 }
12458 return item_count;
12459 }
12460
12463 {
12464 float weight = 0;
12465 float wetness = 1;
12466 if (include_wetness)
12469 {
12470 weight = wetness * m_ConfigWeight;
12471 }
12473 {
12474 weight = 1;
12475 }
12476 return weight;
12477 }
12478
12479
12480
12482 {
12483 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12484 {
12485 GameInventory inv = GetInventory();
12486 array<EntityAI> items = new array<EntityAI>;
12488 for (int i = 0; i < items.Count(); i++)
12489 {
12491 if (item)
12492 {
12494 }
12495 }
12496 }
12497 }
12498
12499
12500
12501
12503 {
12504 float energy = 0;
12505 if (HasEnergyManager())
12506 {
12507 energy = GetCompEM().GetEnergy();
12508 }
12509 return energy;
12510 }
12511
12512
12514 {
12515 super.OnEnergyConsumed();
12516
12518 }
12519
12521 {
12522 super.OnEnergyAdded();
12523
12525 }
12526
12527
12529 {
12530 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12531 {
12533 {
12534 float energy_0to1 = GetCompEM().GetEnergy0To1();
12536 }
12537 }
12538 }
12539
12540
12542 {
12543 return ConfigGetFloat("heatIsolation");
12544 }
12545
12547 {
12549 }
12550
12552 {
12553 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12554 if (
GetGame().ConfigIsExisting(paramPath))
12556
12557 return 0.0;
12558 }
12559
12561 {
12562 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12563 if (
GetGame().ConfigIsExisting(paramPath))
12565
12566 return 0.0;
12567 }
12568
12569 override void SetWet(
float value,
bool allow_client =
false)
12570 {
12571 if (!IsServerCheck(allow_client))
12572 return;
12573
12576
12578
12579 m_VarWet = Math.Clamp(value, min, max);
12580
12582 {
12585 }
12586 }
12587
12588 override void AddWet(
float value)
12589 {
12591 }
12592
12594 {
12596 }
12597
12599 {
12601 }
12602
12604 {
12606 }
12607
12609 {
12611 }
12612
12614 {
12616 }
12617
12618 override void OnWetChanged(
float newVal,
float oldVal)
12619 {
12622 if (newLevel != oldLevel)
12623 {
12625 }
12626 }
12627
12629 {
12630 SetWeightDirty();
12631 }
12632
12634 {
12635 return GetWetLevelInternal(
m_VarWet);
12636 }
12637
12638
12639
12641 {
12643 }
12644
12646 {
12648 }
12649
12651 {
12653 }
12654
12656 {
12658 }
12659
12660
12661
12663 {
12664 if (ConfigIsExisting("itemModelLength"))
12665 {
12666 return ConfigGetFloat("itemModelLength");
12667 }
12668 return 0;
12669 }
12670
12672 {
12673 if (ConfigIsExisting("itemAttachOffset"))
12674 {
12675 return ConfigGetFloat("itemAttachOffset");
12676 }
12677 return 0;
12678 }
12679
12680 override void SetCleanness(
int value,
bool allow_client =
false)
12681 {
12682 if (!IsServerCheck(allow_client))
12683 return;
12684
12686
12688
12691 }
12692
12694 {
12696 }
12697
12699 {
12700 return true;
12701 }
12702
12703
12704
12705
12707 {
12709 }
12710
12712 {
12714 }
12715
12716
12717
12718
12719 override void SetColor(
int r,
int g,
int b,
int a)
12720 {
12726 }
12728 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12729 {
12734 }
12735
12737 {
12739 }
12740
12743 {
12744 int r,g,b,a;
12746 r = r/255;
12747 g = g/255;
12748 b = b/255;
12749 a = a/255;
12750 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12751 }
12752
12753
12754
12755 override void SetLiquidType(
int value,
bool allow_client =
false)
12756 {
12757 if (!IsServerCheck(allow_client))
12758 return;
12759
12764 }
12765
12767 {
12768 return ConfigGetInt("varLiquidTypeInit");
12769 }
12770
12772 {
12774 }
12775
12777 {
12779 SetFrozen(false);
12780 }
12781
12784 {
12785 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12786 }
12787
12788
12791 {
12792 PlayerBase nplayer;
12793 if (PlayerBase.CastTo(nplayer, player))
12794 {
12796
12797 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12798 }
12799 }
12800
12801
12804 {
12805 PlayerBase nplayer;
12806 if (PlayerBase.CastTo(nplayer,player))
12807 {
12808
12809 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12810
12811 }
12812
12813
12814 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12815
12816
12817 if (HasEnergyManager())
12818 {
12819 GetCompEM().UpdatePlugState();
12820 }
12821 }
12822
12823
12825 {
12826 super.OnPlacementStarted(player);
12827
12829 }
12830
12831 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12832 {
12834 {
12835 m_AdminLog.OnPlacementComplete(player,
this);
12836 }
12837
12838 super.OnPlacementComplete(player, position, orientation);
12839 }
12840
12841
12842
12843
12844
12846 {
12848 {
12849 return true;
12850 }
12851 else
12852 {
12853 return false;
12854 }
12855 }
12856
12857
12859 {
12861 {
12863 }
12864 }
12865
12866
12868 {
12870 }
12871
12873 {
12875 }
12876
12877 override void InsertAgent(
int agent,
float count = 1)
12878 {
12879 if (count < 1)
12880 return;
12881
12883 }
12884
12887 {
12889 }
12890
12891
12893 {
12895 }
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12939 {
12941 return false;
12942 return true;
12943 }
12944
12946 {
12947
12949 }
12950
12951
12954 {
12955 super.CheckForRoofLimited(timeTresholdMS);
12956
12958 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12959 {
12960 m_PreviousRoofTestTime = time;
12961 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12962 }
12963 }
12964
12965
12967 {
12969 {
12970 return 0;
12971 }
12972
12973 if (GetInventory().GetAttachmentSlotsCount() != 0)
12974 {
12975 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12976 if (filter)
12977 return filter.GetProtectionLevel(type, false, system);
12978 else
12979 return 0;
12980 }
12981
12982 string subclassPath, entryName;
12983
12984 switch (type)
12985 {
12987 entryName = "biological";
12988 break;
12990 entryName = "chemical";
12991 break;
12992 default:
12993 entryName = "biological";
12994 break;
12995 }
12996
12997 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12998
13000 }
13001
13002
13003
13006 {
13007 if (!IsMagazine())
13009
13011 }
13012
13013
13014
13015
13016
13021 {
13022 return true;
13023 }
13024
13026 {
13028 }
13029
13030
13031
13032
13033
13035 {
13036 if (parent)
13037 {
13038 if (parent.IsInherited(DayZInfected))
13039 return true;
13040
13041 if (!parent.IsRuined())
13042 return true;
13043 }
13044
13045 return true;
13046 }
13047
13049 {
13050 if (!super.CanPutAsAttachment(parent))
13051 {
13052 return false;
13053 }
13054
13055 if (!IsRuined() && !parent.IsRuined())
13056 {
13057 return true;
13058 }
13059
13060 return false;
13061 }
13062
13064 {
13065
13066
13067
13068
13069 return super.CanReceiveItemIntoCargo(item);
13070 }
13071
13073 {
13074
13075
13076
13077
13078 GameInventory attachmentInv = attachment.GetInventory();
13080 {
13081 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13082 return false;
13083 }
13084
13085 InventoryLocation loc = new InventoryLocation();
13086 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13087 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13088 return false;
13089
13090 return super.CanReceiveAttachment(attachment, slotId);
13091 }
13092
13094 {
13095 if (!super.CanReleaseAttachment(attachment))
13096 return false;
13097
13098 return GetInventory().AreChildrenAccessible();
13099 }
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13122 {
13123 int id = muzzle_owner.GetMuzzleID();
13124 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13125
13126 if (WPOF_array)
13127 {
13128 for (int i = 0; i < WPOF_array.Count(); i++)
13129 {
13130 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13131
13132 if (WPOF)
13133 {
13134 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13135 }
13136 }
13137 }
13138 }
13139
13140
13142 {
13143 int id = muzzle_owner.GetMuzzleID();
13145
13146 if (WPOBE_array)
13147 {
13148 for (int i = 0; i < WPOBE_array.Count(); i++)
13149 {
13150 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13151
13152 if (WPOBE)
13153 {
13154 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13155 }
13156 }
13157 }
13158 }
13159
13160
13162 {
13163 int id = muzzle_owner.GetMuzzleID();
13164 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13165
13166 if (WPOOH_array)
13167 {
13168 for (int i = 0; i < WPOOH_array.Count(); i++)
13169 {
13170 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13171
13172 if (WPOOH)
13173 {
13174 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13175 }
13176 }
13177 }
13178 }
13179
13180
13182 {
13183 int id = muzzle_owner.GetMuzzleID();
13184 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13185
13186 if (WPOOH_array)
13187 {
13188 for (int i = 0; i < WPOOH_array.Count(); i++)
13189 {
13190 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13191
13192 if (WPOOH)
13193 {
13194 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13195 }
13196 }
13197 }
13198 }
13199
13200
13202 {
13203 int id = muzzle_owner.GetMuzzleID();
13204 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13205
13206 if (WPOOH_array)
13207 {
13208 for (int i = 0; i < WPOOH_array.Count(); i++)
13209 {
13210 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13211
13212 if (WPOOH)
13213 {
13214 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13215 }
13216 }
13217 }
13218 }
13219
13220
13221
13223 {
13225 {
13226 return true;
13227 }
13228
13229 return false;
13230 }
13231
13233 {
13235 {
13236 return true;
13237 }
13238
13239 return false;
13240 }
13241
13243 {
13245 {
13246 return true;
13247 }
13248
13249 return false;
13250 }
13251
13253 {
13254 return false;
13255 }
13256
13259 {
13260 return UATimeSpent.DEFAULT_DEPLOY;
13261 }
13262
13263
13264
13265
13267 {
13269 SetSynchDirty();
13270 }
13271
13273 {
13275 }
13276
13277
13279 {
13280 return false;
13281 }
13282
13285 {
13286 string att_type = "None";
13287
13288 if (ConfigIsExisting("soundAttType"))
13289 {
13290 att_type = ConfigGetString("soundAttType");
13291 }
13292
13294 }
13295
13297 {
13299 }
13300
13301
13302
13303
13304
13310
13312 {
13315
13317 }
13318
13319
13321 {
13323 return;
13324
13326
13329
13332
13333 SoundParameters params = new SoundParameters();
13337 }
13338
13339
13341 {
13343 return;
13344
13346 SetSynchDirty();
13347
13350 }
13351
13352
13354 {
13356 return;
13357
13359 SetSynchDirty();
13360
13363 }
13364
13366 {
13368 }
13369
13371 {
13373 }
13374
13377 {
13378 if (!
GetGame().IsDedicatedServer())
13379 {
13380 if (ConfigIsExisting("attachSoundSet"))
13381 {
13382 string cfg_path = "";
13383 string soundset = "";
13384 string type_name =
GetType();
13385
13388 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13389 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13390
13391 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13392 {
13393 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13394 {
13395 if (cfg_slot_array[i] == slot_type)
13396 {
13397 soundset = cfg_soundset_array[i];
13398 break;
13399 }
13400 }
13401 }
13402
13403 if (soundset != "")
13404 {
13405 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13407 }
13408 }
13409 }
13410 }
13411
13413 {
13414
13415 }
13416
13417 void OnApply(PlayerBase player);
13418
13420 {
13421 return 1.0;
13422 };
13423
13425 {
13427 }
13428
13430 {
13432 }
13433
13435
13437 {
13438 SetDynamicPhysicsLifeTime(0.01);
13440 }
13441
13443 {
13444 array<string> zone_names = new array<string>;
13445 GetDamageZones(zone_names);
13446 for (int i = 0; i < zone_names.Count(); i++)
13447 {
13448 SetHealthMax(zone_names.Get(i),"Health");
13449 }
13450 SetHealthMax("","Health");
13451 }
13452
13455 {
13456 float global_health = GetHealth01("","Health");
13457 array<string> zones = new array<string>;
13458 GetDamageZones(zones);
13459
13460 for (int i = 0; i < zones.Count(); i++)
13461 {
13462 SetHealth01(zones.Get(i),"Health",global_health);
13463 }
13464 }
13465
13468 {
13469 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13470 }
13471
13473 {
13474 if (!hasRootAsPlayer)
13475 {
13476 if (refParentIB)
13477 {
13478
13479 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13480 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13481
13482 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13483 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13484
13487 }
13488 else
13489 {
13490
13493 }
13494 }
13495 }
13496
13498 {
13500 {
13501 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13502 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13503 {
13504 float heatPermCoef = 1.0;
13506 while (ent)
13507 {
13508 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13509 ent = ent.GetHierarchyParent();
13510 }
13511
13512 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13513 }
13514 }
13515 }
13516
13518 {
13519
13520 EntityAI parent = GetHierarchyParent();
13521 if (!parent)
13522 {
13523 hasParent = false;
13524 hasRootAsPlayer = false;
13525 }
13526 else
13527 {
13528 hasParent = true;
13529 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13530 refParentIB =
ItemBase.Cast(parent);
13531 }
13532 }
13533
13534 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13535 {
13536
13537 }
13538
13540 {
13541
13542 return false;
13543 }
13544
13546 {
13547
13548
13549 return false;
13550 }
13551
13553 {
13554
13555 return false;
13556 }
13557
13560 {
13561 return !GetIsFrozen() &&
IsOpen();
13562 }
13563
13565 {
13566 bool hasParent = false, hasRootAsPlayer = false;
13568
13569 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13570 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13571
13572 if (wwtu || foodDecay)
13573 {
13577
13578 if (processWetness || processTemperature || processDecay)
13579 {
13581
13582 if (processWetness)
13583 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13584
13585 if (processTemperature)
13587
13588 if (processDecay)
13589 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13590 }
13591 }
13592 }
13593
13596 {
13598 }
13599
13601 {
13604
13605 return super.GetTemperatureFreezeThreshold();
13606 }
13607
13609 {
13612
13613 return super.GetTemperatureThawThreshold();
13614 }
13615
13617 {
13620
13621 return super.GetItemOverheatThreshold();
13622 }
13623
13625 {
13627 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13628
13629 return super.GetTemperatureFreezeTime();
13630 }
13631
13633 {
13635 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13636
13637 return super.GetTemperatureThawTime();
13638 }
13639
13644
13646 {
13647 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13648 }
13649
13651 {
13652 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13653 }
13654
13657 {
13659 }
13660
13662 {
13664 }
13665
13667 {
13669 }
13670
13673 {
13674 return null;
13675 }
13676
13679 {
13680 return false;
13681 }
13682
13684 {
13686 {
13689 if (!trg)
13690 {
13692 explosive = this;
13693 }
13694
13695 explosive.PairRemote(trg);
13697
13698 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13699 trg.SetPersistentPairID(persistentID);
13700 explosive.SetPersistentPairID(persistentID);
13701
13702 return true;
13703 }
13704 return false;
13705 }
13706
13709 {
13710 float ret = 1.0;
13713 ret *= GetHealth01();
13714
13715 return ret;
13716 }
13717
13718 #ifdef DEVELOPER
13719 override void SetDebugItem()
13720 {
13721 super.SetDebugItem();
13722 _itemBase = this;
13723 }
13724
13726 {
13727 string text = super.GetDebugText();
13728
13730 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13731
13732 return text;
13733 }
13734 #endif
13735
13737 {
13738 return true;
13739 }
13740
13742
13744
13746 {
13749 }
13750
13751
13759
13775}
13776
13778{
13780 if (entity)
13781 {
13782 bool is_item = entity.IsInherited(
ItemBase);
13783 if (is_item && full_quantity)
13784 {
13787 }
13788 }
13789 else
13790 {
13792 return NULL;
13793 }
13794 return entity;
13795}
13796
13798{
13799 if (item)
13800 {
13801 if (health > 0)
13802 item.SetHealth("", "", health);
13803
13804 if (item.CanHaveTemperature())
13805 {
13807 if (item.CanFreeze())
13808 item.SetFrozen(false);
13809 }
13810
13811 if (item.HasEnergyManager())
13812 {
13813 if (quantity >= 0)
13814 {
13815 item.GetCompEM().SetEnergy0To1(quantity);
13816 }
13817 else
13818 {
13820 }
13821 }
13822 else if (item.IsMagazine())
13823 {
13824 Magazine mag = Magazine.Cast(item);
13825 if (quantity >= 0)
13826 {
13827 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13828 }
13829 else
13830 {
13832 }
13833
13834 }
13835 else
13836 {
13837 if (quantity >= 0)
13838 {
13839 item.SetQuantityNormalized(quantity, false);
13840 }
13841 else
13842 {
13844 }
13845
13846 }
13847 }
13848}
13849
13850#ifdef DEVELOPER
13852#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.