Plays sound on item attach. Be advised, the config structure may slightly change in 1.11 update to allow for more complex use.
9154{
9156 {
9157 return true;
9158 }
9159};
9160
9161
9162
9164{
9168
9170
9173
9174
9175
9176
9177
9186
9192
9197
9202
9223 protected bool m_IsResultOfSplit
9224
9226
9231
9232
9233
9235
9239
9240
9241
9243
9246
9247
9248
9254
9255
9263
9266
9267
9269
9270
9272
9273
9278
9279
9284
9285
9287
9288
9290 {
9295
9296 if (!
GetGame().IsDedicatedServer())
9297 {
9299 {
9301
9303 {
9305 }
9306 }
9307
9310 }
9311
9312 m_OldLocation = null;
9313
9315 {
9317 }
9318
9319 if (ConfigIsExisting("headSelectionsToHide"))
9320 {
9323 }
9324
9326 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9327 {
9329 }
9330
9332
9333 m_IsResultOfSplit = false;
9334
9336 }
9337
9339 {
9340 super.InitItemVariables();
9341
9347 m_Count = ConfigGetInt(
"count");
9348
9351
9356
9359
9364
9376
9380
9381
9384 if (ConfigIsExisting("canBeSplit"))
9385 {
9388 }
9389
9391 if (ConfigIsExisting("itemBehaviour"))
9393
9394
9397 RegisterNetSyncVariableInt("m_VarLiquidType");
9398 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9399
9400 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9401 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9402 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9403
9404 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9405 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9406 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9407 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9408
9409 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9410 RegisterNetSyncVariableBool("m_IsTakeable");
9411 RegisterNetSyncVariableBool("m_IsHologram");
9412
9415 {
9418 }
9419
9421
9423 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9425
9426 }
9427
9429 {
9431 }
9432
9434 {
9437 {
9442 }
9443 }
9444
9445 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9446 {
9448 {
9451 }
9452
9454 }
9455
9457 {
9463 }
9464
9466
9468 {
9470
9471 if (!action)
9472 {
9473 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9474 return;
9475 }
9476
9478 if (!ai)
9479 {
9481 return;
9482 }
9483
9485 if (!action_array)
9486 {
9487 action_array = new array<ActionBase_Basic>;
9489 }
9490 if (LogManager.IsActionLogEnable())
9491 {
9492 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9493 }
9494
9495 if (action_array.Find(action) != -1)
9496 {
9497 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9498 }
9499 else
9500 {
9501 action_array.Insert(action);
9502 }
9503 }
9504
9506 {
9508 ActionBase action = player.GetActionManager().GetAction(actionName);
9511
9512 if (action_array)
9513 {
9514 action_array.RemoveItem(action);
9515 }
9516 }
9517
9518
9519
9521 {
9522 ActionOverrideData overrideData = new ActionOverrideData();
9526
9528 if (!actionMap)
9529 {
9532 }
9533
9534 actionMap.Insert(this.
Type(), overrideData);
9535
9536 }
9537
9539
9541
9542
9544 {
9547
9550
9551 string config_to_search = "CfgVehicles";
9552 string muzzle_owner_config;
9553
9555 {
9556 if (IsInherited(Weapon))
9557 config_to_search = "CfgWeapons";
9558
9559 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9560
9561 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9562
9564
9565 if (config_OnFire_subclass_count > 0)
9566 {
9567 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9568
9569 for (int i = 0; i < config_OnFire_subclass_count; i++)
9570 {
9571 string particle_class = "";
9573 string config_OnFire_entry = config_OnFire_class + particle_class;
9574 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9575 WPOF_array.Insert(WPOF);
9576 }
9577
9578
9580 }
9581 }
9582
9584 {
9585 config_to_search = "CfgWeapons";
9586 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9587
9588 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9589
9591
9592 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9593 {
9594 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9595
9596 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9597 {
9598 string particle_class2 = "";
9600 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9601 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9602 WPOBE_array.Insert(WPOBE);
9603 }
9604
9605
9607 }
9608 }
9609 }
9610
9611
9613 {
9616
9618 {
9619 string config_to_search = "CfgVehicles";
9620
9621 if (IsInherited(Weapon))
9622 config_to_search = "CfgWeapons";
9623
9624 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9625 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9626
9627 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9628 {
9629
9631
9633 {
9635 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9637 return;
9638 }
9639
9642
9643
9644
9646 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9647
9648 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9649 {
9650 string particle_class = "";
9652 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9654
9655 if (entry_type == CT_CLASS)
9656 {
9657 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9658 WPOOH_array.Insert(WPOF);
9659 }
9660 }
9661
9662
9664 }
9665 }
9666 }
9667
9669 {
9671 }
9672
9674 {
9676 {
9678
9681
9684
9685 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9686 }
9687 }
9688
9690 {
9692 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9693
9695 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9696
9698 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9699
9701 {
9703 }
9704 }
9705
9707 {
9709 }
9710
9712 {
9715 else
9717
9719 {
9722 }
9723 else
9724 {
9727
9730 }
9731
9733 }
9734
9736 {
9738 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9739 }
9740
9742 {
9744 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9746 }
9747
9749 {
9751 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9752 }
9753
9755 {
9758
9759 OverheatingParticle OP = new OverheatingParticle();
9764
9766 }
9767
9769 {
9772
9773 return -1;
9774 }
9775
9777 {
9779 {
9782
9783 for (int i = count; i > 0; --i)
9784 {
9785 int id = i - 1;
9788
9791
9792 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9793 {
9794 if (p)
9795 {
9798 }
9799 }
9800 }
9801 }
9802 }
9803
9805 {
9807 {
9809 {
9810 int id = i - 1;
9812
9813 if (OP)
9814 {
9816
9817 if (p)
9818 {
9820 }
9821
9822 delete OP;
9823 }
9824 }
9825
9828 }
9829 }
9830
9833 {
9834 return 0.0;
9835 }
9836
9837
9839 {
9840 return 250;
9841 }
9842
9844 {
9845 return 0;
9846 }
9847
9850 {
9852 return true;
9853
9854 return false;
9855 }
9856
9859 {
9862
9864 {
9866 }
9867 else
9868 {
9869
9871 }
9872
9874 }
9875
9882 {
9883 return -1;
9884 }
9885
9886
9887
9888
9890 {
9892 {
9894 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9895
9896 if (r_index >= 0)
9897 {
9898 InventoryLocation r_il = new InventoryLocation;
9899 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9900
9901 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9904 {
9905 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9906 }
9908 {
9909 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9910 }
9911
9912 }
9913
9914 player.GetHumanInventory().ClearUserReservedLocation(this);
9915 }
9916
9919 }
9920
9921
9922
9923
9925 {
9926 return ItemBase.m_DebugActionsMask;
9927 }
9928
9930 {
9931 return ItemBase.m_DebugActionsMask & mask;
9932 }
9933
9935 {
9936 ItemBase.m_DebugActionsMask = mask;
9937 }
9938
9940 {
9941 ItemBase.m_DebugActionsMask |= mask;
9942 }
9943
9945 {
9946 ItemBase.m_DebugActionsMask &= ~mask;
9947 }
9948
9950 {
9952 {
9954 }
9955 else
9956 {
9958 }
9959 }
9960
9961
9963 {
9964 if (GetEconomyProfile())
9965 {
9966 float q_max = GetEconomyProfile().GetQuantityMax();
9967 if (q_max > 0)
9968 {
9969 float q_min = GetEconomyProfile().GetQuantityMin();
9970 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9971
9973 {
9974 ComponentEnergyManager comp = GetCompEM();
9976 {
9978 }
9979 }
9981 {
9983
9984 }
9985
9986 }
9987 }
9988 }
9989
9992 {
9993 EntityAI parent = GetHierarchyParent();
9994
9995 if (parent)
9996 {
9997 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9998 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9999 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10000 }
10001 }
10002
10005 {
10006 EntityAI parent = GetHierarchyParent();
10007
10008 if (parent)
10009 {
10010 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10011 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10012 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10013 }
10014 }
10015
10017 {
10018
10019
10020
10021
10023
10025 {
10026 if (ScriptInputUserData.CanStoreInputUserData())
10027 {
10028 ScriptInputUserData ctx = new ScriptInputUserData;
10034 ctx.
Write(use_stack_max);
10037
10039 {
10040 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10041 }
10042 }
10043 }
10044 else if (!
GetGame().IsMultiplayer())
10045 {
10047 }
10048 }
10049
10051 {
10053 }
10054
10056 {
10058 }
10059
10061 {
10063 }
10064
10066 {
10067
10068 return false;
10069 }
10070
10072 {
10073 return false;
10074 }
10075
10079 {
10080 return false;
10081 }
10082
10084 {
10085 return "";
10086 }
10087
10089
10091 {
10092 return false;
10093 }
10094
10096 {
10097 return true;
10098 }
10099
10100
10101
10103 {
10104 return true;
10105 }
10106
10108 {
10109 return true;
10110 }
10111
10113 {
10114 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10116 }
10117
10119 {
10121 }
10122
10124 {
10126 if (!is_being_placed)
10128 SetSynchDirty();
10129 }
10130
10131
10133
10135 {
10137 }
10138
10140 {
10142 }
10143
10145 {
10146 return 1;
10147 }
10148
10150 {
10151 return false;
10152 }
10153
10155 {
10157 SetSynchDirty();
10158 }
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10195 {
10196 super.OnMovedInsideCargo(container);
10197
10198 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10199 }
10200
10201 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10202 {
10203 super.EEItemLocationChanged(oldLoc,newLoc);
10204
10205 PlayerBase new_player = null;
10206 PlayerBase old_player = null;
10207
10208 if (newLoc.GetParent())
10209 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10210
10211 if (oldLoc.GetParent())
10212 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10213
10215 {
10216 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10217
10218 if (r_index >= 0)
10219 {
10220 InventoryLocation r_il = new InventoryLocation;
10221 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10222
10223 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10226 {
10227 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10228 }
10230 {
10231 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10232 }
10233
10234 }
10235 }
10236
10238 {
10239 if (new_player)
10240 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10241
10242 if (new_player == old_player)
10243 {
10244
10245 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10246 {
10248 {
10249 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10250 {
10251 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10252 }
10253 }
10254 else
10255 {
10256 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10257 }
10258 }
10259
10260 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10261 {
10262 int type = oldLoc.GetType();
10264 {
10265 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10266 }
10268 {
10269 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10270 }
10271 }
10272 if (!m_OldLocation)
10273 {
10274 m_OldLocation = new InventoryLocation;
10275 }
10276 m_OldLocation.Copy(oldLoc);
10277 }
10278 else
10279 {
10280 if (m_OldLocation)
10281 {
10282 m_OldLocation.Reset();
10283 }
10284 }
10285
10287 }
10288 else
10289 {
10290 if (new_player)
10291 {
10292 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10293 if (res_index >= 0)
10294 {
10295 InventoryLocation il = new InventoryLocation;
10296 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10298 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10301 {
10302 il.
GetParent().GetOnReleaseLock().Invoke(it);
10303 }
10305 {
10307 }
10308
10309 }
10310 }
10312 {
10313
10315 }
10316
10317 if (m_OldLocation)
10318 {
10319 m_OldLocation.Reset();
10320 }
10321 }
10322 }
10323
10324 override void EOnContact(IEntity other, Contact extra)
10325 {
10327 {
10328 int liquidType = -1;
10330 if (impactSpeed > 0.0)
10331 {
10333 #ifndef SERVER
10335 #else
10337 SetSynchDirty();
10338 #endif
10340 }
10341 }
10342
10343 #ifdef SERVER
10344 if (GetCompEM() && GetCompEM().IsPlugged())
10345 {
10346 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10347 GetCompEM().UnplugThis();
10348 }
10349 #endif
10350 }
10351
10353
10355 {
10357 }
10358
10360 {
10361
10362 }
10363
10365 {
10366 super.OnItemLocationChanged(old_owner, new_owner);
10367
10368 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10369 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10370
10371 if (!relatedPlayer && playerNew)
10372 relatedPlayer = playerNew;
10373
10374 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10375 {
10377 if (actionMgr)
10378 {
10379 ActionBase currentAction = actionMgr.GetRunningAction();
10380 if (currentAction)
10382 }
10383 }
10384
10385 Man ownerPlayerOld = null;
10386 Man ownerPlayerNew = null;
10387
10388 if (old_owner)
10389 {
10390 if (old_owner.
IsMan())
10391 {
10392 ownerPlayerOld = Man.Cast(old_owner);
10393 }
10394 else
10395 {
10396 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10397 }
10398 }
10399 else
10400 {
10402 {
10404
10405 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10406 {
10407 GetCompEM().UnplugThis();
10408 }
10409 }
10410 }
10411
10412 if (new_owner)
10413 {
10414 if (new_owner.
IsMan())
10415 {
10416 ownerPlayerNew = Man.Cast(new_owner);
10417 }
10418 else
10419 {
10420 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10421 }
10422 }
10423
10424 if (ownerPlayerOld != ownerPlayerNew)
10425 {
10426 if (ownerPlayerOld)
10427 {
10428 array<EntityAI> subItemsExit = new array<EntityAI>;
10430 for (int i = 0; i < subItemsExit.Count(); i++)
10431 {
10434 }
10435 }
10436
10437 if (ownerPlayerNew)
10438 {
10439 array<EntityAI> subItemsEnter = new array<EntityAI>;
10441 for (int j = 0; j < subItemsEnter.Count(); j++)
10442 {
10445 }
10446 }
10447 }
10448 else if (ownerPlayerNew != null)
10449 {
10450 PlayerBase nplayer;
10451 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10452 {
10453 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10455 for (int k = 0; k < subItemsUpdate.Count(); k++)
10456 {
10458 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10459 }
10460 }
10461 }
10462
10463 if (old_owner)
10464 old_owner.OnChildItemRemoved(this);
10465 if (new_owner)
10466 new_owner.OnChildItemReceived(this);
10467 }
10468
10469
10471 {
10472 super.EEDelete(parent);
10473 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10474 if (player)
10475 {
10477
10478 if (player.IsAlive())
10479 {
10480 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10481 if (r_index >= 0)
10482 {
10483 InventoryLocation r_il = new InventoryLocation;
10484 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10485
10486 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10489 {
10490 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10491 }
10493 {
10494 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10495 }
10496
10497 }
10498
10499 player.RemoveQuickBarEntityShortcut(this);
10500 }
10501 }
10502 }
10503
10505 {
10506 super.EEKilled(killer);
10507
10510 {
10511 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10512 {
10513 if (IsMagazine())
10514 {
10515 if (Magazine.Cast(this).GetAmmoCount() > 0)
10516 {
10518 }
10519 }
10520 else
10521 {
10523 }
10524 }
10525 }
10526 }
10527
10529 {
10530 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10531
10532 super.OnWasAttached(parent, slot_id);
10533
10536
10538 }
10539
10541 {
10542 super.OnWasDetached(parent, slot_id);
10543
10546 }
10547
10549 {
10550 int idx;
10553
10554 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10555 if (inventory_slots.Count() < 1)
10556 {
10557 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10558 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10559 }
10560 else
10561 {
10562 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10563 }
10564
10565 idx = inventory_slots.Find(slot);
10566 if (idx < 0)
10567 return "";
10568
10569 return attach_types.Get(idx);
10570 }
10571
10573 {
10574 int idx = -1;
10575 string slot;
10576
10579
10580 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10581 if (inventory_slots.Count() < 1)
10582 {
10583 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10584 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10585 }
10586 else
10587 {
10588 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10589 if (detach_types.Count() < 1)
10590 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10591 }
10592
10593 for (int i = 0; i < inventory_slots.Count(); i++)
10594 {
10595 slot = inventory_slots.Get(i);
10596 }
10597
10598 if (slot != "")
10599 {
10600 if (detach_types.Count() == 1)
10601 idx = 0;
10602 else
10603 idx = inventory_slots.Find(slot);
10604 }
10605 if (idx < 0)
10606 return "";
10607
10608 return detach_types.Get(idx);
10609 }
10610
10612 {
10613
10615
10616
10617 float min_time = 1;
10618 float max_time = 3;
10619 float delay = Math.RandomFloat(min_time, max_time);
10620
10621 explode_timer.Run(delay, this, "DoAmmoExplosion");
10622 }
10623
10625 {
10626 Magazine magazine = Magazine.Cast(this);
10627 int pop_sounds_count = 6;
10628 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10629
10630
10631 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10632 string sound_name = pop_sounds[ sound_idx ];
10634
10635
10636 magazine.ServerAddAmmoCount(-1);
10637
10638
10639 float min_temp_to_explode = 100;
10640
10641 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
10642 {
10644 }
10645 }
10646
10647
10648 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10649 {
10650 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10651
10652 const int CHANCE_DAMAGE_CARGO = 4;
10653 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10654 const int CHANCE_DAMAGE_NOTHING = 2;
10655
10657 {
10658 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10659 int chances;
10660 int rnd;
10661
10662 if (GetInventory().GetCargo())
10663 {
10664 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10665 rnd = Math.RandomInt(0,chances);
10666
10667 if (rnd < CHANCE_DAMAGE_CARGO)
10668 {
10670 }
10671 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10672 {
10674 }
10675 }
10676 else
10677 {
10678 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10679 rnd = Math.RandomInt(0,chances);
10680
10681 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10682 {
10684 }
10685 }
10686 }
10687 }
10688
10690 {
10691 if (GetInventory().GetCargo())
10692 {
10693 int item_count = GetInventory().GetCargo().GetItemCount();
10694 if (item_count > 0)
10695 {
10696 int random_pick = Math.RandomInt(0, item_count);
10698 if (!item.IsExplosive())
10699 {
10700 item.AddHealth("","",damage);
10701 return true;
10702 }
10703 }
10704 }
10705 return false;
10706 }
10707
10709 {
10710 int attachment_count = GetInventory().AttachmentCount();
10711 if (attachment_count > 0)
10712 {
10713 int random_pick = Math.RandomInt(0, attachment_count);
10714 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10715 if (!attachment.IsExplosive())
10716 {
10717 attachment.AddHealth("","",damage);
10718 return true;
10719 }
10720 }
10721 return false;
10722 }
10723
10725 {
10727 }
10728
10730 {
10732 return GetInventory().CanRemoveEntity();
10733
10734 return false;
10735 }
10736
10738 {
10740 return;
10741
10743 {
10744 if (ScriptInputUserData.CanStoreInputUserData())
10745 {
10746 ScriptInputUserData ctx = new ScriptInputUserData;
10751 ctx.
Write(destination_entity);
10753 ctx.
Write(slot_id);
10755 }
10756 }
10757 else if (!
GetGame().IsMultiplayer())
10758 {
10760 }
10761 }
10762
10764 {
10766 return;
10767
10768 float split_quantity_new;
10772 InventoryLocation loc = new InventoryLocation;
10773
10774 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10775 {
10777 split_quantity_new = stack_max;
10778 else
10780
10781 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10782 if (new_item)
10783 {
10784 new_item.SetResultOfSplit(true);
10785 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10787 new_item.SetQuantity(split_quantity_new);
10788 }
10789 }
10790 else if (destination_entity && slot_id == -1)
10791 {
10792 if (quantity > stack_max)
10793 split_quantity_new = stack_max;
10794 else
10795 split_quantity_new = quantity;
10796
10798 {
10801 }
10802
10803 if (new_item)
10804 {
10805 new_item.SetResultOfSplit(true);
10806 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10808 new_item.SetQuantity(split_quantity_new);
10809 }
10810 }
10811 else
10812 {
10813 if (stack_max != 0)
10814 {
10816 {
10818 }
10819
10820 if (split_quantity_new == 0)
10821 {
10822 if (!
GetGame().IsMultiplayer())
10823 player.PhysicalPredictiveDropItem(this);
10824 else
10825 player.ServerDropEntity(this);
10826 return;
10827 }
10828
10830
10831 if (new_item)
10832 {
10833 new_item.SetResultOfSplit(true);
10834 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10836 new_item.SetQuantity(stack_max);
10837 new_item.PlaceOnSurface();
10838 }
10839 }
10840 }
10841 }
10842
10844 {
10846 return;
10847
10848 float split_quantity_new;
10852 InventoryLocation loc = new InventoryLocation;
10853
10854 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10855 {
10857 split_quantity_new = stack_max;
10858 else
10860
10861 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10862 if (new_item)
10863 {
10864 new_item.SetResultOfSplit(true);
10865 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10867 new_item.SetQuantity(split_quantity_new);
10868 }
10869 }
10870 else if (destination_entity && slot_id == -1)
10871 {
10872 if (quantity > stack_max)
10873 split_quantity_new = stack_max;
10874 else
10875 split_quantity_new = quantity;
10876
10878 {
10881 }
10882
10883 if (new_item)
10884 {
10885 new_item.SetResultOfSplit(true);
10886 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10888 new_item.SetQuantity(split_quantity_new);
10889 }
10890 }
10891 else
10892 {
10893 if (stack_max != 0)
10894 {
10896 {
10898 }
10899
10901
10902 if (new_item)
10903 {
10904 new_item.SetResultOfSplit(true);
10905 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10907 new_item.SetQuantity(stack_max);
10908 new_item.PlaceOnSurface();
10909 }
10910 }
10911 }
10912 }
10913
10915 {
10917 return;
10918
10920 {
10921 if (ScriptInputUserData.CanStoreInputUserData())
10922 {
10923 ScriptInputUserData ctx = new ScriptInputUserData;
10928 dst.WriteToContext(ctx);
10930 }
10931 }
10932 else if (!
GetGame().IsMultiplayer())
10933 {
10935 }
10936 }
10937
10939 {
10941 return;
10942
10944 {
10945 if (ScriptInputUserData.CanStoreInputUserData())
10946 {
10947 ScriptInputUserData ctx = new ScriptInputUserData;
10952 ctx.
Write(destination_entity);
10958 }
10959 }
10960 else if (!
GetGame().IsMultiplayer())
10961 {
10963 }
10964 }
10965
10967 {
10969 }
10970
10972 {
10974 return this;
10975
10977 float split_quantity_new;
10979 if (dst.IsValid())
10980 {
10981 int slot_id = dst.GetSlot();
10983
10984 if (quantity > stack_max)
10985 split_quantity_new = stack_max;
10986 else
10987 split_quantity_new = quantity;
10988
10990
10991 if (new_item)
10992 {
10993 new_item.SetResultOfSplit(true);
10994 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10997 }
10998
10999 return new_item;
11000 }
11001
11002 return null;
11003 }
11004
11006 {
11008 return;
11009
11011 float split_quantity_new;
11013 if (destination_entity)
11014 {
11016 if (quantity > stackable)
11017 split_quantity_new = stackable;
11018 else
11019 split_quantity_new = quantity;
11020
11021 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11022 if (new_item)
11023 {
11024 new_item.SetResultOfSplit(true);
11025 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11027 new_item.SetQuantity(split_quantity_new);
11028 }
11029 }
11030 }
11031
11033 {
11035 return;
11036
11038 {
11039 if (ScriptInputUserData.CanStoreInputUserData())
11040 {
11041 ScriptInputUserData ctx = new ScriptInputUserData;
11046 ItemBase destination_entity =
this;
11047 ctx.
Write(destination_entity);
11051 }
11052 }
11053 else if (!
GetGame().IsMultiplayer())
11054 {
11056 }
11057 }
11058
11060 {
11062 return;
11063
11065 float split_quantity_new;
11067 if (player)
11068 {
11070 if (quantity > stackable)
11071 split_quantity_new = stackable;
11072 else
11073 split_quantity_new = quantity;
11074
11075 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11076 new_item =
ItemBase.Cast(in_hands);
11077 if (new_item)
11078 {
11079 new_item.SetResultOfSplit(true);
11080 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11082 new_item.SetQuantity(split_quantity_new);
11083 }
11084 }
11085 }
11086
11088 {
11090 return;
11091
11093 float split_quantity_new = Math.Floor(quantity * 0.5);
11094
11096
11097 if (new_item)
11098 {
11099 if (new_item.GetQuantityMax() < split_quantity_new)
11100 {
11101 split_quantity_new = new_item.GetQuantityMax();
11102 }
11103
11104 new_item.SetResultOfSplit(true);
11105 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11106
11108 {
11111 }
11112 else
11113 {
11116 }
11117 }
11118 }
11119
11121 {
11123 return;
11124
11126 float split_quantity_new = Math.Floor(quantity / 2);
11127
11128 InventoryLocation invloc = new InventoryLocation;
11130
11132 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11133
11134 if (new_item)
11135 {
11136 if (new_item.GetQuantityMax() < split_quantity_new)
11137 {
11138 split_quantity_new = new_item.GetQuantityMax();
11139 }
11141 {
11144 }
11145 else
11146 {
11149 }
11150 }
11151 }
11152
11155 {
11156 SetWeightDirty();
11158
11159 if (parent)
11160 parent.OnAttachmentQuantityChangedEx(this, delta);
11161
11163 {
11165 {
11167 }
11169 {
11170 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11172 }
11173 }
11174
11175 }
11176
11179 {
11180
11181 }
11182
11185 {
11187 }
11188
11190 {
11191 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11192
11194 {
11195 if (newLevel == GameConstants.STATE_RUINED)
11196 {
11198 EntityAI parent = GetHierarchyParent();
11199 if (parent && parent.IsFireplace())
11200 {
11201 CargoBase cargo = GetInventory().GetCargo();
11202 if (cargo)
11203 {
11205 {
11207 }
11208 }
11209 }
11210 }
11211
11213 {
11214
11216 return;
11217 }
11218
11219 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11220 {
11222 }
11223 }
11224 }
11225
11226
11228 {
11229 super.OnRightClick();
11230
11232 {
11234 {
11235 if (ScriptInputUserData.CanStoreInputUserData())
11236 {
11237 vector m4[4];
11239
11240 EntityAI root = GetHierarchyRoot();
11241
11242 InventoryLocation dst = new InventoryLocation;
11244 {
11245 if (root)
11246 {
11247 root.GetTransform(m4);
11249 }
11250 else
11251 GetInventory().GetCurrentInventoryLocation(dst);
11252 }
11253 else
11254 {
11256
11257
11258 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11259 {
11260 if (root)
11261 {
11262 root.GetTransform(m4);
11264 }
11265 else
11266 GetInventory().GetCurrentInventoryLocation(dst);
11267 }
11268 else
11269 {
11270 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11271 }
11272 }
11273
11274 ScriptInputUserData ctx = new ScriptInputUserData;
11282 }
11283 }
11284 else if (!
GetGame().IsMultiplayer())
11285 {
11287 }
11288 }
11289 }
11290
11291 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11292 {
11293
11294 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11295 return false;
11296
11297 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11298 return false;
11299
11300
11302 return false;
11303
11304
11305 Magazine mag = Magazine.Cast(this);
11306 if (mag)
11307 {
11308 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11309 return false;
11310
11311 if (stack_max_limit)
11312 {
11313 Magazine other_mag = Magazine.Cast(other_item);
11314 if (other_item)
11315 {
11316 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11317 return false;
11318 }
11319
11320 }
11321 }
11322 else
11323 {
11324
11326 return false;
11327
11329 return false;
11330 }
11331
11332 PlayerBase player = null;
11333 if (CastTo(player, GetHierarchyRootPlayer()))
11334 {
11335 if (player.GetInventory().HasAttachment(this))
11336 return false;
11337
11338 if (player.IsItemsToDelete())
11339 return false;
11340 }
11341
11342 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11343 return false;
11344
11345 int slotID;
11347 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11348 return false;
11349
11350 return true;
11351 }
11352
11354 {
11356 }
11357
11359 {
11360 return m_IsResultOfSplit;
11361 }
11362
11364 {
11365 m_IsResultOfSplit = value;
11366 }
11367
11369 {
11371 }
11372
11374 {
11375 float other_item_quantity = other_item.GetQuantity();
11376 float this_free_space;
11377
11379
11381
11382 if (other_item_quantity > this_free_space)
11383 {
11384 return this_free_space;
11385 }
11386 else
11387 {
11388 return other_item_quantity;
11389 }
11390 }
11391
11393 {
11395 }
11396
11398 {
11400 return;
11401
11402 if (!IsMagazine() && other_item)
11403 {
11405 if (quantity_used != 0)
11406 {
11407 float hp1 = GetHealth01("","");
11408 float hp2 = other_item.GetHealth01("","");
11409 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11410 hpResult = hpResult / (
GetQuantity() + quantity_used);
11411
11412 hpResult *= GetMaxHealth();
11413 Math.Round(hpResult);
11414 SetHealth("", "Health", hpResult);
11415
11417 other_item.AddQuantity(-quantity_used);
11418 }
11419 }
11421 }
11422
11424 {
11425 #ifdef SERVER
11426 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11427 GetHierarchyParent().IncreaseLifetimeUp();
11428 #endif
11429 };
11430
11432 {
11433 PlayerBase p = PlayerBase.Cast(player);
11434
11435 array<int> recipesIds = p.m_Recipes;
11436 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11437 if (moduleRecipesManager)
11438 {
11439 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11440 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11441 }
11442
11443 for (int i = 0;i < recipesIds.Count(); i++)
11444 {
11445 int key = recipesIds.Get(i);
11446 string recipeName = moduleRecipesManager.GetRecipeName(key);
11448 }
11449 }
11450
11451
11452 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11453 {
11454 super.GetDebugActions(outputList);
11455
11456
11461
11462
11466
11470
11471
11474
11475
11477 {
11480 }
11481
11483
11486
11490 }
11491
11492
11493
11494
11496 {
11497 super.OnAction(action_id, player, ctx);
11498 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11499 {
11500 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11501 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11502 PlayerBase p = PlayerBase.Cast(player);
11503 if (
EActions.RECIPES_RANGE_START < 1000)
11504 {
11505 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11506 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11507 }
11508 }
11509 #ifndef SERVER
11510 else if (action_id ==
EActions.WATCH_PLAYER)
11511 {
11512 PluginDeveloper.SetDeveloperItemClientEx(player);
11513 }
11514 #endif
11516 {
11517 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11518 {
11519 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11520 OnDebugButtonPressServer(id + 1);
11521 }
11522
11523 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11524 {
11525 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11527 }
11528
11529 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11530 {
11531 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11533 }
11534
11535 else if (action_id ==
EActions.ADD_QUANTITY)
11536 {
11537 if (IsMagazine())
11538 {
11539 Magazine mag = Magazine.Cast(this);
11540 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11541 }
11542 else
11543 {
11545 }
11546
11547 if (m_EM)
11548 {
11549 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11550 }
11551
11552 }
11553
11554 else if (action_id ==
EActions.REMOVE_QUANTITY)
11555 {
11556 if (IsMagazine())
11557 {
11558 Magazine mag2 = Magazine.Cast(this);
11559 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11560 }
11561 else
11562 {
11564 }
11565 if (m_EM)
11566 {
11567 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11568 }
11569
11570 }
11571
11572 else if (action_id ==
EActions.SET_QUANTITY_0)
11573 {
11575
11576 if (m_EM)
11577 {
11578 m_EM.SetEnergy(0);
11579 }
11580 }
11581
11582 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11583 {
11585
11586 if (m_EM)
11587 {
11588 m_EM.SetEnergy(m_EM.GetEnergyMax());
11589 }
11590 }
11591
11592 else if (action_id ==
EActions.ADD_HEALTH)
11593 {
11594 AddHealth("","",GetMaxHealth("","Health")/5);
11595 }
11596 else if (action_id ==
EActions.REMOVE_HEALTH)
11597 {
11598 AddHealth("","",-GetMaxHealth("","Health")/5);
11599 }
11600 else if (action_id ==
EActions.DESTROY_HEALTH)
11601 {
11602 SetHealth01("","",0);
11603 }
11604 else if (action_id ==
EActions.WATCH_ITEM)
11605 {
11607 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11608 #ifdef DEVELOPER
11609 SetDebugDeveloper_item(this);
11610 #endif
11611 }
11612
11613 else if (action_id ==
EActions.ADD_TEMPERATURE)
11614 {
11615 AddTemperature(20);
11616
11617 }
11618
11619 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11620 {
11621 AddTemperature(-20);
11622
11623 }
11624
11625 else if (action_id ==
EActions.FLIP_FROZEN)
11626 {
11627 SetFrozen(!GetIsFrozen());
11628
11629 }
11630
11631 else if (action_id ==
EActions.ADD_WETNESS)
11632 {
11634
11635 }
11636
11637 else if (action_id ==
EActions.REMOVE_WETNESS)
11638 {
11640
11641 }
11642
11643 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11644 {
11647
11648
11649 }
11650
11651 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11652 {
11655 }
11656
11657 else if (action_id ==
EActions.MAKE_SPECIAL)
11658 {
11659 auto debugParams = DebugSpawnParams.WithPlayer(player);
11660 OnDebugSpawnEx(debugParams);
11661 }
11662
11663 else if (action_id ==
EActions.DELETE)
11664 {
11665 Delete();
11666 }
11667
11668 }
11669
11670
11671 return false;
11672 }
11673
11674
11675
11676
11680
11683
11684
11685
11687 {
11688 return false;
11689 }
11690
11691
11693 {
11694 return true;
11695 }
11696
11697
11699 {
11700 return true;
11701 }
11702
11703
11704
11706 {
11707 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11709 }
11710
11713 {
11714 return null;
11715 }
11716
11718 {
11719 return false;
11720 }
11721
11723 {
11724 return false;
11725 }
11726
11730
11731
11733 {
11734 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11735 return module_repairing.CanRepair(this, item_repair_kit);
11736 }
11737
11738
11739 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11740 {
11741 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11742 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11743 }
11744
11745
11747 {
11748
11749
11750
11751
11752
11753
11754
11755
11756 return 1;
11757 }
11758
11759
11760
11762 {
11764 }
11765
11766
11767
11769 {
11771 }
11772
11773
11782 {
11783 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11784
11785 if (player)
11786 {
11787 player.MessageStatus(text);
11788 }
11789 }
11790
11791
11800 {
11801 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11802
11803 if (player)
11804 {
11805 player.MessageAction(text);
11806 }
11807 }
11808
11809
11818 {
11819 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11820
11821 if (player)
11822 {
11823 player.MessageFriendly(text);
11824 }
11825 }
11826
11827
11836 {
11837 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11838
11839 if (player)
11840 {
11841 player.MessageImportant(text);
11842 }
11843 }
11844
11846 {
11847 return true;
11848 }
11849
11850
11851 override bool KindOf(
string tag)
11852 {
11853 bool found = false;
11854 string item_name = this.
GetType();
11857
11858 int array_size = item_tag_array.Count();
11859 for (int i = 0; i < array_size; i++)
11860 {
11861 if (item_tag_array.Get(i) == tag)
11862 {
11863 found = true;
11864 break;
11865 }
11866 }
11867 return found;
11868 }
11869
11870
11872 {
11873
11874 super.OnRPC(sender, rpc_type,ctx);
11875
11876
11877 switch (rpc_type)
11878 {
11879 #ifndef SERVER
11880 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11881 Param2<bool, string> p = new Param2<bool, string>(false, "");
11882
11884 return;
11885
11886 bool play = p.param1;
11887 string soundSet = p.param2;
11888
11889 if (play)
11890 {
11892 {
11894 {
11896 }
11897 }
11898 else
11899 {
11901 }
11902 }
11903 else
11904 {
11906 }
11907
11908 break;
11909 #endif
11910
11911 }
11912
11914 {
11916 }
11917 }
11918
11919
11920
11921
11923 {
11924 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11925 return plugin.GetID(
name);
11926 }
11927
11929 {
11930 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11931 return plugin.GetName(id);
11932 }
11933
11936 {
11937
11938
11939 int varFlags;
11940 if (!ctx.
Read(varFlags))
11941 return;
11942
11943 if (varFlags & ItemVariableFlags.FLOAT)
11944 {
11946 }
11947 }
11948
11950 {
11951
11952 super.SerializeNumericalVars(floats_out);
11953
11954
11955
11957 {
11959 }
11960
11962 {
11964 }
11965
11967 {
11969 }
11970
11972 {
11977 }
11978
11980 {
11982 }
11983 }
11984
11986 {
11987
11988 super.DeSerializeNumericalVars(floats);
11989
11990
11991 int index = 0;
11992 int mask = Math.Round(floats.Get(index));
11993
11994 index++;
11995
11997 {
11999 {
12001 }
12002 else
12003 {
12004 float quantity = floats.Get(index);
12005 SetQuantity(quantity,
true,
false,
false,
false);
12006 }
12007 index++;
12008 }
12009
12011 {
12012 float wet = floats.Get(index);
12014 index++;
12015 }
12016
12018 {
12019 int liquidtype = Math.Round(floats.Get(index));
12021 index++;
12022 }
12023
12025 {
12027 index++;
12029 index++;
12031 index++;
12033 index++;
12034 }
12035
12037 {
12038 int cleanness = Math.Round(floats.Get(index));
12040 index++;
12041 }
12042 }
12043
12045 {
12046 super.WriteVarsToCTX(ctx);
12047
12048
12050 {
12052 }
12053
12055 {
12057 }
12058
12060 {
12062 }
12063
12065 {
12066 int r,g,b,a;
12072 }
12073
12075 {
12077 }
12078 }
12079
12081 {
12082 if (!super.ReadVarsFromCTX(ctx,version))
12083 return false;
12084
12085 int intValue;
12086 float value;
12087
12088 if (version < 140)
12089 {
12090 if (!ctx.
Read(intValue))
12091 return false;
12092
12093 m_VariablesMask = intValue;
12094 }
12095
12097 {
12098 if (!ctx.
Read(value))
12099 return false;
12100
12102 {
12104 }
12105 else
12106 {
12108 }
12109 }
12110
12111 if (version < 140)
12112 {
12114 {
12115 if (!ctx.
Read(value))
12116 return false;
12117 SetTemperatureDirect(value);
12118 }
12119 }
12120
12122 {
12123 if (!ctx.
Read(value))
12124 return false;
12126 }
12127
12129 {
12130 if (!ctx.
Read(intValue))
12131 return false;
12133 }
12134
12136 {
12137 int r,g,b,a;
12139 return false;
12141 return false;
12143 return false;
12145 return false;
12146
12148 }
12149
12151 {
12152 if (!ctx.
Read(intValue))
12153 return false;
12155 }
12156
12157 if (version >= 138 && version < 140)
12158 {
12160 {
12161 if (!ctx.
Read(intValue))
12162 return false;
12163 SetFrozen(intValue);
12164 }
12165 }
12166
12167 return true;
12168 }
12169
12170
12172 {
12175 {
12177 }
12178
12179 if (!super.OnStoreLoad(ctx, version))
12180 {
12182 return false;
12183 }
12184
12185 if (version >= 114)
12186 {
12187 bool hasQuickBarIndexSaved;
12188
12189 if (!ctx.
Read(hasQuickBarIndexSaved))
12190 {
12192 return false;
12193 }
12194
12195 if (hasQuickBarIndexSaved)
12196 {
12197 int itmQBIndex;
12198
12199
12200 if (!ctx.
Read(itmQBIndex))
12201 {
12203 return false;
12204 }
12205
12206 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12207 if (itmQBIndex != -1 && parentPlayer)
12208 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12209 }
12210 }
12211 else
12212 {
12213
12214 PlayerBase player;
12215 int itemQBIndex;
12216 if (version ==
int.
MAX)
12217 {
12218 if (!ctx.
Read(itemQBIndex))
12219 {
12221 return false;
12222 }
12223 }
12224 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12225 {
12226
12227 if (!ctx.
Read(itemQBIndex))
12228 {
12230 return false;
12231 }
12232 if (itemQBIndex != -1 && player)
12233 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12234 }
12235 }
12236
12237 if (version < 140)
12238 {
12239
12240 if (!LoadVariables(ctx, version))
12241 {
12243 return false;
12244 }
12245 }
12246
12247
12249 {
12251 return false;
12252 }
12253 if (version >= 132)
12254 {
12256 if (raib)
12257 {
12259 {
12261 return false;
12262 }
12263 }
12264 }
12265
12267 return true;
12268 }
12269
12270
12271
12273 {
12274 super.OnStoreSave(ctx);
12275
12276 PlayerBase player;
12277 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12278 {
12280
12281 int itemQBIndex = -1;
12282 itemQBIndex = player.FindQuickBarEntityIndex(this);
12283 ctx.
Write(itemQBIndex);
12284 }
12285 else
12286 {
12288 }
12289
12291
12293 if (raib)
12294 {
12296 }
12297 }
12298
12299
12301 {
12302 super.AfterStoreLoad();
12303
12305 {
12307 }
12308
12310 {
12313 }
12314 }
12315
12317 {
12318 super.EEOnAfterLoad();
12319
12321 {
12323 }
12324
12327 }
12328
12330 {
12331 return false;
12332 }
12333
12334
12335
12337 {
12339 {
12340 #ifdef PLATFORM_CONSOLE
12341
12343 {
12345 if (menu)
12346 {
12348 }
12349 }
12350 #endif
12351 }
12352
12354 {
12357 }
12358
12360 {
12361 SetWeightDirty();
12363 }
12365 {
12368 }
12369
12371 {
12374 }
12376 {
12379 }
12380
12381 super.OnVariablesSynchronized();
12382 }
12383
12384
12385
12387 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12388 {
12389 if (!IsServerCheck(allow_client))
12390 return false;
12391
12393 return false;
12394
12397
12398 if (value <= (min + 0.001))
12399 value = min;
12400
12401 if (value == min)
12402 {
12403 if (destroy_config)
12404 {
12405 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12406 if (dstr)
12407 {
12409 this.Delete();
12410 return true;
12411 }
12412 }
12413 else if (destroy_forced)
12414 {
12416 this.Delete();
12417 return true;
12418 }
12419
12421 }
12422
12425
12427 {
12429
12430 if (delta)
12432 }
12433
12435
12436 return false;
12437 }
12438
12439
12441 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12442 {
12444 }
12445
12447 {
12450 }
12451
12453 {
12456 }
12457
12460 {
12461 float value_clamped = Math.Clamp(value, 0, 1);
12463 SetQuantity(result, destroy_config, destroy_forced);
12464 }
12465
12466
12469 {
12471 }
12472
12474 {
12476 }
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12488 {
12489 int slot = -1;
12490 if (GetInventory())
12491 {
12492 InventoryLocation il = new InventoryLocation;
12493 GetInventory().GetCurrentInventoryLocation(il);
12495 }
12496
12498 }
12499
12501 {
12502 float quantity_max = 0;
12503
12505 {
12506 if (attSlotID != -1)
12507 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12508
12509 if (quantity_max <= 0)
12511 }
12512
12513 if (quantity_max <= 0)
12515
12516 return quantity_max;
12517 }
12518
12520 {
12522 }
12523
12525 {
12527 }
12528
12529
12531 {
12533 }
12534
12536 {
12538 }
12539
12541 {
12543 }
12544
12545
12547 {
12548
12549 float weightEx = GetWeightEx();
12550 float special = GetInventoryAndCargoWeight();
12551 return weightEx - special;
12552 }
12553
12554
12556 {
12558 }
12559
12561 {
12563 {
12564 #ifdef DEVELOPER
12565 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12566 {
12567 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12569 }
12570 #endif
12571
12572 return GetQuantity() * GetConfigWeightModified();
12573 }
12574 else if (HasEnergyManager())
12575 {
12576 #ifdef DEVELOPER
12577 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12578 {
12579 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12580 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12581 }
12582 #endif
12583 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12584 }
12585 else
12586 {
12587 #ifdef DEVELOPER
12588 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12589 {
12590 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12591 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12592 }
12593 #endif
12594 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
12595 }
12596 }
12597
12600 {
12601 int item_count = 0;
12603
12604 if (GetInventory().GetCargo() != NULL)
12605 {
12606 item_count = GetInventory().GetCargo().GetItemCount();
12607 }
12608
12609 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12610 {
12611 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12612 if (item)
12613 item_count += item.GetNumberOfItems();
12614 }
12615 return item_count;
12616 }
12617
12620 {
12621 float weight = 0;
12622 float wetness = 1;
12623 if (include_wetness)
12626 {
12627 weight = wetness * m_ConfigWeight;
12628 }
12630 {
12631 weight = 1;
12632 }
12633 return weight;
12634 }
12635
12636
12637
12639 {
12640 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12641 {
12642 GameInventory inv = GetInventory();
12643 array<EntityAI> items = new array<EntityAI>;
12645 for (int i = 0; i < items.Count(); i++)
12646 {
12648 if (item)
12649 {
12651 }
12652 }
12653 }
12654 }
12655
12656
12657
12658
12660 {
12661 float energy = 0;
12662 if (HasEnergyManager())
12663 {
12664 energy = GetCompEM().GetEnergy();
12665 }
12666 return energy;
12667 }
12668
12669
12671 {
12672 super.OnEnergyConsumed();
12673
12675 }
12676
12678 {
12679 super.OnEnergyAdded();
12680
12682 }
12683
12684
12686 {
12687 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12688 {
12690 {
12691 float energy_0to1 = GetCompEM().GetEnergy0To1();
12693 }
12694 }
12695 }
12696
12697
12699 {
12700 return ConfigGetFloat("heatIsolation");
12701 }
12702
12704 {
12706 }
12707
12709 {
12710 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12711 if (
GetGame().ConfigIsExisting(paramPath))
12713
12714 return 0.0;
12715 }
12716
12718 {
12719 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12720 if (
GetGame().ConfigIsExisting(paramPath))
12722
12723 return 0.0;
12724 }
12725
12726 override void SetWet(
float value,
bool allow_client =
false)
12727 {
12728 if (!IsServerCheck(allow_client))
12729 return;
12730
12733
12735
12736 m_VarWet = Math.Clamp(value, min, max);
12737
12739 {
12742 }
12743 }
12744
12745 override void AddWet(
float value)
12746 {
12748 }
12749
12751 {
12753 }
12754
12756 {
12758 }
12759
12761 {
12763 }
12764
12766 {
12768 }
12769
12771 {
12773 }
12774
12775 override void OnWetChanged(
float newVal,
float oldVal)
12776 {
12779 if (newLevel != oldLevel)
12780 {
12782 }
12783 }
12784
12786 {
12787 SetWeightDirty();
12788 }
12789
12791 {
12792 return GetWetLevelInternal(
m_VarWet);
12793 }
12794
12795
12796
12798 {
12800 }
12801
12803 {
12805 }
12806
12808 {
12810 }
12811
12813 {
12815 }
12816
12817
12818
12820 {
12821 if (ConfigIsExisting("itemModelLength"))
12822 {
12823 return ConfigGetFloat("itemModelLength");
12824 }
12825 return 0;
12826 }
12827
12829 {
12830 if (ConfigIsExisting("itemAttachOffset"))
12831 {
12832 return ConfigGetFloat("itemAttachOffset");
12833 }
12834 return 0;
12835 }
12836
12837 override void SetCleanness(
int value,
bool allow_client =
false)
12838 {
12839 if (!IsServerCheck(allow_client))
12840 return;
12841
12843
12845
12848 }
12849
12851 {
12853 }
12854
12856 {
12857 return true;
12858 }
12859
12860
12861
12862
12864 {
12866 }
12867
12869 {
12871 }
12872
12873
12874
12875
12876 override void SetColor(
int r,
int g,
int b,
int a)
12877 {
12883 }
12885 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12886 {
12891 }
12892
12894 {
12896 }
12897
12900 {
12901 int r,g,b,a;
12903 r = r/255;
12904 g = g/255;
12905 b = b/255;
12906 a = a/255;
12907 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12908 }
12909
12910
12911
12912 override void SetLiquidType(
int value,
bool allow_client =
false)
12913 {
12914 if (!IsServerCheck(allow_client))
12915 return;
12916
12921 }
12922
12924 {
12925 return ConfigGetInt("varLiquidTypeInit");
12926 }
12927
12929 {
12931 }
12932
12934 {
12936 SetFrozen(false);
12937 }
12938
12941 {
12942 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12943 }
12944
12945
12948 {
12949 PlayerBase nplayer;
12950 if (PlayerBase.CastTo(nplayer, player))
12951 {
12953
12954 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12955 }
12956 }
12957
12958
12961 {
12962 PlayerBase nplayer;
12963 if (PlayerBase.CastTo(nplayer,player))
12964 {
12965
12966 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12967
12968 }
12969
12970
12971 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12972
12973
12974 if (HasEnergyManager())
12975 {
12976 GetCompEM().UpdatePlugState();
12977 }
12978 }
12979
12980
12982 {
12983 super.OnPlacementStarted(player);
12984
12986 }
12987
12988 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12989 {
12991 {
12992 m_AdminLog.OnPlacementComplete(player,
this);
12993 }
12994
12995 super.OnPlacementComplete(player, position, orientation);
12996 }
12997
12998
12999
13000
13001
13003 {
13005 {
13006 return true;
13007 }
13008 else
13009 {
13010 return false;
13011 }
13012 }
13013
13014
13016 {
13018 {
13020 }
13021 }
13022
13023
13025 {
13027 }
13028
13030 {
13032 }
13033
13034 override void InsertAgent(
int agent,
float count = 1)
13035 {
13036 if (count < 1)
13037 return;
13038
13040 }
13041
13044 {
13046 }
13047
13048
13050 {
13052 }
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13096 {
13098 return false;
13099 return true;
13100 }
13101
13103 {
13104
13106 }
13107
13108
13111 {
13112 super.CheckForRoofLimited(timeTresholdMS);
13113
13115 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13116 {
13117 m_PreviousRoofTestTime = time;
13118 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13119 }
13120 }
13121
13122
13124 {
13126 {
13127 return 0;
13128 }
13129
13130 if (GetInventory().GetAttachmentSlotsCount() != 0)
13131 {
13132 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13133 if (filter)
13134 return filter.GetProtectionLevel(type, false, system);
13135 else
13136 return 0;
13137 }
13138
13139 string subclassPath, entryName;
13140
13141 switch (type)
13142 {
13144 entryName = "biological";
13145 break;
13147 entryName = "chemical";
13148 break;
13149 default:
13150 entryName = "biological";
13151 break;
13152 }
13153
13154 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13155
13157 }
13158
13159
13160
13163 {
13164 if (!IsMagazine())
13166
13168 }
13169
13170
13171
13172
13173
13178 {
13179 return true;
13180 }
13181
13183 {
13185 }
13186
13187
13188
13189
13190
13192 {
13193 if (parent)
13194 {
13195 if (parent.IsInherited(DayZInfected))
13196 return true;
13197
13198 if (!parent.IsRuined())
13199 return true;
13200 }
13201
13202 return true;
13203 }
13204
13206 {
13207 if (!super.CanPutAsAttachment(parent))
13208 {
13209 return false;
13210 }
13211
13212 if (!IsRuined() && !parent.IsRuined())
13213 {
13214 return true;
13215 }
13216
13217 return false;
13218 }
13219
13221 {
13222
13223
13224
13225
13226 return super.CanReceiveItemIntoCargo(item);
13227 }
13228
13230 {
13231
13232
13233
13234
13235 GameInventory attachmentInv = attachment.GetInventory();
13237 {
13238 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13239 return false;
13240 }
13241
13242 InventoryLocation loc = new InventoryLocation();
13243 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13244 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13245 return false;
13246
13247 return super.CanReceiveAttachment(attachment, slotId);
13248 }
13249
13251 {
13252 if (!super.CanReleaseAttachment(attachment))
13253 return false;
13254
13255 return GetInventory().AreChildrenAccessible();
13256 }
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13279 {
13280 int id = muzzle_owner.GetMuzzleID();
13281 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13282
13283 if (WPOF_array)
13284 {
13285 for (int i = 0; i < WPOF_array.Count(); i++)
13286 {
13287 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13288
13289 if (WPOF)
13290 {
13291 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13292 }
13293 }
13294 }
13295 }
13296
13297
13299 {
13300 int id = muzzle_owner.GetMuzzleID();
13302
13303 if (WPOBE_array)
13304 {
13305 for (int i = 0; i < WPOBE_array.Count(); i++)
13306 {
13307 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13308
13309 if (WPOBE)
13310 {
13311 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13312 }
13313 }
13314 }
13315 }
13316
13317
13319 {
13320 int id = muzzle_owner.GetMuzzleID();
13321 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13322
13323 if (WPOOH_array)
13324 {
13325 for (int i = 0; i < WPOOH_array.Count(); i++)
13326 {
13327 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13328
13329 if (WPOOH)
13330 {
13331 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13332 }
13333 }
13334 }
13335 }
13336
13337
13339 {
13340 int id = muzzle_owner.GetMuzzleID();
13341 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13342
13343 if (WPOOH_array)
13344 {
13345 for (int i = 0; i < WPOOH_array.Count(); i++)
13346 {
13347 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13348
13349 if (WPOOH)
13350 {
13351 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13352 }
13353 }
13354 }
13355 }
13356
13357
13359 {
13360 int id = muzzle_owner.GetMuzzleID();
13361 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13362
13363 if (WPOOH_array)
13364 {
13365 for (int i = 0; i < WPOOH_array.Count(); i++)
13366 {
13367 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13368
13369 if (WPOOH)
13370 {
13371 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13372 }
13373 }
13374 }
13375 }
13376
13377
13378
13380 {
13382 {
13383 return true;
13384 }
13385
13386 return false;
13387 }
13388
13390 {
13392 {
13393 return true;
13394 }
13395
13396 return false;
13397 }
13398
13400 {
13402 {
13403 return true;
13404 }
13405
13406 return false;
13407 }
13408
13410 {
13411 return false;
13412 }
13413
13416 {
13417 return UATimeSpent.DEFAULT_DEPLOY;
13418 }
13419
13420
13421
13422
13424 {
13426 SetSynchDirty();
13427 }
13428
13430 {
13432 }
13433
13434
13436 {
13437 return false;
13438 }
13439
13442 {
13443 string att_type = "None";
13444
13445 if (ConfigIsExisting("soundAttType"))
13446 {
13447 att_type = ConfigGetString("soundAttType");
13448 }
13449
13451 }
13452
13454 {
13456 }
13457
13458
13459
13460
13461
13465
13467 {
13470
13472 }
13473
13474
13476 {
13478 return;
13479
13481
13484
13487
13488 SoundParameters params = new SoundParameters();
13492 }
13493
13494
13496 {
13498 return;
13499
13501 SetSynchDirty();
13502
13505 }
13506
13507
13509 {
13511 return;
13512
13514 SetSynchDirty();
13515
13518 }
13519
13521 {
13523 }
13524
13526 {
13528 }
13529
13532 {
13533 if (!
GetGame().IsDedicatedServer())
13534 {
13535 if (ConfigIsExisting("attachSoundSet"))
13536 {
13537 string cfg_path = "";
13538 string soundset = "";
13539 string type_name =
GetType();
13540
13543 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13544 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13545
13546 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13547 {
13548 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13549 {
13550 if (cfg_slot_array[i] == slot_type)
13551 {
13552 soundset = cfg_soundset_array[i];
13553 break;
13554 }
13555 }
13556 }
13557
13558 if (soundset != "")
13559 {
13560 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13562 }
13563 }
13564 }
13565 }
13566
13568 {
13569
13570 }
13571
13572 void OnApply(PlayerBase player);
13573
13575 {
13576 return 1.0;
13577 };
13578
13580 {
13582 }
13583
13585 {
13587 }
13588
13590
13592 {
13593 SetDynamicPhysicsLifeTime(0.01);
13595 }
13596
13598 {
13599 array<string> zone_names = new array<string>;
13600 GetDamageZones(zone_names);
13601 for (int i = 0; i < zone_names.Count(); i++)
13602 {
13603 SetHealthMax(zone_names.Get(i),"Health");
13604 }
13605 SetHealthMax("","Health");
13606 }
13607
13610 {
13611 float global_health = GetHealth01("","Health");
13612 array<string> zones = new array<string>;
13613 GetDamageZones(zones);
13614
13615 for (int i = 0; i < zones.Count(); i++)
13616 {
13617 SetHealth01(zones.Get(i),"Health",global_health);
13618 }
13619 }
13620
13623 {
13624 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13625 }
13626
13628 {
13629 if (!hasRootAsPlayer)
13630 {
13631 if (refParentIB)
13632 {
13633
13634 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13635 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13636
13637 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13638 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13639
13642 }
13643 else
13644 {
13645
13648 }
13649 }
13650 }
13651
13653 {
13655 {
13656 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13657 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13658 {
13659 float heatPermCoef = 1.0;
13661 while (ent)
13662 {
13663 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13664 ent = ent.GetHierarchyParent();
13665 }
13666
13667 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13668 }
13669 }
13670 }
13671
13673 {
13674
13675 EntityAI parent = GetHierarchyParent();
13676 if (!parent)
13677 {
13678 hasParent = false;
13679 hasRootAsPlayer = false;
13680 }
13681 else
13682 {
13683 hasParent = true;
13684 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13685 refParentIB =
ItemBase.Cast(parent);
13686 }
13687 }
13688
13689 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13690 {
13691
13692 }
13693
13695 {
13696
13697 return false;
13698 }
13699
13701 {
13702
13703
13704 return false;
13705 }
13706
13708 {
13709
13710 return false;
13711 }
13712
13715 {
13716 return !GetIsFrozen() &&
IsOpen();
13717 }
13718
13720 {
13721 bool hasParent = false, hasRootAsPlayer = false;
13723
13724 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13725 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13726
13727 if (wwtu || foodDecay)
13728 {
13732
13733 if (processWetness || processTemperature || processDecay)
13734 {
13736
13737 if (processWetness)
13738 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13739
13740 if (processTemperature)
13742
13743 if (processDecay)
13744 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13745 }
13746 }
13747 }
13748
13751 {
13753 }
13754
13756 {
13759
13760 return super.GetTemperatureFreezeThreshold();
13761 }
13762
13764 {
13767
13768 return super.GetTemperatureThawThreshold();
13769 }
13770
13772 {
13775
13776 return super.GetItemOverheatThreshold();
13777 }
13778
13780 {
13782 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13783
13784 return super.GetTemperatureFreezeTime();
13785 }
13786
13788 {
13790 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13791
13792 return super.GetTemperatureThawTime();
13793 }
13794
13799
13801 {
13802 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13803 }
13804
13806 {
13807 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13808 }
13809
13812 {
13814 }
13815
13817 {
13819 }
13820
13822 {
13824 }
13825
13828 {
13829 return null;
13830 }
13831
13834 {
13835 return false;
13836 }
13837
13839 {
13841 {
13844 if (!trg)
13845 {
13847 explosive = this;
13848 }
13849
13850 explosive.PairRemote(trg);
13852
13853 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13854 trg.SetPersistentPairID(persistentID);
13855 explosive.SetPersistentPairID(persistentID);
13856
13857 return true;
13858 }
13859 return false;
13860 }
13861
13864 {
13865 float ret = 1.0;
13868 ret *= GetHealth01();
13869
13870 return ret;
13871 }
13872
13873 #ifdef DEVELOPER
13874 override void SetDebugItem()
13875 {
13876 super.SetDebugItem();
13877 _itemBase = this;
13878 }
13879
13881 {
13882 string text = super.GetDebugText();
13883
13885 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13886
13887 return text;
13888 }
13889 #endif
13890
13892 {
13893 return true;
13894 }
13895
13897
13899
13901 {
13904 }
13905
13906
13914
13930}
13931
13933{
13935 if (entity)
13936 {
13937 bool is_item = entity.IsInherited(
ItemBase);
13938 if (is_item && full_quantity)
13939 {
13942 }
13943 }
13944 else
13945 {
13947 return NULL;
13948 }
13949 return entity;
13950}
13951
13953{
13954 if (item)
13955 {
13956 if (health > 0)
13957 item.SetHealth("", "", health);
13958
13959 if (item.CanHaveTemperature())
13960 {
13962 if (item.CanFreeze())
13963 item.SetFrozen(false);
13964 }
13965
13966 if (item.HasEnergyManager())
13967 {
13968 if (quantity >= 0)
13969 {
13970 item.GetCompEM().SetEnergy0To1(quantity);
13971 }
13972 else
13973 {
13975 }
13976 }
13977 else if (item.IsMagazine())
13978 {
13979 Magazine mag = Magazine.Cast(item);
13980 if (quantity >= 0)
13981 {
13982 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13983 }
13984 else
13985 {
13987 }
13988
13989 }
13990 else
13991 {
13992 if (quantity >= 0)
13993 {
13994 item.SetQuantityNormalized(quantity, false);
13995 }
13996 else
13997 {
13999 }
14000
14001 }
14002 }
14003}
14004
14005#ifdef DEVELOPER
14007#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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()
override int GetLiquidType()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.