9295{
9297 {
9298 return true;
9299 }
9300};
9301
9303{
9304
9305};
9306
9307
9308
9310{
9314
9316
9319
9320
9321
9322
9323
9332
9338
9343
9348
9369 protected bool m_IsResultOfSplit
9370
9372
9377
9378
9379
9381
9385
9386
9387
9389
9392
9393
9394
9400
9401
9409
9412
9413
9415
9416
9418
9419
9424
9425
9430
9432
9433
9435
9436
9438 {
9443
9444 if (!
g_Game.IsDedicatedServer())
9445 {
9447 {
9449
9451 {
9453 }
9454 }
9455
9458 }
9459
9460 m_OldLocation = null;
9461
9463 {
9465 }
9466
9467 if (ConfigIsExisting("headSelectionsToHide"))
9468 {
9471 }
9472
9474 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9475 {
9477 }
9478
9480
9481 m_IsResultOfSplit = false;
9482
9484 }
9485
9487 {
9488 super.InitItemVariables();
9489
9495 m_Count = ConfigGetInt(
"count");
9496
9499
9504
9507
9512
9524
9528
9529
9532 if (ConfigIsExisting("canBeSplit"))
9533 {
9536 }
9537
9539 if (ConfigIsExisting("itemBehaviour"))
9541
9542
9545 RegisterNetSyncVariableInt("m_VarLiquidType");
9546 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9547
9548 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9549 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9550 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9551
9552 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9553 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9554 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9555 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9556
9557 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9558 RegisterNetSyncVariableBool("m_IsTakeable");
9559 RegisterNetSyncVariableBool("m_IsHologram");
9560
9563 {
9566 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9567 }
9568
9570
9572 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9574
9576 }
9577
9579 {
9581 }
9582
9584 {
9587 {
9592 }
9593 }
9594
9595 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9596 {
9598 {
9601 }
9602
9604 }
9605
9607 {
9613 }
9614
9616
9618 {
9620
9621 if (!action)
9622 {
9623 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9624 return;
9625 }
9626
9628 if (!ai)
9629 {
9631 return;
9632 }
9633
9635 if (!action_array)
9636 {
9637 action_array = new array<ActionBase_Basic>;
9639 }
9640 if (LogManager.IsActionLogEnable())
9641 {
9642 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9643 }
9644
9645 if (action_array.Find(action) != -1)
9646 {
9647 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9648 }
9649 else
9650 {
9651 action_array.Insert(action);
9652 }
9653 }
9654
9656 {
9657 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9658 ActionBase action = player.GetActionManager().GetAction(actionName);
9661
9662 if (action_array)
9663 {
9664 action_array.RemoveItem(action);
9665 }
9666 }
9667
9668
9669
9671 {
9672 ActionOverrideData overrideData = new ActionOverrideData();
9676
9678 if (!actionMap)
9679 {
9682 }
9683
9684 actionMap.Insert(this.
Type(), overrideData);
9685
9686 }
9687
9689
9691
9692
9694 {
9697
9700
9701 string config_to_search = "CfgVehicles";
9702 string muzzle_owner_config;
9703
9705 {
9706 if (IsInherited(Weapon))
9707 config_to_search = "CfgWeapons";
9708
9709 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9710
9711 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9712
9713 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9714
9715 if (config_OnFire_subclass_count > 0)
9716 {
9717 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9718
9719 for (int i = 0; i < config_OnFire_subclass_count; i++)
9720 {
9721 string particle_class = "";
9722 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9723 string config_OnFire_entry = config_OnFire_class + particle_class;
9724 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9725 WPOF_array.Insert(WPOF);
9726 }
9727
9728
9730 }
9731 }
9732
9734 {
9735 config_to_search = "CfgWeapons";
9736 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9737
9738 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9739
9740 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9741
9742 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9743 {
9744 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9745
9746 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9747 {
9748 string particle_class2 = "";
9749 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9750 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9751 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9752 WPOBE_array.Insert(WPOBE);
9753 }
9754
9755
9757 }
9758 }
9759 }
9760
9761
9763 {
9766
9768 {
9769 string config_to_search = "CfgVehicles";
9770
9771 if (IsInherited(Weapon))
9772 config_to_search = "CfgWeapons";
9773
9774 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9775 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9776
9777 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9778 {
9779
9781
9783 {
9785 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9787 return;
9788 }
9789
9792
9793
9794
9795 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9796 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9797
9798 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9799 {
9800 string particle_class = "";
9801 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9802 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9803 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9804
9805 if (entry_type == CT_CLASS)
9806 {
9807 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9808 WPOOH_array.Insert(WPOF);
9809 }
9810 }
9811
9812
9814 }
9815 }
9816 }
9817
9819 {
9821 }
9822
9824 {
9826 {
9828
9831
9834
9835 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9836 }
9837 }
9838
9840 {
9842 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9843
9845 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9846
9848 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9849
9851 {
9853 }
9854 }
9855
9857 {
9859 }
9860
9862 {
9865 else
9867
9869 {
9872 }
9873 else
9874 {
9877
9880 }
9881
9883 }
9884
9886 {
9888 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9889 }
9890
9892 {
9894 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9896 }
9897
9899 {
9901 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9902 }
9903
9905 {
9908
9909 OverheatingParticle OP = new OverheatingParticle();
9914
9916 }
9917
9919 {
9922
9923 return -1;
9924 }
9925
9927 {
9929 {
9932
9933 for (int i = count; i > 0; --i)
9934 {
9935 int id = i - 1;
9938
9941
9942 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9943 {
9944 if (p)
9945 {
9948 }
9949 }
9950 }
9951 }
9952 }
9953
9955 {
9957 {
9959 {
9960 int id = i - 1;
9962
9963 if (OP)
9964 {
9966
9967 if (p)
9968 {
9970 }
9971
9972 delete OP;
9973 }
9974 }
9975
9978 }
9979 }
9980
9983 {
9984 return 0.0;
9985 }
9986
9987
9989 {
9990 return 250;
9991 }
9992
9994 {
9995 return 0;
9996 }
9997
10000 {
10002 return true;
10003
10004 return false;
10005 }
10006
10009 {
10012
10014 {
10016 }
10017 else
10018 {
10019
10021 }
10022
10024 }
10025
10032 {
10033 return -1;
10034 }
10035
10036
10037
10038
10040 {
10042 {
10043 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10044 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10045
10046 if (r_index >= 0)
10047 {
10048 InventoryLocation r_il = new InventoryLocation;
10049 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10050
10051 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10054 {
10055 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10056 }
10058 {
10059 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10060 }
10061
10062 }
10063
10064 player.GetHumanInventory().ClearUserReservedLocation(this);
10065 }
10066
10069 }
10070
10071
10072
10073
10075 {
10076 return ItemBase.m_DebugActionsMask;
10077 }
10078
10080 {
10081 return ItemBase.m_DebugActionsMask & mask;
10082 }
10083
10085 {
10086 ItemBase.m_DebugActionsMask = mask;
10087 }
10088
10090 {
10091 ItemBase.m_DebugActionsMask |= mask;
10092 }
10093
10095 {
10096 ItemBase.m_DebugActionsMask &= ~mask;
10097 }
10098
10100 {
10102 {
10104 }
10105 else
10106 {
10108 }
10109 }
10110
10111
10113 {
10114 if (GetEconomyProfile())
10115 {
10116 float q_max = GetEconomyProfile().GetQuantityMax();
10117 if (q_max > 0)
10118 {
10119 float q_min = GetEconomyProfile().GetQuantityMin();
10120 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10121
10123 {
10124 ComponentEnergyManager comp = GetCompEM();
10126 {
10128 }
10129 }
10131 {
10133
10134 }
10135
10136 }
10137 }
10138 }
10139
10142 {
10143 EntityAI parent = GetHierarchyParent();
10144
10145 if (parent)
10146 {
10147 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10148 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10149 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10150 }
10151 }
10152
10155 {
10156 EntityAI parent = GetHierarchyParent();
10157
10158 if (parent)
10159 {
10160 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10161 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10162 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10163 }
10164 }
10165
10167 {
10168
10169
10170
10171
10173
10175 {
10176 if (ScriptInputUserData.CanStoreInputUserData())
10177 {
10178 ScriptInputUserData ctx = new ScriptInputUserData;
10184 ctx.
Write(use_stack_max);
10187
10189 {
10190 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10191 }
10192 }
10193 }
10194 else if (!
g_Game.IsMultiplayer())
10195 {
10197 }
10198 }
10199
10201 {
10203 }
10204
10206 {
10208 }
10209
10211 {
10213 }
10214
10216 {
10217
10218 return false;
10219 }
10220
10222 {
10223 return false;
10224 }
10225
10229 {
10230 return false;
10231 }
10232
10234 {
10235 return "";
10236 }
10237
10239
10241 {
10242 return false;
10243 }
10244
10246 {
10247 return true;
10248 }
10249
10250
10251
10253 {
10254 return true;
10255 }
10256
10258 {
10259 return true;
10260 }
10261
10263 {
10264 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10266 }
10267
10269 {
10271 }
10272
10274 {
10276 if (!is_being_placed)
10278 SetSynchDirty();
10279 }
10280
10281
10283
10285 {
10287 }
10288
10290 {
10292 }
10293
10295 {
10296 return 1;
10297 }
10298
10300 {
10301 return false;
10302 }
10303
10305 {
10307 SetSynchDirty();
10308 }
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10345 {
10346 super.OnMovedInsideCargo(container);
10347
10348 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10349 }
10350
10351 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10352 {
10353 super.EEItemLocationChanged(oldLoc, newLoc);
10354
10355 PlayerBase newPlayer = null;
10356 PlayerBase oldPlayer = null;
10357
10358 if (newLoc.GetParent())
10359 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10360
10361 if (oldLoc.GetParent())
10362 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10363
10365 {
10366 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10367
10368 if (rIndex >= 0)
10369 {
10370 InventoryLocation rIl = new InventoryLocation;
10371 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10372
10373 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10376 {
10377 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10378 }
10380 {
10382 }
10383
10384 }
10385 }
10386
10388 {
10389 if (newPlayer)
10390 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10391
10392 if (newPlayer == oldPlayer)
10393 {
10394 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10395 {
10397 {
10398 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10399 {
10400 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10401 }
10402 }
10403 else
10404 {
10405 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10406 }
10407 }
10408
10409 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10410 {
10411 int type = oldLoc.GetType();
10413 {
10414 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10415 }
10417 {
10418 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10419 }
10420 }
10421 if (!m_OldLocation)
10422 {
10423 m_OldLocation = new InventoryLocation;
10424 }
10425 m_OldLocation.Copy(oldLoc);
10426 }
10427 else
10428 {
10429 if (m_OldLocation)
10430 {
10431 m_OldLocation.Reset();
10432 }
10433 }
10434
10435 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10436 }
10437 else
10438 {
10439 if (newPlayer)
10440 {
10441 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10442 if (resIndex >= 0)
10443 {
10444 InventoryLocation il = new InventoryLocation;
10445 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10447 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10450 {
10451 il.
GetParent().GetOnReleaseLock().Invoke(it);
10452 }
10454 {
10456 }
10457
10458 }
10459 }
10461 {
10462
10464 }
10465
10466 if (m_OldLocation)
10467 {
10468 m_OldLocation.Reset();
10469 }
10470 }
10471
10473 {
10474 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10475 }
10476
10478 {
10479 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10480 }
10481 }
10482
10483 override void EOnContact(IEntity other, Contact extra)
10484 {
10486 {
10487 int liquidType = -1;
10489 if (impactSpeed > 0.0)
10490 {
10492 #ifndef SERVER
10494 #else
10496 SetSynchDirty();
10497 #endif
10499 }
10500 }
10501
10502 #ifdef SERVER
10503 if (GetCompEM() && GetCompEM().IsPlugged())
10504 {
10505 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10506 GetCompEM().UnplugThis();
10507 }
10508 #endif
10509 }
10510
10512
10514 {
10516 }
10517
10519 {
10520
10521 }
10522
10524 {
10525 super.OnItemLocationChanged(old_owner, new_owner);
10526
10527 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10528 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10529
10530 if (!relatedPlayer && playerNew)
10531 relatedPlayer = playerNew;
10532
10533 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10534 {
10536 if (actionMgr)
10537 {
10538 ActionBase currentAction = actionMgr.GetRunningAction();
10539 if (currentAction)
10541 }
10542 }
10543
10544 Man ownerPlayerOld = null;
10545 Man ownerPlayerNew = null;
10546
10547 if (old_owner)
10548 {
10549 if (old_owner.
IsMan())
10550 {
10551 ownerPlayerOld = Man.Cast(old_owner);
10552 }
10553 else
10554 {
10555 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10556 }
10557 }
10558 else
10559 {
10561 {
10563
10564 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10565 {
10566 GetCompEM().UnplugThis();
10567 }
10568 }
10569 }
10570
10571 if (new_owner)
10572 {
10573 if (new_owner.
IsMan())
10574 {
10575 ownerPlayerNew = Man.Cast(new_owner);
10576 }
10577 else
10578 {
10579 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10580 }
10581 }
10582
10583 if (ownerPlayerOld != ownerPlayerNew)
10584 {
10585 if (ownerPlayerOld)
10586 {
10587 array<EntityAI> subItemsExit = new array<EntityAI>;
10589 for (int i = 0; i < subItemsExit.Count(); i++)
10590 {
10593 }
10594 }
10595
10596 if (ownerPlayerNew)
10597 {
10598 array<EntityAI> subItemsEnter = new array<EntityAI>;
10600 for (int j = 0; j < subItemsEnter.Count(); j++)
10601 {
10604 }
10605 }
10606 }
10607 else if (ownerPlayerNew != null)
10608 {
10609 PlayerBase nplayer;
10610 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10611 {
10612 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10614 for (int k = 0; k < subItemsUpdate.Count(); k++)
10615 {
10617 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10618 }
10619 }
10620 }
10621
10622 if (old_owner)
10623 old_owner.OnChildItemRemoved(this);
10624 if (new_owner)
10625 new_owner.OnChildItemReceived(this);
10626 }
10627
10628
10630 {
10631 super.EEDelete(parent);
10632 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10633 if (player)
10634 {
10636
10637 if (player.IsAlive())
10638 {
10639 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10640 if (r_index >= 0)
10641 {
10642 InventoryLocation r_il = new InventoryLocation;
10643 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10644
10645 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10648 {
10649 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10650 }
10652 {
10653 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10654 }
10655
10656 }
10657
10658 player.RemoveQuickBarEntityShortcut(this);
10659 }
10660 }
10661 }
10662
10664 {
10665 super.EEKilled(killer);
10666
10669 {
10670 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10671 {
10672 if (IsMagazine())
10673 {
10674 if (Magazine.Cast(this).GetAmmoCount() > 0)
10675 {
10677 }
10678 }
10679 else
10680 {
10682 }
10683 }
10684 }
10685 }
10686
10688 {
10689 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10690
10691 super.OnWasAttached(parent, slot_id);
10692
10695
10698 }
10699
10701 {
10702 super.OnWasDetached(parent, slot_id);
10703
10706
10709 }
10710
10712 {
10713 int idx;
10716
10717 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10718 if (inventory_slots.Count() < 1)
10719 {
10720 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10721 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10722 }
10723 else
10724 {
10725 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10726 }
10727
10728 idx = inventory_slots.Find(slot);
10729 if (idx < 0)
10730 return "";
10731
10732 return attach_types.Get(idx);
10733 }
10734
10736 {
10737 int idx = -1;
10738 string slot;
10739
10742
10743 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10744 if (inventory_slots.Count() < 1)
10745 {
10746 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10747 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10748 }
10749 else
10750 {
10751 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10752 if (detach_types.Count() < 1)
10753 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10754 }
10755
10756 for (int i = 0; i < inventory_slots.Count(); i++)
10757 {
10758 slot = inventory_slots.Get(i);
10759 }
10760
10761 if (slot != "")
10762 {
10763 if (detach_types.Count() == 1)
10764 idx = 0;
10765 else
10766 idx = inventory_slots.Find(slot);
10767 }
10768 if (idx < 0)
10769 return "";
10770
10771 return detach_types.Get(idx);
10772 }
10773
10775 {
10776
10778
10779
10780 float min_time = 1;
10781 float max_time = 3;
10782 float delay = Math.RandomFloat(min_time, max_time);
10783
10784 explode_timer.Run(delay, this, "DoAmmoExplosion");
10785 }
10786
10788 {
10789 Magazine magazine = Magazine.Cast(this);
10790 int pop_sounds_count = 6;
10791 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10792
10793
10794 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10795 string sound_name = pop_sounds[ sound_idx ];
10796 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10797
10798
10799 magazine.ServerAddAmmoCount(-1);
10800
10801
10802 float min_temp_to_explode = 100;
10803
10804 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10805 {
10807 }
10808 }
10809
10810
10811 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10812 {
10813 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10814
10815 const int CHANCE_DAMAGE_CARGO = 4;
10816 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10817 const int CHANCE_DAMAGE_NOTHING = 2;
10818
10820 {
10821 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10822 int chances;
10823 int rnd;
10824
10825 if (GetInventory().GetCargo())
10826 {
10827 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10828 rnd = Math.RandomInt(0,chances);
10829
10830 if (rnd < CHANCE_DAMAGE_CARGO)
10831 {
10833 }
10834 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10835 {
10837 }
10838 }
10839 else
10840 {
10841 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10842 rnd = Math.RandomInt(0,chances);
10843
10844 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10845 {
10847 }
10848 }
10849 }
10850 }
10851
10853 {
10854 CargoBase cargo = GetInventory().GetCargo();
10855 if (cargo)
10856 {
10858 if (item_count > 0)
10859 {
10860 int random_pick = Math.RandomInt(0, item_count);
10862 if (!item.IsExplosive())
10863 {
10864 item.AddHealth("","",damage);
10865 return true;
10866 }
10867 }
10868 }
10869 return false;
10870 }
10871
10873 {
10874 GameInventory inventory = GetInventory();
10876 if (attachment_count > 0)
10877 {
10878 int random_pick = Math.RandomInt(0, attachment_count);
10880 if (!attachment.IsExplosive())
10881 {
10882 attachment.AddHealth("","",damage);
10883 return true;
10884 }
10885 }
10886 return false;
10887 }
10888
10890 {
10892 }
10893
10895 {
10897 return GetInventory().CanRemoveEntity();
10898
10899 return false;
10900 }
10901
10903 {
10904
10906 return false;
10907
10908
10910 return false;
10911
10912
10913
10915 if (delta == 0)
10916 return false;
10917
10918
10919 return true;
10920 }
10921
10923 {
10925 {
10926 if (ScriptInputUserData.CanStoreInputUserData())
10927 {
10928 ScriptInputUserData ctx = new ScriptInputUserData;
10933 ctx.
Write(destination_entity);
10935 ctx.
Write(slot_id);
10937 }
10938 }
10939 else if (!
g_Game.IsMultiplayer())
10940 {
10942 }
10943 }
10944
10946 {
10947 float split_quantity_new;
10951 InventoryLocation loc = new InventoryLocation;
10952
10953 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10954 {
10956 split_quantity_new = stack_max;
10957 else
10959
10961 {
10962 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10963 if (new_item)
10964 {
10965 new_item.SetResultOfSplit(true);
10966 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10968 new_item.
SetQuantity(split_quantity_new,
false,
true);
10969 }
10970 }
10971 }
10972 else if (destination_entity && slot_id == -1)
10973 {
10974 if (quantity > stack_max)
10975 split_quantity_new = stack_max;
10976 else
10977 split_quantity_new = quantity;
10978
10980 {
10981 GameInventory destinationInventory = destination_entity.GetInventory();
10983 {
10986 }
10987
10988 if (new_item)
10989 {
10990 new_item.SetResultOfSplit(true);
10991 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10993 new_item.
SetQuantity(split_quantity_new,
false,
true);
10994 }
10995 }
10996 }
10997 else
10998 {
10999 if (stack_max != 0)
11000 {
11002 {
11004 }
11005
11006 if (split_quantity_new == 0)
11007 {
11008 if (!
g_Game.IsMultiplayer())
11009 player.PhysicalPredictiveDropItem(this);
11010 else
11011 player.ServerDropEntity(this);
11012 return;
11013 }
11014
11016 {
11018
11019 if (new_item)
11020 {
11021 new_item.SetResultOfSplit(true);
11022 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11025 new_item.PlaceOnSurface();
11026 }
11027 }
11028 }
11029 }
11030 }
11031
11033 {
11034 float split_quantity_new;
11038 InventoryLocation loc = new InventoryLocation;
11039
11040 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11041 {
11043 split_quantity_new = stack_max;
11044 else
11046
11048 {
11049 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11050 if (new_item)
11051 {
11052 new_item.SetResultOfSplit(true);
11053 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11055 new_item.
SetQuantity(split_quantity_new,
false,
true);
11056 }
11057 }
11058 }
11059 else if (destination_entity && slot_id == -1)
11060 {
11061 if (quantity > stack_max)
11062 split_quantity_new = stack_max;
11063 else
11064 split_quantity_new = quantity;
11065
11067 {
11068 GameInventory destinationInventory = destination_entity.GetInventory();
11070 {
11073 }
11074
11075 if (new_item)
11076 {
11077 new_item.SetResultOfSplit(true);
11078 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11080 new_item.
SetQuantity(split_quantity_new,
false,
true);
11081 }
11082 }
11083 }
11084 else
11085 {
11086 if (stack_max != 0)
11087 {
11089 {
11091 }
11092
11094 {
11096
11097 if (new_item)
11098 {
11099 new_item.SetResultOfSplit(true);
11100 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11103 new_item.PlaceOnSurface();
11104 }
11105 }
11106 }
11107 }
11108 }
11109
11111 {
11113 {
11114 if (ScriptInputUserData.CanStoreInputUserData())
11115 {
11116 ScriptInputUserData ctx = new ScriptInputUserData;
11121 dst.WriteToContext(ctx);
11123 }
11124 }
11125 else if (!
g_Game.IsMultiplayer())
11126 {
11128 }
11129 }
11130
11132 {
11134 {
11135 if (ScriptInputUserData.CanStoreInputUserData())
11136 {
11137 ScriptInputUserData ctx = new ScriptInputUserData;
11142 ctx.
Write(destination_entity);
11148 }
11149 }
11150 else if (!
g_Game.IsMultiplayer())
11151 {
11153 }
11154 }
11155
11157 {
11159 }
11160
11162 {
11164 float split_quantity_new;
11166 if (dst.IsValid())
11167 {
11168 int slot_id = dst.GetSlot();
11170
11171 if (quantity > stack_max)
11172 split_quantity_new = stack_max;
11173 else
11174 split_quantity_new = quantity;
11175
11177 {
11179
11180 if (new_item)
11181 {
11182 new_item.SetResultOfSplit(true);
11183 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11185 new_item.
SetQuantity(split_quantity_new,
false,
true);
11186 }
11187
11188 return new_item;
11189 }
11190 }
11191
11192 return null;
11193 }
11194
11196 {
11198 float split_quantity_new;
11200 if (destination_entity)
11201 {
11203 if (quantity > stackable)
11204 split_quantity_new = stackable;
11205 else
11206 split_quantity_new = quantity;
11207
11209 {
11210 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11211 if (new_item)
11212 {
11213 new_item.SetResultOfSplit(true);
11214 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11216 new_item.
SetQuantity(split_quantity_new,
false,
true);
11217 }
11218 }
11219 }
11220 }
11221
11223 {
11225 {
11226 if (ScriptInputUserData.CanStoreInputUserData())
11227 {
11228 ScriptInputUserData ctx = new ScriptInputUserData;
11233 ItemBase destination_entity =
this;
11234 ctx.
Write(destination_entity);
11238 }
11239 }
11240 else if (!
g_Game.IsMultiplayer())
11241 {
11243 }
11244 }
11245
11247 {
11249 float split_quantity_new;
11251 if (player)
11252 {
11254 if (quantity > stackable)
11255 split_quantity_new = stackable;
11256 else
11257 split_quantity_new = quantity;
11258
11260 {
11261 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11262 new_item =
ItemBase.Cast(in_hands);
11263 if (new_item)
11264 {
11265 new_item.SetResultOfSplit(true);
11266 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11268 new_item.SetQuantity(split_quantity_new, false, true);
11269 }
11270 }
11271 }
11272 }
11273
11275 {
11277 float split_quantity_new = Math.Floor(quantity * 0.5);
11278
11280 return;
11281
11283
11284 if (new_item)
11285 {
11286 if (new_item.GetQuantityMax() < split_quantity_new)
11287 {
11288 split_quantity_new = new_item.GetQuantityMax();
11289 }
11290
11291 new_item.SetResultOfSplit(true);
11292 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11293
11295 {
11298 }
11299 else
11300 {
11302 new_item.
SetQuantity(split_quantity_new,
false,
true);
11303 }
11304 }
11305 }
11306
11308 {
11310 float split_quantity_new = Math.Floor(quantity / 2);
11311
11313 return;
11314
11315 InventoryLocation invloc = new InventoryLocation;
11317
11319 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11320
11321 if (new_item)
11322 {
11323 if (new_item.GetQuantityMax() < split_quantity_new)
11324 {
11325 split_quantity_new = new_item.GetQuantityMax();
11326 }
11328 {
11331 }
11332 else if (split_quantity_new > 1)
11333 {
11335 new_item.
SetQuantity(split_quantity_new,
false,
true);
11336 }
11337 }
11338 }
11339
11342 {
11343 SetWeightDirty();
11345
11346 if (parent)
11347 parent.OnAttachmentQuantityChangedEx(this, delta);
11348
11350 {
11352 {
11354 }
11356 {
11357 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11359 }
11360 }
11361 }
11362
11365 {
11366
11367 }
11368
11371 {
11373 }
11374
11376 {
11377 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11378
11380 {
11381 if (newLevel == GameConstants.STATE_RUINED)
11382 {
11384 EntityAI parent = GetHierarchyParent();
11385 if (parent && parent.IsFireplace())
11386 {
11387 CargoBase cargo = GetInventory().GetCargo();
11388 if (cargo)
11389 {
11391 {
11393 }
11394 }
11395 }
11396 }
11397
11399 {
11400
11402 return;
11403 }
11404
11405 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11406 {
11408 }
11409 }
11410 }
11411
11412
11414 {
11415 super.OnRightClick();
11416
11418 {
11420 {
11421 if (ScriptInputUserData.CanStoreInputUserData())
11422 {
11423 EntityAI root = GetHierarchyRoot();
11424 Man playerOwner = GetHierarchyRootPlayer();
11425 InventoryLocation dst = new InventoryLocation;
11426
11427
11428 if (!playerOwner && root && root == this)
11429 {
11431 }
11432 else
11433 {
11434
11435 GetInventory().GetCurrentInventoryLocation(dst);
11437 {
11438 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11440 {
11442 }
11443 else
11444 {
11446
11447
11448 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11449 {
11451 }
11452 else
11453 {
11454 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11455 }
11456 }
11457 }
11458 }
11459
11460 ScriptInputUserData ctx = new ScriptInputUserData;
11468 }
11469 }
11470 else if (!
g_Game.IsMultiplayer())
11471 {
11473 }
11474 }
11475 }
11476
11478 {
11479 if (root)
11480 {
11481 vector m4[4];
11482 root.GetTransform(m4);
11483 dst.SetGround(this, m4);
11484 }
11485 else
11486 {
11487 GetInventory().GetCurrentInventoryLocation(dst);
11488 }
11489 }
11490
11491 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11492 {
11493
11494 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11495 return false;
11496
11497 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11498 return false;
11499
11500
11502 return false;
11503
11504
11505 Magazine mag = Magazine.Cast(this);
11506 if (mag)
11507 {
11508 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11509 return false;
11510
11511 if (stack_max_limit)
11512 {
11513 Magazine other_mag = Magazine.Cast(other_item);
11514 if (other_item)
11515 {
11516 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11517 return false;
11518 }
11519
11520 }
11521 }
11522 else
11523 {
11524
11526 return false;
11527
11529 return false;
11530 }
11531
11532 PlayerBase player = null;
11533 if (CastTo(player, GetHierarchyRootPlayer()))
11534 {
11535 if (player.GetInventory().HasAttachment(this))
11536 return false;
11537
11538 if (player.IsItemsToDelete())
11539 return false;
11540 }
11541
11542 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11543 return false;
11544
11545 int slotID;
11547 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11548 return false;
11549
11550 return true;
11551 }
11552
11554 {
11556 }
11557
11559 {
11560 return m_IsResultOfSplit;
11561 }
11562
11564 {
11565 m_IsResultOfSplit = value;
11566 }
11567
11569 {
11571 }
11572
11574 {
11575 float other_item_quantity = other_item.GetQuantity();
11576 float this_free_space;
11577
11579
11581
11582 if (other_item_quantity > this_free_space)
11583 {
11584 return this_free_space;
11585 }
11586 else
11587 {
11588 return other_item_quantity;
11589 }
11590 }
11591
11593 {
11595 }
11596
11598 {
11600 return;
11601
11602 if (!IsMagazine() && other_item)
11603 {
11605 if (quantity_used != 0)
11606 {
11607 float hp1 = GetHealth01("","");
11608 float hp2 = other_item.GetHealth01("","");
11609 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11610 hpResult = hpResult / (
GetQuantity() + quantity_used);
11611
11612 hpResult *= GetMaxHealth();
11613 Math.Round(hpResult);
11614 SetHealth("", "Health", hpResult);
11615
11617 other_item.AddQuantity(-quantity_used);
11618 }
11619 }
11621 }
11622
11624 {
11625 #ifdef SERVER
11626 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11627 GetHierarchyParent().IncreaseLifetimeUp();
11628 #endif
11629 };
11630
11632 {
11633 PlayerBase p = PlayerBase.Cast(player);
11634
11635 array<int> recipesIds = p.m_Recipes;
11636 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11637 if (moduleRecipesManager)
11638 {
11639 EntityAI itemInHands = player.GetEntityInHands();
11640 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11641 }
11642
11643 for (int i = 0;i < recipesIds.Count(); i++)
11644 {
11645 int key = recipesIds.Get(i);
11646 string recipeName = moduleRecipesManager.GetRecipeName(key);
11648 }
11649 }
11650
11651
11652 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11653 {
11654 super.GetDebugActions(outputList);
11655
11656
11662
11663
11668
11673
11674
11678
11679
11681 {
11685 }
11686
11689
11690
11694
11696
11697 InventoryLocation loc = new InventoryLocation();
11698 GetInventory().GetCurrentInventoryLocation(loc);
11700 {
11701 if (Gizmo_IsSupported())
11704 }
11705
11707 }
11708
11709
11710
11711
11713 {
11714 super.OnAction(action_id, player, ctx);
11715
11717 {
11718 switch (action_id)
11719 {
11723 return true;
11727 return true;
11728 }
11729 }
11730
11732 {
11733 switch (action_id)
11734 {
11736 Delete();
11737 return true;
11738 }
11739 }
11740
11741 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11742 {
11743 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11744 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11745 PlayerBase p = PlayerBase.Cast(player);
11746 if (
EActions.RECIPES_RANGE_START < 1000)
11747 {
11748 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11749 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11750 }
11751 }
11752 #ifndef SERVER
11753 else if (action_id ==
EActions.WATCH_PLAYER)
11754 {
11755 PluginDeveloper.SetDeveloperItemClientEx(player);
11756 }
11757 #endif
11759 {
11760 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11761 {
11762 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11763 OnDebugButtonPressServer(id + 1);
11764 }
11765
11766 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11767 {
11768 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11770 }
11771
11772 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11773 {
11774 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11776 }
11777
11778 else if (action_id ==
EActions.ADD_QUANTITY)
11779 {
11780 if (IsMagazine())
11781 {
11782 Magazine mag = Magazine.Cast(this);
11783 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11784 }
11785 else
11786 {
11788 }
11789
11790 if (m_EM)
11791 {
11792 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11793 }
11794
11795 }
11796
11797 else if (action_id ==
EActions.REMOVE_QUANTITY)
11798 {
11799 if (IsMagazine())
11800 {
11801 Magazine mag2 = Magazine.Cast(this);
11802 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11803 }
11804 else
11805 {
11807 }
11808 if (m_EM)
11809 {
11810 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11811 }
11812
11813 }
11814
11815 else if (action_id ==
EActions.SET_QUANTITY_0)
11816 {
11818
11819 if (m_EM)
11820 {
11821 m_EM.SetEnergy(0);
11822 }
11823 }
11824
11825 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11826 {
11828
11829 if (m_EM)
11830 {
11831 m_EM.SetEnergy(m_EM.GetEnergyMax());
11832 }
11833 }
11834
11835 else if (action_id ==
EActions.ADD_HEALTH)
11836 {
11837 AddHealth("","",GetMaxHealth("","Health")/5);
11838 }
11839 else if (action_id ==
EActions.REMOVE_HEALTH)
11840 {
11841 AddHealth("","",-GetMaxHealth("","Health")/5);
11842 }
11843 else if (action_id ==
EActions.DESTROY_HEALTH)
11844 {
11845 SetHealth01("","",0);
11846 }
11847 else if (action_id ==
EActions.WATCH_ITEM)
11848 {
11850 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11851 #ifdef DEVELOPER
11852 SetDebugDeveloper_item(this);
11853 #endif
11854 }
11855
11856 else if (action_id ==
EActions.ADD_TEMPERATURE)
11857 {
11858 AddTemperature(20);
11859
11860 }
11861
11862 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11863 {
11864 AddTemperature(-20);
11865
11866 }
11867
11868 else if (action_id ==
EActions.FLIP_FROZEN)
11869 {
11870 SetFrozen(!GetIsFrozen());
11871
11872 }
11873
11874 else if (action_id ==
EActions.ADD_WETNESS)
11875 {
11877
11878 }
11879
11880 else if (action_id ==
EActions.REMOVE_WETNESS)
11881 {
11883
11884 }
11885
11886 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11887 {
11890
11891
11892 }
11893
11894 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11895 {
11898 }
11899
11900 else if (action_id ==
EActions.MAKE_SPECIAL)
11901 {
11902 auto debugParams = DebugSpawnParams.WithPlayer(player);
11903 OnDebugSpawnEx(debugParams);
11904 }
11905
11906 }
11907
11908
11909 return false;
11910 }
11911
11912
11913
11914
11918
11921
11922
11923
11925 {
11926 return false;
11927 }
11928
11929
11931 {
11932 return true;
11933 }
11934
11935
11937 {
11938 return true;
11939 }
11940
11941
11942
11944 {
11945 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11946 return g_Game.ConfigIsExisting(config_path);
11947 }
11948
11951 {
11952 return null;
11953 }
11954
11956 {
11957 return false;
11958 }
11959
11961 {
11962 return false;
11963 }
11964
11968
11969
11971 {
11972 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11973 return module_repairing.CanRepair(this, item_repair_kit);
11974 }
11975
11976
11977 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11978 {
11979 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11980 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11981 }
11982
11983
11985 {
11986
11987
11988
11989
11990
11991
11992
11993
11994 return 1;
11995 }
11996
11997
11998
12000 {
12002 }
12003
12004
12005
12007 {
12009 }
12010
12011
12020 {
12021 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12022
12023 if (player)
12024 {
12025 player.MessageStatus(text);
12026 }
12027 }
12028
12029
12038 {
12039 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12040
12041 if (player)
12042 {
12043 player.MessageAction(text);
12044 }
12045 }
12046
12047
12056 {
12057 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12058
12059 if (player)
12060 {
12061 player.MessageFriendly(text);
12062 }
12063 }
12064
12065
12074 {
12075 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12076
12077 if (player)
12078 {
12079 player.MessageImportant(text);
12080 }
12081 }
12082
12084 {
12085 return true;
12086 }
12087
12088
12089 override bool KindOf(
string tag)
12090 {
12091 bool found = false;
12092 string item_name = this.
GetType();
12094 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12095
12096 int array_size = item_tag_array.Count();
12097 for (int i = 0; i < array_size; i++)
12098 {
12099 if (item_tag_array.Get(i) == tag)
12100 {
12101 found = true;
12102 break;
12103 }
12104 }
12105 return found;
12106 }
12107
12108
12110 {
12111
12112 super.OnRPC(sender, rpc_type,ctx);
12113
12114
12115 switch (rpc_type)
12116 {
12117 #ifndef SERVER
12118 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12119 Param2<bool, string> p = new Param2<bool, string>(false, "");
12120
12122 return;
12123
12124 bool play = p.param1;
12125 string soundSet = p.param2;
12126
12127 if (play)
12128 {
12130 {
12132 {
12134 }
12135 }
12136 else
12137 {
12139 }
12140 }
12141 else
12142 {
12144 }
12145
12146 break;
12147 #endif
12148
12149 }
12150
12152 {
12154 }
12155 }
12156
12157
12158
12159
12161 {
12162 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12163 return plugin.GetID(
name);
12164 }
12165
12167 {
12168 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12169 return plugin.GetName(id);
12170 }
12171
12174 {
12175
12176
12177 int varFlags;
12178 if (!ctx.
Read(varFlags))
12179 return;
12180
12181 if (varFlags & ItemVariableFlags.FLOAT)
12182 {
12184 }
12185 }
12186
12188 {
12189
12190 super.SerializeNumericalVars(floats_out);
12191
12192
12193
12195 {
12197 }
12198
12200 {
12202 }
12203
12205 {
12207 }
12208
12210 {
12215 }
12216
12218 {
12220 }
12221 }
12222
12224 {
12225
12226 super.DeSerializeNumericalVars(floats);
12227
12228
12229 int index = 0;
12230 int mask = Math.Round(floats.Get(index));
12231
12232 index++;
12233
12235 {
12237 {
12239 }
12240 else
12241 {
12242 float quantity = floats.Get(index);
12243 SetQuantity(quantity,
true,
false,
false,
false);
12244 }
12245 index++;
12246 }
12247
12249 {
12250 float wet = floats.Get(index);
12252 index++;
12253 }
12254
12256 {
12257 int liquidtype = Math.Round(floats.Get(index));
12259 index++;
12260 }
12261
12263 {
12265 index++;
12267 index++;
12269 index++;
12271 index++;
12272 }
12273
12275 {
12276 int cleanness = Math.Round(floats.Get(index));
12278 index++;
12279 }
12280 }
12281
12283 {
12284 super.WriteVarsToCTX(ctx);
12285
12286
12288 {
12290 }
12291
12293 {
12295 }
12296
12298 {
12300 }
12301
12303 {
12304 int r,g,b,a;
12310 }
12311
12313 {
12315 }
12316 }
12317
12319 {
12320 if (!super.ReadVarsFromCTX(ctx,version))
12321 return false;
12322
12323 int intValue;
12324 float value;
12325
12326 if (version < 140)
12327 {
12328 if (!ctx.
Read(intValue))
12329 return false;
12330
12331 m_VariablesMask = intValue;
12332 }
12333
12335 {
12336 if (!ctx.
Read(value))
12337 return false;
12338
12340 {
12342 }
12343 else
12344 {
12346 }
12347 }
12348
12349 if (version < 140)
12350 {
12352 {
12353 if (!ctx.
Read(value))
12354 return false;
12355 SetTemperatureDirect(value);
12356 }
12357 }
12358
12360 {
12361 if (!ctx.
Read(value))
12362 return false;
12364 }
12365
12367 {
12368 if (!ctx.
Read(intValue))
12369 return false;
12371 }
12372
12374 {
12375 int r,g,b,a;
12377 return false;
12379 return false;
12381 return false;
12383 return false;
12384
12386 }
12387
12389 {
12390 if (!ctx.
Read(intValue))
12391 return false;
12393 }
12394
12395 if (version >= 138 && version < 140)
12396 {
12398 {
12399 if (!ctx.
Read(intValue))
12400 return false;
12401 SetFrozen(intValue);
12402 }
12403 }
12404
12405 return true;
12406 }
12407
12408
12410 {
12413 {
12415 }
12416
12417 if (!super.OnStoreLoad(ctx, version))
12418 {
12420 return false;
12421 }
12422
12423 if (version >= 114)
12424 {
12425 bool hasQuickBarIndexSaved;
12426
12427 if (!ctx.
Read(hasQuickBarIndexSaved))
12428 {
12430 return false;
12431 }
12432
12433 if (hasQuickBarIndexSaved)
12434 {
12435 int itmQBIndex;
12436
12437
12438 if (!ctx.
Read(itmQBIndex))
12439 {
12441 return false;
12442 }
12443
12444 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12445 if (itmQBIndex != -1 && parentPlayer)
12446 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12447 }
12448 }
12449 else
12450 {
12451
12452 PlayerBase player;
12453 int itemQBIndex;
12454 if (version ==
int.
MAX)
12455 {
12456 if (!ctx.
Read(itemQBIndex))
12457 {
12459 return false;
12460 }
12461 }
12462 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12463 {
12464
12465 if (!ctx.
Read(itemQBIndex))
12466 {
12468 return false;
12469 }
12470 if (itemQBIndex != -1 && player)
12471 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12472 }
12473 }
12474
12475 if (version < 140)
12476 {
12477
12478 if (!LoadVariables(ctx, version))
12479 {
12481 return false;
12482 }
12483 }
12484
12485
12487 {
12489 return false;
12490 }
12491 if (version >= 132)
12492 {
12494 if (raib)
12495 {
12497 {
12499 return false;
12500 }
12501 }
12502 }
12503
12505 return true;
12506 }
12507
12508
12509
12511 {
12512 super.OnStoreSave(ctx);
12513
12514 PlayerBase player;
12515 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12516 {
12518
12519 int itemQBIndex = -1;
12520 itemQBIndex = player.FindQuickBarEntityIndex(this);
12521 ctx.
Write(itemQBIndex);
12522 }
12523 else
12524 {
12526 }
12527
12529
12531 if (raib)
12532 {
12534 }
12535 }
12536
12537
12539 {
12540 super.AfterStoreLoad();
12541
12543 {
12545 }
12546
12548 {
12551 }
12552 }
12553
12555 {
12556 super.EEOnAfterLoad();
12557
12559 {
12561 }
12562
12565 }
12566
12568 {
12569 return false;
12570 }
12571
12572
12573
12575 {
12577 {
12578 #ifdef PLATFORM_CONSOLE
12579
12581 {
12583 if (menu)
12584 {
12586 }
12587 }
12588 #endif
12589 }
12590
12592 {
12595 }
12596
12598 {
12599 SetWeightDirty();
12601 }
12603 {
12606 }
12607
12609 {
12612
12615 }
12617 {
12621 }
12622
12623 super.OnVariablesSynchronized();
12624 }
12625
12626
12627
12629 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12630 {
12631 if (!IsServerCheck(allow_client))
12632 return false;
12633
12635 return false;
12636
12639
12640 if (value <= (min + 0.001))
12641 value = min;
12642
12643 if (value == min)
12644 {
12645 if (destroy_config)
12646 {
12647 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12648 if (dstr)
12649 {
12651 this.Delete();
12652 return true;
12653 }
12654 }
12655 else if (destroy_forced)
12656 {
12658 this.Delete();
12659 return true;
12660 }
12661
12663 }
12664
12667
12669 {
12670 EntityAI parent = GetHierarchyRoot();
12671 InventoryLocation iLoc = new InventoryLocation();
12672 GetInventory().GetCurrentInventoryLocation(iLoc);
12674 {
12675 int iLocSlot = iLoc.
GetSlot();
12677 {
12679 }
12681 {
12683 }
12684 }
12685 }
12686
12688 {
12690
12691 if (delta)
12693 }
12694
12696
12697 return false;
12698 }
12699
12700
12702 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12703 {
12705 }
12706
12708 {
12711 }
12712
12714 {
12717 }
12718
12720 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12721 {
12722 float value_clamped = Math.Clamp(value, 0, 1);
12724 SetQuantity(result, destroy_config, destroy_forced);
12725 }
12726
12727
12730 {
12732 }
12733
12735 {
12737 }
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12749 {
12750 int slot = -1;
12751 GameInventory inventory = GetInventory();
12752 if (inventory)
12753 {
12754 InventoryLocation il = new InventoryLocation;
12757 }
12758
12760 }
12761
12763 {
12764 float quantity_max = 0;
12765
12767 {
12768 if (attSlotID != -1)
12769 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12770
12771 if (quantity_max <= 0)
12773 }
12774
12775 if (quantity_max <= 0)
12777
12778 return quantity_max;
12779 }
12780
12782 {
12784 }
12785
12787 {
12789 }
12790
12791
12793 {
12795 }
12796
12798 {
12800 }
12801
12803 {
12805 }
12806
12807
12809 {
12810
12811 float weightEx = GetWeightEx();
12812 float special = GetInventoryAndCargoWeight();
12813 return weightEx - special;
12814 }
12815
12816
12818 {
12820 }
12821
12823 {
12825 {
12826 #ifdef DEVELOPER
12827 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12828 {
12829 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12831 }
12832 #endif
12833
12834 return GetQuantity() * GetConfigWeightModified();
12835 }
12836 else if (HasEnergyManager())
12837 {
12838 #ifdef DEVELOPER
12839 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12840 {
12841 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12842 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12843 }
12844 #endif
12845 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12846 }
12847 else
12848 {
12849 #ifdef DEVELOPER
12850 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12851 {
12852 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12853 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12854 }
12855 #endif
12856 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12857 }
12858 }
12859
12862 {
12863 int item_count = 0;
12865
12866 GameInventory inventory = GetInventory();
12867 CargoBase cargo = inventory.
GetCargo();
12868 if (cargo != NULL)
12869 {
12871 }
12872
12874 for (int i = 0; i < nAttachments; ++i)
12875 {
12877 if (item)
12878 item_count += item.GetNumberOfItems();
12879 }
12880 return item_count;
12881 }
12882
12885 {
12886 float weight = 0;
12887 float wetness = 1;
12888 if (include_wetness)
12891 {
12892 weight = wetness * m_ConfigWeight;
12893 }
12895 {
12896 weight = 1;
12897 }
12898 return weight;
12899 }
12900
12901
12902
12904 {
12905 GameInventory inventory = GetInventory();
12906 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12907 {
12908 array<EntityAI> items = new array<EntityAI>;
12910 for (int i = 0; i < items.Count(); ++i)
12911 {
12913 if (item)
12914 {
12915 g_Game.ObjectDelete(item);
12916 }
12917 }
12918 }
12919 }
12920
12921
12922
12923
12925 {
12926 float energy = 0;
12927 if (HasEnergyManager())
12928 {
12929 energy = GetCompEM().GetEnergy();
12930 }
12931 return energy;
12932 }
12933
12934
12936 {
12937 super.OnEnergyConsumed();
12938
12940 }
12941
12943 {
12944 super.OnEnergyAdded();
12945
12947 }
12948
12949
12951 {
12952 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12953 {
12955 {
12956 float energy_0to1 = GetCompEM().GetEnergy0To1();
12958 }
12959 }
12960 }
12961
12962
12964 {
12965 return ConfigGetFloat("heatIsolation");
12966 }
12967
12969 {
12971 }
12972
12974 {
12975 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12976 if (
g_Game.ConfigIsExisting(paramPath))
12977 return g_Game.ConfigGetFloat(paramPath);
12978
12979 return 0.0;
12980 }
12981
12983 {
12984 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12985 if (
g_Game.ConfigIsExisting(paramPath))
12986 return g_Game.ConfigGetFloat(paramPath);
12987
12988 return 0.0;
12989 }
12990
12991 override void SetWet(
float value,
bool allow_client =
false)
12992 {
12993 if (!IsServerCheck(allow_client))
12994 return;
12995
12998
13000
13001 m_VarWet = Math.Clamp(value, min, max);
13002
13004 {
13007 }
13008 }
13009
13010 override void AddWet(
float value)
13011 {
13013 }
13014
13016 {
13018 }
13019
13021 {
13023 }
13024
13026 {
13028 }
13029
13031 {
13033 }
13034
13036 {
13038 }
13039
13040 override void OnWetChanged(
float newVal,
float oldVal)
13041 {
13044 if (newLevel != oldLevel)
13045 {
13047 }
13048 }
13049
13051 {
13052 SetWeightDirty();
13053 }
13054
13056 {
13057 return GetWetLevelInternal(
m_VarWet);
13058 }
13059
13060
13061
13063 {
13065 }
13066
13068 {
13070 }
13071
13073 {
13075 }
13076
13078 {
13080 }
13081
13082
13083
13085 {
13086 if (ConfigIsExisting("itemModelLength"))
13087 {
13088 return ConfigGetFloat("itemModelLength");
13089 }
13090 return 0;
13091 }
13092
13094 {
13095 if (ConfigIsExisting("itemAttachOffset"))
13096 {
13097 return ConfigGetFloat("itemAttachOffset");
13098 }
13099 return 0;
13100 }
13101
13102 override void SetCleanness(
int value,
bool allow_client =
false)
13103 {
13104 if (!IsServerCheck(allow_client))
13105 return;
13106
13108
13110
13113 }
13114
13116 {
13118 }
13119
13121 {
13122 return true;
13123 }
13124
13125
13126
13127
13129 {
13131 }
13132
13134 {
13136 }
13137
13138
13139
13140
13141 override void SetColor(
int r,
int g,
int b,
int a)
13142 {
13148 }
13150 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13151 {
13156 }
13157
13159 {
13161 }
13162
13165 {
13166 int r,g,b,a;
13168 r = r/255;
13169 g = g/255;
13170 b = b/255;
13171 a = a/255;
13172 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13173 }
13174
13175
13176
13177 override void SetLiquidType(
int value,
bool allow_client =
false)
13178 {
13179 if (!IsServerCheck(allow_client))
13180 return;
13181
13186 }
13187
13189 {
13190 return ConfigGetInt("varLiquidTypeInit");
13191 }
13192
13194 {
13196 }
13197
13199 {
13201 SetFrozen(false);
13202 }
13203
13206 {
13207 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13208 }
13209
13210
13213 {
13214 PlayerBase nplayer;
13215 if (PlayerBase.CastTo(nplayer, player))
13216 {
13218 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13219 }
13220 }
13221
13222
13225 {
13226 PlayerBase nplayer;
13227 if (PlayerBase.CastTo(nplayer,player))
13228 {
13229 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13230 }
13231
13232 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13233
13234 if (HasEnergyManager())
13235 {
13236 GetCompEM().UpdatePlugState();
13237 }
13238 }
13239
13240
13242 {
13243 super.OnPlacementStarted(player);
13244
13246 }
13247
13248 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13249 {
13251 {
13252 m_AdminLog.OnPlacementComplete(player,
this);
13253 }
13254
13255 super.OnPlacementComplete(player, position, orientation);
13256 }
13257
13258
13259
13260
13261
13263 {
13265 {
13266 return true;
13267 }
13268 else
13269 {
13270 return false;
13271 }
13272 }
13273
13274
13276 {
13278 {
13280 }
13281 }
13282
13283
13285 {
13287 }
13288
13290 {
13292 }
13293
13294 override void InsertAgent(
int agent,
float count = 1)
13295 {
13296 if (count < 1)
13297 return;
13298
13300 }
13301
13304 {
13306 }
13307
13308
13310 {
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
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13356 {
13358 return false;
13359 return true;
13360 }
13361
13363 {
13364
13366 }
13367
13368
13371 {
13372 super.CheckForRoofLimited(timeTresholdMS);
13373
13374 float time =
g_Game.GetTime();
13375 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13376 {
13377 m_PreviousRoofTestTime = time;
13378 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13379 }
13380 }
13381
13382
13384 {
13386 {
13387 return 0;
13388 }
13389
13390 if (GetInventory().GetAttachmentSlotsCount() != 0)
13391 {
13392 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13393 if (filter)
13394 return filter.GetProtectionLevel(type, false, system);
13395 else
13396 return 0;
13397 }
13398
13399 string subclassPath, entryName;
13400
13401 switch (type)
13402 {
13404 entryName = "biological";
13405 break;
13407 entryName = "chemical";
13408 break;
13409 default:
13410 entryName = "biological";
13411 break;
13412 }
13413
13414 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13415
13416 return g_Game.ConfigGetFloat(subclassPath + entryName);
13417 }
13418
13419
13420
13423 {
13424 if (!IsMagazine())
13426
13428 }
13429
13430
13431
13432
13433
13438 {
13439 return true;
13440 }
13441
13443 {
13445 }
13446
13447
13448
13449
13450
13452 {
13453 if (parent)
13454 {
13455 if (parent.IsInherited(DayZInfected))
13456 return true;
13457
13458 if (!parent.IsRuined())
13459 return true;
13460 }
13461
13462 return true;
13463 }
13464
13466 {
13467 if (!super.CanPutAsAttachment(parent))
13468 {
13469 return false;
13470 }
13471
13472 if (!IsRuined() && !parent.IsRuined())
13473 {
13474 return true;
13475 }
13476
13477 return false;
13478 }
13479
13481 {
13482
13483
13484
13485
13486 return super.CanReceiveItemIntoCargo(item);
13487 }
13488
13490 {
13491
13492
13493
13494
13495 GameInventory attachmentInv = attachment.GetInventory();
13497 {
13498 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13499 return false;
13500 }
13501
13502 InventoryLocation loc = new InventoryLocation();
13503 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13504 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13505 return false;
13506
13507 return super.CanReceiveAttachment(attachment, slotId);
13508 }
13509
13511 {
13512 if (!super.CanReleaseAttachment(attachment))
13513 return false;
13514
13515 return GetInventory().AreChildrenAccessible();
13516 }
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13539 {
13540 int id = muzzle_owner.GetMuzzleID();
13541 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13542
13543 if (WPOF_array)
13544 {
13545 for (int i = 0; i < WPOF_array.Count(); i++)
13546 {
13547 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13548
13549 if (WPOF)
13550 {
13551 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13552 }
13553 }
13554 }
13555 }
13556
13557
13559 {
13560 int id = muzzle_owner.GetMuzzleID();
13562
13563 if (WPOBE_array)
13564 {
13565 for (int i = 0; i < WPOBE_array.Count(); i++)
13566 {
13567 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13568
13569 if (WPOBE)
13570 {
13571 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13572 }
13573 }
13574 }
13575 }
13576
13577
13579 {
13580 int id = muzzle_owner.GetMuzzleID();
13581 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13582
13583 if (WPOOH_array)
13584 {
13585 for (int i = 0; i < WPOOH_array.Count(); i++)
13586 {
13587 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13588
13589 if (WPOOH)
13590 {
13591 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13592 }
13593 }
13594 }
13595 }
13596
13597
13599 {
13600 int id = muzzle_owner.GetMuzzleID();
13601 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13602
13603 if (WPOOH_array)
13604 {
13605 for (int i = 0; i < WPOOH_array.Count(); i++)
13606 {
13607 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13608
13609 if (WPOOH)
13610 {
13611 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13612 }
13613 }
13614 }
13615 }
13616
13617
13619 {
13620 int id = muzzle_owner.GetMuzzleID();
13621 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13622
13623 if (WPOOH_array)
13624 {
13625 for (int i = 0; i < WPOOH_array.Count(); i++)
13626 {
13627 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13628
13629 if (WPOOH)
13630 {
13631 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13632 }
13633 }
13634 }
13635 }
13636
13637
13638
13640 {
13642 {
13643 return true;
13644 }
13645
13646 return false;
13647 }
13648
13650 {
13652 {
13653 return true;
13654 }
13655
13656 return false;
13657 }
13658
13660 {
13662 {
13663 return true;
13664 }
13665
13666 return false;
13667 }
13668
13670 {
13671 return false;
13672 }
13673
13676 {
13677 return UATimeSpent.DEFAULT_DEPLOY;
13678 }
13679
13680
13681
13682
13684 {
13686 SetSynchDirty();
13687 }
13688
13690 {
13692 }
13693
13694
13696 {
13697 return false;
13698 }
13699
13702 {
13703 string att_type = "None";
13704
13705 if (ConfigIsExisting("soundAttType"))
13706 {
13707 att_type = ConfigGetString("soundAttType");
13708 }
13709
13711 }
13712
13714 {
13716 }
13717
13718
13719
13720
13721
13727
13729 {
13732
13734 }
13735
13736
13738 {
13740 return;
13741
13743
13746
13749
13750 SoundParameters params = new SoundParameters();
13754 }
13755
13756
13758 {
13760 {
13763
13764 SetSynchDirty();
13765
13768 }
13769 }
13770
13772 {
13774 }
13775
13776
13778 {
13780 return;
13781
13783 SetSynchDirty();
13784
13787 }
13788
13790 {
13793 }
13794
13796 {
13798 }
13799
13800 void OnApply(PlayerBase player);
13801
13803 {
13804 return 1.0;
13805 };
13806
13808 {
13810 }
13811
13813 {
13815 }
13816
13818
13820 {
13821 SetDynamicPhysicsLifeTime(0.01);
13823 }
13824
13826 {
13827 array<string> zone_names = new array<string>;
13828 GetDamageZones(zone_names);
13829 for (int i = 0; i < zone_names.Count(); i++)
13830 {
13831 SetHealthMax(zone_names.Get(i),"Health");
13832 }
13833 SetHealthMax("","Health");
13834 }
13835
13838 {
13839 float global_health = GetHealth01("","Health");
13840 array<string> zones = new array<string>;
13841 GetDamageZones(zones);
13842
13843 for (int i = 0; i < zones.Count(); i++)
13844 {
13845 SetHealth01(zones.Get(i),"Health",global_health);
13846 }
13847 }
13848
13851 {
13852 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13853 }
13854
13856 {
13857 if (!hasRootAsPlayer)
13858 {
13859 if (refParentIB)
13860 {
13861
13862 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13863 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13864
13865 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13866 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13867
13870 }
13871 else
13872 {
13873
13876 }
13877 }
13878 }
13879
13881 {
13883 {
13884 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13885 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13886 {
13887 float heatPermCoef = 1.0;
13889 while (ent)
13890 {
13891 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13892 ent = ent.GetHierarchyParent();
13893 }
13894
13895 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13896 }
13897 }
13898 }
13899
13901 {
13902
13903 EntityAI parent = GetHierarchyParent();
13904 if (!parent)
13905 {
13906 hasParent = false;
13907 hasRootAsPlayer = false;
13908 }
13909 else
13910 {
13911 hasParent = true;
13912 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13913 refParentIB =
ItemBase.Cast(parent);
13914 }
13915 }
13916
13917 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13918 {
13919
13920 }
13921
13923 {
13924
13925 return false;
13926 }
13927
13929 {
13930
13931
13932 return false;
13933 }
13934
13936 {
13937
13938 return false;
13939 }
13940
13943 {
13944 return !GetIsFrozen() &&
IsOpen();
13945 }
13946
13948 {
13949 bool hasParent = false, hasRootAsPlayer = false;
13951
13952 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13953 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13954
13955 if (wwtu || foodDecay)
13956 {
13960
13961 if (processWetness || processTemperature || processDecay)
13962 {
13964
13965 if (processWetness)
13966 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13967
13968 if (processTemperature)
13970
13971 if (processDecay)
13972 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13973 }
13974 }
13975 }
13976
13979 {
13981 }
13982
13984 {
13987
13988 return super.GetTemperatureFreezeThreshold();
13989 }
13990
13992 {
13995
13996 return super.GetTemperatureThawThreshold();
13997 }
13998
14000 {
14003
14004 return super.GetItemOverheatThreshold();
14005 }
14006
14008 {
14010 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14011
14012 return super.GetTemperatureFreezeTime();
14013 }
14014
14016 {
14018 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14019
14020 return super.GetTemperatureThawTime();
14021 }
14022
14027
14029 {
14030 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14031 }
14032
14034 {
14035 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14036 }
14037
14040 {
14042 }
14043
14045 {
14047 }
14048
14050 {
14052 }
14053
14056 {
14057 return null;
14058 }
14059
14062 {
14063 return false;
14064 }
14065
14067 {
14069 {
14072 if (!trg)
14073 {
14075 explosive = this;
14076 }
14077
14078 explosive.PairRemote(trg);
14080
14081 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14082 trg.SetPersistentPairID(persistentID);
14083 explosive.SetPersistentPairID(persistentID);
14084
14085 return true;
14086 }
14087 return false;
14088 }
14089
14092 {
14093 float ret = 1.0;
14096 ret *= GetHealth01();
14097
14098 return ret;
14099 }
14100
14101 #ifdef DEVELOPER
14102 override void SetDebugItem()
14103 {
14104 super.SetDebugItem();
14105 _itemBase = this;
14106 }
14107
14109 {
14110 string text = super.GetDebugText();
14111
14113 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14114
14115 return text;
14116 }
14117 #endif
14118
14120 {
14121 return true;
14122 }
14123
14125
14127
14129 {
14132 }
14133
14134
14142
14158
14159 [
Obsolete(
"Use ItemSoundHandler instead")]
14162 {
14163 if (!
g_Game.IsDedicatedServer())
14164 {
14165 if (ConfigIsExisting("attachSoundSet"))
14166 {
14167 string cfg_path = "";
14168 string soundset = "";
14169 string type_name =
GetType();
14170
14173 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14174 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14175
14176 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14177 {
14178 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14179 {
14180 if (cfg_slot_array[i] == slot_type)
14181 {
14182 soundset = cfg_soundset_array[i];
14183 break;
14184 }
14185 }
14186 }
14187
14188 if (soundset != "")
14189 {
14190 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14192 }
14193 }
14194 }
14195 }
14196
14198}
14199
14201{
14203 if (entity)
14204 {
14205 bool is_item = entity.IsInherited(
ItemBase);
14206 if (is_item && full_quantity)
14207 {
14210 }
14211 }
14212 else
14213 {
14215 return NULL;
14216 }
14217 return entity;
14218}
14219
14221{
14222 if (item)
14223 {
14224 if (health > 0)
14225 item.SetHealth("", "", health);
14226
14227 if (item.CanHaveTemperature())
14228 {
14230 if (item.CanFreeze())
14231 item.SetFrozen(false);
14232 }
14233
14234 if (item.HasEnergyManager())
14235 {
14236 if (quantity >= 0)
14237 {
14238 item.GetCompEM().SetEnergy0To1(quantity);
14239 }
14240 else
14241 {
14243 }
14244 }
14245 else if (item.IsMagazine())
14246 {
14247 Magazine mag = Magazine.Cast(item);
14248 if (quantity >= 0)
14249 {
14250 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14251 }
14252 else
14253 {
14255 }
14256
14257 }
14258 else
14259 {
14260 if (quantity >= 0)
14261 {
14262 item.SetQuantityNormalized(quantity, false);
14263 }
14264 else
14265 {
14267 }
14268
14269 }
14270 }
14271}
14272
14273#ifdef DEVELOPER
14275#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.