9319{
9321 {
9322 return true;
9323 }
9324};
9325
9327{
9328
9329};
9330
9331
9332
9334{
9338
9340
9343
9344
9345
9346
9347
9356
9362
9367
9372
9393 protected bool m_IsResultOfSplit
9394
9396
9401
9402
9403
9405
9409
9410
9411
9413
9416
9417
9418
9424
9425
9433
9436
9437
9439
9440
9442
9443
9448
9449
9454
9456
9457
9459
9460
9462 {
9467
9468 if (!
g_Game.IsDedicatedServer())
9469 {
9471 {
9473
9475 {
9477 }
9478 }
9479
9482 }
9483
9484 m_OldLocation = null;
9485
9487 {
9489 }
9490
9491 if (ConfigIsExisting("headSelectionsToHide"))
9492 {
9495 }
9496
9498 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9499 {
9501 }
9502
9504
9505 m_IsResultOfSplit = false;
9506
9508 }
9509
9511 {
9512 super.InitItemVariables();
9513
9519 m_Count = ConfigGetInt(
"count");
9520
9523
9528
9531
9536
9548
9552
9553
9556 if (ConfigIsExisting("canBeSplit"))
9557 {
9560 }
9561
9563 if (ConfigIsExisting("itemBehaviour"))
9565
9566
9569 RegisterNetSyncVariableInt("m_VarLiquidType");
9570 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9571
9572 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9573 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9574 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9575
9576 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9577 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9578 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9579 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9580
9581 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9582 RegisterNetSyncVariableBool("m_IsTakeable");
9583 RegisterNetSyncVariableBool("m_IsHologram");
9584
9587 {
9590 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9591 }
9592
9594
9596 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9598
9600 }
9601
9603 {
9605 }
9606
9608 {
9611 {
9616 }
9617 }
9618
9619 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9620 {
9622 {
9625 }
9626
9628 }
9629
9631 {
9637 }
9638
9640
9642 {
9644
9645 if (!action)
9646 {
9647 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9648 return;
9649 }
9650
9652 if (!ai)
9653 {
9655 return;
9656 }
9657
9659 if (!action_array)
9660 {
9661 action_array = new array<ActionBase_Basic>;
9663 }
9664 if (LogManager.IsActionLogEnable())
9665 {
9666 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9667 }
9668
9669 if (action_array.Find(action) != -1)
9670 {
9671 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9672 }
9673 else
9674 {
9675 action_array.Insert(action);
9676 }
9677 }
9678
9680 {
9681 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9682 ActionBase action = player.GetActionManager().GetAction(actionName);
9685
9686 if (action_array)
9687 {
9688 action_array.RemoveItem(action);
9689 }
9690 }
9691
9692
9693
9695 {
9696 ActionOverrideData overrideData = new ActionOverrideData();
9700
9702 if (!actionMap)
9703 {
9706 }
9707
9708 actionMap.Insert(this.
Type(), overrideData);
9709
9710 }
9711
9713
9715
9716
9718 {
9721
9724
9725 string config_to_search = "CfgVehicles";
9726 string muzzle_owner_config;
9727
9729 {
9730 if (IsInherited(Weapon))
9731 config_to_search = "CfgWeapons";
9732
9733 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9734
9735 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9736
9737 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9738
9739 if (config_OnFire_subclass_count > 0)
9740 {
9741 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9742
9743 for (int i = 0; i < config_OnFire_subclass_count; i++)
9744 {
9745 string particle_class = "";
9746 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9747 string config_OnFire_entry = config_OnFire_class + particle_class;
9748 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9749 WPOF_array.Insert(WPOF);
9750 }
9751
9752
9754 }
9755 }
9756
9758 {
9759 config_to_search = "CfgWeapons";
9760 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9761
9762 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9763
9764 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9765
9766 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9767 {
9768 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9769
9770 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9771 {
9772 string particle_class2 = "";
9773 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9774 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9775 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9776 WPOBE_array.Insert(WPOBE);
9777 }
9778
9779
9781 }
9782 }
9783 }
9784
9785
9787 {
9790
9792 {
9793 string config_to_search = "CfgVehicles";
9794
9795 if (IsInherited(Weapon))
9796 config_to_search = "CfgWeapons";
9797
9798 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9799 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9800
9801 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9802 {
9803
9805
9807 {
9809 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9811 return;
9812 }
9813
9816
9817
9818
9819 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9820 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9821
9822 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9823 {
9824 string particle_class = "";
9825 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9826 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9827 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9828
9829 if (entry_type == CT_CLASS)
9830 {
9831 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9832 WPOOH_array.Insert(WPOF);
9833 }
9834 }
9835
9836
9838 }
9839 }
9840 }
9841
9843 {
9845 }
9846
9848 {
9850 {
9852
9855
9858
9859 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9860 }
9861 }
9862
9864 {
9866 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9867
9869 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9870
9872 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9873
9875 {
9877 }
9878 }
9879
9881 {
9883 }
9884
9886 {
9889 else
9891
9893 {
9896 }
9897 else
9898 {
9901
9904 }
9905
9907 }
9908
9910 {
9912 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9913 }
9914
9916 {
9918 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9920 }
9921
9923 {
9925 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9926 }
9927
9929 {
9932
9933 OverheatingParticle OP = new OverheatingParticle();
9938
9940 }
9941
9943 {
9946
9947 return -1;
9948 }
9949
9951 {
9953 {
9956
9957 for (int i = count; i > 0; --i)
9958 {
9959 int id = i - 1;
9962
9965
9966 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9967 {
9968 if (p)
9969 {
9972 }
9973 }
9974 }
9975 }
9976 }
9977
9979 {
9981 {
9983 {
9984 int id = i - 1;
9986
9987 if (OP)
9988 {
9990
9991 if (p)
9992 {
9994 }
9995
9996 delete OP;
9997 }
9998 }
9999
10002 }
10003 }
10004
10007 {
10008 return 0.0;
10009 }
10010
10011
10013 {
10014 return 250;
10015 }
10016
10018 {
10019 return 0;
10020 }
10021
10024 {
10026 return true;
10027
10028 return false;
10029 }
10030
10033 {
10036
10038 {
10040 }
10041 else
10042 {
10043
10045 }
10046
10048 }
10049
10056 {
10057 return -1;
10058 }
10059
10060
10061
10062
10064 {
10066 {
10067 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10068 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10069
10070 if (r_index >= 0)
10071 {
10072 InventoryLocation r_il = new InventoryLocation;
10073 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10074
10075 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10078 {
10079 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10080 }
10082 {
10083 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10084 }
10085
10086 }
10087
10088 player.GetHumanInventory().ClearUserReservedLocation(this);
10089 }
10090
10093 }
10094
10095
10096
10097
10099 {
10100 return ItemBase.m_DebugActionsMask;
10101 }
10102
10104 {
10105 return ItemBase.m_DebugActionsMask & mask;
10106 }
10107
10109 {
10110 ItemBase.m_DebugActionsMask = mask;
10111 }
10112
10114 {
10115 ItemBase.m_DebugActionsMask |= mask;
10116 }
10117
10119 {
10120 ItemBase.m_DebugActionsMask &= ~mask;
10121 }
10122
10124 {
10126 {
10128 }
10129 else
10130 {
10132 }
10133 }
10134
10135
10137 {
10138 if (GetEconomyProfile())
10139 {
10140 float q_max = GetEconomyProfile().GetQuantityMax();
10141 if (q_max > 0)
10142 {
10143 float q_min = GetEconomyProfile().GetQuantityMin();
10144 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10145
10147 {
10148 ComponentEnergyManager comp = GetCompEM();
10150 {
10152 }
10153 }
10155 {
10157
10158 }
10159
10160 }
10161 }
10162 }
10163
10166 {
10167 EntityAI parent = GetHierarchyParent();
10168
10169 if (parent)
10170 {
10171 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10172 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10173 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10174 }
10175 }
10176
10179 {
10180 EntityAI parent = GetHierarchyParent();
10181
10182 if (parent)
10183 {
10184 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10185 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10186 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10187 }
10188 }
10189
10191 {
10192
10193
10194
10195
10197
10199 {
10200 if (ScriptInputUserData.CanStoreInputUserData())
10201 {
10202 ScriptInputUserData ctx = new ScriptInputUserData;
10208 ctx.
Write(use_stack_max);
10211
10213 {
10214 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10215 }
10216 }
10217 }
10218 else if (!
g_Game.IsMultiplayer())
10219 {
10221 }
10222 }
10223
10225 {
10227 }
10228
10230 {
10232 }
10233
10235 {
10237 }
10238
10240 {
10241
10242 return false;
10243 }
10244
10246 {
10247 return false;
10248 }
10249
10253 {
10254 return false;
10255 }
10256
10258 {
10259 return "";
10260 }
10261
10263
10265 {
10266 return false;
10267 }
10268
10270 {
10271 return true;
10272 }
10273
10274
10275
10277 {
10278 return true;
10279 }
10280
10282 {
10283 return true;
10284 }
10285
10287 {
10288 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10290 }
10291
10293 {
10295 }
10296
10298 {
10300 if (!is_being_placed)
10302 SetSynchDirty();
10303 }
10304
10305
10307
10309 {
10311 }
10312
10314 {
10316 }
10317
10319 {
10320 return 1;
10321 }
10322
10324 {
10325 return false;
10326 }
10327
10329 {
10331 SetSynchDirty();
10332 }
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10369 {
10370 super.OnMovedInsideCargo(container);
10371
10372 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10373 }
10374
10375 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10376 {
10377 super.EEItemLocationChanged(oldLoc, newLoc);
10378
10379 PlayerBase newPlayer = null;
10380 PlayerBase oldPlayer = null;
10381
10382 if (newLoc.GetParent())
10383 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10384
10385 if (oldLoc.GetParent())
10386 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10387
10389 {
10390 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10391
10392 if (rIndex >= 0)
10393 {
10394 InventoryLocation rIl = new InventoryLocation;
10395 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10396
10397 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10400 {
10401 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10402 }
10404 {
10406 }
10407
10408 }
10409 }
10410
10412 {
10413 if (newPlayer)
10414 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10415
10416 if (newPlayer == oldPlayer)
10417 {
10418 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10419 {
10421 {
10422 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10423 {
10424 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10425 }
10426 }
10427 else
10428 {
10429 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10430 }
10431 }
10432
10433 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10434 {
10435 int type = oldLoc.GetType();
10437 {
10438 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10439 }
10441 {
10442 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10443 }
10444 }
10445 if (!m_OldLocation)
10446 {
10447 m_OldLocation = new InventoryLocation;
10448 }
10449 m_OldLocation.Copy(oldLoc);
10450 }
10451 else
10452 {
10453 if (m_OldLocation)
10454 {
10455 m_OldLocation.Reset();
10456 }
10457 }
10458
10459 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10460 }
10461 else
10462 {
10463 if (newPlayer)
10464 {
10465 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10466 if (resIndex >= 0)
10467 {
10468 InventoryLocation il = new InventoryLocation;
10469 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10471 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10474 {
10475 il.
GetParent().GetOnReleaseLock().Invoke(it);
10476 }
10478 {
10480 }
10481
10482 }
10483 }
10485 {
10486
10488 }
10489
10490 if (m_OldLocation)
10491 {
10492 m_OldLocation.Reset();
10493 }
10494 }
10495
10497 {
10498 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10499 }
10500
10502 {
10503 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10504 }
10505 }
10506
10507 override void EOnContact(IEntity other, Contact extra)
10508 {
10510 {
10511 int liquidType = -1;
10513 if (impactSpeed > 0.0)
10514 {
10516 #ifndef SERVER
10518 #else
10520 SetSynchDirty();
10521 #endif
10523 }
10524 }
10525
10526 #ifdef SERVER
10527 if (GetCompEM() && GetCompEM().IsPlugged())
10528 {
10529 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10530 GetCompEM().UnplugThis();
10531 }
10532 #endif
10533 }
10534
10536
10538 {
10540 }
10541
10543 {
10544
10545 }
10546
10548 {
10549 super.OnItemLocationChanged(old_owner, new_owner);
10550
10551 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10552 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10553
10554 if (!relatedPlayer && playerNew)
10555 relatedPlayer = playerNew;
10556
10557 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10558 {
10560 if (actionMgr)
10561 {
10562 ActionBase currentAction = actionMgr.GetRunningAction();
10563 if (currentAction)
10565 }
10566 }
10567
10568 Man ownerPlayerOld = null;
10569 Man ownerPlayerNew = null;
10570
10571 if (old_owner)
10572 {
10573 if (old_owner.
IsMan())
10574 {
10575 ownerPlayerOld = Man.Cast(old_owner);
10576 }
10577 else
10578 {
10579 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10580 }
10581 }
10582 else
10583 {
10585 {
10587
10588 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10589 {
10590 GetCompEM().UnplugThis();
10591 }
10592 }
10593 }
10594
10595 if (new_owner)
10596 {
10597 if (new_owner.
IsMan())
10598 {
10599 ownerPlayerNew = Man.Cast(new_owner);
10600 }
10601 else
10602 {
10603 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10604 }
10605 }
10606
10607 if (ownerPlayerOld != ownerPlayerNew)
10608 {
10609 if (ownerPlayerOld)
10610 {
10611 array<EntityAI> subItemsExit = new array<EntityAI>;
10613 for (int i = 0; i < subItemsExit.Count(); i++)
10614 {
10617 }
10618 }
10619
10620 if (ownerPlayerNew)
10621 {
10622 array<EntityAI> subItemsEnter = new array<EntityAI>;
10624 for (int j = 0; j < subItemsEnter.Count(); j++)
10625 {
10628 }
10629 }
10630 }
10631 else if (ownerPlayerNew != null)
10632 {
10633 PlayerBase nplayer;
10634 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10635 {
10636 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10638 for (int k = 0; k < subItemsUpdate.Count(); k++)
10639 {
10641 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10642 }
10643 }
10644 }
10645
10646 if (old_owner)
10647 old_owner.OnChildItemRemoved(this);
10648 if (new_owner)
10649 new_owner.OnChildItemReceived(this);
10650 }
10651
10652
10654 {
10655 super.EEDelete(parent);
10656 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10657 if (player)
10658 {
10660
10661 if (player.IsAlive())
10662 {
10663 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10664 if (r_index >= 0)
10665 {
10666 InventoryLocation r_il = new InventoryLocation;
10667 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10668
10669 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10672 {
10673 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10674 }
10676 {
10677 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10678 }
10679
10680 }
10681
10682 player.RemoveQuickBarEntityShortcut(this);
10683 }
10684 }
10685 }
10686
10688 {
10689 super.EEKilled(killer);
10690
10693 {
10694 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10695 {
10696 if (IsMagazine())
10697 {
10698 if (Magazine.Cast(this).GetAmmoCount() > 0)
10699 {
10701 }
10702 }
10703 else
10704 {
10706 }
10707 }
10708 }
10709 }
10710
10712 {
10713 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10714
10715 super.OnWasAttached(parent, slot_id);
10716
10719
10722 }
10723
10725 {
10726 super.OnWasDetached(parent, slot_id);
10727
10730
10733 }
10734
10736 {
10737 int idx;
10740
10741 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10742 if (inventory_slots.Count() < 1)
10743 {
10744 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10745 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10746 }
10747 else
10748 {
10749 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10750 }
10751
10752 idx = inventory_slots.Find(slot);
10753 if (idx < 0)
10754 return "";
10755
10756 return attach_types.Get(idx);
10757 }
10758
10760 {
10761 int idx = -1;
10762 string slot;
10763
10766
10767 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10768 if (inventory_slots.Count() < 1)
10769 {
10770 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10771 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10772 }
10773 else
10774 {
10775 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10776 if (detach_types.Count() < 1)
10777 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10778 }
10779
10780 for (int i = 0; i < inventory_slots.Count(); i++)
10781 {
10782 slot = inventory_slots.Get(i);
10783 }
10784
10785 if (slot != "")
10786 {
10787 if (detach_types.Count() == 1)
10788 idx = 0;
10789 else
10790 idx = inventory_slots.Find(slot);
10791 }
10792 if (idx < 0)
10793 return "";
10794
10795 return detach_types.Get(idx);
10796 }
10797
10799 {
10800
10802
10803
10804 float min_time = 1;
10805 float max_time = 3;
10806 float delay = Math.RandomFloat(min_time, max_time);
10807
10808 explode_timer.Run(delay, this, "DoAmmoExplosion");
10809 }
10810
10812 {
10813 Magazine magazine = Magazine.Cast(this);
10814 int pop_sounds_count = 6;
10815 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10816
10817
10818 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10819 string sound_name = pop_sounds[ sound_idx ];
10820 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10821
10822
10823 magazine.ServerAddAmmoCount(-1);
10824
10825
10826 float min_temp_to_explode = 100;
10827
10828 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10829 {
10831 }
10832 }
10833
10834
10835 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10836 {
10837 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10838
10839 const int CHANCE_DAMAGE_CARGO = 4;
10840 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10841 const int CHANCE_DAMAGE_NOTHING = 2;
10842
10844 {
10845 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10846 int chances;
10847 int rnd;
10848
10849 if (GetInventory().GetCargo())
10850 {
10851 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10852 rnd = Math.RandomInt(0,chances);
10853
10854 if (rnd < CHANCE_DAMAGE_CARGO)
10855 {
10857 }
10858 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10859 {
10861 }
10862 }
10863 else
10864 {
10865 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10866 rnd = Math.RandomInt(0,chances);
10867
10868 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10869 {
10871 }
10872 }
10873 }
10874 }
10875
10877 {
10878 CargoBase cargo = GetInventory().GetCargo();
10879 if (cargo)
10880 {
10882 if (item_count > 0)
10883 {
10884 int random_pick = Math.RandomInt(0, item_count);
10886 if (!item.IsExplosive())
10887 {
10888 item.AddHealth("","",damage);
10889 return true;
10890 }
10891 }
10892 }
10893 return false;
10894 }
10895
10897 {
10898 GameInventory inventory = GetInventory();
10900 if (attachment_count > 0)
10901 {
10902 int random_pick = Math.RandomInt(0, attachment_count);
10904 if (!attachment.IsExplosive())
10905 {
10906 attachment.AddHealth("","",damage);
10907 return true;
10908 }
10909 }
10910 return false;
10911 }
10912
10914 {
10916 }
10917
10919 {
10921 return GetInventory().CanRemoveEntity();
10922
10923 return false;
10924 }
10925
10927 {
10928
10930 return false;
10931
10932
10934 return false;
10935
10936
10937
10939 if (delta == 0)
10940 return false;
10941
10942
10943 return true;
10944 }
10945
10947 {
10949 {
10950 if (ScriptInputUserData.CanStoreInputUserData())
10951 {
10952 ScriptInputUserData ctx = new ScriptInputUserData;
10957 ctx.
Write(destination_entity);
10959 ctx.
Write(slot_id);
10961 }
10962 }
10963 else if (!
g_Game.IsMultiplayer())
10964 {
10966 }
10967 }
10968
10970 {
10971 float split_quantity_new;
10975 InventoryLocation loc = new InventoryLocation;
10976
10977 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10978 {
10980 split_quantity_new = stack_max;
10981 else
10983
10985 {
10986 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10987 if (new_item)
10988 {
10989 new_item.SetResultOfSplit(true);
10990 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10992 new_item.
SetQuantity(split_quantity_new,
false,
true);
10993 }
10994 }
10995 }
10996 else if (destination_entity && slot_id == -1)
10997 {
10998 if (quantity > stack_max)
10999 split_quantity_new = stack_max;
11000 else
11001 split_quantity_new = quantity;
11002
11004 {
11005 GameInventory destinationInventory = destination_entity.GetInventory();
11007 {
11010 }
11011
11012 if (new_item)
11013 {
11014 new_item.SetResultOfSplit(true);
11015 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11017 new_item.
SetQuantity(split_quantity_new,
false,
true);
11018 }
11019 }
11020 }
11021 else
11022 {
11023 if (stack_max != 0)
11024 {
11026 {
11028 }
11029
11030 if (split_quantity_new == 0)
11031 {
11032 if (!
g_Game.IsMultiplayer())
11033 player.PhysicalPredictiveDropItem(this);
11034 else
11035 player.ServerDropEntity(this);
11036 return;
11037 }
11038
11040 {
11042
11043 if (new_item)
11044 {
11045 new_item.SetResultOfSplit(true);
11046 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11049 new_item.PlaceOnSurface();
11050 }
11051 }
11052 }
11053 }
11054 }
11055
11057 {
11058 float split_quantity_new;
11062 InventoryLocation loc = new InventoryLocation;
11063
11064 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11065 {
11067 split_quantity_new = stack_max;
11068 else
11070
11072 {
11073 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11074 if (new_item)
11075 {
11076 new_item.SetResultOfSplit(true);
11077 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11079 new_item.
SetQuantity(split_quantity_new,
false,
true);
11080 }
11081 }
11082 }
11083 else if (destination_entity && slot_id == -1)
11084 {
11085 if (quantity > stack_max)
11086 split_quantity_new = stack_max;
11087 else
11088 split_quantity_new = quantity;
11089
11091 {
11092 GameInventory destinationInventory = destination_entity.GetInventory();
11094 {
11097 }
11098
11099 if (new_item)
11100 {
11101 new_item.SetResultOfSplit(true);
11102 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11104 new_item.
SetQuantity(split_quantity_new,
false,
true);
11105 }
11106 }
11107 }
11108 else
11109 {
11110 if (stack_max != 0)
11111 {
11113 {
11115 }
11116
11118 {
11120
11121 if (new_item)
11122 {
11123 new_item.SetResultOfSplit(true);
11124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11127 new_item.PlaceOnSurface();
11128 }
11129 }
11130 }
11131 }
11132 }
11133
11135 {
11137 {
11138 if (ScriptInputUserData.CanStoreInputUserData())
11139 {
11140 ScriptInputUserData ctx = new ScriptInputUserData;
11145 dst.WriteToContext(ctx);
11147 }
11148 }
11149 else if (!
g_Game.IsMultiplayer())
11150 {
11152 }
11153 }
11154
11156 {
11158 {
11159 if (ScriptInputUserData.CanStoreInputUserData())
11160 {
11161 ScriptInputUserData ctx = new ScriptInputUserData;
11166 ctx.
Write(destination_entity);
11172 }
11173 }
11174 else if (!
g_Game.IsMultiplayer())
11175 {
11177 }
11178 }
11179
11181 {
11183 }
11184
11186 {
11188 float split_quantity_new;
11190 if (dst.IsValid())
11191 {
11192 int slot_id = dst.GetSlot();
11194
11195 if (quantity > stack_max)
11196 split_quantity_new = stack_max;
11197 else
11198 split_quantity_new = quantity;
11199
11201 {
11203
11204 if (new_item)
11205 {
11206 new_item.SetResultOfSplit(true);
11207 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11209 new_item.
SetQuantity(split_quantity_new,
false,
true);
11210 }
11211
11212 return new_item;
11213 }
11214 }
11215
11216 return null;
11217 }
11218
11220 {
11222 float split_quantity_new;
11224 if (destination_entity)
11225 {
11227 if (quantity > stackable)
11228 split_quantity_new = stackable;
11229 else
11230 split_quantity_new = quantity;
11231
11233 {
11234 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11235 if (new_item)
11236 {
11237 new_item.SetResultOfSplit(true);
11238 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11240 new_item.
SetQuantity(split_quantity_new,
false,
true);
11241 }
11242 }
11243 }
11244 }
11245
11247 {
11249 {
11250 if (ScriptInputUserData.CanStoreInputUserData())
11251 {
11252 ScriptInputUserData ctx = new ScriptInputUserData;
11257 ItemBase destination_entity =
this;
11258 ctx.
Write(destination_entity);
11262 }
11263 }
11264 else if (!
g_Game.IsMultiplayer())
11265 {
11267 }
11268 }
11269
11271 {
11273 float split_quantity_new;
11275 if (player)
11276 {
11278 if (quantity > stackable)
11279 split_quantity_new = stackable;
11280 else
11281 split_quantity_new = quantity;
11282
11284 {
11285 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11286 new_item =
ItemBase.Cast(in_hands);
11287 if (new_item)
11288 {
11289 new_item.SetResultOfSplit(true);
11290 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11292 new_item.SetQuantity(split_quantity_new, false, true);
11293 }
11294 }
11295 }
11296 }
11297
11299 {
11301 float split_quantity_new = Math.Floor(quantity * 0.5);
11302
11304 return;
11305
11307
11308 if (new_item)
11309 {
11310 if (new_item.GetQuantityMax() < split_quantity_new)
11311 {
11312 split_quantity_new = new_item.GetQuantityMax();
11313 }
11314
11315 new_item.SetResultOfSplit(true);
11316 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11317
11319 {
11322 }
11323 else
11324 {
11326 new_item.
SetQuantity(split_quantity_new,
false,
true);
11327 }
11328 }
11329 }
11330
11332 {
11334 float split_quantity_new = Math.Floor(quantity / 2);
11335
11337 return;
11338
11339 InventoryLocation invloc = new InventoryLocation;
11341
11343 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11344
11345 if (new_item)
11346 {
11347 if (new_item.GetQuantityMax() < split_quantity_new)
11348 {
11349 split_quantity_new = new_item.GetQuantityMax();
11350 }
11352 {
11355 }
11356 else if (split_quantity_new > 1)
11357 {
11359 new_item.
SetQuantity(split_quantity_new,
false,
true);
11360 }
11361 }
11362 }
11363
11366 {
11367 SetWeightDirty();
11369
11370 if (parent)
11371 parent.OnAttachmentQuantityChangedEx(this, delta);
11372
11374 {
11376 {
11378 }
11380 {
11381 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11383 }
11384 }
11385 }
11386
11389 {
11390
11391 }
11392
11395 {
11397 }
11398
11400 {
11401 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11402
11404 {
11405 if (newLevel == GameConstants.STATE_RUINED)
11406 {
11408 EntityAI parent = GetHierarchyParent();
11409 if (parent && parent.IsFireplace())
11410 {
11411 CargoBase cargo = GetInventory().GetCargo();
11412 if (cargo)
11413 {
11415 {
11417 }
11418 }
11419 }
11420 }
11421
11423 {
11424
11426 return;
11427 }
11428
11429 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11430 {
11432 }
11433 }
11434 }
11435
11436
11438 {
11439 super.OnRightClick();
11440
11442 {
11444 {
11445 if (ScriptInputUserData.CanStoreInputUserData())
11446 {
11447 EntityAI root = GetHierarchyRoot();
11448 Man playerOwner = GetHierarchyRootPlayer();
11449 InventoryLocation dst = new InventoryLocation;
11450
11451
11452 if (!playerOwner && root && root == this)
11453 {
11455 }
11456 else
11457 {
11458
11459 GetInventory().GetCurrentInventoryLocation(dst);
11461 {
11462 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11464 {
11466 }
11467 else
11468 {
11470
11471
11472 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11473 {
11475 }
11476 else
11477 {
11478 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11479 }
11480 }
11481 }
11482 }
11483
11484 ScriptInputUserData ctx = new ScriptInputUserData;
11492 }
11493 }
11494 else if (!
g_Game.IsMultiplayer())
11495 {
11497 }
11498 }
11499 }
11500
11502 {
11503 if (root)
11504 {
11505 vector m4[4];
11506 root.GetTransform(m4);
11507 dst.SetGround(this, m4);
11508 }
11509 else
11510 {
11511 GetInventory().GetCurrentInventoryLocation(dst);
11512 }
11513 }
11514
11515 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11516 {
11517
11518 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11519 return false;
11520
11521 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11522 return false;
11523
11524
11526 return false;
11527
11528
11529 Magazine mag = Magazine.Cast(this);
11530 if (mag)
11531 {
11532 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11533 return false;
11534
11535 if (stack_max_limit)
11536 {
11537 Magazine other_mag = Magazine.Cast(other_item);
11538 if (other_item)
11539 {
11540 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11541 return false;
11542 }
11543
11544 }
11545 }
11546 else
11547 {
11548
11550 return false;
11551
11553 return false;
11554 }
11555
11556 PlayerBase player = null;
11557 if (CastTo(player, GetHierarchyRootPlayer()))
11558 {
11559 if (player.GetInventory().HasAttachment(this))
11560 return false;
11561
11562 if (player.IsItemsToDelete())
11563 return false;
11564 }
11565
11566 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11567 return false;
11568
11569 int slotID;
11571 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11572 return false;
11573
11574 return true;
11575 }
11576
11578 {
11580 }
11581
11583 {
11584 return m_IsResultOfSplit;
11585 }
11586
11588 {
11589 m_IsResultOfSplit = value;
11590 }
11591
11593 {
11595 }
11596
11598 {
11599 float other_item_quantity = other_item.GetQuantity();
11600 float this_free_space;
11601
11603
11605
11606 if (other_item_quantity > this_free_space)
11607 {
11608 return this_free_space;
11609 }
11610 else
11611 {
11612 return other_item_quantity;
11613 }
11614 }
11615
11617 {
11619 }
11620
11622 {
11624 return;
11625
11626 if (!IsMagazine() && other_item)
11627 {
11629 if (quantity_used != 0)
11630 {
11631 float hp1 = GetHealth01("","");
11632 float hp2 = other_item.GetHealth01("","");
11633 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11634 hpResult = hpResult / (
GetQuantity() + quantity_used);
11635
11636 hpResult *= GetMaxHealth();
11637 Math.Round(hpResult);
11638 SetHealth("", "Health", hpResult);
11639
11641 other_item.AddQuantity(-quantity_used);
11642 }
11643 }
11645 }
11646
11648 {
11649 #ifdef SERVER
11650 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11651 GetHierarchyParent().IncreaseLifetimeUp();
11652 #endif
11653 };
11654
11656 {
11657 PlayerBase p = PlayerBase.Cast(player);
11658
11659 array<int> recipesIds = p.m_Recipes;
11660 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11661 if (moduleRecipesManager)
11662 {
11663 EntityAI itemInHands = player.GetEntityInHands();
11664 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11665 }
11666
11667 for (int i = 0;i < recipesIds.Count(); i++)
11668 {
11669 int key = recipesIds.Get(i);
11670 string recipeName = moduleRecipesManager.GetRecipeName(key);
11672 }
11673 }
11674
11675
11676 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11677 {
11678 super.GetDebugActions(outputList);
11679
11680
11686
11687
11692
11697
11698
11702
11703
11705 {
11709 }
11710
11713
11714
11718
11720
11721 InventoryLocation loc = new InventoryLocation();
11722 GetInventory().GetCurrentInventoryLocation(loc);
11724 {
11725 if (Gizmo_IsSupported())
11728 }
11729
11731 }
11732
11733
11734
11735
11737 {
11738 super.OnAction(action_id, player, ctx);
11739
11741 {
11742 switch (action_id)
11743 {
11747 return true;
11751 return true;
11752 }
11753 }
11754
11756 {
11757 switch (action_id)
11758 {
11760 Delete();
11761 return true;
11762 }
11763 }
11764
11765 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11766 {
11767 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11768 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11769 PlayerBase p = PlayerBase.Cast(player);
11770 if (
EActions.RECIPES_RANGE_START < 1000)
11771 {
11772 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11773 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11774 }
11775 }
11776 #ifndef SERVER
11777 else if (action_id ==
EActions.WATCH_PLAYER)
11778 {
11779 PluginDeveloper.SetDeveloperItemClientEx(player);
11780 }
11781 #endif
11783 {
11784 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11785 {
11786 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11787 OnDebugButtonPressServer(id + 1);
11788 }
11789
11790 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11791 {
11792 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11794 }
11795
11796 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11797 {
11798 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11800 }
11801
11802 else if (action_id ==
EActions.ADD_QUANTITY)
11803 {
11804 if (IsMagazine())
11805 {
11806 Magazine mag = Magazine.Cast(this);
11807 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11808 }
11809 else
11810 {
11812 }
11813
11814 if (m_EM)
11815 {
11816 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11817 }
11818
11819 }
11820
11821 else if (action_id ==
EActions.REMOVE_QUANTITY)
11822 {
11823 if (IsMagazine())
11824 {
11825 Magazine mag2 = Magazine.Cast(this);
11826 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11827 }
11828 else
11829 {
11831 }
11832 if (m_EM)
11833 {
11834 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11835 }
11836
11837 }
11838
11839 else if (action_id ==
EActions.SET_QUANTITY_0)
11840 {
11842
11843 if (m_EM)
11844 {
11845 m_EM.SetEnergy(0);
11846 }
11847 }
11848
11849 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11850 {
11852
11853 if (m_EM)
11854 {
11855 m_EM.SetEnergy(m_EM.GetEnergyMax());
11856 }
11857 }
11858
11859 else if (action_id ==
EActions.ADD_HEALTH)
11860 {
11861 AddHealth("","",GetMaxHealth("","Health")/5);
11862 }
11863 else if (action_id ==
EActions.REMOVE_HEALTH)
11864 {
11865 AddHealth("","",-GetMaxHealth("","Health")/5);
11866 }
11867 else if (action_id ==
EActions.DESTROY_HEALTH)
11868 {
11869 SetHealth01("","",0);
11870 }
11871 else if (action_id ==
EActions.WATCH_ITEM)
11872 {
11874 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11875 #ifdef DEVELOPER
11876 SetDebugDeveloper_item(this);
11877 #endif
11878 }
11879
11880 else if (action_id ==
EActions.ADD_TEMPERATURE)
11881 {
11882 AddTemperature(20);
11883
11884 }
11885
11886 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11887 {
11888 AddTemperature(-20);
11889
11890 }
11891
11892 else if (action_id ==
EActions.FLIP_FROZEN)
11893 {
11894 SetFrozen(!GetIsFrozen());
11895
11896 }
11897
11898 else if (action_id ==
EActions.ADD_WETNESS)
11899 {
11901
11902 }
11903
11904 else if (action_id ==
EActions.REMOVE_WETNESS)
11905 {
11907
11908 }
11909
11910 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11911 {
11914
11915
11916 }
11917
11918 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11919 {
11922 }
11923
11924 else if (action_id ==
EActions.MAKE_SPECIAL)
11925 {
11926 auto debugParams = DebugSpawnParams.WithPlayer(player);
11927 OnDebugSpawnEx(debugParams);
11928 }
11929
11930 }
11931
11932
11933 return false;
11934 }
11935
11936
11937
11938
11942
11945
11946
11947
11949 {
11950 return false;
11951 }
11952
11953
11955 {
11956 return true;
11957 }
11958
11959
11961 {
11962 return true;
11963 }
11964
11965
11966
11968 {
11969 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11970 return g_Game.ConfigIsExisting(config_path);
11971 }
11972
11975 {
11976 return null;
11977 }
11978
11980 {
11981 return false;
11982 }
11983
11985 {
11986 return false;
11987 }
11988
11992
11993
11995 {
11996 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11997 return module_repairing.CanRepair(this, item_repair_kit);
11998 }
11999
12000
12001 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
12002 {
12003 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
12004 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
12005 }
12006
12007
12009 {
12010
12011
12012
12013
12014
12015
12016
12017
12018 return 1;
12019 }
12020
12021
12022
12024 {
12026 }
12027
12028
12029
12031 {
12033 }
12034
12035
12044 {
12045 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12046
12047 if (player)
12048 {
12049 player.MessageStatus(text);
12050 }
12051 }
12052
12053
12062 {
12063 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12064
12065 if (player)
12066 {
12067 player.MessageAction(text);
12068 }
12069 }
12070
12071
12080 {
12081 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12082
12083 if (player)
12084 {
12085 player.MessageFriendly(text);
12086 }
12087 }
12088
12089
12098 {
12099 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12100
12101 if (player)
12102 {
12103 player.MessageImportant(text);
12104 }
12105 }
12106
12108 {
12109 return true;
12110 }
12111
12112
12113 override bool KindOf(
string tag)
12114 {
12115 bool found = false;
12116 string item_name = this.
GetType();
12118 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12119
12120 int array_size = item_tag_array.Count();
12121 for (int i = 0; i < array_size; i++)
12122 {
12123 if (item_tag_array.Get(i) == tag)
12124 {
12125 found = true;
12126 break;
12127 }
12128 }
12129 return found;
12130 }
12131
12132
12134 {
12135
12136 super.OnRPC(sender, rpc_type,ctx);
12137
12138
12139 switch (rpc_type)
12140 {
12141 #ifndef SERVER
12142 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12143 Param2<bool, string> p = new Param2<bool, string>(false, "");
12144
12146 return;
12147
12148 bool play = p.param1;
12149 string soundSet = p.param2;
12150
12151 if (play)
12152 {
12154 {
12156 {
12158 }
12159 }
12160 else
12161 {
12163 }
12164 }
12165 else
12166 {
12168 }
12169
12170 break;
12171 #endif
12172
12173 }
12174
12176 {
12178 }
12179 }
12180
12181
12182
12183
12185 {
12186 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12187 return plugin.GetID(
name);
12188 }
12189
12191 {
12192 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12193 return plugin.GetName(id);
12194 }
12195
12198 {
12199
12200
12201 int varFlags;
12202 if (!ctx.
Read(varFlags))
12203 return;
12204
12205 if (varFlags & ItemVariableFlags.FLOAT)
12206 {
12208 }
12209 }
12210
12212 {
12213
12214 super.SerializeNumericalVars(floats_out);
12215
12216
12217
12219 {
12221 }
12222
12224 {
12226 }
12227
12229 {
12231 }
12232
12234 {
12239 }
12240
12242 {
12244 }
12245 }
12246
12248 {
12249
12250 super.DeSerializeNumericalVars(floats);
12251
12252
12253 int index = 0;
12254 int mask = Math.Round(floats.Get(index));
12255
12256 index++;
12257
12259 {
12261 {
12263 }
12264 else
12265 {
12266 float quantity = floats.Get(index);
12267 SetQuantity(quantity,
true,
false,
false,
false);
12268 }
12269 index++;
12270 }
12271
12273 {
12274 float wet = floats.Get(index);
12276 index++;
12277 }
12278
12280 {
12281 int liquidtype = Math.Round(floats.Get(index));
12283 index++;
12284 }
12285
12287 {
12289 index++;
12291 index++;
12293 index++;
12295 index++;
12296 }
12297
12299 {
12300 int cleanness = Math.Round(floats.Get(index));
12302 index++;
12303 }
12304 }
12305
12307 {
12308 super.WriteVarsToCTX(ctx);
12309
12310
12312 {
12314 }
12315
12317 {
12319 }
12320
12322 {
12324 }
12325
12327 {
12328 int r,g,b,a;
12334 }
12335
12337 {
12339 }
12340 }
12341
12343 {
12344 if (!super.ReadVarsFromCTX(ctx,version))
12345 return false;
12346
12347 int intValue;
12348 float value;
12349
12350 if (version < 140)
12351 {
12352 if (!ctx.
Read(intValue))
12353 return false;
12354
12355 m_VariablesMask = intValue;
12356 }
12357
12359 {
12360 if (!ctx.
Read(value))
12361 return false;
12362
12364 {
12366 }
12367 else
12368 {
12370 }
12371 }
12372
12373 if (version < 140)
12374 {
12376 {
12377 if (!ctx.
Read(value))
12378 return false;
12379 SetTemperatureDirect(value);
12380 }
12381 }
12382
12384 {
12385 if (!ctx.
Read(value))
12386 return false;
12388 }
12389
12391 {
12392 if (!ctx.
Read(intValue))
12393 return false;
12395 }
12396
12398 {
12399 int r,g,b,a;
12401 return false;
12403 return false;
12405 return false;
12407 return false;
12408
12410 }
12411
12413 {
12414 if (!ctx.
Read(intValue))
12415 return false;
12417 }
12418
12419 if (version >= 138 && version < 140)
12420 {
12422 {
12423 if (!ctx.
Read(intValue))
12424 return false;
12425 SetFrozen(intValue);
12426 }
12427 }
12428
12429 return true;
12430 }
12431
12432
12434 {
12437 {
12439 }
12440
12441 if (!super.OnStoreLoad(ctx, version))
12442 {
12444 return false;
12445 }
12446
12447 if (version >= 114)
12448 {
12449 bool hasQuickBarIndexSaved;
12450
12451 if (!ctx.
Read(hasQuickBarIndexSaved))
12452 {
12454 return false;
12455 }
12456
12457 if (hasQuickBarIndexSaved)
12458 {
12459 int itmQBIndex;
12460
12461
12462 if (!ctx.
Read(itmQBIndex))
12463 {
12465 return false;
12466 }
12467
12468 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12469 if (itmQBIndex != -1 && parentPlayer)
12470 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12471 }
12472 }
12473 else
12474 {
12475
12476 PlayerBase player;
12477 int itemQBIndex;
12478 if (version ==
int.
MAX)
12479 {
12480 if (!ctx.
Read(itemQBIndex))
12481 {
12483 return false;
12484 }
12485 }
12486 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12487 {
12488
12489 if (!ctx.
Read(itemQBIndex))
12490 {
12492 return false;
12493 }
12494 if (itemQBIndex != -1 && player)
12495 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12496 }
12497 }
12498
12499 if (version < 140)
12500 {
12501
12502 if (!LoadVariables(ctx, version))
12503 {
12505 return false;
12506 }
12507 }
12508
12509
12511 {
12513 return false;
12514 }
12515 if (version >= 132)
12516 {
12518 if (raib)
12519 {
12521 {
12523 return false;
12524 }
12525 }
12526 }
12527
12529 return true;
12530 }
12531
12532
12533
12535 {
12536 super.OnStoreSave(ctx);
12537
12538 PlayerBase player;
12539 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12540 {
12542
12543 int itemQBIndex = -1;
12544 itemQBIndex = player.FindQuickBarEntityIndex(this);
12545 ctx.
Write(itemQBIndex);
12546 }
12547 else
12548 {
12550 }
12551
12553
12555 if (raib)
12556 {
12558 }
12559 }
12560
12561
12563 {
12564 super.AfterStoreLoad();
12565
12567 {
12569 }
12570
12572 {
12575 }
12576 }
12577
12579 {
12580 super.EEOnAfterLoad();
12581
12583 {
12585 }
12586
12589 }
12590
12592 {
12593 return false;
12594 }
12595
12596
12597
12599 {
12601 {
12602 #ifdef PLATFORM_CONSOLE
12603
12605 {
12607 if (menu)
12608 {
12610 }
12611 }
12612 #endif
12613 }
12614
12616 {
12619 }
12620
12622 {
12623 SetWeightDirty();
12625 }
12627 {
12630 }
12631
12633 {
12636
12639 }
12641 {
12645 }
12646
12647 super.OnVariablesSynchronized();
12648 }
12649
12650
12651
12653 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12654 {
12655 if (!IsServerCheck(allow_client))
12656 return false;
12657
12659 return false;
12660
12663
12664 if (value <= (min + 0.001))
12665 value = min;
12666
12667 if (value == min)
12668 {
12669 if (destroy_config)
12670 {
12671 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12672 if (dstr)
12673 {
12675 this.Delete();
12676 return true;
12677 }
12678 }
12679 else if (destroy_forced)
12680 {
12682 this.Delete();
12683 return true;
12684 }
12685
12687 }
12688
12691
12693 {
12694 EntityAI parent = GetHierarchyRoot();
12695 InventoryLocation iLoc = new InventoryLocation();
12696 GetInventory().GetCurrentInventoryLocation(iLoc);
12698 {
12699 int iLocSlot = iLoc.
GetSlot();
12701 {
12703 }
12705 {
12707 }
12708 }
12709 }
12710
12712 {
12714
12715 if (delta)
12717 }
12718
12720
12721 return false;
12722 }
12723
12724
12726 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12727 {
12729 }
12730
12732 {
12735 }
12736
12738 {
12741 }
12742
12744 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12745 {
12746 float value_clamped = Math.Clamp(value, 0, 1);
12748 SetQuantity(result, destroy_config, destroy_forced);
12749 }
12750
12751
12754 {
12756 }
12757
12759 {
12761 }
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12773 {
12774 int slot = -1;
12775 GameInventory inventory = GetInventory();
12776 if (inventory)
12777 {
12778 InventoryLocation il = new InventoryLocation;
12781 }
12782
12784 }
12785
12787 {
12788 float quantity_max = 0;
12789
12791 {
12792 if (attSlotID != -1)
12793 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12794
12795 if (quantity_max <= 0)
12797 }
12798
12799 if (quantity_max <= 0)
12801
12802 return quantity_max;
12803 }
12804
12806 {
12808 }
12809
12811 {
12813 }
12814
12815
12817 {
12819 }
12820
12822 {
12824 }
12825
12827 {
12829 }
12830
12831
12833 {
12834
12835 float weightEx = GetWeightEx();
12836 float special = GetInventoryAndCargoWeight();
12837 return weightEx - special;
12838 }
12839
12840
12842 {
12844 }
12845
12847 {
12849 {
12850 #ifdef DEVELOPER
12851 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12852 {
12853 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12855 }
12856 #endif
12857
12858 return GetQuantity() * GetConfigWeightModified();
12859 }
12860 else if (HasEnergyManager())
12861 {
12862 #ifdef DEVELOPER
12863 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12864 {
12865 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12866 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12867 }
12868 #endif
12869 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12870 }
12871 else
12872 {
12873 #ifdef DEVELOPER
12874 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12875 {
12876 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12877 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12878 }
12879 #endif
12880 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12881 }
12882 }
12883
12886 {
12887 int item_count = 0;
12889
12890 GameInventory inventory = GetInventory();
12891 CargoBase cargo = inventory.
GetCargo();
12892 if (cargo != NULL)
12893 {
12895 }
12896
12898 for (int i = 0; i < nAttachments; ++i)
12899 {
12901 if (item)
12902 item_count += item.GetNumberOfItems();
12903 }
12904 return item_count;
12905 }
12906
12909 {
12910 float weight = 0;
12911 float wetness = 1;
12912 if (include_wetness)
12915 {
12916 weight = wetness * m_ConfigWeight;
12917 }
12919 {
12920 weight = 1;
12921 }
12922 return weight;
12923 }
12924
12925
12926
12928 {
12929 GameInventory inventory = GetInventory();
12930 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12931 {
12932 array<EntityAI> items = new array<EntityAI>;
12934 for (int i = 0; i < items.Count(); ++i)
12935 {
12937 if (item)
12938 {
12939 g_Game.ObjectDelete(item);
12940 }
12941 }
12942 }
12943 }
12944
12945
12946
12947
12949 {
12950 float energy = 0;
12951 if (HasEnergyManager())
12952 {
12953 energy = GetCompEM().GetEnergy();
12954 }
12955 return energy;
12956 }
12957
12958
12960 {
12961 super.OnEnergyConsumed();
12962
12964 }
12965
12967 {
12968 super.OnEnergyAdded();
12969
12971 }
12972
12973
12975 {
12976 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12977 {
12979 {
12980 float energy_0to1 = GetCompEM().GetEnergy0To1();
12982 }
12983 }
12984 }
12985
12986
12988 {
12989 return ConfigGetFloat("heatIsolation");
12990 }
12991
12993 {
12995 }
12996
12998 {
12999 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
13000 if (
g_Game.ConfigIsExisting(paramPath))
13001 return g_Game.ConfigGetFloat(paramPath);
13002
13003 return 0.0;
13004 }
13005
13007 {
13008 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
13009 if (
g_Game.ConfigIsExisting(paramPath))
13010 return g_Game.ConfigGetFloat(paramPath);
13011
13012 return 0.0;
13013 }
13014
13015 override void SetWet(
float value,
bool allow_client =
false)
13016 {
13017 if (!IsServerCheck(allow_client))
13018 return;
13019
13022
13024
13025 m_VarWet = Math.Clamp(value, min, max);
13026
13028 {
13031 }
13032 }
13033
13034 override void AddWet(
float value)
13035 {
13037 }
13038
13040 {
13042 }
13043
13045 {
13047 }
13048
13050 {
13052 }
13053
13055 {
13057 }
13058
13060 {
13062 }
13063
13064 override void OnWetChanged(
float newVal,
float oldVal)
13065 {
13068 if (newLevel != oldLevel)
13069 {
13071 }
13072 }
13073
13075 {
13076 SetWeightDirty();
13077 }
13078
13080 {
13081 return GetWetLevelInternal(
m_VarWet);
13082 }
13083
13084
13085
13087 {
13089 }
13090
13092 {
13094 }
13095
13097 {
13099 }
13100
13102 {
13104 }
13105
13106
13107
13109 {
13110 if (ConfigIsExisting("itemModelLength"))
13111 {
13112 return ConfigGetFloat("itemModelLength");
13113 }
13114 return 0;
13115 }
13116
13118 {
13119 if (ConfigIsExisting("itemAttachOffset"))
13120 {
13121 return ConfigGetFloat("itemAttachOffset");
13122 }
13123 return 0;
13124 }
13125
13126 override void SetCleanness(
int value,
bool allow_client =
false)
13127 {
13128 if (!IsServerCheck(allow_client))
13129 return;
13130
13132
13134
13137 }
13138
13140 {
13142 }
13143
13145 {
13146 return true;
13147 }
13148
13149
13150
13151
13153 {
13155 }
13156
13158 {
13160 }
13161
13162
13163
13164
13165 override void SetColor(
int r,
int g,
int b,
int a)
13166 {
13172 }
13174 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13175 {
13180 }
13181
13183 {
13185 }
13186
13189 {
13190 int r,g,b,a;
13192 r = r/255;
13193 g = g/255;
13194 b = b/255;
13195 a = a/255;
13196 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13197 }
13198
13199
13200
13201 override void SetLiquidType(
int value,
bool allow_client =
false)
13202 {
13203 if (!IsServerCheck(allow_client))
13204 return;
13205
13210 }
13211
13213 {
13214 return ConfigGetInt("varLiquidTypeInit");
13215 }
13216
13218 {
13220 }
13221
13223 {
13225 SetFrozen(false);
13226 }
13227
13230 {
13231 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13232 }
13233
13234
13237 {
13238 PlayerBase nplayer;
13239 if (PlayerBase.CastTo(nplayer, player))
13240 {
13242 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13243 }
13244 }
13245
13246
13249 {
13250 PlayerBase nplayer;
13251 if (PlayerBase.CastTo(nplayer,player))
13252 {
13253 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13254 }
13255
13256 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13257
13258 if (HasEnergyManager())
13259 {
13260 GetCompEM().UpdatePlugState();
13261 }
13262 }
13263
13264
13266 {
13267 super.OnPlacementStarted(player);
13268
13270 }
13271
13272 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13273 {
13275 {
13276 m_AdminLog.OnPlacementComplete(player,
this);
13277 }
13278
13279 super.OnPlacementComplete(player, position, orientation);
13280 }
13281
13282
13283
13284
13285
13287 {
13289 {
13290 return true;
13291 }
13292 else
13293 {
13294 return false;
13295 }
13296 }
13297
13298
13300 {
13302 {
13304 }
13305 }
13306
13307
13309 {
13311 }
13312
13314 {
13316 }
13317
13318 override void InsertAgent(
int agent,
float count = 1)
13319 {
13320 if (count < 1)
13321 return;
13322
13324 }
13325
13328 {
13330 }
13331
13332
13334 {
13336 }
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13380 {
13382 return false;
13383 return true;
13384 }
13385
13387 {
13388
13390 }
13391
13392
13395 {
13396 super.CheckForRoofLimited(timeTresholdMS);
13397
13398 float time =
g_Game.GetTime();
13399 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13400 {
13401 m_PreviousRoofTestTime = time;
13402 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13403 }
13404 }
13405
13406
13408 {
13410 {
13411 return 0;
13412 }
13413
13414 if (GetInventory().GetAttachmentSlotsCount() != 0)
13415 {
13416 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13417 if (filter)
13418 return filter.GetProtectionLevel(type, false, system);
13419 else
13420 return 0;
13421 }
13422
13423 string subclassPath, entryName;
13424
13425 switch (type)
13426 {
13428 entryName = "biological";
13429 break;
13431 entryName = "chemical";
13432 break;
13433 default:
13434 entryName = "biological";
13435 break;
13436 }
13437
13438 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13439
13440 return g_Game.ConfigGetFloat(subclassPath + entryName);
13441 }
13442
13443
13444
13447 {
13448 if (!IsMagazine())
13450
13452 }
13453
13454
13455
13456
13457
13462 {
13463 return true;
13464 }
13465
13467 {
13469 }
13470
13471
13472
13473
13474
13476 {
13477 if (parent)
13478 {
13479 if (parent.IsInherited(DayZInfected))
13480 return true;
13481
13482 if (!parent.IsRuined())
13483 return true;
13484 }
13485
13486 return true;
13487 }
13488
13490 {
13491 if (!super.CanPutAsAttachment(parent))
13492 {
13493 return false;
13494 }
13495
13496 if (!IsRuined() && !parent.IsRuined())
13497 {
13498 return true;
13499 }
13500
13501 return false;
13502 }
13503
13505 {
13506
13507
13508
13509
13510 return super.CanReceiveItemIntoCargo(item);
13511 }
13512
13514 {
13515
13516
13517
13518
13519 GameInventory attachmentInv = attachment.GetInventory();
13521 {
13522 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13523 return false;
13524 }
13525
13526 InventoryLocation loc = new InventoryLocation();
13527 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13528 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13529 return false;
13530
13531 return super.CanReceiveAttachment(attachment, slotId);
13532 }
13533
13535 {
13536 if (!super.CanReleaseAttachment(attachment))
13537 return false;
13538
13539 return GetInventory().AreChildrenAccessible();
13540 }
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13563 {
13564 int id = muzzle_owner.GetMuzzleID();
13565 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13566
13567 if (WPOF_array)
13568 {
13569 for (int i = 0; i < WPOF_array.Count(); i++)
13570 {
13571 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13572
13573 if (WPOF)
13574 {
13575 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13576 }
13577 }
13578 }
13579 }
13580
13581
13583 {
13584 int id = muzzle_owner.GetMuzzleID();
13586
13587 if (WPOBE_array)
13588 {
13589 for (int i = 0; i < WPOBE_array.Count(); i++)
13590 {
13591 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13592
13593 if (WPOBE)
13594 {
13595 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13596 }
13597 }
13598 }
13599 }
13600
13601
13603 {
13604 int id = muzzle_owner.GetMuzzleID();
13605 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13606
13607 if (WPOOH_array)
13608 {
13609 for (int i = 0; i < WPOOH_array.Count(); i++)
13610 {
13611 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13612
13613 if (WPOOH)
13614 {
13615 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13616 }
13617 }
13618 }
13619 }
13620
13621
13623 {
13624 int id = muzzle_owner.GetMuzzleID();
13625 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13626
13627 if (WPOOH_array)
13628 {
13629 for (int i = 0; i < WPOOH_array.Count(); i++)
13630 {
13631 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13632
13633 if (WPOOH)
13634 {
13635 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13636 }
13637 }
13638 }
13639 }
13640
13641
13643 {
13644 int id = muzzle_owner.GetMuzzleID();
13645 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13646
13647 if (WPOOH_array)
13648 {
13649 for (int i = 0; i < WPOOH_array.Count(); i++)
13650 {
13651 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13652
13653 if (WPOOH)
13654 {
13655 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13656 }
13657 }
13658 }
13659 }
13660
13661
13662
13664 {
13666 {
13667 return true;
13668 }
13669
13670 return false;
13671 }
13672
13674 {
13676 {
13677 return true;
13678 }
13679
13680 return false;
13681 }
13682
13684 {
13686 {
13687 return true;
13688 }
13689
13690 return false;
13691 }
13692
13694 {
13695 return false;
13696 }
13697
13700 {
13701 return UATimeSpent.DEFAULT_DEPLOY;
13702 }
13703
13704
13705
13706
13708 {
13710 SetSynchDirty();
13711 }
13712
13714 {
13716 }
13717
13718
13720 {
13721 return false;
13722 }
13723
13726 {
13727 string att_type = "None";
13728
13729 if (ConfigIsExisting("soundAttType"))
13730 {
13731 att_type = ConfigGetString("soundAttType");
13732 }
13733
13735 }
13736
13738 {
13740 }
13741
13742
13743
13744
13745
13751
13753 {
13756
13758 }
13759
13760
13762 {
13764 return;
13765
13767
13770
13773
13774 SoundParameters params = new SoundParameters();
13778 }
13779
13780
13782 {
13784 {
13787
13788 SetSynchDirty();
13789
13792 }
13793 }
13794
13796 {
13798 }
13799
13800
13802 {
13804 return;
13805
13807 SetSynchDirty();
13808
13811 }
13812
13814 {
13817 }
13818
13820 {
13822 }
13823
13824 void OnApply(PlayerBase player);
13825
13827 {
13828 return 1.0;
13829 };
13830
13832 {
13834 }
13835
13837 {
13839 }
13840
13842
13844 {
13845 SetDynamicPhysicsLifeTime(0.01);
13847 }
13848
13850 {
13851 array<string> zone_names = new array<string>;
13852 GetDamageZones(zone_names);
13853 for (int i = 0; i < zone_names.Count(); i++)
13854 {
13855 SetHealthMax(zone_names.Get(i),"Health");
13856 }
13857 SetHealthMax("","Health");
13858 }
13859
13862 {
13863 float global_health = GetHealth01("","Health");
13864 array<string> zones = new array<string>;
13865 GetDamageZones(zones);
13866
13867 for (int i = 0; i < zones.Count(); i++)
13868 {
13869 SetHealth01(zones.Get(i),"Health",global_health);
13870 }
13871 }
13872
13875 {
13876 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13877 }
13878
13880 {
13881 if (!hasRootAsPlayer)
13882 {
13883 if (refParentIB)
13884 {
13885
13886 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13887 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13888
13889 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13890 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13891
13894 }
13895 else
13896 {
13897
13900 }
13901 }
13902 }
13903
13905 {
13907 {
13908 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13909 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13910 {
13911 float heatPermCoef = 1.0;
13913 while (ent)
13914 {
13915 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13916 ent = ent.GetHierarchyParent();
13917 }
13918
13919 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13920 }
13921 }
13922 }
13923
13925 {
13926
13927 EntityAI parent = GetHierarchyParent();
13928 if (!parent)
13929 {
13930 hasParent = false;
13931 hasRootAsPlayer = false;
13932 }
13933 else
13934 {
13935 hasParent = true;
13936 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13937 refParentIB =
ItemBase.Cast(parent);
13938 }
13939 }
13940
13941 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13942 {
13943
13944 }
13945
13947 {
13948
13949 return false;
13950 }
13951
13953 {
13954
13955
13956 return false;
13957 }
13958
13960 {
13961
13962 return false;
13963 }
13964
13967 {
13968 return !GetIsFrozen() &&
IsOpen();
13969 }
13970
13972 {
13973 bool hasParent = false, hasRootAsPlayer = false;
13975
13976 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13977 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13978
13979 if (wwtu || foodDecay)
13980 {
13984
13985 if (processWetness || processTemperature || processDecay)
13986 {
13988
13989 if (processWetness)
13990 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13991
13992 if (processTemperature)
13994
13995 if (processDecay)
13996 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13997 }
13998 }
13999 }
14000
14003 {
14005 }
14006
14008 {
14011
14012 return super.GetTemperatureFreezeThreshold();
14013 }
14014
14016 {
14019
14020 return super.GetTemperatureThawThreshold();
14021 }
14022
14024 {
14027
14028 return super.GetItemOverheatThreshold();
14029 }
14030
14032 {
14034 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14035
14036 return super.GetTemperatureFreezeTime();
14037 }
14038
14040 {
14042 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14043
14044 return super.GetTemperatureThawTime();
14045 }
14046
14051
14053 {
14054 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14055 }
14056
14058 {
14059 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14060 }
14061
14064 {
14066 }
14067
14069 {
14071 }
14072
14074 {
14076 }
14077
14080 {
14081 return null;
14082 }
14083
14086 {
14087 return false;
14088 }
14089
14091 {
14093 {
14096 if (!trg)
14097 {
14099 explosive = this;
14100 }
14101
14102 explosive.PairRemote(trg);
14104
14105 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14106 trg.SetPersistentPairID(persistentID);
14107 explosive.SetPersistentPairID(persistentID);
14108
14109 return true;
14110 }
14111 return false;
14112 }
14113
14116 {
14117 float ret = 1.0;
14120 ret *= GetHealth01();
14121
14122 return ret;
14123 }
14124
14125 #ifdef DEVELOPER
14126 override void SetDebugItem()
14127 {
14128 super.SetDebugItem();
14129 _itemBase = this;
14130 }
14131
14133 {
14134 string text = super.GetDebugText();
14135
14137 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14138
14139 return text;
14140 }
14141 #endif
14142
14144 {
14145 return true;
14146 }
14147
14149
14151
14153 {
14156 }
14157
14158
14166
14182
14183 [
Obsolete(
"Use ItemSoundHandler instead")]
14186 {
14187 if (!
g_Game.IsDedicatedServer())
14188 {
14189 if (ConfigIsExisting("attachSoundSet"))
14190 {
14191 string cfg_path = "";
14192 string soundset = "";
14193 string type_name =
GetType();
14194
14197 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14198 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14199
14200 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14201 {
14202 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14203 {
14204 if (cfg_slot_array[i] == slot_type)
14205 {
14206 soundset = cfg_soundset_array[i];
14207 break;
14208 }
14209 }
14210 }
14211
14212 if (soundset != "")
14213 {
14214 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14216 }
14217 }
14218 }
14219 }
14220
14222}
14223
14225{
14227 if (entity)
14228 {
14229 bool is_item = entity.IsInherited(
ItemBase);
14230 if (is_item && full_quantity)
14231 {
14234 }
14235 }
14236 else
14237 {
14239 return NULL;
14240 }
14241 return entity;
14242}
14243
14245{
14246 if (item)
14247 {
14248 if (health > 0)
14249 item.SetHealth("", "", health);
14250
14251 if (item.CanHaveTemperature())
14252 {
14254 if (item.CanFreeze())
14255 item.SetFrozen(false);
14256 }
14257
14258 if (item.HasEnergyManager())
14259 {
14260 if (quantity >= 0)
14261 {
14262 item.GetCompEM().SetEnergy0To1(quantity);
14263 }
14264 else
14265 {
14267 }
14268 }
14269 else if (item.IsMagazine())
14270 {
14271 Magazine mag = Magazine.Cast(item);
14272 if (quantity >= 0)
14273 {
14274 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14275 }
14276 else
14277 {
14279 }
14280
14281 }
14282 else
14283 {
14284 if (quantity >= 0)
14285 {
14286 item.SetQuantityNormalized(quantity, false);
14287 }
14288 else
14289 {
14291 }
14292
14293 }
14294 }
14295}
14296
14297#ifdef DEVELOPER
14299#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.