9281{
9283 {
9284 return true;
9285 }
9286};
9287
9289{
9290
9291};
9292
9293
9294
9296{
9300
9302
9305
9306
9307
9308
9309
9318
9324
9329
9334
9355 protected bool m_IsResultOfSplit
9356
9358
9363
9364
9365
9367
9371
9372
9373
9375
9378
9379
9380
9386
9387
9395
9398
9399
9401
9402
9404
9405
9410
9411
9416
9418
9419
9421
9422
9424 {
9429
9430 if (!
g_Game.IsDedicatedServer())
9431 {
9433 {
9435
9437 {
9439 }
9440 }
9441
9444 }
9445
9446 m_OldLocation = null;
9447
9449 {
9451 }
9452
9453 if (ConfigIsExisting("headSelectionsToHide"))
9454 {
9457 }
9458
9460 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9461 {
9463 }
9464
9466
9467 m_IsResultOfSplit = false;
9468
9470 }
9471
9473 {
9474 super.InitItemVariables();
9475
9481 m_Count = ConfigGetInt(
"count");
9482
9485
9490
9493
9498
9510
9514
9515
9518 if (ConfigIsExisting("canBeSplit"))
9519 {
9522 }
9523
9525 if (ConfigIsExisting("itemBehaviour"))
9527
9528
9531 RegisterNetSyncVariableInt("m_VarLiquidType");
9532 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9533
9534 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9535 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9536 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9537
9538 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9539 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9540 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9541 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9542
9543 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9544 RegisterNetSyncVariableBool("m_IsTakeable");
9545 RegisterNetSyncVariableBool("m_IsHologram");
9546
9549 {
9552 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9553 }
9554
9556
9558 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9560
9562 }
9563
9565 {
9567 }
9568
9570 {
9573 {
9578 }
9579 }
9580
9581 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9582 {
9584 {
9587 }
9588
9590 }
9591
9593 {
9599 }
9600
9602
9604 {
9606
9607 if (!action)
9608 {
9609 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9610 return;
9611 }
9612
9614 if (!ai)
9615 {
9617 return;
9618 }
9619
9621 if (!action_array)
9622 {
9623 action_array = new array<ActionBase_Basic>;
9625 }
9626 if (LogManager.IsActionLogEnable())
9627 {
9628 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9629 }
9630
9631 if (action_array.Find(action) != -1)
9632 {
9633 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9634 }
9635 else
9636 {
9637 action_array.Insert(action);
9638 }
9639 }
9640
9642 {
9643 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9644 ActionBase action = player.GetActionManager().GetAction(actionName);
9647
9648 if (action_array)
9649 {
9650 action_array.RemoveItem(action);
9651 }
9652 }
9653
9654
9655
9657 {
9658 ActionOverrideData overrideData = new ActionOverrideData();
9662
9664 if (!actionMap)
9665 {
9668 }
9669
9670 actionMap.Insert(this.
Type(), overrideData);
9671
9672 }
9673
9675
9677
9678
9680 {
9683
9686
9687 string config_to_search = "CfgVehicles";
9688 string muzzle_owner_config;
9689
9691 {
9692 if (IsInherited(Weapon))
9693 config_to_search = "CfgWeapons";
9694
9695 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9696
9697 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9698
9699 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9700
9701 if (config_OnFire_subclass_count > 0)
9702 {
9703 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9704
9705 for (int i = 0; i < config_OnFire_subclass_count; i++)
9706 {
9707 string particle_class = "";
9708 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9709 string config_OnFire_entry = config_OnFire_class + particle_class;
9710 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9711 WPOF_array.Insert(WPOF);
9712 }
9713
9714
9716 }
9717 }
9718
9720 {
9721 config_to_search = "CfgWeapons";
9722 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9723
9724 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9725
9726 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9727
9728 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9729 {
9730 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9731
9732 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9733 {
9734 string particle_class2 = "";
9735 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9736 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9737 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9738 WPOBE_array.Insert(WPOBE);
9739 }
9740
9741
9743 }
9744 }
9745 }
9746
9747
9749 {
9752
9754 {
9755 string config_to_search = "CfgVehicles";
9756
9757 if (IsInherited(Weapon))
9758 config_to_search = "CfgWeapons";
9759
9760 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9761 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9762
9763 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9764 {
9765
9767
9769 {
9771 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9773 return;
9774 }
9775
9778
9779
9780
9781 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9782 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9783
9784 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9785 {
9786 string particle_class = "";
9787 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9788 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9789 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9790
9791 if (entry_type == CT_CLASS)
9792 {
9793 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9794 WPOOH_array.Insert(WPOF);
9795 }
9796 }
9797
9798
9800 }
9801 }
9802 }
9803
9805 {
9807 }
9808
9810 {
9812 {
9814
9817
9820
9821 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9822 }
9823 }
9824
9826 {
9828 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9829
9831 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9832
9834 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9835
9837 {
9839 }
9840 }
9841
9843 {
9845 }
9846
9848 {
9851 else
9853
9855 {
9858 }
9859 else
9860 {
9863
9866 }
9867
9869 }
9870
9872 {
9874 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9875 }
9876
9878 {
9880 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9882 }
9883
9885 {
9887 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9888 }
9889
9891 {
9894
9895 OverheatingParticle OP = new OverheatingParticle();
9900
9902 }
9903
9905 {
9908
9909 return -1;
9910 }
9911
9913 {
9915 {
9918
9919 for (int i = count; i > 0; --i)
9920 {
9921 int id = i - 1;
9924
9927
9928 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9929 {
9930 if (p)
9931 {
9934 }
9935 }
9936 }
9937 }
9938 }
9939
9941 {
9943 {
9945 {
9946 int id = i - 1;
9948
9949 if (OP)
9950 {
9952
9953 if (p)
9954 {
9956 }
9957
9958 delete OP;
9959 }
9960 }
9961
9964 }
9965 }
9966
9969 {
9970 return 0.0;
9971 }
9972
9973
9975 {
9976 return 250;
9977 }
9978
9980 {
9981 return 0;
9982 }
9983
9986 {
9988 return true;
9989
9990 return false;
9991 }
9992
9995 {
9998
10000 {
10002 }
10003 else
10004 {
10005
10007 }
10008
10010 }
10011
10018 {
10019 return -1;
10020 }
10021
10022
10023
10024
10026 {
10028 {
10029 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10030 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10031
10032 if (r_index >= 0)
10033 {
10034 InventoryLocation r_il = new InventoryLocation;
10035 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10036
10037 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10040 {
10041 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10042 }
10044 {
10045 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10046 }
10047
10048 }
10049
10050 player.GetHumanInventory().ClearUserReservedLocation(this);
10051 }
10052
10055 }
10056
10057
10058
10059
10061 {
10062 return ItemBase.m_DebugActionsMask;
10063 }
10064
10066 {
10067 return ItemBase.m_DebugActionsMask & mask;
10068 }
10069
10071 {
10072 ItemBase.m_DebugActionsMask = mask;
10073 }
10074
10076 {
10077 ItemBase.m_DebugActionsMask |= mask;
10078 }
10079
10081 {
10082 ItemBase.m_DebugActionsMask &= ~mask;
10083 }
10084
10086 {
10088 {
10090 }
10091 else
10092 {
10094 }
10095 }
10096
10097
10099 {
10100 if (GetEconomyProfile())
10101 {
10102 float q_max = GetEconomyProfile().GetQuantityMax();
10103 if (q_max > 0)
10104 {
10105 float q_min = GetEconomyProfile().GetQuantityMin();
10106 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10107
10109 {
10110 ComponentEnergyManager comp = GetCompEM();
10112 {
10114 }
10115 }
10117 {
10119
10120 }
10121
10122 }
10123 }
10124 }
10125
10128 {
10129 EntityAI parent = GetHierarchyParent();
10130
10131 if (parent)
10132 {
10133 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10134 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10135 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10136 }
10137 }
10138
10141 {
10142 EntityAI parent = GetHierarchyParent();
10143
10144 if (parent)
10145 {
10146 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10147 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10148 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10149 }
10150 }
10151
10153 {
10154
10155
10156
10157
10159
10161 {
10162 if (ScriptInputUserData.CanStoreInputUserData())
10163 {
10164 ScriptInputUserData ctx = new ScriptInputUserData;
10170 ctx.
Write(use_stack_max);
10173
10175 {
10176 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10177 }
10178 }
10179 }
10180 else if (!
g_Game.IsMultiplayer())
10181 {
10183 }
10184 }
10185
10187 {
10189 }
10190
10192 {
10194 }
10195
10197 {
10199 }
10200
10202 {
10203
10204 return false;
10205 }
10206
10208 {
10209 return false;
10210 }
10211
10215 {
10216 return false;
10217 }
10218
10220 {
10221 return "";
10222 }
10223
10225
10227 {
10228 return false;
10229 }
10230
10232 {
10233 return true;
10234 }
10235
10236
10237
10239 {
10240 return true;
10241 }
10242
10244 {
10245 return true;
10246 }
10247
10249 {
10250 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10252 }
10253
10255 {
10257 }
10258
10260 {
10262 if (!is_being_placed)
10264 SetSynchDirty();
10265 }
10266
10267
10269
10271 {
10273 }
10274
10276 {
10278 }
10279
10281 {
10282 return 1;
10283 }
10284
10286 {
10287 return false;
10288 }
10289
10291 {
10293 SetSynchDirty();
10294 }
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10331 {
10332 super.OnMovedInsideCargo(container);
10333
10334 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10335 }
10336
10337 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10338 {
10339 super.EEItemLocationChanged(oldLoc, newLoc);
10340
10341 PlayerBase newPlayer = null;
10342 PlayerBase oldPlayer = null;
10343
10344 if (newLoc.GetParent())
10345 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10346
10347 if (oldLoc.GetParent())
10348 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10349
10351 {
10352 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10353
10354 if (rIndex >= 0)
10355 {
10356 InventoryLocation rIl = new InventoryLocation;
10357 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10358
10359 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10362 {
10363 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10364 }
10366 {
10368 }
10369
10370 }
10371 }
10372
10374 {
10375 if (newPlayer)
10376 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10377
10378 if (newPlayer == oldPlayer)
10379 {
10380 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10381 {
10383 {
10384 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10385 {
10386 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10387 }
10388 }
10389 else
10390 {
10391 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10392 }
10393 }
10394
10395 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10396 {
10397 int type = oldLoc.GetType();
10399 {
10400 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10401 }
10403 {
10404 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10405 }
10406 }
10407 if (!m_OldLocation)
10408 {
10409 m_OldLocation = new InventoryLocation;
10410 }
10411 m_OldLocation.Copy(oldLoc);
10412 }
10413 else
10414 {
10415 if (m_OldLocation)
10416 {
10417 m_OldLocation.Reset();
10418 }
10419 }
10420
10421 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10422 }
10423 else
10424 {
10425 if (newPlayer)
10426 {
10427 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10428 if (resIndex >= 0)
10429 {
10430 InventoryLocation il = new InventoryLocation;
10431 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10433 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10436 {
10437 il.
GetParent().GetOnReleaseLock().Invoke(it);
10438 }
10440 {
10442 }
10443
10444 }
10445 }
10447 {
10448
10450 }
10451
10452 if (m_OldLocation)
10453 {
10454 m_OldLocation.Reset();
10455 }
10456 }
10457
10459 {
10460 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10461 }
10462
10464 {
10465 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10466 }
10467 }
10468
10469 override void EOnContact(IEntity other, Contact extra)
10470 {
10472 {
10473 int liquidType = -1;
10475 if (impactSpeed > 0.0)
10476 {
10478 #ifndef SERVER
10480 #else
10482 SetSynchDirty();
10483 #endif
10485 }
10486 }
10487
10488 #ifdef SERVER
10489 if (GetCompEM() && GetCompEM().IsPlugged())
10490 {
10491 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10492 GetCompEM().UnplugThis();
10493 }
10494 #endif
10495 }
10496
10498
10500 {
10502 }
10503
10505 {
10506
10507 }
10508
10510 {
10511 super.OnItemLocationChanged(old_owner, new_owner);
10512
10513 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10514 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10515
10516 if (!relatedPlayer && playerNew)
10517 relatedPlayer = playerNew;
10518
10519 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10520 {
10522 if (actionMgr)
10523 {
10524 ActionBase currentAction = actionMgr.GetRunningAction();
10525 if (currentAction)
10527 }
10528 }
10529
10530 Man ownerPlayerOld = null;
10531 Man ownerPlayerNew = null;
10532
10533 if (old_owner)
10534 {
10535 if (old_owner.
IsMan())
10536 {
10537 ownerPlayerOld = Man.Cast(old_owner);
10538 }
10539 else
10540 {
10541 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10542 }
10543 }
10544 else
10545 {
10547 {
10549
10550 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10551 {
10552 GetCompEM().UnplugThis();
10553 }
10554 }
10555 }
10556
10557 if (new_owner)
10558 {
10559 if (new_owner.
IsMan())
10560 {
10561 ownerPlayerNew = Man.Cast(new_owner);
10562 }
10563 else
10564 {
10565 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10566 }
10567 }
10568
10569 if (ownerPlayerOld != ownerPlayerNew)
10570 {
10571 if (ownerPlayerOld)
10572 {
10573 array<EntityAI> subItemsExit = new array<EntityAI>;
10575 for (int i = 0; i < subItemsExit.Count(); i++)
10576 {
10579 }
10580 }
10581
10582 if (ownerPlayerNew)
10583 {
10584 array<EntityAI> subItemsEnter = new array<EntityAI>;
10586 for (int j = 0; j < subItemsEnter.Count(); j++)
10587 {
10590 }
10591 }
10592 }
10593 else if (ownerPlayerNew != null)
10594 {
10595 PlayerBase nplayer;
10596 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10597 {
10598 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10600 for (int k = 0; k < subItemsUpdate.Count(); k++)
10601 {
10603 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10604 }
10605 }
10606 }
10607
10608 if (old_owner)
10609 old_owner.OnChildItemRemoved(this);
10610 if (new_owner)
10611 new_owner.OnChildItemReceived(this);
10612 }
10613
10614
10616 {
10617 super.EEDelete(parent);
10618 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10619 if (player)
10620 {
10622
10623 if (player.IsAlive())
10624 {
10625 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10626 if (r_index >= 0)
10627 {
10628 InventoryLocation r_il = new InventoryLocation;
10629 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10630
10631 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10634 {
10635 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10636 }
10638 {
10639 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10640 }
10641
10642 }
10643
10644 player.RemoveQuickBarEntityShortcut(this);
10645 }
10646 }
10647 }
10648
10650 {
10651 super.EEKilled(killer);
10652
10655 {
10656 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10657 {
10658 if (IsMagazine())
10659 {
10660 if (Magazine.Cast(this).GetAmmoCount() > 0)
10661 {
10663 }
10664 }
10665 else
10666 {
10668 }
10669 }
10670 }
10671 }
10672
10674 {
10675 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10676
10677 super.OnWasAttached(parent, slot_id);
10678
10681
10684 }
10685
10687 {
10688 super.OnWasDetached(parent, slot_id);
10689
10692
10695 }
10696
10698 {
10699 int idx;
10702
10703 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10704 if (inventory_slots.Count() < 1)
10705 {
10706 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10707 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10708 }
10709 else
10710 {
10711 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10712 }
10713
10714 idx = inventory_slots.Find(slot);
10715 if (idx < 0)
10716 return "";
10717
10718 return attach_types.Get(idx);
10719 }
10720
10722 {
10723 int idx = -1;
10724 string slot;
10725
10728
10729 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10730 if (inventory_slots.Count() < 1)
10731 {
10732 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10733 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10734 }
10735 else
10736 {
10737 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10738 if (detach_types.Count() < 1)
10739 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10740 }
10741
10742 for (int i = 0; i < inventory_slots.Count(); i++)
10743 {
10744 slot = inventory_slots.Get(i);
10745 }
10746
10747 if (slot != "")
10748 {
10749 if (detach_types.Count() == 1)
10750 idx = 0;
10751 else
10752 idx = inventory_slots.Find(slot);
10753 }
10754 if (idx < 0)
10755 return "";
10756
10757 return detach_types.Get(idx);
10758 }
10759
10761 {
10762
10764
10765
10766 float min_time = 1;
10767 float max_time = 3;
10768 float delay = Math.RandomFloat(min_time, max_time);
10769
10770 explode_timer.Run(delay, this, "DoAmmoExplosion");
10771 }
10772
10774 {
10775 Magazine magazine = Magazine.Cast(this);
10776 int pop_sounds_count = 6;
10777 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10778
10779
10780 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10781 string sound_name = pop_sounds[ sound_idx ];
10782 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10783
10784
10785 magazine.ServerAddAmmoCount(-1);
10786
10787
10788 float min_temp_to_explode = 100;
10789
10790 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10791 {
10793 }
10794 }
10795
10796
10797 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10798 {
10799 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10800
10801 const int CHANCE_DAMAGE_CARGO = 4;
10802 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10803 const int CHANCE_DAMAGE_NOTHING = 2;
10804
10806 {
10807 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10808 int chances;
10809 int rnd;
10810
10811 if (GetInventory().GetCargo())
10812 {
10813 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10814 rnd = Math.RandomInt(0,chances);
10815
10816 if (rnd < CHANCE_DAMAGE_CARGO)
10817 {
10819 }
10820 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10821 {
10823 }
10824 }
10825 else
10826 {
10827 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10828 rnd = Math.RandomInt(0,chances);
10829
10830 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10831 {
10833 }
10834 }
10835 }
10836 }
10837
10839 {
10840 CargoBase cargo = GetInventory().GetCargo();
10841 if (cargo)
10842 {
10844 if (item_count > 0)
10845 {
10846 int random_pick = Math.RandomInt(0, item_count);
10848 if (!item.IsExplosive())
10849 {
10850 item.AddHealth("","",damage);
10851 return true;
10852 }
10853 }
10854 }
10855 return false;
10856 }
10857
10859 {
10860 GameInventory inventory = GetInventory();
10862 if (attachment_count > 0)
10863 {
10864 int random_pick = Math.RandomInt(0, attachment_count);
10866 if (!attachment.IsExplosive())
10867 {
10868 attachment.AddHealth("","",damage);
10869 return true;
10870 }
10871 }
10872 return false;
10873 }
10874
10876 {
10878 }
10879
10881 {
10883 return GetInventory().CanRemoveEntity();
10884
10885 return false;
10886 }
10887
10889 {
10890
10892 return false;
10893
10894
10896 return false;
10897
10898
10899
10901 if (delta == 0)
10902 return false;
10903
10904
10905 return true;
10906 }
10907
10909 {
10911 {
10912 if (ScriptInputUserData.CanStoreInputUserData())
10913 {
10914 ScriptInputUserData ctx = new ScriptInputUserData;
10919 ctx.
Write(destination_entity);
10921 ctx.
Write(slot_id);
10923 }
10924 }
10925 else if (!
g_Game.IsMultiplayer())
10926 {
10928 }
10929 }
10930
10932 {
10933 float split_quantity_new;
10937 InventoryLocation loc = new InventoryLocation;
10938
10939 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10940 {
10942 split_quantity_new = stack_max;
10943 else
10945
10947 {
10948 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10949 if (new_item)
10950 {
10951 new_item.SetResultOfSplit(true);
10952 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10954 new_item.
SetQuantity(split_quantity_new,
false,
true);
10955 }
10956 }
10957 }
10958 else if (destination_entity && slot_id == -1)
10959 {
10960 if (quantity > stack_max)
10961 split_quantity_new = stack_max;
10962 else
10963 split_quantity_new = quantity;
10964
10966 {
10967 GameInventory destinationInventory = destination_entity.GetInventory();
10969 {
10972 }
10973
10974 if (new_item)
10975 {
10976 new_item.SetResultOfSplit(true);
10977 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10979 new_item.
SetQuantity(split_quantity_new,
false,
true);
10980 }
10981 }
10982 }
10983 else
10984 {
10985 if (stack_max != 0)
10986 {
10988 {
10990 }
10991
10992 if (split_quantity_new == 0)
10993 {
10994 if (!
g_Game.IsMultiplayer())
10995 player.PhysicalPredictiveDropItem(this);
10996 else
10997 player.ServerDropEntity(this);
10998 return;
10999 }
11000
11002 {
11004
11005 if (new_item)
11006 {
11007 new_item.SetResultOfSplit(true);
11008 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11011 new_item.PlaceOnSurface();
11012 }
11013 }
11014 }
11015 }
11016 }
11017
11019 {
11020 float split_quantity_new;
11024 InventoryLocation loc = new InventoryLocation;
11025
11026 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11027 {
11029 split_quantity_new = stack_max;
11030 else
11032
11034 {
11035 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11036 if (new_item)
11037 {
11038 new_item.SetResultOfSplit(true);
11039 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11041 new_item.
SetQuantity(split_quantity_new,
false,
true);
11042 }
11043 }
11044 }
11045 else if (destination_entity && slot_id == -1)
11046 {
11047 if (quantity > stack_max)
11048 split_quantity_new = stack_max;
11049 else
11050 split_quantity_new = quantity;
11051
11053 {
11054 GameInventory destinationInventory = destination_entity.GetInventory();
11056 {
11059 }
11060
11061 if (new_item)
11062 {
11063 new_item.SetResultOfSplit(true);
11064 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11066 new_item.
SetQuantity(split_quantity_new,
false,
true);
11067 }
11068 }
11069 }
11070 else
11071 {
11072 if (stack_max != 0)
11073 {
11075 {
11077 }
11078
11080 {
11082
11083 if (new_item)
11084 {
11085 new_item.SetResultOfSplit(true);
11086 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11089 new_item.PlaceOnSurface();
11090 }
11091 }
11092 }
11093 }
11094 }
11095
11097 {
11099 {
11100 if (ScriptInputUserData.CanStoreInputUserData())
11101 {
11102 ScriptInputUserData ctx = new ScriptInputUserData;
11107 dst.WriteToContext(ctx);
11109 }
11110 }
11111 else if (!
g_Game.IsMultiplayer())
11112 {
11114 }
11115 }
11116
11118 {
11120 {
11121 if (ScriptInputUserData.CanStoreInputUserData())
11122 {
11123 ScriptInputUserData ctx = new ScriptInputUserData;
11128 ctx.
Write(destination_entity);
11134 }
11135 }
11136 else if (!
g_Game.IsMultiplayer())
11137 {
11139 }
11140 }
11141
11143 {
11145 }
11146
11148 {
11150 float split_quantity_new;
11152 if (dst.IsValid())
11153 {
11154 int slot_id = dst.GetSlot();
11156
11157 if (quantity > stack_max)
11158 split_quantity_new = stack_max;
11159 else
11160 split_quantity_new = quantity;
11161
11163 {
11165
11166 if (new_item)
11167 {
11168 new_item.SetResultOfSplit(true);
11169 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11171 new_item.
SetQuantity(split_quantity_new,
false,
true);
11172 }
11173
11174 return new_item;
11175 }
11176 }
11177
11178 return null;
11179 }
11180
11182 {
11184 float split_quantity_new;
11186 if (destination_entity)
11187 {
11189 if (quantity > stackable)
11190 split_quantity_new = stackable;
11191 else
11192 split_quantity_new = quantity;
11193
11195 {
11196 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11197 if (new_item)
11198 {
11199 new_item.SetResultOfSplit(true);
11200 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11202 new_item.
SetQuantity(split_quantity_new,
false,
true);
11203 }
11204 }
11205 }
11206 }
11207
11209 {
11211 {
11212 if (ScriptInputUserData.CanStoreInputUserData())
11213 {
11214 ScriptInputUserData ctx = new ScriptInputUserData;
11219 ItemBase destination_entity =
this;
11220 ctx.
Write(destination_entity);
11224 }
11225 }
11226 else if (!
g_Game.IsMultiplayer())
11227 {
11229 }
11230 }
11231
11233 {
11235 float split_quantity_new;
11237 if (player)
11238 {
11240 if (quantity > stackable)
11241 split_quantity_new = stackable;
11242 else
11243 split_quantity_new = quantity;
11244
11246 {
11247 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11248 new_item =
ItemBase.Cast(in_hands);
11249 if (new_item)
11250 {
11251 new_item.SetResultOfSplit(true);
11252 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11254 new_item.SetQuantity(split_quantity_new, false, true);
11255 }
11256 }
11257 }
11258 }
11259
11261 {
11263 float split_quantity_new = Math.Floor(quantity * 0.5);
11264
11266 return;
11267
11269
11270 if (new_item)
11271 {
11272 if (new_item.GetQuantityMax() < split_quantity_new)
11273 {
11274 split_quantity_new = new_item.GetQuantityMax();
11275 }
11276
11277 new_item.SetResultOfSplit(true);
11278 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11279
11281 {
11284 }
11285 else
11286 {
11288 new_item.
SetQuantity(split_quantity_new,
false,
true);
11289 }
11290 }
11291 }
11292
11294 {
11296 float split_quantity_new = Math.Floor(quantity / 2);
11297
11299 return;
11300
11301 InventoryLocation invloc = new InventoryLocation;
11303
11305 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11306
11307 if (new_item)
11308 {
11309 if (new_item.GetQuantityMax() < split_quantity_new)
11310 {
11311 split_quantity_new = new_item.GetQuantityMax();
11312 }
11314 {
11317 }
11318 else if (split_quantity_new > 1)
11319 {
11321 new_item.
SetQuantity(split_quantity_new,
false,
true);
11322 }
11323 }
11324 }
11325
11328 {
11329 SetWeightDirty();
11331
11332 if (parent)
11333 parent.OnAttachmentQuantityChangedEx(this, delta);
11334
11336 {
11338 {
11340 }
11342 {
11343 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11345 }
11346 }
11347 }
11348
11351 {
11352
11353 }
11354
11357 {
11359 }
11360
11362 {
11363 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11364
11366 {
11367 if (newLevel == GameConstants.STATE_RUINED)
11368 {
11370 EntityAI parent = GetHierarchyParent();
11371 if (parent && parent.IsFireplace())
11372 {
11373 CargoBase cargo = GetInventory().GetCargo();
11374 if (cargo)
11375 {
11377 {
11379 }
11380 }
11381 }
11382 }
11383
11385 {
11386
11388 return;
11389 }
11390
11391 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11392 {
11394 }
11395 }
11396 }
11397
11398
11400 {
11401 super.OnRightClick();
11402
11404 {
11406 {
11407 if (ScriptInputUserData.CanStoreInputUserData())
11408 {
11409 EntityAI root = GetHierarchyRoot();
11410 Man playerOwner = GetHierarchyRootPlayer();
11411 InventoryLocation dst = new InventoryLocation;
11412
11413
11414 if (!playerOwner && root && root == this)
11415 {
11417 }
11418 else
11419 {
11420
11421 GetInventory().GetCurrentInventoryLocation(dst);
11423 {
11424 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11426 {
11428 }
11429 else
11430 {
11432
11433
11434 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11435 {
11437 }
11438 else
11439 {
11440 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11441 }
11442 }
11443 }
11444 }
11445
11446 ScriptInputUserData ctx = new ScriptInputUserData;
11454 }
11455 }
11456 else if (!
g_Game.IsMultiplayer())
11457 {
11459 }
11460 }
11461 }
11462
11464 {
11465 if (root)
11466 {
11467 vector m4[4];
11468 root.GetTransform(m4);
11469 dst.SetGround(this, m4);
11470 }
11471 else
11472 {
11473 GetInventory().GetCurrentInventoryLocation(dst);
11474 }
11475 }
11476
11477 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11478 {
11479
11480 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11481 return false;
11482
11483 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11484 return false;
11485
11486
11488 return false;
11489
11490
11491 Magazine mag = Magazine.Cast(this);
11492 if (mag)
11493 {
11494 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11495 return false;
11496
11497 if (stack_max_limit)
11498 {
11499 Magazine other_mag = Magazine.Cast(other_item);
11500 if (other_item)
11501 {
11502 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11503 return false;
11504 }
11505
11506 }
11507 }
11508 else
11509 {
11510
11512 return false;
11513
11515 return false;
11516 }
11517
11518 PlayerBase player = null;
11519 if (CastTo(player, GetHierarchyRootPlayer()))
11520 {
11521 if (player.GetInventory().HasAttachment(this))
11522 return false;
11523
11524 if (player.IsItemsToDelete())
11525 return false;
11526 }
11527
11528 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11529 return false;
11530
11531 int slotID;
11533 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11534 return false;
11535
11536 return true;
11537 }
11538
11540 {
11542 }
11543
11545 {
11546 return m_IsResultOfSplit;
11547 }
11548
11550 {
11551 m_IsResultOfSplit = value;
11552 }
11553
11555 {
11557 }
11558
11560 {
11561 float other_item_quantity = other_item.GetQuantity();
11562 float this_free_space;
11563
11565
11567
11568 if (other_item_quantity > this_free_space)
11569 {
11570 return this_free_space;
11571 }
11572 else
11573 {
11574 return other_item_quantity;
11575 }
11576 }
11577
11579 {
11581 }
11582
11584 {
11586 return;
11587
11588 if (!IsMagazine() && other_item)
11589 {
11591 if (quantity_used != 0)
11592 {
11593 float hp1 = GetHealth01("","");
11594 float hp2 = other_item.GetHealth01("","");
11595 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11596 hpResult = hpResult / (
GetQuantity() + quantity_used);
11597
11598 hpResult *= GetMaxHealth();
11599 Math.Round(hpResult);
11600 SetHealth("", "Health", hpResult);
11601
11603 other_item.AddQuantity(-quantity_used);
11604 }
11605 }
11607 }
11608
11610 {
11611 #ifdef SERVER
11612 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11613 GetHierarchyParent().IncreaseLifetimeUp();
11614 #endif
11615 };
11616
11618 {
11619 PlayerBase p = PlayerBase.Cast(player);
11620
11621 array<int> recipesIds = p.m_Recipes;
11622 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11623 if (moduleRecipesManager)
11624 {
11625 EntityAI itemInHands = player.GetEntityInHands();
11626 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11627 }
11628
11629 for (int i = 0;i < recipesIds.Count(); i++)
11630 {
11631 int key = recipesIds.Get(i);
11632 string recipeName = moduleRecipesManager.GetRecipeName(key);
11634 }
11635 }
11636
11637
11638 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11639 {
11640 super.GetDebugActions(outputList);
11641
11642
11648
11649
11654
11659
11660
11664
11665
11667 {
11671 }
11672
11675
11676
11680
11682
11683 InventoryLocation loc = new InventoryLocation();
11684 GetInventory().GetCurrentInventoryLocation(loc);
11686 {
11687 if (Gizmo_IsSupported())
11690 }
11691
11693 }
11694
11695
11696
11697
11699 {
11700 super.OnAction(action_id, player, ctx);
11701
11703 {
11704 switch (action_id)
11705 {
11709 return true;
11713 return true;
11714 }
11715 }
11716
11718 {
11719 switch (action_id)
11720 {
11722 Delete();
11723 return true;
11724 }
11725 }
11726
11727 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11728 {
11729 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11730 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11731 PlayerBase p = PlayerBase.Cast(player);
11732 if (
EActions.RECIPES_RANGE_START < 1000)
11733 {
11734 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11735 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11736 }
11737 }
11738 #ifndef SERVER
11739 else if (action_id ==
EActions.WATCH_PLAYER)
11740 {
11741 PluginDeveloper.SetDeveloperItemClientEx(player);
11742 }
11743 #endif
11745 {
11746 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11747 {
11748 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11749 OnDebugButtonPressServer(id + 1);
11750 }
11751
11752 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11753 {
11754 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11756 }
11757
11758 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11759 {
11760 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11762 }
11763
11764 else if (action_id ==
EActions.ADD_QUANTITY)
11765 {
11766 if (IsMagazine())
11767 {
11768 Magazine mag = Magazine.Cast(this);
11769 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11770 }
11771 else
11772 {
11774 }
11775
11776 if (m_EM)
11777 {
11778 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11779 }
11780
11781 }
11782
11783 else if (action_id ==
EActions.REMOVE_QUANTITY)
11784 {
11785 if (IsMagazine())
11786 {
11787 Magazine mag2 = Magazine.Cast(this);
11788 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11789 }
11790 else
11791 {
11793 }
11794 if (m_EM)
11795 {
11796 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11797 }
11798
11799 }
11800
11801 else if (action_id ==
EActions.SET_QUANTITY_0)
11802 {
11804
11805 if (m_EM)
11806 {
11807 m_EM.SetEnergy(0);
11808 }
11809 }
11810
11811 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11812 {
11814
11815 if (m_EM)
11816 {
11817 m_EM.SetEnergy(m_EM.GetEnergyMax());
11818 }
11819 }
11820
11821 else if (action_id ==
EActions.ADD_HEALTH)
11822 {
11823 AddHealth("","",GetMaxHealth("","Health")/5);
11824 }
11825 else if (action_id ==
EActions.REMOVE_HEALTH)
11826 {
11827 AddHealth("","",-GetMaxHealth("","Health")/5);
11828 }
11829 else if (action_id ==
EActions.DESTROY_HEALTH)
11830 {
11831 SetHealth01("","",0);
11832 }
11833 else if (action_id ==
EActions.WATCH_ITEM)
11834 {
11836 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11837 #ifdef DEVELOPER
11838 SetDebugDeveloper_item(this);
11839 #endif
11840 }
11841
11842 else if (action_id ==
EActions.ADD_TEMPERATURE)
11843 {
11844 AddTemperature(20);
11845
11846 }
11847
11848 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11849 {
11850 AddTemperature(-20);
11851
11852 }
11853
11854 else if (action_id ==
EActions.FLIP_FROZEN)
11855 {
11856 SetFrozen(!GetIsFrozen());
11857
11858 }
11859
11860 else if (action_id ==
EActions.ADD_WETNESS)
11861 {
11863
11864 }
11865
11866 else if (action_id ==
EActions.REMOVE_WETNESS)
11867 {
11869
11870 }
11871
11872 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11873 {
11876
11877
11878 }
11879
11880 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11881 {
11884 }
11885
11886 else if (action_id ==
EActions.MAKE_SPECIAL)
11887 {
11888 auto debugParams = DebugSpawnParams.WithPlayer(player);
11889 OnDebugSpawnEx(debugParams);
11890 }
11891
11892 }
11893
11894
11895 return false;
11896 }
11897
11898
11899
11900
11904
11907
11908
11909
11911 {
11912 return false;
11913 }
11914
11915
11917 {
11918 return true;
11919 }
11920
11921
11923 {
11924 return true;
11925 }
11926
11927
11928
11930 {
11931 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11932 return g_Game.ConfigIsExisting(config_path);
11933 }
11934
11937 {
11938 return null;
11939 }
11940
11942 {
11943 return false;
11944 }
11945
11947 {
11948 return false;
11949 }
11950
11954
11955
11957 {
11958 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11959 return module_repairing.CanRepair(this, item_repair_kit);
11960 }
11961
11962
11963 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11964 {
11965 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11966 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11967 }
11968
11969
11971 {
11972
11973
11974
11975
11976
11977
11978
11979
11980 return 1;
11981 }
11982
11983
11984
11986 {
11988 }
11989
11990
11991
11993 {
11995 }
11996
11997
12006 {
12007 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12008
12009 if (player)
12010 {
12011 player.MessageStatus(text);
12012 }
12013 }
12014
12015
12024 {
12025 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12026
12027 if (player)
12028 {
12029 player.MessageAction(text);
12030 }
12031 }
12032
12033
12042 {
12043 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12044
12045 if (player)
12046 {
12047 player.MessageFriendly(text);
12048 }
12049 }
12050
12051
12060 {
12061 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12062
12063 if (player)
12064 {
12065 player.MessageImportant(text);
12066 }
12067 }
12068
12070 {
12071 return true;
12072 }
12073
12074
12075 override bool KindOf(
string tag)
12076 {
12077 bool found = false;
12078 string item_name = this.
GetType();
12080 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12081
12082 int array_size = item_tag_array.Count();
12083 for (int i = 0; i < array_size; i++)
12084 {
12085 if (item_tag_array.Get(i) == tag)
12086 {
12087 found = true;
12088 break;
12089 }
12090 }
12091 return found;
12092 }
12093
12094
12096 {
12097
12098 super.OnRPC(sender, rpc_type,ctx);
12099
12100
12101 switch (rpc_type)
12102 {
12103 #ifndef SERVER
12104 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12105 Param2<bool, string> p = new Param2<bool, string>(false, "");
12106
12108 return;
12109
12110 bool play = p.param1;
12111 string soundSet = p.param2;
12112
12113 if (play)
12114 {
12116 {
12118 {
12120 }
12121 }
12122 else
12123 {
12125 }
12126 }
12127 else
12128 {
12130 }
12131
12132 break;
12133 #endif
12134
12135 }
12136
12138 {
12140 }
12141 }
12142
12143
12144
12145
12147 {
12148 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12149 return plugin.GetID(
name);
12150 }
12151
12153 {
12154 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12155 return plugin.GetName(id);
12156 }
12157
12160 {
12161
12162
12163 int varFlags;
12164 if (!ctx.
Read(varFlags))
12165 return;
12166
12167 if (varFlags & ItemVariableFlags.FLOAT)
12168 {
12170 }
12171 }
12172
12174 {
12175
12176 super.SerializeNumericalVars(floats_out);
12177
12178
12179
12181 {
12183 }
12184
12186 {
12188 }
12189
12191 {
12193 }
12194
12196 {
12201 }
12202
12204 {
12206 }
12207 }
12208
12210 {
12211
12212 super.DeSerializeNumericalVars(floats);
12213
12214
12215 int index = 0;
12216 int mask = Math.Round(floats.Get(index));
12217
12218 index++;
12219
12221 {
12223 {
12225 }
12226 else
12227 {
12228 float quantity = floats.Get(index);
12229 SetQuantity(quantity,
true,
false,
false,
false);
12230 }
12231 index++;
12232 }
12233
12235 {
12236 float wet = floats.Get(index);
12238 index++;
12239 }
12240
12242 {
12243 int liquidtype = Math.Round(floats.Get(index));
12245 index++;
12246 }
12247
12249 {
12251 index++;
12253 index++;
12255 index++;
12257 index++;
12258 }
12259
12261 {
12262 int cleanness = Math.Round(floats.Get(index));
12264 index++;
12265 }
12266 }
12267
12269 {
12270 super.WriteVarsToCTX(ctx);
12271
12272
12274 {
12276 }
12277
12279 {
12281 }
12282
12284 {
12286 }
12287
12289 {
12290 int r,g,b,a;
12296 }
12297
12299 {
12301 }
12302 }
12303
12305 {
12306 if (!super.ReadVarsFromCTX(ctx,version))
12307 return false;
12308
12309 int intValue;
12310 float value;
12311
12312 if (version < 140)
12313 {
12314 if (!ctx.
Read(intValue))
12315 return false;
12316
12317 m_VariablesMask = intValue;
12318 }
12319
12321 {
12322 if (!ctx.
Read(value))
12323 return false;
12324
12326 {
12328 }
12329 else
12330 {
12332 }
12333 }
12334
12335 if (version < 140)
12336 {
12338 {
12339 if (!ctx.
Read(value))
12340 return false;
12341 SetTemperatureDirect(value);
12342 }
12343 }
12344
12346 {
12347 if (!ctx.
Read(value))
12348 return false;
12350 }
12351
12353 {
12354 if (!ctx.
Read(intValue))
12355 return false;
12357 }
12358
12360 {
12361 int r,g,b,a;
12363 return false;
12365 return false;
12367 return false;
12369 return false;
12370
12372 }
12373
12375 {
12376 if (!ctx.
Read(intValue))
12377 return false;
12379 }
12380
12381 if (version >= 138 && version < 140)
12382 {
12384 {
12385 if (!ctx.
Read(intValue))
12386 return false;
12387 SetFrozen(intValue);
12388 }
12389 }
12390
12391 return true;
12392 }
12393
12394
12396 {
12399 {
12401 }
12402
12403 if (!super.OnStoreLoad(ctx, version))
12404 {
12406 return false;
12407 }
12408
12409 if (version >= 114)
12410 {
12411 bool hasQuickBarIndexSaved;
12412
12413 if (!ctx.
Read(hasQuickBarIndexSaved))
12414 {
12416 return false;
12417 }
12418
12419 if (hasQuickBarIndexSaved)
12420 {
12421 int itmQBIndex;
12422
12423
12424 if (!ctx.
Read(itmQBIndex))
12425 {
12427 return false;
12428 }
12429
12430 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12431 if (itmQBIndex != -1 && parentPlayer)
12432 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12433 }
12434 }
12435 else
12436 {
12437
12438 PlayerBase player;
12439 int itemQBIndex;
12440 if (version ==
int.
MAX)
12441 {
12442 if (!ctx.
Read(itemQBIndex))
12443 {
12445 return false;
12446 }
12447 }
12448 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12449 {
12450
12451 if (!ctx.
Read(itemQBIndex))
12452 {
12454 return false;
12455 }
12456 if (itemQBIndex != -1 && player)
12457 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12458 }
12459 }
12460
12461 if (version < 140)
12462 {
12463
12464 if (!LoadVariables(ctx, version))
12465 {
12467 return false;
12468 }
12469 }
12470
12471
12473 {
12475 return false;
12476 }
12477 if (version >= 132)
12478 {
12480 if (raib)
12481 {
12483 {
12485 return false;
12486 }
12487 }
12488 }
12489
12491 return true;
12492 }
12493
12494
12495
12497 {
12498 super.OnStoreSave(ctx);
12499
12500 PlayerBase player;
12501 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12502 {
12504
12505 int itemQBIndex = -1;
12506 itemQBIndex = player.FindQuickBarEntityIndex(this);
12507 ctx.
Write(itemQBIndex);
12508 }
12509 else
12510 {
12512 }
12513
12515
12517 if (raib)
12518 {
12520 }
12521 }
12522
12523
12525 {
12526 super.AfterStoreLoad();
12527
12529 {
12531 }
12532
12534 {
12537 }
12538 }
12539
12541 {
12542 super.EEOnAfterLoad();
12543
12545 {
12547 }
12548
12551 }
12552
12554 {
12555 return false;
12556 }
12557
12558
12559
12561 {
12563 {
12564 #ifdef PLATFORM_CONSOLE
12565
12567 {
12569 if (menu)
12570 {
12572 }
12573 }
12574 #endif
12575 }
12576
12578 {
12581 }
12582
12584 {
12585 SetWeightDirty();
12587 }
12589 {
12592 }
12593
12595 {
12598
12601 }
12603 {
12607 }
12608
12609 super.OnVariablesSynchronized();
12610 }
12611
12612
12613
12615 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12616 {
12617 if (!IsServerCheck(allow_client))
12618 return false;
12619
12621 return false;
12622
12625
12626 if (value <= (min + 0.001))
12627 value = min;
12628
12629 if (value == min)
12630 {
12631 if (destroy_config)
12632 {
12633 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12634 if (dstr)
12635 {
12637 this.Delete();
12638 return true;
12639 }
12640 }
12641 else if (destroy_forced)
12642 {
12644 this.Delete();
12645 return true;
12646 }
12647
12649 }
12650
12653
12655 {
12656 EntityAI parent = GetHierarchyRoot();
12657 InventoryLocation iLoc = new InventoryLocation();
12658 GetInventory().GetCurrentInventoryLocation(iLoc);
12660 {
12661 int iLocSlot = iLoc.
GetSlot();
12663 {
12665 }
12667 {
12669 }
12670 }
12671 }
12672
12674 {
12676
12677 if (delta)
12679 }
12680
12682
12683 return false;
12684 }
12685
12686
12688 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12689 {
12691 }
12692
12694 {
12697 }
12698
12700 {
12703 }
12704
12706 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12707 {
12708 float value_clamped = Math.Clamp(value, 0, 1);
12710 SetQuantity(result, destroy_config, destroy_forced);
12711 }
12712
12713
12716 {
12718 }
12719
12721 {
12723 }
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12735 {
12736 int slot = -1;
12737 GameInventory inventory = GetInventory();
12738 if (inventory)
12739 {
12740 InventoryLocation il = new InventoryLocation;
12743 }
12744
12746 }
12747
12749 {
12750 float quantity_max = 0;
12751
12753 {
12754 if (attSlotID != -1)
12755 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12756
12757 if (quantity_max <= 0)
12759 }
12760
12761 if (quantity_max <= 0)
12763
12764 return quantity_max;
12765 }
12766
12768 {
12770 }
12771
12773 {
12775 }
12776
12777
12779 {
12781 }
12782
12784 {
12786 }
12787
12789 {
12791 }
12792
12793
12795 {
12796
12797 float weightEx = GetWeightEx();
12798 float special = GetInventoryAndCargoWeight();
12799 return weightEx - special;
12800 }
12801
12802
12804 {
12806 }
12807
12809 {
12811 {
12812 #ifdef DEVELOPER
12813 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12814 {
12815 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12817 }
12818 #endif
12819
12820 return GetQuantity() * GetConfigWeightModified();
12821 }
12822 else if (HasEnergyManager())
12823 {
12824 #ifdef DEVELOPER
12825 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12826 {
12827 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12828 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12829 }
12830 #endif
12831 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12832 }
12833 else
12834 {
12835 #ifdef DEVELOPER
12836 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12837 {
12838 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12839 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12840 }
12841 #endif
12842 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12843 }
12844 }
12845
12848 {
12849 int item_count = 0;
12851
12852 GameInventory inventory = GetInventory();
12853 CargoBase cargo = inventory.
GetCargo();
12854 if (cargo != NULL)
12855 {
12857 }
12858
12860 for (int i = 0; i < nAttachments; ++i)
12861 {
12863 if (item)
12864 item_count += item.GetNumberOfItems();
12865 }
12866 return item_count;
12867 }
12868
12871 {
12872 float weight = 0;
12873 float wetness = 1;
12874 if (include_wetness)
12877 {
12878 weight = wetness * m_ConfigWeight;
12879 }
12881 {
12882 weight = 1;
12883 }
12884 return weight;
12885 }
12886
12887
12888
12890 {
12891 GameInventory inventory = GetInventory();
12892 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12893 {
12894 array<EntityAI> items = new array<EntityAI>;
12896 for (int i = 0; i < items.Count(); ++i)
12897 {
12899 if (item)
12900 {
12901 g_Game.ObjectDelete(item);
12902 }
12903 }
12904 }
12905 }
12906
12907
12908
12909
12911 {
12912 float energy = 0;
12913 if (HasEnergyManager())
12914 {
12915 energy = GetCompEM().GetEnergy();
12916 }
12917 return energy;
12918 }
12919
12920
12922 {
12923 super.OnEnergyConsumed();
12924
12926 }
12927
12929 {
12930 super.OnEnergyAdded();
12931
12933 }
12934
12935
12937 {
12938 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12939 {
12941 {
12942 float energy_0to1 = GetCompEM().GetEnergy0To1();
12944 }
12945 }
12946 }
12947
12948
12950 {
12951 return ConfigGetFloat("heatIsolation");
12952 }
12953
12955 {
12957 }
12958
12960 {
12961 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12962 if (
g_Game.ConfigIsExisting(paramPath))
12963 return g_Game.ConfigGetFloat(paramPath);
12964
12965 return 0.0;
12966 }
12967
12969 {
12970 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12971 if (
g_Game.ConfigIsExisting(paramPath))
12972 return g_Game.ConfigGetFloat(paramPath);
12973
12974 return 0.0;
12975 }
12976
12977 override void SetWet(
float value,
bool allow_client =
false)
12978 {
12979 if (!IsServerCheck(allow_client))
12980 return;
12981
12984
12986
12987 m_VarWet = Math.Clamp(value, min, max);
12988
12990 {
12993 }
12994 }
12995
12996 override void AddWet(
float value)
12997 {
12999 }
13000
13002 {
13004 }
13005
13007 {
13009 }
13010
13012 {
13014 }
13015
13017 {
13019 }
13020
13022 {
13024 }
13025
13026 override void OnWetChanged(
float newVal,
float oldVal)
13027 {
13030 if (newLevel != oldLevel)
13031 {
13033 }
13034 }
13035
13037 {
13038 SetWeightDirty();
13039 }
13040
13042 {
13043 return GetWetLevelInternal(
m_VarWet);
13044 }
13045
13046
13047
13049 {
13051 }
13052
13054 {
13056 }
13057
13059 {
13061 }
13062
13064 {
13066 }
13067
13068
13069
13071 {
13072 if (ConfigIsExisting("itemModelLength"))
13073 {
13074 return ConfigGetFloat("itemModelLength");
13075 }
13076 return 0;
13077 }
13078
13080 {
13081 if (ConfigIsExisting("itemAttachOffset"))
13082 {
13083 return ConfigGetFloat("itemAttachOffset");
13084 }
13085 return 0;
13086 }
13087
13088 override void SetCleanness(
int value,
bool allow_client =
false)
13089 {
13090 if (!IsServerCheck(allow_client))
13091 return;
13092
13094
13096
13099 }
13100
13102 {
13104 }
13105
13107 {
13108 return true;
13109 }
13110
13111
13112
13113
13115 {
13117 }
13118
13120 {
13122 }
13123
13124
13125
13126
13127 override void SetColor(
int r,
int g,
int b,
int a)
13128 {
13134 }
13136 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13137 {
13142 }
13143
13145 {
13147 }
13148
13151 {
13152 int r,g,b,a;
13154 r = r/255;
13155 g = g/255;
13156 b = b/255;
13157 a = a/255;
13158 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13159 }
13160
13161
13162
13163 override void SetLiquidType(
int value,
bool allow_client =
false)
13164 {
13165 if (!IsServerCheck(allow_client))
13166 return;
13167
13172 }
13173
13175 {
13176 return ConfigGetInt("varLiquidTypeInit");
13177 }
13178
13180 {
13182 }
13183
13185 {
13187 SetFrozen(false);
13188 }
13189
13192 {
13193 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13194 }
13195
13196
13199 {
13200 PlayerBase nplayer;
13201 if (PlayerBase.CastTo(nplayer, player))
13202 {
13204 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13205 }
13206 }
13207
13208
13211 {
13212 PlayerBase nplayer;
13213 if (PlayerBase.CastTo(nplayer,player))
13214 {
13215 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13216 }
13217
13218 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13219
13220 if (HasEnergyManager())
13221 {
13222 GetCompEM().UpdatePlugState();
13223 }
13224 }
13225
13226
13228 {
13229 super.OnPlacementStarted(player);
13230
13232 }
13233
13234 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13235 {
13237 {
13238 m_AdminLog.OnPlacementComplete(player,
this);
13239 }
13240
13241 super.OnPlacementComplete(player, position, orientation);
13242 }
13243
13244
13245
13246
13247
13249 {
13251 {
13252 return true;
13253 }
13254 else
13255 {
13256 return false;
13257 }
13258 }
13259
13260
13262 {
13264 {
13266 }
13267 }
13268
13269
13271 {
13273 }
13274
13276 {
13278 }
13279
13280 override void InsertAgent(
int agent,
float count = 1)
13281 {
13282 if (count < 1)
13283 return;
13284
13286 }
13287
13290 {
13292 }
13293
13294
13296 {
13298 }
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13342 {
13344 return false;
13345 return true;
13346 }
13347
13349 {
13350
13352 }
13353
13354
13357 {
13358 super.CheckForRoofLimited(timeTresholdMS);
13359
13360 float time =
g_Game.GetTime();
13361 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13362 {
13363 m_PreviousRoofTestTime = time;
13364 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13365 }
13366 }
13367
13368
13370 {
13372 {
13373 return 0;
13374 }
13375
13376 if (GetInventory().GetAttachmentSlotsCount() != 0)
13377 {
13378 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13379 if (filter)
13380 return filter.GetProtectionLevel(type, false, system);
13381 else
13382 return 0;
13383 }
13384
13385 string subclassPath, entryName;
13386
13387 switch (type)
13388 {
13390 entryName = "biological";
13391 break;
13393 entryName = "chemical";
13394 break;
13395 default:
13396 entryName = "biological";
13397 break;
13398 }
13399
13400 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13401
13402 return g_Game.ConfigGetFloat(subclassPath + entryName);
13403 }
13404
13405
13406
13409 {
13410 if (!IsMagazine())
13412
13414 }
13415
13416
13417
13418
13419
13424 {
13425 return true;
13426 }
13427
13429 {
13431 }
13432
13433
13434
13435
13436
13438 {
13439 if (parent)
13440 {
13441 if (parent.IsInherited(DayZInfected))
13442 return true;
13443
13444 if (!parent.IsRuined())
13445 return true;
13446 }
13447
13448 return true;
13449 }
13450
13452 {
13453 if (!super.CanPutAsAttachment(parent))
13454 {
13455 return false;
13456 }
13457
13458 if (!IsRuined() && !parent.IsRuined())
13459 {
13460 return true;
13461 }
13462
13463 return false;
13464 }
13465
13467 {
13468
13469
13470
13471
13472 return super.CanReceiveItemIntoCargo(item);
13473 }
13474
13476 {
13477
13478
13479
13480
13481 GameInventory attachmentInv = attachment.GetInventory();
13483 {
13484 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13485 return false;
13486 }
13487
13488 InventoryLocation loc = new InventoryLocation();
13489 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13490 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13491 return false;
13492
13493 return super.CanReceiveAttachment(attachment, slotId);
13494 }
13495
13497 {
13498 if (!super.CanReleaseAttachment(attachment))
13499 return false;
13500
13501 return GetInventory().AreChildrenAccessible();
13502 }
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13525 {
13526 int id = muzzle_owner.GetMuzzleID();
13527 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13528
13529 if (WPOF_array)
13530 {
13531 for (int i = 0; i < WPOF_array.Count(); i++)
13532 {
13533 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13534
13535 if (WPOF)
13536 {
13537 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13538 }
13539 }
13540 }
13541 }
13542
13543
13545 {
13546 int id = muzzle_owner.GetMuzzleID();
13548
13549 if (WPOBE_array)
13550 {
13551 for (int i = 0; i < WPOBE_array.Count(); i++)
13552 {
13553 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13554
13555 if (WPOBE)
13556 {
13557 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13558 }
13559 }
13560 }
13561 }
13562
13563
13565 {
13566 int id = muzzle_owner.GetMuzzleID();
13567 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13568
13569 if (WPOOH_array)
13570 {
13571 for (int i = 0; i < WPOOH_array.Count(); i++)
13572 {
13573 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13574
13575 if (WPOOH)
13576 {
13577 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13578 }
13579 }
13580 }
13581 }
13582
13583
13585 {
13586 int id = muzzle_owner.GetMuzzleID();
13587 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13588
13589 if (WPOOH_array)
13590 {
13591 for (int i = 0; i < WPOOH_array.Count(); i++)
13592 {
13593 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13594
13595 if (WPOOH)
13596 {
13597 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13598 }
13599 }
13600 }
13601 }
13602
13603
13605 {
13606 int id = muzzle_owner.GetMuzzleID();
13607 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13608
13609 if (WPOOH_array)
13610 {
13611 for (int i = 0; i < WPOOH_array.Count(); i++)
13612 {
13613 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13614
13615 if (WPOOH)
13616 {
13617 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13618 }
13619 }
13620 }
13621 }
13622
13623
13624
13626 {
13628 {
13629 return true;
13630 }
13631
13632 return false;
13633 }
13634
13636 {
13638 {
13639 return true;
13640 }
13641
13642 return false;
13643 }
13644
13646 {
13648 {
13649 return true;
13650 }
13651
13652 return false;
13653 }
13654
13656 {
13657 return false;
13658 }
13659
13662 {
13663 return UATimeSpent.DEFAULT_DEPLOY;
13664 }
13665
13666
13667
13668
13670 {
13672 SetSynchDirty();
13673 }
13674
13676 {
13678 }
13679
13680
13682 {
13683 return false;
13684 }
13685
13688 {
13689 string att_type = "None";
13690
13691 if (ConfigIsExisting("soundAttType"))
13692 {
13693 att_type = ConfigGetString("soundAttType");
13694 }
13695
13697 }
13698
13700 {
13702 }
13703
13704
13705
13706
13707
13713
13715 {
13718
13720 }
13721
13722
13724 {
13726 return;
13727
13729
13732
13735
13736 SoundParameters params = new SoundParameters();
13740 }
13741
13742
13744 {
13746 {
13749
13750 SetSynchDirty();
13751
13754 }
13755 }
13756
13758 {
13760 }
13761
13762
13764 {
13766 return;
13767
13769 SetSynchDirty();
13770
13773 }
13774
13776 {
13779 }
13780
13782 {
13784 }
13785
13786 void OnApply(PlayerBase player);
13787
13789 {
13790 return 1.0;
13791 };
13792
13794 {
13796 }
13797
13799 {
13801 }
13802
13804
13806 {
13807 SetDynamicPhysicsLifeTime(0.01);
13809 }
13810
13812 {
13813 array<string> zone_names = new array<string>;
13814 GetDamageZones(zone_names);
13815 for (int i = 0; i < zone_names.Count(); i++)
13816 {
13817 SetHealthMax(zone_names.Get(i),"Health");
13818 }
13819 SetHealthMax("","Health");
13820 }
13821
13824 {
13825 float global_health = GetHealth01("","Health");
13826 array<string> zones = new array<string>;
13827 GetDamageZones(zones);
13828
13829 for (int i = 0; i < zones.Count(); i++)
13830 {
13831 SetHealth01(zones.Get(i),"Health",global_health);
13832 }
13833 }
13834
13837 {
13838 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13839 }
13840
13842 {
13843 if (!hasRootAsPlayer)
13844 {
13845 if (refParentIB)
13846 {
13847
13848 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13849 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13850
13851 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13852 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13853
13856 }
13857 else
13858 {
13859
13862 }
13863 }
13864 }
13865
13867 {
13869 {
13870 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13871 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13872 {
13873 float heatPermCoef = 1.0;
13875 while (ent)
13876 {
13877 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13878 ent = ent.GetHierarchyParent();
13879 }
13880
13881 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13882 }
13883 }
13884 }
13885
13887 {
13888
13889 EntityAI parent = GetHierarchyParent();
13890 if (!parent)
13891 {
13892 hasParent = false;
13893 hasRootAsPlayer = false;
13894 }
13895 else
13896 {
13897 hasParent = true;
13898 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13899 refParentIB =
ItemBase.Cast(parent);
13900 }
13901 }
13902
13903 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13904 {
13905
13906 }
13907
13909 {
13910
13911 return false;
13912 }
13913
13915 {
13916
13917
13918 return false;
13919 }
13920
13922 {
13923
13924 return false;
13925 }
13926
13929 {
13930 return !GetIsFrozen() &&
IsOpen();
13931 }
13932
13934 {
13935 bool hasParent = false, hasRootAsPlayer = false;
13937
13938 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13939 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13940
13941 if (wwtu || foodDecay)
13942 {
13946
13947 if (processWetness || processTemperature || processDecay)
13948 {
13950
13951 if (processWetness)
13952 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13953
13954 if (processTemperature)
13956
13957 if (processDecay)
13958 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13959 }
13960 }
13961 }
13962
13965 {
13967 }
13968
13970 {
13973
13974 return super.GetTemperatureFreezeThreshold();
13975 }
13976
13978 {
13981
13982 return super.GetTemperatureThawThreshold();
13983 }
13984
13986 {
13989
13990 return super.GetItemOverheatThreshold();
13991 }
13992
13994 {
13996 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13997
13998 return super.GetTemperatureFreezeTime();
13999 }
14000
14002 {
14004 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14005
14006 return super.GetTemperatureThawTime();
14007 }
14008
14013
14015 {
14016 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14017 }
14018
14020 {
14021 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14022 }
14023
14026 {
14028 }
14029
14031 {
14033 }
14034
14036 {
14038 }
14039
14042 {
14043 return null;
14044 }
14045
14048 {
14049 return false;
14050 }
14051
14053 {
14055 {
14058 if (!trg)
14059 {
14061 explosive = this;
14062 }
14063
14064 explosive.PairRemote(trg);
14066
14067 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14068 trg.SetPersistentPairID(persistentID);
14069 explosive.SetPersistentPairID(persistentID);
14070
14071 return true;
14072 }
14073 return false;
14074 }
14075
14078 {
14079 float ret = 1.0;
14082 ret *= GetHealth01();
14083
14084 return ret;
14085 }
14086
14087 #ifdef DEVELOPER
14088 override void SetDebugItem()
14089 {
14090 super.SetDebugItem();
14091 _itemBase = this;
14092 }
14093
14095 {
14096 string text = super.GetDebugText();
14097
14099 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14100
14101 return text;
14102 }
14103 #endif
14104
14106 {
14107 return true;
14108 }
14109
14111
14113
14115 {
14118 }
14119
14120
14128
14144
14145 [
Obsolete(
"Use ItemSoundHandler instead")]
14148 {
14149 if (!
g_Game.IsDedicatedServer())
14150 {
14151 if (ConfigIsExisting("attachSoundSet"))
14152 {
14153 string cfg_path = "";
14154 string soundset = "";
14155 string type_name =
GetType();
14156
14159 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14160 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14161
14162 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14163 {
14164 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14165 {
14166 if (cfg_slot_array[i] == slot_type)
14167 {
14168 soundset = cfg_soundset_array[i];
14169 break;
14170 }
14171 }
14172 }
14173
14174 if (soundset != "")
14175 {
14176 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14178 }
14179 }
14180 }
14181 }
14182
14184}
14185
14187{
14189 if (entity)
14190 {
14191 bool is_item = entity.IsInherited(
ItemBase);
14192 if (is_item && full_quantity)
14193 {
14196 }
14197 }
14198 else
14199 {
14201 return NULL;
14202 }
14203 return entity;
14204}
14205
14207{
14208 if (item)
14209 {
14210 if (health > 0)
14211 item.SetHealth("", "", health);
14212
14213 if (item.CanHaveTemperature())
14214 {
14216 if (item.CanFreeze())
14217 item.SetFrozen(false);
14218 }
14219
14220 if (item.HasEnergyManager())
14221 {
14222 if (quantity >= 0)
14223 {
14224 item.GetCompEM().SetEnergy0To1(quantity);
14225 }
14226 else
14227 {
14229 }
14230 }
14231 else if (item.IsMagazine())
14232 {
14233 Magazine mag = Magazine.Cast(item);
14234 if (quantity >= 0)
14235 {
14236 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14237 }
14238 else
14239 {
14241 }
14242
14243 }
14244 else
14245 {
14246 if (quantity >= 0)
14247 {
14248 item.SetQuantityNormalized(quantity, false);
14249 }
14250 else
14251 {
14253 }
14254
14255 }
14256 }
14257}
14258
14259#ifdef DEVELOPER
14261#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.