Attachment Sound Type getting from config file.
9307{
9309 {
9310 return true;
9311 }
9312};
9313
9315{
9316
9317};
9318
9319
9320
9322{
9326
9328
9331
9332
9333
9334
9335
9344
9350
9355
9360
9381 protected bool m_IsResultOfSplit
9382
9384
9389
9390
9391
9393
9397
9398
9399
9401
9404
9405
9406
9412
9413
9421
9424
9425
9427
9428
9430
9431
9436
9437
9442
9444
9445
9447
9448
9450 {
9455
9456 if (!
g_Game.IsDedicatedServer())
9457 {
9459 {
9461
9463 {
9465 }
9466 }
9467
9470 }
9471
9472 m_OldLocation = null;
9473
9475 {
9477 }
9478
9479 if (ConfigIsExisting("headSelectionsToHide"))
9480 {
9483 }
9484
9486 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9487 {
9489 }
9490
9492
9493 m_IsResultOfSplit = false;
9494
9496 }
9497
9499 {
9500 super.InitItemVariables();
9501
9507 m_Count = ConfigGetInt(
"count");
9508
9511
9516
9519
9524
9536
9540
9541
9544 if (ConfigIsExisting("canBeSplit"))
9545 {
9548 }
9549
9551 if (ConfigIsExisting("itemBehaviour"))
9553
9554
9557 RegisterNetSyncVariableInt("m_VarLiquidType");
9558 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9559
9560 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9561 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9562 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9563
9564 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9565 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9566 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9567 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9568
9569 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9570 RegisterNetSyncVariableBool("m_IsTakeable");
9571 RegisterNetSyncVariableBool("m_IsHologram");
9572
9575 {
9578 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9579 }
9580
9582
9584 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9586
9588 }
9589
9591 {
9593 }
9594
9596 {
9599 {
9604 }
9605 }
9606
9607 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9608 {
9610 {
9613 }
9614
9616 }
9617
9619 {
9625 }
9626
9628
9630 {
9632
9633 if (!action)
9634 {
9635 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9636 return;
9637 }
9638
9640 if (!ai)
9641 {
9643 return;
9644 }
9645
9647 if (!action_array)
9648 {
9649 action_array = new array<ActionBase_Basic>;
9651 }
9652 if (LogManager.IsActionLogEnable())
9653 {
9654 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9655 }
9656
9657 if (action_array.Find(action) != -1)
9658 {
9659 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9660 }
9661 else
9662 {
9663 action_array.Insert(action);
9664 }
9665 }
9666
9668 {
9669 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9670 ActionBase action = player.GetActionManager().GetAction(actionName);
9673
9674 if (action_array)
9675 {
9676 action_array.RemoveItem(action);
9677 }
9678 }
9679
9680
9681
9683 {
9684 ActionOverrideData overrideData = new ActionOverrideData();
9688
9690 if (!actionMap)
9691 {
9694 }
9695
9696 actionMap.Insert(this.
Type(), overrideData);
9697
9698 }
9699
9701
9703
9704
9706 {
9709
9712
9713 string config_to_search = "CfgVehicles";
9714 string muzzle_owner_config;
9715
9717 {
9718 if (IsInherited(Weapon))
9719 config_to_search = "CfgWeapons";
9720
9721 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9722
9723 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9724
9725 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9726
9727 if (config_OnFire_subclass_count > 0)
9728 {
9729 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9730
9731 for (int i = 0; i < config_OnFire_subclass_count; i++)
9732 {
9733 string particle_class = "";
9734 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9735 string config_OnFire_entry = config_OnFire_class + particle_class;
9736 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9737 WPOF_array.Insert(WPOF);
9738 }
9739
9740
9742 }
9743 }
9744
9746 {
9747 config_to_search = "CfgWeapons";
9748 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9749
9750 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9751
9752 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9753
9754 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9755 {
9756 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9757
9758 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9759 {
9760 string particle_class2 = "";
9761 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9762 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9763 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9764 WPOBE_array.Insert(WPOBE);
9765 }
9766
9767
9769 }
9770 }
9771 }
9772
9773
9775 {
9778
9780 {
9781 string config_to_search = "CfgVehicles";
9782
9783 if (IsInherited(Weapon))
9784 config_to_search = "CfgWeapons";
9785
9786 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9787 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9788
9789 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9790 {
9791
9793
9795 {
9797 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9799 return;
9800 }
9801
9804
9805
9806
9807 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9808 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9809
9810 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9811 {
9812 string particle_class = "";
9813 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9814 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9815 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9816
9817 if (entry_type == CT_CLASS)
9818 {
9819 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9820 WPOOH_array.Insert(WPOF);
9821 }
9822 }
9823
9824
9826 }
9827 }
9828 }
9829
9831 {
9833 }
9834
9836 {
9838 {
9840
9843
9846
9847 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9848 }
9849 }
9850
9852 {
9854 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9855
9857 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9858
9860 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9861
9863 {
9865 }
9866 }
9867
9869 {
9871 }
9872
9874 {
9877 else
9879
9881 {
9884 }
9885 else
9886 {
9889
9892 }
9893
9895 }
9896
9898 {
9900 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9901 }
9902
9904 {
9906 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9908 }
9909
9911 {
9913 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9914 }
9915
9917 {
9920
9921 OverheatingParticle OP = new OverheatingParticle();
9926
9928 }
9929
9931 {
9934
9935 return -1;
9936 }
9937
9939 {
9941 {
9944
9945 for (int i = count; i > 0; --i)
9946 {
9947 int id = i - 1;
9950
9953
9954 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9955 {
9956 if (p)
9957 {
9960 }
9961 }
9962 }
9963 }
9964 }
9965
9967 {
9969 {
9971 {
9972 int id = i - 1;
9974
9975 if (OP)
9976 {
9978
9979 if (p)
9980 {
9982 }
9983
9984 delete OP;
9985 }
9986 }
9987
9990 }
9991 }
9992
9995 {
9996 return 0.0;
9997 }
9998
9999
10001 {
10002 return 250;
10003 }
10004
10006 {
10007 return 0;
10008 }
10009
10012 {
10014 return true;
10015
10016 return false;
10017 }
10018
10021 {
10024
10026 {
10028 }
10029 else
10030 {
10031
10033 }
10034
10036 }
10037
10044 {
10045 return -1;
10046 }
10047
10048
10049
10050
10052 {
10054 {
10055 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10056 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10057
10058 if (r_index >= 0)
10059 {
10060 InventoryLocation r_il = new InventoryLocation;
10061 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10062
10063 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10066 {
10067 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10068 }
10070 {
10071 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10072 }
10073
10074 }
10075
10076 player.GetHumanInventory().ClearUserReservedLocation(this);
10077 }
10078
10081 }
10082
10083
10084
10085
10087 {
10088 return ItemBase.m_DebugActionsMask;
10089 }
10090
10092 {
10093 return ItemBase.m_DebugActionsMask & mask;
10094 }
10095
10097 {
10098 ItemBase.m_DebugActionsMask = mask;
10099 }
10100
10102 {
10103 ItemBase.m_DebugActionsMask |= mask;
10104 }
10105
10107 {
10108 ItemBase.m_DebugActionsMask &= ~mask;
10109 }
10110
10112 {
10114 {
10116 }
10117 else
10118 {
10120 }
10121 }
10122
10123
10125 {
10126 if (GetEconomyProfile())
10127 {
10128 float q_max = GetEconomyProfile().GetQuantityMax();
10129 if (q_max > 0)
10130 {
10131 float q_min = GetEconomyProfile().GetQuantityMin();
10132 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10133
10135 {
10136 ComponentEnergyManager comp = GetCompEM();
10138 {
10140 }
10141 }
10143 {
10145
10146 }
10147
10148 }
10149 }
10150 }
10151
10154 {
10155 EntityAI parent = GetHierarchyParent();
10156
10157 if (parent)
10158 {
10159 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10160 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10161 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10162 }
10163 }
10164
10167 {
10168 EntityAI parent = GetHierarchyParent();
10169
10170 if (parent)
10171 {
10172 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10173 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10174 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10175 }
10176 }
10177
10179 {
10180
10181
10182
10183
10185
10187 {
10188 if (ScriptInputUserData.CanStoreInputUserData())
10189 {
10190 ScriptInputUserData ctx = new ScriptInputUserData;
10196 ctx.
Write(use_stack_max);
10199
10201 {
10202 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10203 }
10204 }
10205 }
10206 else if (!
g_Game.IsMultiplayer())
10207 {
10209 }
10210 }
10211
10213 {
10215 }
10216
10218 {
10220 }
10221
10223 {
10225 }
10226
10228 {
10229
10230 return false;
10231 }
10232
10234 {
10235 return false;
10236 }
10237
10241 {
10242 return false;
10243 }
10244
10246 {
10247 return "";
10248 }
10249
10251
10253 {
10254 return false;
10255 }
10256
10258 {
10259 return true;
10260 }
10261
10262
10263
10265 {
10266 return true;
10267 }
10268
10270 {
10271 return true;
10272 }
10273
10275 {
10276 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10278 }
10279
10281 {
10283 }
10284
10286 {
10288 if (!is_being_placed)
10290 SetSynchDirty();
10291 }
10292
10293
10295
10297 {
10299 }
10300
10302 {
10304 }
10305
10307 {
10308 return 1;
10309 }
10310
10312 {
10313 return false;
10314 }
10315
10317 {
10319 SetSynchDirty();
10320 }
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10357 {
10358 super.OnMovedInsideCargo(container);
10359
10360 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10361 }
10362
10363 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10364 {
10365 super.EEItemLocationChanged(oldLoc, newLoc);
10366
10367 PlayerBase newPlayer = null;
10368 PlayerBase oldPlayer = null;
10369
10370 if (newLoc.GetParent())
10371 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10372
10373 if (oldLoc.GetParent())
10374 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10375
10377 {
10378 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10379
10380 if (rIndex >= 0)
10381 {
10382 InventoryLocation rIl = new InventoryLocation;
10383 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10384
10385 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10388 {
10389 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10390 }
10392 {
10394 }
10395
10396 }
10397 }
10398
10400 {
10401 if (newPlayer)
10402 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10403
10404 if (newPlayer == oldPlayer)
10405 {
10406 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10407 {
10409 {
10410 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10411 {
10412 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10413 }
10414 }
10415 else
10416 {
10417 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10418 }
10419 }
10420
10421 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10422 {
10423 int type = oldLoc.GetType();
10425 {
10426 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10427 }
10429 {
10430 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10431 }
10432 }
10433 if (!m_OldLocation)
10434 {
10435 m_OldLocation = new InventoryLocation;
10436 }
10437 m_OldLocation.Copy(oldLoc);
10438 }
10439 else
10440 {
10441 if (m_OldLocation)
10442 {
10443 m_OldLocation.Reset();
10444 }
10445 }
10446
10447 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10448 }
10449 else
10450 {
10451 if (newPlayer)
10452 {
10453 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10454 if (resIndex >= 0)
10455 {
10456 InventoryLocation il = new InventoryLocation;
10457 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10459 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10462 {
10463 il.
GetParent().GetOnReleaseLock().Invoke(it);
10464 }
10466 {
10468 }
10469
10470 }
10471 }
10473 {
10474
10476 }
10477
10478 if (m_OldLocation)
10479 {
10480 m_OldLocation.Reset();
10481 }
10482 }
10483
10485 {
10486 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10487 }
10488
10490 {
10491 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10492 }
10493 }
10494
10495 override void EOnContact(IEntity other, Contact extra)
10496 {
10498 {
10499 int liquidType = -1;
10501 if (impactSpeed > 0.0)
10502 {
10504 #ifndef SERVER
10506 #else
10508 SetSynchDirty();
10509 #endif
10511 }
10512 }
10513
10514 #ifdef SERVER
10515 if (GetCompEM() && GetCompEM().IsPlugged())
10516 {
10517 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10518 GetCompEM().UnplugThis();
10519 }
10520 #endif
10521 }
10522
10524
10526 {
10528 }
10529
10531 {
10532
10533 }
10534
10536 {
10537 super.OnItemLocationChanged(old_owner, new_owner);
10538
10539 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10540 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10541
10542 if (!relatedPlayer && playerNew)
10543 relatedPlayer = playerNew;
10544
10545 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10546 {
10548 if (actionMgr)
10549 {
10550 ActionBase currentAction = actionMgr.GetRunningAction();
10551 if (currentAction)
10553 }
10554 }
10555
10556 Man ownerPlayerOld = null;
10557 Man ownerPlayerNew = null;
10558
10559 if (old_owner)
10560 {
10561 if (old_owner.
IsMan())
10562 {
10563 ownerPlayerOld = Man.Cast(old_owner);
10564 }
10565 else
10566 {
10567 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10568 }
10569 }
10570 else
10571 {
10573 {
10575
10576 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10577 {
10578 GetCompEM().UnplugThis();
10579 }
10580 }
10581 }
10582
10583 if (new_owner)
10584 {
10585 if (new_owner.
IsMan())
10586 {
10587 ownerPlayerNew = Man.Cast(new_owner);
10588 }
10589 else
10590 {
10591 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10592 }
10593 }
10594
10595 if (ownerPlayerOld != ownerPlayerNew)
10596 {
10597 if (ownerPlayerOld)
10598 {
10599 array<EntityAI> subItemsExit = new array<EntityAI>;
10601 for (int i = 0; i < subItemsExit.Count(); i++)
10602 {
10605 }
10606 }
10607
10608 if (ownerPlayerNew)
10609 {
10610 array<EntityAI> subItemsEnter = new array<EntityAI>;
10612 for (int j = 0; j < subItemsEnter.Count(); j++)
10613 {
10616 }
10617 }
10618 }
10619 else if (ownerPlayerNew != null)
10620 {
10621 PlayerBase nplayer;
10622 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10623 {
10624 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10626 for (int k = 0; k < subItemsUpdate.Count(); k++)
10627 {
10629 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10630 }
10631 }
10632 }
10633
10634 if (old_owner)
10635 old_owner.OnChildItemRemoved(this);
10636 if (new_owner)
10637 new_owner.OnChildItemReceived(this);
10638 }
10639
10640
10642 {
10643 super.EEDelete(parent);
10644 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10645 if (player)
10646 {
10648
10649 if (player.IsAlive())
10650 {
10651 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10652 if (r_index >= 0)
10653 {
10654 InventoryLocation r_il = new InventoryLocation;
10655 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10656
10657 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10660 {
10661 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10662 }
10664 {
10665 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10666 }
10667
10668 }
10669
10670 player.RemoveQuickBarEntityShortcut(this);
10671 }
10672 }
10673 }
10674
10676 {
10677 super.EEKilled(killer);
10678
10681 {
10682 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10683 {
10684 if (IsMagazine())
10685 {
10686 if (Magazine.Cast(this).GetAmmoCount() > 0)
10687 {
10689 }
10690 }
10691 else
10692 {
10694 }
10695 }
10696 }
10697 }
10698
10700 {
10701 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10702
10703 super.OnWasAttached(parent, slot_id);
10704
10707
10710 }
10711
10713 {
10714 super.OnWasDetached(parent, slot_id);
10715
10718
10721 }
10722
10724 {
10725 int idx;
10728
10729 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10730 if (inventory_slots.Count() < 1)
10731 {
10732 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10733 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10734 }
10735 else
10736 {
10737 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10738 }
10739
10740 idx = inventory_slots.Find(slot);
10741 if (idx < 0)
10742 return "";
10743
10744 return attach_types.Get(idx);
10745 }
10746
10748 {
10749 int idx = -1;
10750 string slot;
10751
10754
10755 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10756 if (inventory_slots.Count() < 1)
10757 {
10758 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10759 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10760 }
10761 else
10762 {
10763 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10764 if (detach_types.Count() < 1)
10765 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10766 }
10767
10768 for (int i = 0; i < inventory_slots.Count(); i++)
10769 {
10770 slot = inventory_slots.Get(i);
10771 }
10772
10773 if (slot != "")
10774 {
10775 if (detach_types.Count() == 1)
10776 idx = 0;
10777 else
10778 idx = inventory_slots.Find(slot);
10779 }
10780 if (idx < 0)
10781 return "";
10782
10783 return detach_types.Get(idx);
10784 }
10785
10787 {
10788
10790
10791
10792 float min_time = 1;
10793 float max_time = 3;
10794 float delay = Math.RandomFloat(min_time, max_time);
10795
10796 explode_timer.Run(delay, this, "DoAmmoExplosion");
10797 }
10798
10800 {
10801 Magazine magazine = Magazine.Cast(this);
10802 int pop_sounds_count = 6;
10803 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10804
10805
10806 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10807 string sound_name = pop_sounds[ sound_idx ];
10808 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10809
10810
10811 magazine.ServerAddAmmoCount(-1);
10812
10813
10814 float min_temp_to_explode = 100;
10815
10816 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10817 {
10819 }
10820 }
10821
10822
10823 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10824 {
10825 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10826
10827 const int CHANCE_DAMAGE_CARGO = 4;
10828 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10829 const int CHANCE_DAMAGE_NOTHING = 2;
10830
10832 {
10833 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10834 int chances;
10835 int rnd;
10836
10837 if (GetInventory().GetCargo())
10838 {
10839 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10840 rnd = Math.RandomInt(0,chances);
10841
10842 if (rnd < CHANCE_DAMAGE_CARGO)
10843 {
10845 }
10846 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10847 {
10849 }
10850 }
10851 else
10852 {
10853 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10854 rnd = Math.RandomInt(0,chances);
10855
10856 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10857 {
10859 }
10860 }
10861 }
10862 }
10863
10865 {
10866 CargoBase cargo = GetInventory().GetCargo();
10867 if (cargo)
10868 {
10870 if (item_count > 0)
10871 {
10872 int random_pick = Math.RandomInt(0, item_count);
10874 if (!item.IsExplosive())
10875 {
10876 item.AddHealth("","",damage);
10877 return true;
10878 }
10879 }
10880 }
10881 return false;
10882 }
10883
10885 {
10886 GameInventory inventory = GetInventory();
10888 if (attachment_count > 0)
10889 {
10890 int random_pick = Math.RandomInt(0, attachment_count);
10892 if (!attachment.IsExplosive())
10893 {
10894 attachment.AddHealth("","",damage);
10895 return true;
10896 }
10897 }
10898 return false;
10899 }
10900
10902 {
10904 }
10905
10907 {
10909 return GetInventory().CanRemoveEntity();
10910
10911 return false;
10912 }
10913
10915 {
10916
10918 return false;
10919
10920
10922 return false;
10923
10924
10925
10927 if (delta == 0)
10928 return false;
10929
10930
10931 return true;
10932 }
10933
10935 {
10937 {
10938 if (ScriptInputUserData.CanStoreInputUserData())
10939 {
10940 ScriptInputUserData ctx = new ScriptInputUserData;
10945 ctx.
Write(destination_entity);
10947 ctx.
Write(slot_id);
10949 }
10950 }
10951 else if (!
g_Game.IsMultiplayer())
10952 {
10954 }
10955 }
10956
10958 {
10959 float split_quantity_new;
10963 InventoryLocation loc = new InventoryLocation;
10964
10965 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10966 {
10968 split_quantity_new = stack_max;
10969 else
10971
10973 {
10974 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10975 if (new_item)
10976 {
10977 new_item.SetResultOfSplit(true);
10978 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10980 new_item.
SetQuantity(split_quantity_new,
false,
true);
10981 }
10982 }
10983 }
10984 else if (destination_entity && slot_id == -1)
10985 {
10986 if (quantity > stack_max)
10987 split_quantity_new = stack_max;
10988 else
10989 split_quantity_new = quantity;
10990
10992 {
10993 GameInventory destinationInventory = destination_entity.GetInventory();
10995 {
10998 }
10999
11000 if (new_item)
11001 {
11002 new_item.SetResultOfSplit(true);
11003 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11005 new_item.
SetQuantity(split_quantity_new,
false,
true);
11006 }
11007 }
11008 }
11009 else
11010 {
11011 if (stack_max != 0)
11012 {
11014 {
11016 }
11017
11018 if (split_quantity_new == 0)
11019 {
11020 if (!
g_Game.IsMultiplayer())
11021 player.PhysicalPredictiveDropItem(this);
11022 else
11023 player.ServerDropEntity(this);
11024 return;
11025 }
11026
11028 {
11030
11031 if (new_item)
11032 {
11033 new_item.SetResultOfSplit(true);
11034 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11037 new_item.PlaceOnSurface();
11038 }
11039 }
11040 }
11041 }
11042 }
11043
11045 {
11046 float split_quantity_new;
11050 InventoryLocation loc = new InventoryLocation;
11051
11052 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11053 {
11055 split_quantity_new = stack_max;
11056 else
11058
11060 {
11061 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11062 if (new_item)
11063 {
11064 new_item.SetResultOfSplit(true);
11065 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11067 new_item.
SetQuantity(split_quantity_new,
false,
true);
11068 }
11069 }
11070 }
11071 else if (destination_entity && slot_id == -1)
11072 {
11073 if (quantity > stack_max)
11074 split_quantity_new = stack_max;
11075 else
11076 split_quantity_new = quantity;
11077
11079 {
11080 GameInventory destinationInventory = destination_entity.GetInventory();
11082 {
11085 }
11086
11087 if (new_item)
11088 {
11089 new_item.SetResultOfSplit(true);
11090 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11092 new_item.
SetQuantity(split_quantity_new,
false,
true);
11093 }
11094 }
11095 }
11096 else
11097 {
11098 if (stack_max != 0)
11099 {
11101 {
11103 }
11104
11106 {
11108
11109 if (new_item)
11110 {
11111 new_item.SetResultOfSplit(true);
11112 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11115 new_item.PlaceOnSurface();
11116 }
11117 }
11118 }
11119 }
11120 }
11121
11123 {
11125 {
11126 if (ScriptInputUserData.CanStoreInputUserData())
11127 {
11128 ScriptInputUserData ctx = new ScriptInputUserData;
11133 dst.WriteToContext(ctx);
11135 }
11136 }
11137 else if (!
g_Game.IsMultiplayer())
11138 {
11140 }
11141 }
11142
11144 {
11146 {
11147 if (ScriptInputUserData.CanStoreInputUserData())
11148 {
11149 ScriptInputUserData ctx = new ScriptInputUserData;
11154 ctx.
Write(destination_entity);
11160 }
11161 }
11162 else if (!
g_Game.IsMultiplayer())
11163 {
11165 }
11166 }
11167
11169 {
11171 }
11172
11174 {
11176 float split_quantity_new;
11178 if (dst.IsValid())
11179 {
11180 int slot_id = dst.GetSlot();
11182
11183 if (quantity > stack_max)
11184 split_quantity_new = stack_max;
11185 else
11186 split_quantity_new = quantity;
11187
11189 {
11191
11192 if (new_item)
11193 {
11194 new_item.SetResultOfSplit(true);
11195 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11197 new_item.
SetQuantity(split_quantity_new,
false,
true);
11198 }
11199
11200 return new_item;
11201 }
11202 }
11203
11204 return null;
11205 }
11206
11208 {
11210 float split_quantity_new;
11212 if (destination_entity)
11213 {
11215 if (quantity > stackable)
11216 split_quantity_new = stackable;
11217 else
11218 split_quantity_new = quantity;
11219
11221 {
11222 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11223 if (new_item)
11224 {
11225 new_item.SetResultOfSplit(true);
11226 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11228 new_item.
SetQuantity(split_quantity_new,
false,
true);
11229 }
11230 }
11231 }
11232 }
11233
11235 {
11237 {
11238 if (ScriptInputUserData.CanStoreInputUserData())
11239 {
11240 ScriptInputUserData ctx = new ScriptInputUserData;
11245 ItemBase destination_entity =
this;
11246 ctx.
Write(destination_entity);
11250 }
11251 }
11252 else if (!
g_Game.IsMultiplayer())
11253 {
11255 }
11256 }
11257
11259 {
11261 float split_quantity_new;
11263 if (player)
11264 {
11266 if (quantity > stackable)
11267 split_quantity_new = stackable;
11268 else
11269 split_quantity_new = quantity;
11270
11272 {
11273 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11274 new_item =
ItemBase.Cast(in_hands);
11275 if (new_item)
11276 {
11277 new_item.SetResultOfSplit(true);
11278 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11280 new_item.SetQuantity(split_quantity_new, false, true);
11281 }
11282 }
11283 }
11284 }
11285
11287 {
11289 float split_quantity_new = Math.Floor(quantity * 0.5);
11290
11292 return;
11293
11295
11296 if (new_item)
11297 {
11298 if (new_item.GetQuantityMax() < split_quantity_new)
11299 {
11300 split_quantity_new = new_item.GetQuantityMax();
11301 }
11302
11303 new_item.SetResultOfSplit(true);
11304 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11305
11307 {
11310 }
11311 else
11312 {
11314 new_item.
SetQuantity(split_quantity_new,
false,
true);
11315 }
11316 }
11317 }
11318
11320 {
11322 float split_quantity_new = Math.Floor(quantity / 2);
11323
11325 return;
11326
11327 InventoryLocation invloc = new InventoryLocation;
11329
11331 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11332
11333 if (new_item)
11334 {
11335 if (new_item.GetQuantityMax() < split_quantity_new)
11336 {
11337 split_quantity_new = new_item.GetQuantityMax();
11338 }
11340 {
11343 }
11344 else if (split_quantity_new > 1)
11345 {
11347 new_item.
SetQuantity(split_quantity_new,
false,
true);
11348 }
11349 }
11350 }
11351
11354 {
11355 SetWeightDirty();
11357
11358 if (parent)
11359 parent.OnAttachmentQuantityChangedEx(this, delta);
11360
11362 {
11364 {
11366 }
11368 {
11369 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11371 }
11372 }
11373 }
11374
11377 {
11378
11379 }
11380
11383 {
11385 }
11386
11388 {
11389 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11390
11392 {
11393 if (newLevel == GameConstants.STATE_RUINED)
11394 {
11396 EntityAI parent = GetHierarchyParent();
11397 if (parent && parent.IsFireplace())
11398 {
11399 CargoBase cargo = GetInventory().GetCargo();
11400 if (cargo)
11401 {
11403 {
11405 }
11406 }
11407 }
11408 }
11409
11411 {
11412
11414 return;
11415 }
11416
11417 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11418 {
11420 }
11421 }
11422 }
11423
11424
11426 {
11427 super.OnRightClick();
11428
11430 {
11432 {
11433 if (ScriptInputUserData.CanStoreInputUserData())
11434 {
11435 EntityAI root = GetHierarchyRoot();
11436 Man playerOwner = GetHierarchyRootPlayer();
11437 InventoryLocation dst = new InventoryLocation;
11438
11439
11440 if (!playerOwner && root && root == this)
11441 {
11443 }
11444 else
11445 {
11446
11447 GetInventory().GetCurrentInventoryLocation(dst);
11449 {
11450 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11452 {
11454 }
11455 else
11456 {
11458
11459
11460 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11461 {
11463 }
11464 else
11465 {
11466 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11467 }
11468 }
11469 }
11470 }
11471
11472 ScriptInputUserData ctx = new ScriptInputUserData;
11480 }
11481 }
11482 else if (!
g_Game.IsMultiplayer())
11483 {
11485 }
11486 }
11487 }
11488
11490 {
11491 if (root)
11492 {
11493 vector m4[4];
11494 root.GetTransform(m4);
11495 dst.SetGround(this, m4);
11496 }
11497 else
11498 {
11499 GetInventory().GetCurrentInventoryLocation(dst);
11500 }
11501 }
11502
11503 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11504 {
11505
11506 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11507 return false;
11508
11509 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11510 return false;
11511
11512
11514 return false;
11515
11516
11517 Magazine mag = Magazine.Cast(this);
11518 if (mag)
11519 {
11520 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11521 return false;
11522
11523 if (stack_max_limit)
11524 {
11525 Magazine other_mag = Magazine.Cast(other_item);
11526 if (other_item)
11527 {
11528 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11529 return false;
11530 }
11531
11532 }
11533 }
11534 else
11535 {
11536
11538 return false;
11539
11541 return false;
11542 }
11543
11544 PlayerBase player = null;
11545 if (CastTo(player, GetHierarchyRootPlayer()))
11546 {
11547 if (player.GetInventory().HasAttachment(this))
11548 return false;
11549
11550 if (player.IsItemsToDelete())
11551 return false;
11552 }
11553
11554 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11555 return false;
11556
11557 int slotID;
11559 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11560 return false;
11561
11562 return true;
11563 }
11564
11566 {
11568 }
11569
11571 {
11572 return m_IsResultOfSplit;
11573 }
11574
11576 {
11577 m_IsResultOfSplit = value;
11578 }
11579
11581 {
11583 }
11584
11586 {
11587 float other_item_quantity = other_item.GetQuantity();
11588 float this_free_space;
11589
11591
11593
11594 if (other_item_quantity > this_free_space)
11595 {
11596 return this_free_space;
11597 }
11598 else
11599 {
11600 return other_item_quantity;
11601 }
11602 }
11603
11605 {
11607 }
11608
11610 {
11612 return;
11613
11614 if (!IsMagazine() && other_item)
11615 {
11617 if (quantity_used != 0)
11618 {
11619 float hp1 = GetHealth01("","");
11620 float hp2 = other_item.GetHealth01("","");
11621 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11622 hpResult = hpResult / (
GetQuantity() + quantity_used);
11623
11624 hpResult *= GetMaxHealth();
11625 Math.Round(hpResult);
11626 SetHealth("", "Health", hpResult);
11627
11629 other_item.AddQuantity(-quantity_used);
11630 }
11631 }
11633 }
11634
11636 {
11637 #ifdef SERVER
11638 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11639 GetHierarchyParent().IncreaseLifetimeUp();
11640 #endif
11641 };
11642
11644 {
11645 PlayerBase p = PlayerBase.Cast(player);
11646
11647 array<int> recipesIds = p.m_Recipes;
11648 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11649 if (moduleRecipesManager)
11650 {
11651 EntityAI itemInHands = player.GetEntityInHands();
11652 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11653 }
11654
11655 for (int i = 0;i < recipesIds.Count(); i++)
11656 {
11657 int key = recipesIds.Get(i);
11658 string recipeName = moduleRecipesManager.GetRecipeName(key);
11660 }
11661 }
11662
11663
11664 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11665 {
11666 super.GetDebugActions(outputList);
11667
11668
11674
11675
11680
11685
11686
11690
11691
11693 {
11697 }
11698
11701
11702
11706
11708
11709 InventoryLocation loc = new InventoryLocation();
11710 GetInventory().GetCurrentInventoryLocation(loc);
11712 {
11713 if (Gizmo_IsSupported())
11716 }
11717
11719 }
11720
11721
11722
11723
11725 {
11726 super.OnAction(action_id, player, ctx);
11727
11729 {
11730 switch (action_id)
11731 {
11735 return true;
11739 return true;
11740 }
11741 }
11742
11744 {
11745 switch (action_id)
11746 {
11748 Delete();
11749 return true;
11750 }
11751 }
11752
11753 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11754 {
11755 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11756 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11757 PlayerBase p = PlayerBase.Cast(player);
11758 if (
EActions.RECIPES_RANGE_START < 1000)
11759 {
11760 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11761 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11762 }
11763 }
11764 #ifndef SERVER
11765 else if (action_id ==
EActions.WATCH_PLAYER)
11766 {
11767 PluginDeveloper.SetDeveloperItemClientEx(player);
11768 }
11769 #endif
11771 {
11772 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11773 {
11774 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11775 OnDebugButtonPressServer(id + 1);
11776 }
11777
11778 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11779 {
11780 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11782 }
11783
11784 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11785 {
11786 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11788 }
11789
11790 else if (action_id ==
EActions.ADD_QUANTITY)
11791 {
11792 if (IsMagazine())
11793 {
11794 Magazine mag = Magazine.Cast(this);
11795 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11796 }
11797 else
11798 {
11800 }
11801
11802 if (m_EM)
11803 {
11804 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11805 }
11806
11807 }
11808
11809 else if (action_id ==
EActions.REMOVE_QUANTITY)
11810 {
11811 if (IsMagazine())
11812 {
11813 Magazine mag2 = Magazine.Cast(this);
11814 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11815 }
11816 else
11817 {
11819 }
11820 if (m_EM)
11821 {
11822 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11823 }
11824
11825 }
11826
11827 else if (action_id ==
EActions.SET_QUANTITY_0)
11828 {
11830
11831 if (m_EM)
11832 {
11833 m_EM.SetEnergy(0);
11834 }
11835 }
11836
11837 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11838 {
11840
11841 if (m_EM)
11842 {
11843 m_EM.SetEnergy(m_EM.GetEnergyMax());
11844 }
11845 }
11846
11847 else if (action_id ==
EActions.ADD_HEALTH)
11848 {
11849 AddHealth("","",GetMaxHealth("","Health")/5);
11850 }
11851 else if (action_id ==
EActions.REMOVE_HEALTH)
11852 {
11853 AddHealth("","",-GetMaxHealth("","Health")/5);
11854 }
11855 else if (action_id ==
EActions.DESTROY_HEALTH)
11856 {
11857 SetHealth01("","",0);
11858 }
11859 else if (action_id ==
EActions.WATCH_ITEM)
11860 {
11862 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11863 #ifdef DEVELOPER
11864 SetDebugDeveloper_item(this);
11865 #endif
11866 }
11867
11868 else if (action_id ==
EActions.ADD_TEMPERATURE)
11869 {
11870 AddTemperature(20);
11871
11872 }
11873
11874 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11875 {
11876 AddTemperature(-20);
11877
11878 }
11879
11880 else if (action_id ==
EActions.FLIP_FROZEN)
11881 {
11882 SetFrozen(!GetIsFrozen());
11883
11884 }
11885
11886 else if (action_id ==
EActions.ADD_WETNESS)
11887 {
11889
11890 }
11891
11892 else if (action_id ==
EActions.REMOVE_WETNESS)
11893 {
11895
11896 }
11897
11898 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11899 {
11902
11903
11904 }
11905
11906 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11907 {
11910 }
11911
11912 else if (action_id ==
EActions.MAKE_SPECIAL)
11913 {
11914 auto debugParams = DebugSpawnParams.WithPlayer(player);
11915 OnDebugSpawnEx(debugParams);
11916 }
11917
11918 }
11919
11920
11921 return false;
11922 }
11923
11924
11925
11926
11930
11933
11934
11935
11937 {
11938 return false;
11939 }
11940
11941
11943 {
11944 return true;
11945 }
11946
11947
11949 {
11950 return true;
11951 }
11952
11953
11954
11956 {
11957 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11958 return g_Game.ConfigIsExisting(config_path);
11959 }
11960
11963 {
11964 return null;
11965 }
11966
11968 {
11969 return false;
11970 }
11971
11973 {
11974 return false;
11975 }
11976
11980
11981
11983 {
11984 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11985 return module_repairing.CanRepair(this, item_repair_kit);
11986 }
11987
11988
11989 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11990 {
11991 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11992 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11993 }
11994
11995
11997 {
11998
11999
12000
12001
12002
12003
12004
12005
12006 return 1;
12007 }
12008
12009
12010
12012 {
12014 }
12015
12016
12017
12019 {
12021 }
12022
12023
12032 {
12033 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12034
12035 if (player)
12036 {
12037 player.MessageStatus(text);
12038 }
12039 }
12040
12041
12050 {
12051 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12052
12053 if (player)
12054 {
12055 player.MessageAction(text);
12056 }
12057 }
12058
12059
12068 {
12069 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12070
12071 if (player)
12072 {
12073 player.MessageFriendly(text);
12074 }
12075 }
12076
12077
12086 {
12087 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12088
12089 if (player)
12090 {
12091 player.MessageImportant(text);
12092 }
12093 }
12094
12096 {
12097 return true;
12098 }
12099
12100
12101 override bool KindOf(
string tag)
12102 {
12103 bool found = false;
12104 string item_name = this.
GetType();
12106 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12107
12108 int array_size = item_tag_array.Count();
12109 for (int i = 0; i < array_size; i++)
12110 {
12111 if (item_tag_array.Get(i) == tag)
12112 {
12113 found = true;
12114 break;
12115 }
12116 }
12117 return found;
12118 }
12119
12120
12122 {
12123
12124 super.OnRPC(sender, rpc_type,ctx);
12125
12126
12127 switch (rpc_type)
12128 {
12129 #ifndef SERVER
12130 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12131 Param2<bool, string> p = new Param2<bool, string>(false, "");
12132
12134 return;
12135
12136 bool play = p.param1;
12137 string soundSet = p.param2;
12138
12139 if (play)
12140 {
12142 {
12144 {
12146 }
12147 }
12148 else
12149 {
12151 }
12152 }
12153 else
12154 {
12156 }
12157
12158 break;
12159 #endif
12160
12161 }
12162
12164 {
12166 }
12167 }
12168
12169
12170
12171
12173 {
12174 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12175 return plugin.GetID(
name);
12176 }
12177
12179 {
12180 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12181 return plugin.GetName(id);
12182 }
12183
12186 {
12187
12188
12189 int varFlags;
12190 if (!ctx.
Read(varFlags))
12191 return;
12192
12193 if (varFlags & ItemVariableFlags.FLOAT)
12194 {
12196 }
12197 }
12198
12200 {
12201
12202 super.SerializeNumericalVars(floats_out);
12203
12204
12205
12207 {
12209 }
12210
12212 {
12214 }
12215
12217 {
12219 }
12220
12222 {
12227 }
12228
12230 {
12232 }
12233 }
12234
12236 {
12237
12238 super.DeSerializeNumericalVars(floats);
12239
12240
12241 int index = 0;
12242 int mask = Math.Round(floats.Get(index));
12243
12244 index++;
12245
12247 {
12249 {
12251 }
12252 else
12253 {
12254 float quantity = floats.Get(index);
12255 SetQuantity(quantity,
true,
false,
false,
false);
12256 }
12257 index++;
12258 }
12259
12261 {
12262 float wet = floats.Get(index);
12264 index++;
12265 }
12266
12268 {
12269 int liquidtype = Math.Round(floats.Get(index));
12271 index++;
12272 }
12273
12275 {
12277 index++;
12279 index++;
12281 index++;
12283 index++;
12284 }
12285
12287 {
12288 int cleanness = Math.Round(floats.Get(index));
12290 index++;
12291 }
12292 }
12293
12295 {
12296 super.WriteVarsToCTX(ctx);
12297
12298
12300 {
12302 }
12303
12305 {
12307 }
12308
12310 {
12312 }
12313
12315 {
12316 int r,g,b,a;
12322 }
12323
12325 {
12327 }
12328 }
12329
12331 {
12332 if (!super.ReadVarsFromCTX(ctx,version))
12333 return false;
12334
12335 int intValue;
12336 float value;
12337
12338 if (version < 140)
12339 {
12340 if (!ctx.
Read(intValue))
12341 return false;
12342
12343 m_VariablesMask = intValue;
12344 }
12345
12347 {
12348 if (!ctx.
Read(value))
12349 return false;
12350
12352 {
12354 }
12355 else
12356 {
12358 }
12359 }
12360
12361 if (version < 140)
12362 {
12364 {
12365 if (!ctx.
Read(value))
12366 return false;
12367 SetTemperatureDirect(value);
12368 }
12369 }
12370
12372 {
12373 if (!ctx.
Read(value))
12374 return false;
12376 }
12377
12379 {
12380 if (!ctx.
Read(intValue))
12381 return false;
12383 }
12384
12386 {
12387 int r,g,b,a;
12389 return false;
12391 return false;
12393 return false;
12395 return false;
12396
12398 }
12399
12401 {
12402 if (!ctx.
Read(intValue))
12403 return false;
12405 }
12406
12407 if (version >= 138 && version < 140)
12408 {
12410 {
12411 if (!ctx.
Read(intValue))
12412 return false;
12413 SetFrozen(intValue);
12414 }
12415 }
12416
12417 return true;
12418 }
12419
12420
12422 {
12425 {
12427 }
12428
12429 if (!super.OnStoreLoad(ctx, version))
12430 {
12432 return false;
12433 }
12434
12435 if (version >= 114)
12436 {
12437 bool hasQuickBarIndexSaved;
12438
12439 if (!ctx.
Read(hasQuickBarIndexSaved))
12440 {
12442 return false;
12443 }
12444
12445 if (hasQuickBarIndexSaved)
12446 {
12447 int itmQBIndex;
12448
12449
12450 if (!ctx.
Read(itmQBIndex))
12451 {
12453 return false;
12454 }
12455
12456 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12457 if (itmQBIndex != -1 && parentPlayer)
12458 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12459 }
12460 }
12461 else
12462 {
12463
12464 PlayerBase player;
12465 int itemQBIndex;
12466 if (version ==
int.
MAX)
12467 {
12468 if (!ctx.
Read(itemQBIndex))
12469 {
12471 return false;
12472 }
12473 }
12474 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12475 {
12476
12477 if (!ctx.
Read(itemQBIndex))
12478 {
12480 return false;
12481 }
12482 if (itemQBIndex != -1 && player)
12483 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12484 }
12485 }
12486
12487 if (version < 140)
12488 {
12489
12490 if (!LoadVariables(ctx, version))
12491 {
12493 return false;
12494 }
12495 }
12496
12497
12499 {
12501 return false;
12502 }
12503 if (version >= 132)
12504 {
12506 if (raib)
12507 {
12509 {
12511 return false;
12512 }
12513 }
12514 }
12515
12517 return true;
12518 }
12519
12520
12521
12523 {
12524 super.OnStoreSave(ctx);
12525
12526 PlayerBase player;
12527 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12528 {
12530
12531 int itemQBIndex = -1;
12532 itemQBIndex = player.FindQuickBarEntityIndex(this);
12533 ctx.
Write(itemQBIndex);
12534 }
12535 else
12536 {
12538 }
12539
12541
12543 if (raib)
12544 {
12546 }
12547 }
12548
12549
12551 {
12552 super.AfterStoreLoad();
12553
12555 {
12557 }
12558
12560 {
12563 }
12564 }
12565
12567 {
12568 super.EEOnAfterLoad();
12569
12571 {
12573 }
12574
12577 }
12578
12580 {
12581 return false;
12582 }
12583
12584
12585
12587 {
12589 {
12590 #ifdef PLATFORM_CONSOLE
12591
12593 {
12595 if (menu)
12596 {
12598 }
12599 }
12600 #endif
12601 }
12602
12604 {
12607 }
12608
12610 {
12611 SetWeightDirty();
12613 }
12615 {
12618 }
12619
12621 {
12624
12627 }
12629 {
12633 }
12634
12635 super.OnVariablesSynchronized();
12636 }
12637
12638
12639
12641 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12642 {
12643 if (!IsServerCheck(allow_client))
12644 return false;
12645
12647 return false;
12648
12651
12652 if (value <= (min + 0.001))
12653 value = min;
12654
12655 if (value == min)
12656 {
12657 if (destroy_config)
12658 {
12659 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12660 if (dstr)
12661 {
12663 this.Delete();
12664 return true;
12665 }
12666 }
12667 else if (destroy_forced)
12668 {
12670 this.Delete();
12671 return true;
12672 }
12673
12675 }
12676
12679
12681 {
12682 EntityAI parent = GetHierarchyRoot();
12683 InventoryLocation iLoc = new InventoryLocation();
12684 GetInventory().GetCurrentInventoryLocation(iLoc);
12686 {
12687 int iLocSlot = iLoc.
GetSlot();
12689 {
12691 }
12693 {
12695 }
12696 }
12697 }
12698
12700 {
12702
12703 if (delta)
12705 }
12706
12708
12709 return false;
12710 }
12711
12712
12714 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12715 {
12717 }
12718
12720 {
12723 }
12724
12726 {
12729 }
12730
12732 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12733 {
12734 float value_clamped = Math.Clamp(value, 0, 1);
12736 SetQuantity(result, destroy_config, destroy_forced);
12737 }
12738
12739
12742 {
12744 }
12745
12747 {
12749 }
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12761 {
12762 int slot = -1;
12763 GameInventory inventory = GetInventory();
12764 if (inventory)
12765 {
12766 InventoryLocation il = new InventoryLocation;
12769 }
12770
12772 }
12773
12775 {
12776 float quantity_max = 0;
12777
12779 {
12780 if (attSlotID != -1)
12781 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12782
12783 if (quantity_max <= 0)
12785 }
12786
12787 if (quantity_max <= 0)
12789
12790 return quantity_max;
12791 }
12792
12794 {
12796 }
12797
12799 {
12801 }
12802
12803
12805 {
12807 }
12808
12810 {
12812 }
12813
12815 {
12817 }
12818
12819
12821 {
12822
12823 float weightEx = GetWeightEx();
12824 float special = GetInventoryAndCargoWeight();
12825 return weightEx - special;
12826 }
12827
12828
12830 {
12832 }
12833
12835 {
12837 {
12838 #ifdef DEVELOPER
12839 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12840 {
12841 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12843 }
12844 #endif
12845
12846 return GetQuantity() * GetConfigWeightModified();
12847 }
12848 else if (HasEnergyManager())
12849 {
12850 #ifdef DEVELOPER
12851 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12852 {
12853 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12854 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12855 }
12856 #endif
12857 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12858 }
12859 else
12860 {
12861 #ifdef DEVELOPER
12862 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12863 {
12864 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12865 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12866 }
12867 #endif
12868 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12869 }
12870 }
12871
12874 {
12875 int item_count = 0;
12877
12878 GameInventory inventory = GetInventory();
12879 CargoBase cargo = inventory.
GetCargo();
12880 if (cargo != NULL)
12881 {
12883 }
12884
12886 for (int i = 0; i < nAttachments; ++i)
12887 {
12889 if (item)
12890 item_count += item.GetNumberOfItems();
12891 }
12892 return item_count;
12893 }
12894
12897 {
12898 float weight = 0;
12899 float wetness = 1;
12900 if (include_wetness)
12903 {
12904 weight = wetness * m_ConfigWeight;
12905 }
12907 {
12908 weight = 1;
12909 }
12910 return weight;
12911 }
12912
12913
12914
12916 {
12917 GameInventory inventory = GetInventory();
12918 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12919 {
12920 array<EntityAI> items = new array<EntityAI>;
12922 for (int i = 0; i < items.Count(); ++i)
12923 {
12925 if (item)
12926 {
12927 g_Game.ObjectDelete(item);
12928 }
12929 }
12930 }
12931 }
12932
12933
12934
12935
12937 {
12938 float energy = 0;
12939 if (HasEnergyManager())
12940 {
12941 energy = GetCompEM().GetEnergy();
12942 }
12943 return energy;
12944 }
12945
12946
12948 {
12949 super.OnEnergyConsumed();
12950
12952 }
12953
12955 {
12956 super.OnEnergyAdded();
12957
12959 }
12960
12961
12963 {
12964 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12965 {
12967 {
12968 float energy_0to1 = GetCompEM().GetEnergy0To1();
12970 }
12971 }
12972 }
12973
12974
12976 {
12977 return ConfigGetFloat("heatIsolation");
12978 }
12979
12981 {
12983 }
12984
12986 {
12987 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12988 if (
g_Game.ConfigIsExisting(paramPath))
12989 return g_Game.ConfigGetFloat(paramPath);
12990
12991 return 0.0;
12992 }
12993
12995 {
12996 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12997 if (
g_Game.ConfigIsExisting(paramPath))
12998 return g_Game.ConfigGetFloat(paramPath);
12999
13000 return 0.0;
13001 }
13002
13003 override void SetWet(
float value,
bool allow_client =
false)
13004 {
13005 if (!IsServerCheck(allow_client))
13006 return;
13007
13010
13012
13013 m_VarWet = Math.Clamp(value, min, max);
13014
13016 {
13019 }
13020 }
13021
13022 override void AddWet(
float value)
13023 {
13025 }
13026
13028 {
13030 }
13031
13033 {
13035 }
13036
13038 {
13040 }
13041
13043 {
13045 }
13046
13048 {
13050 }
13051
13052 override void OnWetChanged(
float newVal,
float oldVal)
13053 {
13056 if (newLevel != oldLevel)
13057 {
13059 }
13060 }
13061
13063 {
13064 SetWeightDirty();
13065 }
13066
13068 {
13069 return GetWetLevelInternal(
m_VarWet);
13070 }
13071
13072
13073
13075 {
13077 }
13078
13080 {
13082 }
13083
13085 {
13087 }
13088
13090 {
13092 }
13093
13094
13095
13097 {
13098 if (ConfigIsExisting("itemModelLength"))
13099 {
13100 return ConfigGetFloat("itemModelLength");
13101 }
13102 return 0;
13103 }
13104
13106 {
13107 if (ConfigIsExisting("itemAttachOffset"))
13108 {
13109 return ConfigGetFloat("itemAttachOffset");
13110 }
13111 return 0;
13112 }
13113
13114 override void SetCleanness(
int value,
bool allow_client =
false)
13115 {
13116 if (!IsServerCheck(allow_client))
13117 return;
13118
13120
13122
13125 }
13126
13128 {
13130 }
13131
13133 {
13134 return true;
13135 }
13136
13137
13138
13139
13141 {
13143 }
13144
13146 {
13148 }
13149
13150
13151
13152
13153 override void SetColor(
int r,
int g,
int b,
int a)
13154 {
13160 }
13162 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13163 {
13168 }
13169
13171 {
13173 }
13174
13177 {
13178 int r,g,b,a;
13180 r = r/255;
13181 g = g/255;
13182 b = b/255;
13183 a = a/255;
13184 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13185 }
13186
13187
13188
13189 override void SetLiquidType(
int value,
bool allow_client =
false)
13190 {
13191 if (!IsServerCheck(allow_client))
13192 return;
13193
13198 }
13199
13201 {
13202 return ConfigGetInt("varLiquidTypeInit");
13203 }
13204
13206 {
13208 }
13209
13211 {
13213 SetFrozen(false);
13214 }
13215
13218 {
13219 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13220 }
13221
13222
13225 {
13226 PlayerBase nplayer;
13227 if (PlayerBase.CastTo(nplayer, player))
13228 {
13230 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13231 }
13232 }
13233
13234
13237 {
13238 PlayerBase nplayer;
13239 if (PlayerBase.CastTo(nplayer,player))
13240 {
13241 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13242 }
13243
13244 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13245
13246 if (HasEnergyManager())
13247 {
13248 GetCompEM().UpdatePlugState();
13249 }
13250 }
13251
13252
13254 {
13255 super.OnPlacementStarted(player);
13256
13258 }
13259
13260 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13261 {
13263 {
13264 m_AdminLog.OnPlacementComplete(player,
this);
13265 }
13266
13267 super.OnPlacementComplete(player, position, orientation);
13268 }
13269
13270
13271
13272
13273
13275 {
13277 {
13278 return true;
13279 }
13280 else
13281 {
13282 return false;
13283 }
13284 }
13285
13286
13288 {
13290 {
13292 }
13293 }
13294
13295
13297 {
13299 }
13300
13302 {
13304 }
13305
13306 override void InsertAgent(
int agent,
float count = 1)
13307 {
13308 if (count < 1)
13309 return;
13310
13312 }
13313
13316 {
13318 }
13319
13320
13322 {
13324 }
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13368 {
13370 return false;
13371 return true;
13372 }
13373
13375 {
13376
13378 }
13379
13380
13383 {
13384 super.CheckForRoofLimited(timeTresholdMS);
13385
13386 float time =
g_Game.GetTime();
13387 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13388 {
13389 m_PreviousRoofTestTime = time;
13390 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13391 }
13392 }
13393
13394
13396 {
13398 {
13399 return 0;
13400 }
13401
13402 if (GetInventory().GetAttachmentSlotsCount() != 0)
13403 {
13404 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13405 if (filter)
13406 return filter.GetProtectionLevel(type, false, system);
13407 else
13408 return 0;
13409 }
13410
13411 string subclassPath, entryName;
13412
13413 switch (type)
13414 {
13416 entryName = "biological";
13417 break;
13419 entryName = "chemical";
13420 break;
13421 default:
13422 entryName = "biological";
13423 break;
13424 }
13425
13426 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13427
13428 return g_Game.ConfigGetFloat(subclassPath + entryName);
13429 }
13430
13431
13432
13435 {
13436 if (!IsMagazine())
13438
13440 }
13441
13442
13443
13444
13445
13450 {
13451 return true;
13452 }
13453
13455 {
13457 }
13458
13459
13460
13461
13462
13464 {
13465 if (parent)
13466 {
13467 if (parent.IsInherited(DayZInfected))
13468 return true;
13469
13470 if (!parent.IsRuined())
13471 return true;
13472 }
13473
13474 return true;
13475 }
13476
13478 {
13479 if (!super.CanPutAsAttachment(parent))
13480 {
13481 return false;
13482 }
13483
13484 if (!IsRuined() && !parent.IsRuined())
13485 {
13486 return true;
13487 }
13488
13489 return false;
13490 }
13491
13493 {
13494
13495
13496
13497
13498 return super.CanReceiveItemIntoCargo(item);
13499 }
13500
13502 {
13503
13504
13505
13506
13507 GameInventory attachmentInv = attachment.GetInventory();
13509 {
13510 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13511 return false;
13512 }
13513
13514 InventoryLocation loc = new InventoryLocation();
13515 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13516 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13517 return false;
13518
13519 return super.CanReceiveAttachment(attachment, slotId);
13520 }
13521
13523 {
13524 if (!super.CanReleaseAttachment(attachment))
13525 return false;
13526
13527 return GetInventory().AreChildrenAccessible();
13528 }
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13551 {
13552 int id = muzzle_owner.GetMuzzleID();
13553 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13554
13555 if (WPOF_array)
13556 {
13557 for (int i = 0; i < WPOF_array.Count(); i++)
13558 {
13559 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13560
13561 if (WPOF)
13562 {
13563 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13564 }
13565 }
13566 }
13567 }
13568
13569
13571 {
13572 int id = muzzle_owner.GetMuzzleID();
13574
13575 if (WPOBE_array)
13576 {
13577 for (int i = 0; i < WPOBE_array.Count(); i++)
13578 {
13579 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13580
13581 if (WPOBE)
13582 {
13583 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13584 }
13585 }
13586 }
13587 }
13588
13589
13591 {
13592 int id = muzzle_owner.GetMuzzleID();
13593 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13594
13595 if (WPOOH_array)
13596 {
13597 for (int i = 0; i < WPOOH_array.Count(); i++)
13598 {
13599 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13600
13601 if (WPOOH)
13602 {
13603 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13604 }
13605 }
13606 }
13607 }
13608
13609
13611 {
13612 int id = muzzle_owner.GetMuzzleID();
13613 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13614
13615 if (WPOOH_array)
13616 {
13617 for (int i = 0; i < WPOOH_array.Count(); i++)
13618 {
13619 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13620
13621 if (WPOOH)
13622 {
13623 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13624 }
13625 }
13626 }
13627 }
13628
13629
13631 {
13632 int id = muzzle_owner.GetMuzzleID();
13633 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13634
13635 if (WPOOH_array)
13636 {
13637 for (int i = 0; i < WPOOH_array.Count(); i++)
13638 {
13639 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13640
13641 if (WPOOH)
13642 {
13643 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13644 }
13645 }
13646 }
13647 }
13648
13649
13650
13652 {
13654 {
13655 return true;
13656 }
13657
13658 return false;
13659 }
13660
13662 {
13664 {
13665 return true;
13666 }
13667
13668 return false;
13669 }
13670
13672 {
13674 {
13675 return true;
13676 }
13677
13678 return false;
13679 }
13680
13682 {
13683 return false;
13684 }
13685
13688 {
13689 return UATimeSpent.DEFAULT_DEPLOY;
13690 }
13691
13692
13693
13694
13696 {
13698 SetSynchDirty();
13699 }
13700
13702 {
13704 }
13705
13706
13708 {
13709 return false;
13710 }
13711
13714 {
13715 string att_type = "None";
13716
13717 if (ConfigIsExisting("soundAttType"))
13718 {
13719 att_type = ConfigGetString("soundAttType");
13720 }
13721
13723 }
13724
13726 {
13728 }
13729
13730
13731
13732
13733
13739
13741 {
13744
13746 }
13747
13748
13750 {
13752 return;
13753
13755
13758
13761
13762 SoundParameters params = new SoundParameters();
13766 }
13767
13768
13770 {
13772 {
13775
13776 SetSynchDirty();
13777
13780 }
13781 }
13782
13784 {
13786 }
13787
13788
13790 {
13792 return;
13793
13795 SetSynchDirty();
13796
13799 }
13800
13802 {
13805 }
13806
13808 {
13810 }
13811
13812 void OnApply(PlayerBase player);
13813
13815 {
13816 return 1.0;
13817 };
13818
13820 {
13822 }
13823
13825 {
13827 }
13828
13830
13832 {
13833 SetDynamicPhysicsLifeTime(0.01);
13835 }
13836
13838 {
13839 array<string> zone_names = new array<string>;
13840 GetDamageZones(zone_names);
13841 for (int i = 0; i < zone_names.Count(); i++)
13842 {
13843 SetHealthMax(zone_names.Get(i),"Health");
13844 }
13845 SetHealthMax("","Health");
13846 }
13847
13850 {
13851 float global_health = GetHealth01("","Health");
13852 array<string> zones = new array<string>;
13853 GetDamageZones(zones);
13854
13855 for (int i = 0; i < zones.Count(); i++)
13856 {
13857 SetHealth01(zones.Get(i),"Health",global_health);
13858 }
13859 }
13860
13863 {
13864 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13865 }
13866
13868 {
13869 if (!hasRootAsPlayer)
13870 {
13871 if (refParentIB)
13872 {
13873
13874 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13875 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13876
13877 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13878 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13879
13882 }
13883 else
13884 {
13885
13888 }
13889 }
13890 }
13891
13893 {
13895 {
13896 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13897 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13898 {
13899 float heatPermCoef = 1.0;
13901 while (ent)
13902 {
13903 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13904 ent = ent.GetHierarchyParent();
13905 }
13906
13907 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13908 }
13909 }
13910 }
13911
13913 {
13914
13915 EntityAI parent = GetHierarchyParent();
13916 if (!parent)
13917 {
13918 hasParent = false;
13919 hasRootAsPlayer = false;
13920 }
13921 else
13922 {
13923 hasParent = true;
13924 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13925 refParentIB =
ItemBase.Cast(parent);
13926 }
13927 }
13928
13929 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13930 {
13931
13932 }
13933
13935 {
13936
13937 return false;
13938 }
13939
13941 {
13942
13943
13944 return false;
13945 }
13946
13948 {
13949
13950 return false;
13951 }
13952
13955 {
13956 return !GetIsFrozen() &&
IsOpen();
13957 }
13958
13960 {
13961 bool hasParent = false, hasRootAsPlayer = false;
13963
13964 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13965 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13966
13967 if (wwtu || foodDecay)
13968 {
13972
13973 if (processWetness || processTemperature || processDecay)
13974 {
13976
13977 if (processWetness)
13978 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13979
13980 if (processTemperature)
13982
13983 if (processDecay)
13984 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13985 }
13986 }
13987 }
13988
13991 {
13993 }
13994
13996 {
13999
14000 return super.GetTemperatureFreezeThreshold();
14001 }
14002
14004 {
14007
14008 return super.GetTemperatureThawThreshold();
14009 }
14010
14012 {
14015
14016 return super.GetItemOverheatThreshold();
14017 }
14018
14020 {
14022 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14023
14024 return super.GetTemperatureFreezeTime();
14025 }
14026
14028 {
14030 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14031
14032 return super.GetTemperatureThawTime();
14033 }
14034
14039
14041 {
14042 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14043 }
14044
14046 {
14047 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14048 }
14049
14052 {
14054 }
14055
14057 {
14059 }
14060
14062 {
14064 }
14065
14068 {
14069 return null;
14070 }
14071
14074 {
14075 return false;
14076 }
14077
14079 {
14081 {
14084 if (!trg)
14085 {
14087 explosive = this;
14088 }
14089
14090 explosive.PairRemote(trg);
14092
14093 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14094 trg.SetPersistentPairID(persistentID);
14095 explosive.SetPersistentPairID(persistentID);
14096
14097 return true;
14098 }
14099 return false;
14100 }
14101
14104 {
14105 float ret = 1.0;
14108 ret *= GetHealth01();
14109
14110 return ret;
14111 }
14112
14113 #ifdef DEVELOPER
14114 override void SetDebugItem()
14115 {
14116 super.SetDebugItem();
14117 _itemBase = this;
14118 }
14119
14121 {
14122 string text = super.GetDebugText();
14123
14125 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14126
14127 return text;
14128 }
14129 #endif
14130
14132 {
14133 return true;
14134 }
14135
14137
14139
14141 {
14144 }
14145
14146
14154
14170
14171 [
Obsolete(
"Use ItemSoundHandler instead")]
14174 {
14175 if (!
g_Game.IsDedicatedServer())
14176 {
14177 if (ConfigIsExisting("attachSoundSet"))
14178 {
14179 string cfg_path = "";
14180 string soundset = "";
14181 string type_name =
GetType();
14182
14185 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14186 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14187
14188 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14189 {
14190 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14191 {
14192 if (cfg_slot_array[i] == slot_type)
14193 {
14194 soundset = cfg_soundset_array[i];
14195 break;
14196 }
14197 }
14198 }
14199
14200 if (soundset != "")
14201 {
14202 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14204 }
14205 }
14206 }
14207 }
14208
14210}
14211
14213{
14215 if (entity)
14216 {
14217 bool is_item = entity.IsInherited(
ItemBase);
14218 if (is_item && full_quantity)
14219 {
14222 }
14223 }
14224 else
14225 {
14227 return NULL;
14228 }
14229 return entity;
14230}
14231
14233{
14234 if (item)
14235 {
14236 if (health > 0)
14237 item.SetHealth("", "", health);
14238
14239 if (item.CanHaveTemperature())
14240 {
14242 if (item.CanFreeze())
14243 item.SetFrozen(false);
14244 }
14245
14246 if (item.HasEnergyManager())
14247 {
14248 if (quantity >= 0)
14249 {
14250 item.GetCompEM().SetEnergy0To1(quantity);
14251 }
14252 else
14253 {
14255 }
14256 }
14257 else if (item.IsMagazine())
14258 {
14259 Magazine mag = Magazine.Cast(item);
14260 if (quantity >= 0)
14261 {
14262 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14263 }
14264 else
14265 {
14267 }
14268
14269 }
14270 else
14271 {
14272 if (quantity >= 0)
14273 {
14274 item.SetQuantityNormalized(quantity, false);
14275 }
14276 else
14277 {
14279 }
14280
14281 }
14282 }
14283}
14284
14285#ifdef DEVELOPER
14287#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
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)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.