9204{
9206 {
9207 return true;
9208 }
9209};
9210
9212{
9213
9214};
9215
9216
9217
9219{
9223
9225
9228
9229
9230
9231
9232
9241
9247
9252
9257
9278 protected bool m_IsResultOfSplit
9279
9281
9286
9287
9288
9290
9294
9295
9296
9298
9301
9302
9303
9309
9310
9318
9321
9322
9324
9325
9327
9328
9333
9334
9339
9341
9342
9344
9345
9347 {
9352
9353 if (!
g_Game.IsDedicatedServer())
9354 {
9356 {
9358
9360 {
9362 }
9363 }
9364
9367 }
9368
9369 m_OldLocation = null;
9370
9372 {
9374 }
9375
9376 if (ConfigIsExisting("headSelectionsToHide"))
9377 {
9380 }
9381
9383 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9384 {
9386 }
9387
9389
9390 m_IsResultOfSplit = false;
9391
9393 }
9394
9396 {
9397 super.InitItemVariables();
9398
9404 m_Count = ConfigGetInt(
"count");
9405
9408
9413
9416
9421
9433
9437
9438
9441 if (ConfigIsExisting("canBeSplit"))
9442 {
9445 }
9446
9448 if (ConfigIsExisting("itemBehaviour"))
9450
9451
9454 RegisterNetSyncVariableInt("m_VarLiquidType");
9455 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9456
9457 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9458 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9459 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9460
9461 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9462 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9463 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9464 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9465
9466 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9467 RegisterNetSyncVariableBool("m_IsTakeable");
9468 RegisterNetSyncVariableBool("m_IsHologram");
9469
9472 {
9475 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9476 }
9477
9479
9481 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9483
9485 }
9486
9488 {
9490 }
9491
9493 {
9496 {
9501 }
9502 }
9503
9504 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9505 {
9507 {
9510 }
9511
9513 }
9514
9516 {
9522 }
9523
9525
9527 {
9529
9530 if (!action)
9531 {
9532 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9533 return;
9534 }
9535
9537 if (!ai)
9538 {
9540 return;
9541 }
9542
9544 if (!action_array)
9545 {
9546 action_array = new array<ActionBase_Basic>;
9548 }
9549 if (LogManager.IsActionLogEnable())
9550 {
9551 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9552 }
9553
9554 if (action_array.Find(action) != -1)
9555 {
9556 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9557 }
9558 else
9559 {
9560 action_array.Insert(action);
9561 }
9562 }
9563
9565 {
9566 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9567 ActionBase action = player.GetActionManager().GetAction(actionName);
9570
9571 if (action_array)
9572 {
9573 action_array.RemoveItem(action);
9574 }
9575 }
9576
9577
9578
9580 {
9581 ActionOverrideData overrideData = new ActionOverrideData();
9585
9587 if (!actionMap)
9588 {
9591 }
9592
9593 actionMap.Insert(this.
Type(), overrideData);
9594
9595 }
9596
9598
9600
9601
9603 {
9606
9609
9610 string config_to_search = "CfgVehicles";
9611 string muzzle_owner_config;
9612
9614 {
9615 if (IsInherited(Weapon))
9616 config_to_search = "CfgWeapons";
9617
9618 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9619
9620 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9621
9622 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9623
9624 if (config_OnFire_subclass_count > 0)
9625 {
9626 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9627
9628 for (int i = 0; i < config_OnFire_subclass_count; i++)
9629 {
9630 string particle_class = "";
9631 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9632 string config_OnFire_entry = config_OnFire_class + particle_class;
9633 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9634 WPOF_array.Insert(WPOF);
9635 }
9636
9637
9639 }
9640 }
9641
9643 {
9644 config_to_search = "CfgWeapons";
9645 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9646
9647 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9648
9649 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9650
9651 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9652 {
9653 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9654
9655 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9656 {
9657 string particle_class2 = "";
9658 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9659 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9660 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9661 WPOBE_array.Insert(WPOBE);
9662 }
9663
9664
9666 }
9667 }
9668 }
9669
9670
9672 {
9675
9677 {
9678 string config_to_search = "CfgVehicles";
9679
9680 if (IsInherited(Weapon))
9681 config_to_search = "CfgWeapons";
9682
9683 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9684 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9685
9686 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9687 {
9688
9690
9692 {
9694 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9696 return;
9697 }
9698
9701
9702
9703
9704 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9705 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9706
9707 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9708 {
9709 string particle_class = "";
9710 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9711 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9712 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9713
9714 if (entry_type == CT_CLASS)
9715 {
9716 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9717 WPOOH_array.Insert(WPOF);
9718 }
9719 }
9720
9721
9723 }
9724 }
9725 }
9726
9728 {
9730 }
9731
9733 {
9735 {
9737
9740
9743
9744 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9745 }
9746 }
9747
9749 {
9751 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9752
9754 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9755
9757 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9758
9760 {
9762 }
9763 }
9764
9766 {
9768 }
9769
9771 {
9774 else
9776
9778 {
9781 }
9782 else
9783 {
9786
9789 }
9790
9792 }
9793
9795 {
9797 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9798 }
9799
9801 {
9803 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9805 }
9806
9808 {
9810 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9811 }
9812
9814 {
9817
9818 OverheatingParticle OP = new OverheatingParticle();
9823
9825 }
9826
9828 {
9831
9832 return -1;
9833 }
9834
9836 {
9838 {
9841
9842 for (int i = count; i > 0; --i)
9843 {
9844 int id = i - 1;
9847
9850
9851 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9852 {
9853 if (p)
9854 {
9857 }
9858 }
9859 }
9860 }
9861 }
9862
9864 {
9866 {
9868 {
9869 int id = i - 1;
9871
9872 if (OP)
9873 {
9875
9876 if (p)
9877 {
9879 }
9880
9881 delete OP;
9882 }
9883 }
9884
9887 }
9888 }
9889
9892 {
9893 return 0.0;
9894 }
9895
9896
9898 {
9899 return 250;
9900 }
9901
9903 {
9904 return 0;
9905 }
9906
9909 {
9911 return true;
9912
9913 return false;
9914 }
9915
9918 {
9921
9923 {
9925 }
9926 else
9927 {
9928
9930 }
9931
9933 }
9934
9941 {
9942 return -1;
9943 }
9944
9945
9946
9947
9949 {
9951 {
9952 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9953 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9954
9955 if (r_index >= 0)
9956 {
9957 InventoryLocation r_il = new InventoryLocation;
9958 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9959
9960 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9963 {
9964 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9965 }
9967 {
9968 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9969 }
9970
9971 }
9972
9973 player.GetHumanInventory().ClearUserReservedLocation(this);
9974 }
9975
9978 }
9979
9980
9981
9982
9984 {
9985 return ItemBase.m_DebugActionsMask;
9986 }
9987
9989 {
9990 return ItemBase.m_DebugActionsMask & mask;
9991 }
9992
9994 {
9995 ItemBase.m_DebugActionsMask = mask;
9996 }
9997
9999 {
10000 ItemBase.m_DebugActionsMask |= mask;
10001 }
10002
10004 {
10005 ItemBase.m_DebugActionsMask &= ~mask;
10006 }
10007
10009 {
10011 {
10013 }
10014 else
10015 {
10017 }
10018 }
10019
10020
10022 {
10023 if (GetEconomyProfile())
10024 {
10025 float q_max = GetEconomyProfile().GetQuantityMax();
10026 if (q_max > 0)
10027 {
10028 float q_min = GetEconomyProfile().GetQuantityMin();
10029 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10030
10032 {
10033 ComponentEnergyManager comp = GetCompEM();
10035 {
10037 }
10038 }
10040 {
10042
10043 }
10044
10045 }
10046 }
10047 }
10048
10051 {
10052 EntityAI parent = GetHierarchyParent();
10053
10054 if (parent)
10055 {
10056 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10057 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10058 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10059 }
10060 }
10061
10064 {
10065 EntityAI parent = GetHierarchyParent();
10066
10067 if (parent)
10068 {
10069 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10070 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10071 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10072 }
10073 }
10074
10076 {
10077
10078
10079
10080
10082
10084 {
10085 if (ScriptInputUserData.CanStoreInputUserData())
10086 {
10087 ScriptInputUserData ctx = new ScriptInputUserData;
10093 ctx.
Write(use_stack_max);
10096
10098 {
10099 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10100 }
10101 }
10102 }
10103 else if (!
g_Game.IsMultiplayer())
10104 {
10106 }
10107 }
10108
10110 {
10112 }
10113
10115 {
10117 }
10118
10120 {
10122 }
10123
10125 {
10126
10127 return false;
10128 }
10129
10131 {
10132 return false;
10133 }
10134
10138 {
10139 return false;
10140 }
10141
10143 {
10144 return "";
10145 }
10146
10148
10150 {
10151 return false;
10152 }
10153
10155 {
10156 return true;
10157 }
10158
10159
10160
10162 {
10163 return true;
10164 }
10165
10167 {
10168 return true;
10169 }
10170
10172 {
10173 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10175 }
10176
10178 {
10180 }
10181
10183 {
10185 if (!is_being_placed)
10187 SetSynchDirty();
10188 }
10189
10190
10192
10194 {
10196 }
10197
10199 {
10201 }
10202
10204 {
10205 return 1;
10206 }
10207
10209 {
10210 return false;
10211 }
10212
10214 {
10216 SetSynchDirty();
10217 }
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10254 {
10255 super.OnMovedInsideCargo(container);
10256
10257 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10258 }
10259
10260 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10261 {
10262 super.EEItemLocationChanged(oldLoc, newLoc);
10263
10264 PlayerBase newPlayer = null;
10265 PlayerBase oldPlayer = null;
10266
10267 if (newLoc.GetParent())
10268 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10269
10270 if (oldLoc.GetParent())
10271 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10272
10274 {
10275 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10276
10277 if (rIndex >= 0)
10278 {
10279 InventoryLocation rIl = new InventoryLocation;
10280 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10281
10282 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10285 {
10286 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10287 }
10289 {
10291 }
10292
10293 }
10294 }
10295
10297 {
10298 if (newPlayer)
10299 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10300
10301 if (newPlayer == oldPlayer)
10302 {
10303 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10304 {
10306 {
10307 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10308 {
10309 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10310 }
10311 }
10312 else
10313 {
10314 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10315 }
10316 }
10317
10318 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10319 {
10320 int type = oldLoc.GetType();
10322 {
10323 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10324 }
10326 {
10327 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10328 }
10329 }
10330 if (!m_OldLocation)
10331 {
10332 m_OldLocation = new InventoryLocation;
10333 }
10334 m_OldLocation.Copy(oldLoc);
10335 }
10336 else
10337 {
10338 if (m_OldLocation)
10339 {
10340 m_OldLocation.Reset();
10341 }
10342 }
10343
10344 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10345 }
10346 else
10347 {
10348 if (newPlayer)
10349 {
10350 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10351 if (resIndex >= 0)
10352 {
10353 InventoryLocation il = new InventoryLocation;
10354 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10356 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10359 {
10360 il.
GetParent().GetOnReleaseLock().Invoke(it);
10361 }
10363 {
10365 }
10366
10367 }
10368 }
10370 {
10371
10373 }
10374
10375 if (m_OldLocation)
10376 {
10377 m_OldLocation.Reset();
10378 }
10379 }
10380
10382 {
10383 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10384 }
10385
10387 {
10388 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10389 }
10390 }
10391
10392 override void EOnContact(IEntity other, Contact extra)
10393 {
10395 {
10396 int liquidType = -1;
10398 if (impactSpeed > 0.0)
10399 {
10401 #ifndef SERVER
10403 #else
10405 SetSynchDirty();
10406 #endif
10408 }
10409 }
10410
10411 #ifdef SERVER
10412 if (GetCompEM() && GetCompEM().IsPlugged())
10413 {
10414 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10415 GetCompEM().UnplugThis();
10416 }
10417 #endif
10418 }
10419
10421
10423 {
10425 }
10426
10428 {
10429
10430 }
10431
10433 {
10434 super.OnItemLocationChanged(old_owner, new_owner);
10435
10436 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10437 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10438
10439 if (!relatedPlayer && playerNew)
10440 relatedPlayer = playerNew;
10441
10442 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10443 {
10445 if (actionMgr)
10446 {
10447 ActionBase currentAction = actionMgr.GetRunningAction();
10448 if (currentAction)
10450 }
10451 }
10452
10453 Man ownerPlayerOld = null;
10454 Man ownerPlayerNew = null;
10455
10456 if (old_owner)
10457 {
10458 if (old_owner.
IsMan())
10459 {
10460 ownerPlayerOld = Man.Cast(old_owner);
10461 }
10462 else
10463 {
10464 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10465 }
10466 }
10467 else
10468 {
10470 {
10472
10473 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10474 {
10475 GetCompEM().UnplugThis();
10476 }
10477 }
10478 }
10479
10480 if (new_owner)
10481 {
10482 if (new_owner.
IsMan())
10483 {
10484 ownerPlayerNew = Man.Cast(new_owner);
10485 }
10486 else
10487 {
10488 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10489 }
10490 }
10491
10492 if (ownerPlayerOld != ownerPlayerNew)
10493 {
10494 if (ownerPlayerOld)
10495 {
10496 array<EntityAI> subItemsExit = new array<EntityAI>;
10498 for (int i = 0; i < subItemsExit.Count(); i++)
10499 {
10502 }
10503 }
10504
10505 if (ownerPlayerNew)
10506 {
10507 array<EntityAI> subItemsEnter = new array<EntityAI>;
10509 for (int j = 0; j < subItemsEnter.Count(); j++)
10510 {
10513 }
10514 }
10515 }
10516 else if (ownerPlayerNew != null)
10517 {
10518 PlayerBase nplayer;
10519 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10520 {
10521 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10523 for (int k = 0; k < subItemsUpdate.Count(); k++)
10524 {
10526 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10527 }
10528 }
10529 }
10530
10531 if (old_owner)
10532 old_owner.OnChildItemRemoved(this);
10533 if (new_owner)
10534 new_owner.OnChildItemReceived(this);
10535 }
10536
10537
10539 {
10540 super.EEDelete(parent);
10541 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10542 if (player)
10543 {
10545
10546 if (player.IsAlive())
10547 {
10548 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10549 if (r_index >= 0)
10550 {
10551 InventoryLocation r_il = new InventoryLocation;
10552 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10553
10554 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10557 {
10558 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10559 }
10561 {
10562 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10563 }
10564
10565 }
10566
10567 player.RemoveQuickBarEntityShortcut(this);
10568 }
10569 }
10570 }
10571
10573 {
10574 super.EEKilled(killer);
10575
10578 {
10579 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10580 {
10581 if (IsMagazine())
10582 {
10583 if (Magazine.Cast(this).GetAmmoCount() > 0)
10584 {
10586 }
10587 }
10588 else
10589 {
10591 }
10592 }
10593 }
10594 }
10595
10597 {
10598 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10599
10600 super.OnWasAttached(parent, slot_id);
10601
10604
10607 }
10608
10610 {
10611 super.OnWasDetached(parent, slot_id);
10612
10615
10618 }
10619
10621 {
10622 int idx;
10625
10626 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10627 if (inventory_slots.Count() < 1)
10628 {
10629 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10630 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10631 }
10632 else
10633 {
10634 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10635 }
10636
10637 idx = inventory_slots.Find(slot);
10638 if (idx < 0)
10639 return "";
10640
10641 return attach_types.Get(idx);
10642 }
10643
10645 {
10646 int idx = -1;
10647 string slot;
10648
10651
10652 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10653 if (inventory_slots.Count() < 1)
10654 {
10655 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10656 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10657 }
10658 else
10659 {
10660 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10661 if (detach_types.Count() < 1)
10662 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10663 }
10664
10665 for (int i = 0; i < inventory_slots.Count(); i++)
10666 {
10667 slot = inventory_slots.Get(i);
10668 }
10669
10670 if (slot != "")
10671 {
10672 if (detach_types.Count() == 1)
10673 idx = 0;
10674 else
10675 idx = inventory_slots.Find(slot);
10676 }
10677 if (idx < 0)
10678 return "";
10679
10680 return detach_types.Get(idx);
10681 }
10682
10684 {
10685
10687
10688
10689 float min_time = 1;
10690 float max_time = 3;
10691 float delay = Math.RandomFloat(min_time, max_time);
10692
10693 explode_timer.Run(delay, this, "DoAmmoExplosion");
10694 }
10695
10697 {
10698 Magazine magazine = Magazine.Cast(this);
10699 int pop_sounds_count = 6;
10700 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10701
10702
10703 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10704 string sound_name = pop_sounds[ sound_idx ];
10705 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10706
10707
10708 magazine.ServerAddAmmoCount(-1);
10709
10710
10711 float min_temp_to_explode = 100;
10712
10713 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10714 {
10716 }
10717 }
10718
10719
10720 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10721 {
10722 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10723
10724 const int CHANCE_DAMAGE_CARGO = 4;
10725 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10726 const int CHANCE_DAMAGE_NOTHING = 2;
10727
10729 {
10730 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10731 int chances;
10732 int rnd;
10733
10734 if (GetInventory().GetCargo())
10735 {
10736 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10737 rnd = Math.RandomInt(0,chances);
10738
10739 if (rnd < CHANCE_DAMAGE_CARGO)
10740 {
10742 }
10743 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10744 {
10746 }
10747 }
10748 else
10749 {
10750 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10751 rnd = Math.RandomInt(0,chances);
10752
10753 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10754 {
10756 }
10757 }
10758 }
10759 }
10760
10762 {
10763 CargoBase cargo = GetInventory().GetCargo();
10764 if (cargo)
10765 {
10767 if (item_count > 0)
10768 {
10769 int random_pick = Math.RandomInt(0, item_count);
10771 if (!item.IsExplosive())
10772 {
10773 item.AddHealth("","",damage);
10774 return true;
10775 }
10776 }
10777 }
10778 return false;
10779 }
10780
10782 {
10783 GameInventory inventory = GetInventory();
10785 if (attachment_count > 0)
10786 {
10787 int random_pick = Math.RandomInt(0, attachment_count);
10789 if (!attachment.IsExplosive())
10790 {
10791 attachment.AddHealth("","",damage);
10792 return true;
10793 }
10794 }
10795 return false;
10796 }
10797
10799 {
10801 }
10802
10804 {
10806 return GetInventory().CanRemoveEntity();
10807
10808 return false;
10809 }
10810
10812 {
10813
10815 return false;
10816
10817
10819 return false;
10820
10821
10822
10824 if (delta == 0)
10825 return false;
10826
10827
10828 return true;
10829 }
10830
10832 {
10834 {
10835 if (ScriptInputUserData.CanStoreInputUserData())
10836 {
10837 ScriptInputUserData ctx = new ScriptInputUserData;
10842 ctx.
Write(destination_entity);
10844 ctx.
Write(slot_id);
10846 }
10847 }
10848 else if (!
g_Game.IsMultiplayer())
10849 {
10851 }
10852 }
10853
10855 {
10856 float split_quantity_new;
10860 InventoryLocation loc = new InventoryLocation;
10861
10862 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10863 {
10865 split_quantity_new = stack_max;
10866 else
10868
10870 {
10871 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10872 if (new_item)
10873 {
10874 new_item.SetResultOfSplit(true);
10875 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10877 new_item.
SetQuantity(split_quantity_new,
false,
true);
10878 }
10879 }
10880 }
10881 else if (destination_entity && slot_id == -1)
10882 {
10883 if (quantity > stack_max)
10884 split_quantity_new = stack_max;
10885 else
10886 split_quantity_new = quantity;
10887
10889 {
10890 GameInventory destinationInventory = destination_entity.GetInventory();
10892 {
10895 }
10896
10897 if (new_item)
10898 {
10899 new_item.SetResultOfSplit(true);
10900 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10902 new_item.
SetQuantity(split_quantity_new,
false,
true);
10903 }
10904 }
10905 }
10906 else
10907 {
10908 if (stack_max != 0)
10909 {
10911 {
10913 }
10914
10915 if (split_quantity_new == 0)
10916 {
10917 if (!
g_Game.IsMultiplayer())
10918 player.PhysicalPredictiveDropItem(this);
10919 else
10920 player.ServerDropEntity(this);
10921 return;
10922 }
10923
10925 {
10927
10928 if (new_item)
10929 {
10930 new_item.SetResultOfSplit(true);
10931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10934 new_item.PlaceOnSurface();
10935 }
10936 }
10937 }
10938 }
10939 }
10940
10942 {
10943 float split_quantity_new;
10947 InventoryLocation loc = new InventoryLocation;
10948
10949 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10950 {
10952 split_quantity_new = stack_max;
10953 else
10955
10957 {
10958 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10959 if (new_item)
10960 {
10961 new_item.SetResultOfSplit(true);
10962 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10964 new_item.
SetQuantity(split_quantity_new,
false,
true);
10965 }
10966 }
10967 }
10968 else if (destination_entity && slot_id == -1)
10969 {
10970 if (quantity > stack_max)
10971 split_quantity_new = stack_max;
10972 else
10973 split_quantity_new = quantity;
10974
10976 {
10977 GameInventory destinationInventory = destination_entity.GetInventory();
10979 {
10982 }
10983
10984 if (new_item)
10985 {
10986 new_item.SetResultOfSplit(true);
10987 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10989 new_item.
SetQuantity(split_quantity_new,
false,
true);
10990 }
10991 }
10992 }
10993 else
10994 {
10995 if (stack_max != 0)
10996 {
10998 {
11000 }
11001
11003 {
11005
11006 if (new_item)
11007 {
11008 new_item.SetResultOfSplit(true);
11009 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11012 new_item.PlaceOnSurface();
11013 }
11014 }
11015 }
11016 }
11017 }
11018
11020 {
11022 {
11023 if (ScriptInputUserData.CanStoreInputUserData())
11024 {
11025 ScriptInputUserData ctx = new ScriptInputUserData;
11030 dst.WriteToContext(ctx);
11032 }
11033 }
11034 else if (!
g_Game.IsMultiplayer())
11035 {
11037 }
11038 }
11039
11041 {
11043 {
11044 if (ScriptInputUserData.CanStoreInputUserData())
11045 {
11046 ScriptInputUserData ctx = new ScriptInputUserData;
11051 ctx.
Write(destination_entity);
11057 }
11058 }
11059 else if (!
g_Game.IsMultiplayer())
11060 {
11062 }
11063 }
11064
11066 {
11068 }
11069
11071 {
11073 float split_quantity_new;
11075 if (dst.IsValid())
11076 {
11077 int slot_id = dst.GetSlot();
11079
11080 if (quantity > stack_max)
11081 split_quantity_new = stack_max;
11082 else
11083 split_quantity_new = quantity;
11084
11086 {
11088
11089 if (new_item)
11090 {
11091 new_item.SetResultOfSplit(true);
11092 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11094 new_item.
SetQuantity(split_quantity_new,
false,
true);
11095 }
11096
11097 return new_item;
11098 }
11099 }
11100
11101 return null;
11102 }
11103
11105 {
11107 float split_quantity_new;
11109 if (destination_entity)
11110 {
11112 if (quantity > stackable)
11113 split_quantity_new = stackable;
11114 else
11115 split_quantity_new = quantity;
11116
11118 {
11119 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11120 if (new_item)
11121 {
11122 new_item.SetResultOfSplit(true);
11123 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11125 new_item.
SetQuantity(split_quantity_new,
false,
true);
11126 }
11127 }
11128 }
11129 }
11130
11132 {
11134 {
11135 if (ScriptInputUserData.CanStoreInputUserData())
11136 {
11137 ScriptInputUserData ctx = new ScriptInputUserData;
11142 ItemBase destination_entity =
this;
11143 ctx.
Write(destination_entity);
11147 }
11148 }
11149 else if (!
g_Game.IsMultiplayer())
11150 {
11152 }
11153 }
11154
11156 {
11158 float split_quantity_new;
11160 if (player)
11161 {
11163 if (quantity > stackable)
11164 split_quantity_new = stackable;
11165 else
11166 split_quantity_new = quantity;
11167
11169 {
11170 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11171 new_item =
ItemBase.Cast(in_hands);
11172 if (new_item)
11173 {
11174 new_item.SetResultOfSplit(true);
11175 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11177 new_item.SetQuantity(split_quantity_new, false, true);
11178 }
11179 }
11180 }
11181 }
11182
11184 {
11186 float split_quantity_new = Math.Floor(quantity * 0.5);
11187
11189 return;
11190
11192
11193 if (new_item)
11194 {
11195 if (new_item.GetQuantityMax() < split_quantity_new)
11196 {
11197 split_quantity_new = new_item.GetQuantityMax();
11198 }
11199
11200 new_item.SetResultOfSplit(true);
11201 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11202
11204 {
11207 }
11208 else
11209 {
11211 new_item.
SetQuantity(split_quantity_new,
false,
true);
11212 }
11213 }
11214 }
11215
11217 {
11219 float split_quantity_new = Math.Floor(quantity / 2);
11220
11222 return;
11223
11224 InventoryLocation invloc = new InventoryLocation;
11226
11228 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11229
11230 if (new_item)
11231 {
11232 if (new_item.GetQuantityMax() < split_quantity_new)
11233 {
11234 split_quantity_new = new_item.GetQuantityMax();
11235 }
11237 {
11240 }
11241 else if (split_quantity_new > 1)
11242 {
11244 new_item.
SetQuantity(split_quantity_new,
false,
true);
11245 }
11246 }
11247 }
11248
11251 {
11252 SetWeightDirty();
11254
11255 if (parent)
11256 parent.OnAttachmentQuantityChangedEx(this, delta);
11257
11259 {
11261 {
11263 }
11265 {
11266 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11268 }
11269 }
11270 }
11271
11274 {
11275
11276 }
11277
11280 {
11282 }
11283
11285 {
11286 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11287
11289 {
11290 if (newLevel == GameConstants.STATE_RUINED)
11291 {
11293 EntityAI parent = GetHierarchyParent();
11294 if (parent && parent.IsFireplace())
11295 {
11296 CargoBase cargo = GetInventory().GetCargo();
11297 if (cargo)
11298 {
11300 {
11302 }
11303 }
11304 }
11305 }
11306
11308 {
11309
11311 return;
11312 }
11313
11314 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11315 {
11317 }
11318 }
11319 }
11320
11321
11323 {
11324 super.OnRightClick();
11325
11327 {
11329 {
11330 if (ScriptInputUserData.CanStoreInputUserData())
11331 {
11332 EntityAI root = GetHierarchyRoot();
11333 Man playerOwner = GetHierarchyRootPlayer();
11334 InventoryLocation dst = new InventoryLocation;
11335
11336
11337 if (!playerOwner && root && root == this)
11338 {
11340 }
11341 else
11342 {
11343
11344 GetInventory().GetCurrentInventoryLocation(dst);
11346 {
11347 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11349 {
11351 }
11352 else
11353 {
11355
11356
11357 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11358 {
11360 }
11361 else
11362 {
11363 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11364 }
11365 }
11366 }
11367 }
11368
11369 ScriptInputUserData ctx = new ScriptInputUserData;
11377 }
11378 }
11379 else if (!
g_Game.IsMultiplayer())
11380 {
11382 }
11383 }
11384 }
11385
11387 {
11388 if (root)
11389 {
11390 vector m4[4];
11391 root.GetTransform(m4);
11392 dst.SetGround(this, m4);
11393 }
11394 else
11395 {
11396 GetInventory().GetCurrentInventoryLocation(dst);
11397 }
11398 }
11399
11400 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11401 {
11402
11403 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11404 return false;
11405
11406 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11407 return false;
11408
11409
11411 return false;
11412
11413
11414 Magazine mag = Magazine.Cast(this);
11415 if (mag)
11416 {
11417 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11418 return false;
11419
11420 if (stack_max_limit)
11421 {
11422 Magazine other_mag = Magazine.Cast(other_item);
11423 if (other_item)
11424 {
11425 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11426 return false;
11427 }
11428
11429 }
11430 }
11431 else
11432 {
11433
11435 return false;
11436
11438 return false;
11439 }
11440
11441 PlayerBase player = null;
11442 if (CastTo(player, GetHierarchyRootPlayer()))
11443 {
11444 if (player.GetInventory().HasAttachment(this))
11445 return false;
11446
11447 if (player.IsItemsToDelete())
11448 return false;
11449 }
11450
11451 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11452 return false;
11453
11454 int slotID;
11456 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11457 return false;
11458
11459 return true;
11460 }
11461
11463 {
11465 }
11466
11468 {
11469 return m_IsResultOfSplit;
11470 }
11471
11473 {
11474 m_IsResultOfSplit = value;
11475 }
11476
11478 {
11480 }
11481
11483 {
11484 float other_item_quantity = other_item.GetQuantity();
11485 float this_free_space;
11486
11488
11490
11491 if (other_item_quantity > this_free_space)
11492 {
11493 return this_free_space;
11494 }
11495 else
11496 {
11497 return other_item_quantity;
11498 }
11499 }
11500
11502 {
11504 }
11505
11507 {
11509 return;
11510
11511 if (!IsMagazine() && other_item)
11512 {
11514 if (quantity_used != 0)
11515 {
11516 float hp1 = GetHealth01("","");
11517 float hp2 = other_item.GetHealth01("","");
11518 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11519 hpResult = hpResult / (
GetQuantity() + quantity_used);
11520
11521 hpResult *= GetMaxHealth();
11522 Math.Round(hpResult);
11523 SetHealth("", "Health", hpResult);
11524
11526 other_item.AddQuantity(-quantity_used);
11527 }
11528 }
11530 }
11531
11533 {
11534 #ifdef SERVER
11535 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11536 GetHierarchyParent().IncreaseLifetimeUp();
11537 #endif
11538 };
11539
11541 {
11542 PlayerBase p = PlayerBase.Cast(player);
11543
11544 array<int> recipesIds = p.m_Recipes;
11545 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11546 if (moduleRecipesManager)
11547 {
11548 EntityAI itemInHands = player.GetEntityInHands();
11549 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11550 }
11551
11552 for (int i = 0;i < recipesIds.Count(); i++)
11553 {
11554 int key = recipesIds.Get(i);
11555 string recipeName = moduleRecipesManager.GetRecipeName(key);
11557 }
11558 }
11559
11560
11561 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11562 {
11563 super.GetDebugActions(outputList);
11564
11565
11571
11572
11577
11582
11583
11587
11588
11590 {
11594 }
11595
11598
11599
11603
11605
11606 InventoryLocation loc = new InventoryLocation();
11607 GetInventory().GetCurrentInventoryLocation(loc);
11609 {
11610 if (Gizmo_IsSupported())
11613 }
11614
11616 }
11617
11618
11619
11620
11622 {
11623 super.OnAction(action_id, player, ctx);
11624
11626 {
11627 switch (action_id)
11628 {
11632 return true;
11636 return true;
11637 }
11638 }
11639
11641 {
11642 switch (action_id)
11643 {
11645 Delete();
11646 return true;
11647 }
11648 }
11649
11650 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11651 {
11652 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11653 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11654 PlayerBase p = PlayerBase.Cast(player);
11655 if (
EActions.RECIPES_RANGE_START < 1000)
11656 {
11657 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11658 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11659 }
11660 }
11661 #ifndef SERVER
11662 else if (action_id ==
EActions.WATCH_PLAYER)
11663 {
11664 PluginDeveloper.SetDeveloperItemClientEx(player);
11665 }
11666 #endif
11668 {
11669 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11670 {
11671 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11672 OnDebugButtonPressServer(id + 1);
11673 }
11674
11675 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11676 {
11677 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11679 }
11680
11681 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11682 {
11683 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11685 }
11686
11687 else if (action_id ==
EActions.ADD_QUANTITY)
11688 {
11689 if (IsMagazine())
11690 {
11691 Magazine mag = Magazine.Cast(this);
11692 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11693 }
11694 else
11695 {
11697 }
11698
11699 if (m_EM)
11700 {
11701 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11702 }
11703
11704 }
11705
11706 else if (action_id ==
EActions.REMOVE_QUANTITY)
11707 {
11708 if (IsMagazine())
11709 {
11710 Magazine mag2 = Magazine.Cast(this);
11711 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11712 }
11713 else
11714 {
11716 }
11717 if (m_EM)
11718 {
11719 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11720 }
11721
11722 }
11723
11724 else if (action_id ==
EActions.SET_QUANTITY_0)
11725 {
11727
11728 if (m_EM)
11729 {
11730 m_EM.SetEnergy(0);
11731 }
11732 }
11733
11734 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11735 {
11737
11738 if (m_EM)
11739 {
11740 m_EM.SetEnergy(m_EM.GetEnergyMax());
11741 }
11742 }
11743
11744 else if (action_id ==
EActions.ADD_HEALTH)
11745 {
11746 AddHealth("","",GetMaxHealth("","Health")/5);
11747 }
11748 else if (action_id ==
EActions.REMOVE_HEALTH)
11749 {
11750 AddHealth("","",-GetMaxHealth("","Health")/5);
11751 }
11752 else if (action_id ==
EActions.DESTROY_HEALTH)
11753 {
11754 SetHealth01("","",0);
11755 }
11756 else if (action_id ==
EActions.WATCH_ITEM)
11757 {
11759 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11760 #ifdef DEVELOPER
11761 SetDebugDeveloper_item(this);
11762 #endif
11763 }
11764
11765 else if (action_id ==
EActions.ADD_TEMPERATURE)
11766 {
11767 AddTemperature(20);
11768
11769 }
11770
11771 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11772 {
11773 AddTemperature(-20);
11774
11775 }
11776
11777 else if (action_id ==
EActions.FLIP_FROZEN)
11778 {
11779 SetFrozen(!GetIsFrozen());
11780
11781 }
11782
11783 else if (action_id ==
EActions.ADD_WETNESS)
11784 {
11786
11787 }
11788
11789 else if (action_id ==
EActions.REMOVE_WETNESS)
11790 {
11792
11793 }
11794
11795 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11796 {
11799
11800
11801 }
11802
11803 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11804 {
11807 }
11808
11809 else if (action_id ==
EActions.MAKE_SPECIAL)
11810 {
11811 auto debugParams = DebugSpawnParams.WithPlayer(player);
11812 OnDebugSpawnEx(debugParams);
11813 }
11814
11815 }
11816
11817
11818 return false;
11819 }
11820
11821
11822
11823
11827
11830
11831
11832
11834 {
11835 return false;
11836 }
11837
11838
11840 {
11841 return true;
11842 }
11843
11844
11846 {
11847 return true;
11848 }
11849
11850
11851
11853 {
11854 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11855 return g_Game.ConfigIsExisting(config_path);
11856 }
11857
11860 {
11861 return null;
11862 }
11863
11865 {
11866 return false;
11867 }
11868
11870 {
11871 return false;
11872 }
11873
11877
11878
11880 {
11881 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11882 return module_repairing.CanRepair(this, item_repair_kit);
11883 }
11884
11885
11886 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11887 {
11888 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11889 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11890 }
11891
11892
11894 {
11895
11896
11897
11898
11899
11900
11901
11902
11903 return 1;
11904 }
11905
11906
11907
11909 {
11911 }
11912
11913
11914
11916 {
11918 }
11919
11920
11929 {
11930 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11931
11932 if (player)
11933 {
11934 player.MessageStatus(text);
11935 }
11936 }
11937
11938
11947 {
11948 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11949
11950 if (player)
11951 {
11952 player.MessageAction(text);
11953 }
11954 }
11955
11956
11965 {
11966 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11967
11968 if (player)
11969 {
11970 player.MessageFriendly(text);
11971 }
11972 }
11973
11974
11983 {
11984 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11985
11986 if (player)
11987 {
11988 player.MessageImportant(text);
11989 }
11990 }
11991
11993 {
11994 return true;
11995 }
11996
11997
11998 override bool KindOf(
string tag)
11999 {
12000 bool found = false;
12001 string item_name = this.
GetType();
12003 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12004
12005 int array_size = item_tag_array.Count();
12006 for (int i = 0; i < array_size; i++)
12007 {
12008 if (item_tag_array.Get(i) == tag)
12009 {
12010 found = true;
12011 break;
12012 }
12013 }
12014 return found;
12015 }
12016
12017
12019 {
12020
12021 super.OnRPC(sender, rpc_type,ctx);
12022
12023
12024 switch (rpc_type)
12025 {
12026 #ifndef SERVER
12027 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12028 Param2<bool, string> p = new Param2<bool, string>(false, "");
12029
12031 return;
12032
12033 bool play = p.param1;
12034 string soundSet = p.param2;
12035
12036 if (play)
12037 {
12039 {
12041 {
12043 }
12044 }
12045 else
12046 {
12048 }
12049 }
12050 else
12051 {
12053 }
12054
12055 break;
12056 #endif
12057
12058 }
12059
12061 {
12063 }
12064 }
12065
12066
12067
12068
12070 {
12071 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12072 return plugin.GetID(
name);
12073 }
12074
12076 {
12077 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12078 return plugin.GetName(id);
12079 }
12080
12083 {
12084
12085
12086 int varFlags;
12087 if (!ctx.
Read(varFlags))
12088 return;
12089
12090 if (varFlags & ItemVariableFlags.FLOAT)
12091 {
12093 }
12094 }
12095
12097 {
12098
12099 super.SerializeNumericalVars(floats_out);
12100
12101
12102
12104 {
12106 }
12107
12109 {
12111 }
12112
12114 {
12116 }
12117
12119 {
12124 }
12125
12127 {
12129 }
12130 }
12131
12133 {
12134
12135 super.DeSerializeNumericalVars(floats);
12136
12137
12138 int index = 0;
12139 int mask = Math.Round(floats.Get(index));
12140
12141 index++;
12142
12144 {
12146 {
12148 }
12149 else
12150 {
12151 float quantity = floats.Get(index);
12152 SetQuantity(quantity,
true,
false,
false,
false);
12153 }
12154 index++;
12155 }
12156
12158 {
12159 float wet = floats.Get(index);
12161 index++;
12162 }
12163
12165 {
12166 int liquidtype = Math.Round(floats.Get(index));
12168 index++;
12169 }
12170
12172 {
12174 index++;
12176 index++;
12178 index++;
12180 index++;
12181 }
12182
12184 {
12185 int cleanness = Math.Round(floats.Get(index));
12187 index++;
12188 }
12189 }
12190
12192 {
12193 super.WriteVarsToCTX(ctx);
12194
12195
12197 {
12199 }
12200
12202 {
12204 }
12205
12207 {
12209 }
12210
12212 {
12213 int r,g,b,a;
12219 }
12220
12222 {
12224 }
12225 }
12226
12228 {
12229 if (!super.ReadVarsFromCTX(ctx,version))
12230 return false;
12231
12232 int intValue;
12233 float value;
12234
12235 if (version < 140)
12236 {
12237 if (!ctx.
Read(intValue))
12238 return false;
12239
12240 m_VariablesMask = intValue;
12241 }
12242
12244 {
12245 if (!ctx.
Read(value))
12246 return false;
12247
12249 {
12251 }
12252 else
12253 {
12255 }
12256 }
12257
12258 if (version < 140)
12259 {
12261 {
12262 if (!ctx.
Read(value))
12263 return false;
12264 SetTemperatureDirect(value);
12265 }
12266 }
12267
12269 {
12270 if (!ctx.
Read(value))
12271 return false;
12273 }
12274
12276 {
12277 if (!ctx.
Read(intValue))
12278 return false;
12280 }
12281
12283 {
12284 int r,g,b,a;
12286 return false;
12288 return false;
12290 return false;
12292 return false;
12293
12295 }
12296
12298 {
12299 if (!ctx.
Read(intValue))
12300 return false;
12302 }
12303
12304 if (version >= 138 && version < 140)
12305 {
12307 {
12308 if (!ctx.
Read(intValue))
12309 return false;
12310 SetFrozen(intValue);
12311 }
12312 }
12313
12314 return true;
12315 }
12316
12317
12319 {
12322 {
12324 }
12325
12326 if (!super.OnStoreLoad(ctx, version))
12327 {
12329 return false;
12330 }
12331
12332 if (version >= 114)
12333 {
12334 bool hasQuickBarIndexSaved;
12335
12336 if (!ctx.
Read(hasQuickBarIndexSaved))
12337 {
12339 return false;
12340 }
12341
12342 if (hasQuickBarIndexSaved)
12343 {
12344 int itmQBIndex;
12345
12346
12347 if (!ctx.
Read(itmQBIndex))
12348 {
12350 return false;
12351 }
12352
12353 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12354 if (itmQBIndex != -1 && parentPlayer)
12355 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12356 }
12357 }
12358 else
12359 {
12360
12361 PlayerBase player;
12362 int itemQBIndex;
12363 if (version ==
int.
MAX)
12364 {
12365 if (!ctx.
Read(itemQBIndex))
12366 {
12368 return false;
12369 }
12370 }
12371 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12372 {
12373
12374 if (!ctx.
Read(itemQBIndex))
12375 {
12377 return false;
12378 }
12379 if (itemQBIndex != -1 && player)
12380 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12381 }
12382 }
12383
12384 if (version < 140)
12385 {
12386
12387 if (!LoadVariables(ctx, version))
12388 {
12390 return false;
12391 }
12392 }
12393
12394
12396 {
12398 return false;
12399 }
12400 if (version >= 132)
12401 {
12403 if (raib)
12404 {
12406 {
12408 return false;
12409 }
12410 }
12411 }
12412
12414 return true;
12415 }
12416
12417
12418
12420 {
12421 super.OnStoreSave(ctx);
12422
12423 PlayerBase player;
12424 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12425 {
12427
12428 int itemQBIndex = -1;
12429 itemQBIndex = player.FindQuickBarEntityIndex(this);
12430 ctx.
Write(itemQBIndex);
12431 }
12432 else
12433 {
12435 }
12436
12438
12440 if (raib)
12441 {
12443 }
12444 }
12445
12446
12448 {
12449 super.AfterStoreLoad();
12450
12452 {
12454 }
12455
12457 {
12460 }
12461 }
12462
12464 {
12465 super.EEOnAfterLoad();
12466
12468 {
12470 }
12471
12474 }
12475
12477 {
12478 return false;
12479 }
12480
12481
12482
12484 {
12486 {
12487 #ifdef PLATFORM_CONSOLE
12488
12490 {
12492 if (menu)
12493 {
12495 }
12496 }
12497 #endif
12498 }
12499
12501 {
12504 }
12505
12507 {
12508 SetWeightDirty();
12510 }
12512 {
12515 }
12516
12518 {
12521
12524 }
12526 {
12530 }
12531
12532 super.OnVariablesSynchronized();
12533 }
12534
12535
12536
12538 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12539 {
12540 if (!IsServerCheck(allow_client))
12541 return false;
12542
12544 return false;
12545
12548
12549 if (value <= (min + 0.001))
12550 value = min;
12551
12552 if (value == min)
12553 {
12554 if (destroy_config)
12555 {
12556 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12557 if (dstr)
12558 {
12560 this.Delete();
12561 return true;
12562 }
12563 }
12564 else if (destroy_forced)
12565 {
12567 this.Delete();
12568 return true;
12569 }
12570
12572 }
12573
12576
12578 {
12579 EntityAI parent = GetHierarchyRoot();
12580 InventoryLocation iLoc = new InventoryLocation();
12581 GetInventory().GetCurrentInventoryLocation(iLoc);
12583 {
12584 int iLocSlot = iLoc.
GetSlot();
12586 {
12588 }
12590 {
12592 }
12593 }
12594 }
12595
12597 {
12599
12600 if (delta)
12602 }
12603
12605
12606 return false;
12607 }
12608
12609
12611 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12612 {
12614 }
12615
12617 {
12620 }
12621
12623 {
12626 }
12627
12629 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12630 {
12631 float value_clamped = Math.Clamp(value, 0, 1);
12633 SetQuantity(result, destroy_config, destroy_forced);
12634 }
12635
12636
12639 {
12641 }
12642
12644 {
12646 }
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12658 {
12659 int slot = -1;
12660 GameInventory inventory = GetInventory();
12661 if (inventory)
12662 {
12663 InventoryLocation il = new InventoryLocation;
12666 }
12667
12669 }
12670
12672 {
12673 float quantity_max = 0;
12674
12676 {
12677 if (attSlotID != -1)
12678 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12679
12680 if (quantity_max <= 0)
12682 }
12683
12684 if (quantity_max <= 0)
12686
12687 return quantity_max;
12688 }
12689
12691 {
12693 }
12694
12696 {
12698 }
12699
12700
12702 {
12704 }
12705
12707 {
12709 }
12710
12712 {
12714 }
12715
12716
12718 {
12719
12720 float weightEx = GetWeightEx();
12721 float special = GetInventoryAndCargoWeight();
12722 return weightEx - special;
12723 }
12724
12725
12727 {
12729 }
12730
12732 {
12734 {
12735 #ifdef DEVELOPER
12736 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12737 {
12738 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12740 }
12741 #endif
12742
12743 return GetQuantity() * GetConfigWeightModified();
12744 }
12745 else if (HasEnergyManager())
12746 {
12747 #ifdef DEVELOPER
12748 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12749 {
12750 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12751 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12752 }
12753 #endif
12754 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12755 }
12756 else
12757 {
12758 #ifdef DEVELOPER
12759 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12760 {
12761 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12762 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12763 }
12764 #endif
12765 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12766 }
12767 }
12768
12771 {
12772 int item_count = 0;
12774
12775 GameInventory inventory = GetInventory();
12776 CargoBase cargo = inventory.
GetCargo();
12777 if (cargo != NULL)
12778 {
12780 }
12781
12783 for (int i = 0; i < nAttachments; ++i)
12784 {
12786 if (item)
12787 item_count += item.GetNumberOfItems();
12788 }
12789 return item_count;
12790 }
12791
12794 {
12795 float weight = 0;
12796 float wetness = 1;
12797 if (include_wetness)
12800 {
12801 weight = wetness * m_ConfigWeight;
12802 }
12804 {
12805 weight = 1;
12806 }
12807 return weight;
12808 }
12809
12810
12811
12813 {
12814 GameInventory inventory = GetInventory();
12815 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12816 {
12817 array<EntityAI> items = new array<EntityAI>;
12819 for (int i = 0; i < items.Count(); ++i)
12820 {
12822 if (item)
12823 {
12824 g_Game.ObjectDelete(item);
12825 }
12826 }
12827 }
12828 }
12829
12830
12831
12832
12834 {
12835 float energy = 0;
12836 if (HasEnergyManager())
12837 {
12838 energy = GetCompEM().GetEnergy();
12839 }
12840 return energy;
12841 }
12842
12843
12845 {
12846 super.OnEnergyConsumed();
12847
12849 }
12850
12852 {
12853 super.OnEnergyAdded();
12854
12856 }
12857
12858
12860 {
12861 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12862 {
12864 {
12865 float energy_0to1 = GetCompEM().GetEnergy0To1();
12867 }
12868 }
12869 }
12870
12871
12873 {
12874 return ConfigGetFloat("heatIsolation");
12875 }
12876
12878 {
12880 }
12881
12883 {
12884 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12885 if (
g_Game.ConfigIsExisting(paramPath))
12886 return g_Game.ConfigGetFloat(paramPath);
12887
12888 return 0.0;
12889 }
12890
12892 {
12893 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12894 if (
g_Game.ConfigIsExisting(paramPath))
12895 return g_Game.ConfigGetFloat(paramPath);
12896
12897 return 0.0;
12898 }
12899
12900 override void SetWet(
float value,
bool allow_client =
false)
12901 {
12902 if (!IsServerCheck(allow_client))
12903 return;
12904
12907
12909
12910 m_VarWet = Math.Clamp(value, min, max);
12911
12913 {
12916 }
12917 }
12918
12919 override void AddWet(
float value)
12920 {
12922 }
12923
12925 {
12927 }
12928
12930 {
12932 }
12933
12935 {
12937 }
12938
12940 {
12942 }
12943
12945 {
12947 }
12948
12949 override void OnWetChanged(
float newVal,
float oldVal)
12950 {
12953 if (newLevel != oldLevel)
12954 {
12956 }
12957 }
12958
12960 {
12961 SetWeightDirty();
12962 }
12963
12965 {
12966 return GetWetLevelInternal(
m_VarWet);
12967 }
12968
12969
12970
12972 {
12974 }
12975
12977 {
12979 }
12980
12982 {
12984 }
12985
12987 {
12989 }
12990
12991
12992
12994 {
12995 if (ConfigIsExisting("itemModelLength"))
12996 {
12997 return ConfigGetFloat("itemModelLength");
12998 }
12999 return 0;
13000 }
13001
13003 {
13004 if (ConfigIsExisting("itemAttachOffset"))
13005 {
13006 return ConfigGetFloat("itemAttachOffset");
13007 }
13008 return 0;
13009 }
13010
13011 override void SetCleanness(
int value,
bool allow_client =
false)
13012 {
13013 if (!IsServerCheck(allow_client))
13014 return;
13015
13017
13019
13022 }
13023
13025 {
13027 }
13028
13030 {
13031 return true;
13032 }
13033
13034
13035
13036
13038 {
13040 }
13041
13043 {
13045 }
13046
13047
13048
13049
13050 override void SetColor(
int r,
int g,
int b,
int a)
13051 {
13057 }
13059 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13060 {
13065 }
13066
13068 {
13070 }
13071
13074 {
13075 int r,g,b,a;
13077 r = r/255;
13078 g = g/255;
13079 b = b/255;
13080 a = a/255;
13081 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13082 }
13083
13084
13085
13086 override void SetLiquidType(
int value,
bool allow_client =
false)
13087 {
13088 if (!IsServerCheck(allow_client))
13089 return;
13090
13095 }
13096
13098 {
13099 return ConfigGetInt("varLiquidTypeInit");
13100 }
13101
13103 {
13105 }
13106
13108 {
13110 SetFrozen(false);
13111 }
13112
13115 {
13116 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13117 }
13118
13119
13122 {
13123 PlayerBase nplayer;
13124 if (PlayerBase.CastTo(nplayer, player))
13125 {
13127 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13128 }
13129 }
13130
13131
13134 {
13135 PlayerBase nplayer;
13136 if (PlayerBase.CastTo(nplayer,player))
13137 {
13138 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13139 }
13140
13141 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13142
13143 if (HasEnergyManager())
13144 {
13145 GetCompEM().UpdatePlugState();
13146 }
13147 }
13148
13149
13151 {
13152 super.OnPlacementStarted(player);
13153
13155 }
13156
13157 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13158 {
13160 {
13161 m_AdminLog.OnPlacementComplete(player,
this);
13162 }
13163
13164 super.OnPlacementComplete(player, position, orientation);
13165 }
13166
13167
13168
13169
13170
13172 {
13174 {
13175 return true;
13176 }
13177 else
13178 {
13179 return false;
13180 }
13181 }
13182
13183
13185 {
13187 {
13189 }
13190 }
13191
13192
13194 {
13196 }
13197
13199 {
13201 }
13202
13203 override void InsertAgent(
int agent,
float count = 1)
13204 {
13205 if (count < 1)
13206 return;
13207
13209 }
13210
13213 {
13215 }
13216
13217
13219 {
13221 }
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13265 {
13267 return false;
13268 return true;
13269 }
13270
13272 {
13273
13275 }
13276
13277
13280 {
13281 super.CheckForRoofLimited(timeTresholdMS);
13282
13283 float time =
g_Game.GetTime();
13284 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13285 {
13286 m_PreviousRoofTestTime = time;
13287 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13288 }
13289 }
13290
13291
13293 {
13295 {
13296 return 0;
13297 }
13298
13299 if (GetInventory().GetAttachmentSlotsCount() != 0)
13300 {
13301 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13302 if (filter)
13303 return filter.GetProtectionLevel(type, false, system);
13304 else
13305 return 0;
13306 }
13307
13308 string subclassPath, entryName;
13309
13310 switch (type)
13311 {
13313 entryName = "biological";
13314 break;
13316 entryName = "chemical";
13317 break;
13318 default:
13319 entryName = "biological";
13320 break;
13321 }
13322
13323 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13324
13325 return g_Game.ConfigGetFloat(subclassPath + entryName);
13326 }
13327
13328
13329
13332 {
13333 if (!IsMagazine())
13335
13337 }
13338
13339
13340
13341
13342
13347 {
13348 return true;
13349 }
13350
13352 {
13354 }
13355
13356
13357
13358
13359
13361 {
13362 if (parent)
13363 {
13364 if (parent.IsInherited(DayZInfected))
13365 return true;
13366
13367 if (!parent.IsRuined())
13368 return true;
13369 }
13370
13371 return true;
13372 }
13373
13375 {
13376 if (!super.CanPutAsAttachment(parent))
13377 {
13378 return false;
13379 }
13380
13381 if (!IsRuined() && !parent.IsRuined())
13382 {
13383 return true;
13384 }
13385
13386 return false;
13387 }
13388
13390 {
13391
13392
13393
13394
13395 return super.CanReceiveItemIntoCargo(item);
13396 }
13397
13399 {
13400
13401
13402
13403
13404 GameInventory attachmentInv = attachment.GetInventory();
13406 {
13407 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13408 return false;
13409 }
13410
13411 InventoryLocation loc = new InventoryLocation();
13412 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13413 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13414 return false;
13415
13416 return super.CanReceiveAttachment(attachment, slotId);
13417 }
13418
13420 {
13421 if (!super.CanReleaseAttachment(attachment))
13422 return false;
13423
13424 return GetInventory().AreChildrenAccessible();
13425 }
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13448 {
13449 int id = muzzle_owner.GetMuzzleID();
13450 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13451
13452 if (WPOF_array)
13453 {
13454 for (int i = 0; i < WPOF_array.Count(); i++)
13455 {
13456 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13457
13458 if (WPOF)
13459 {
13460 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13461 }
13462 }
13463 }
13464 }
13465
13466
13468 {
13469 int id = muzzle_owner.GetMuzzleID();
13471
13472 if (WPOBE_array)
13473 {
13474 for (int i = 0; i < WPOBE_array.Count(); i++)
13475 {
13476 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13477
13478 if (WPOBE)
13479 {
13480 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13481 }
13482 }
13483 }
13484 }
13485
13486
13488 {
13489 int id = muzzle_owner.GetMuzzleID();
13490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13491
13492 if (WPOOH_array)
13493 {
13494 for (int i = 0; i < WPOOH_array.Count(); i++)
13495 {
13496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13497
13498 if (WPOOH)
13499 {
13500 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13501 }
13502 }
13503 }
13504 }
13505
13506
13508 {
13509 int id = muzzle_owner.GetMuzzleID();
13510 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13511
13512 if (WPOOH_array)
13513 {
13514 for (int i = 0; i < WPOOH_array.Count(); i++)
13515 {
13516 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13517
13518 if (WPOOH)
13519 {
13520 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13521 }
13522 }
13523 }
13524 }
13525
13526
13528 {
13529 int id = muzzle_owner.GetMuzzleID();
13530 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13531
13532 if (WPOOH_array)
13533 {
13534 for (int i = 0; i < WPOOH_array.Count(); i++)
13535 {
13536 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13537
13538 if (WPOOH)
13539 {
13540 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13541 }
13542 }
13543 }
13544 }
13545
13546
13547
13549 {
13551 {
13552 return true;
13553 }
13554
13555 return false;
13556 }
13557
13559 {
13561 {
13562 return true;
13563 }
13564
13565 return false;
13566 }
13567
13569 {
13571 {
13572 return true;
13573 }
13574
13575 return false;
13576 }
13577
13579 {
13580 return false;
13581 }
13582
13585 {
13586 return UATimeSpent.DEFAULT_DEPLOY;
13587 }
13588
13589
13590
13591
13593 {
13595 SetSynchDirty();
13596 }
13597
13599 {
13601 }
13602
13603
13605 {
13606 return false;
13607 }
13608
13611 {
13612 string att_type = "None";
13613
13614 if (ConfigIsExisting("soundAttType"))
13615 {
13616 att_type = ConfigGetString("soundAttType");
13617 }
13618
13620 }
13621
13623 {
13625 }
13626
13627
13628
13629
13630
13636
13638 {
13641
13643 }
13644
13645
13647 {
13649 return;
13650
13652
13655
13658
13659 SoundParameters params = new SoundParameters();
13663 }
13664
13665
13667 {
13669 {
13672
13673 SetSynchDirty();
13674
13677 }
13678 }
13679
13681 {
13683 }
13684
13685
13687 {
13689 return;
13690
13692 SetSynchDirty();
13693
13696 }
13697
13699 {
13702 }
13703
13705 {
13707 }
13708
13709 void OnApply(PlayerBase player);
13710
13712 {
13713 return 1.0;
13714 };
13715
13717 {
13719 }
13720
13722 {
13724 }
13725
13727
13729 {
13730 SetDynamicPhysicsLifeTime(0.01);
13732 }
13733
13735 {
13736 array<string> zone_names = new array<string>;
13737 GetDamageZones(zone_names);
13738 for (int i = 0; i < zone_names.Count(); i++)
13739 {
13740 SetHealthMax(zone_names.Get(i),"Health");
13741 }
13742 SetHealthMax("","Health");
13743 }
13744
13747 {
13748 float global_health = GetHealth01("","Health");
13749 array<string> zones = new array<string>;
13750 GetDamageZones(zones);
13751
13752 for (int i = 0; i < zones.Count(); i++)
13753 {
13754 SetHealth01(zones.Get(i),"Health",global_health);
13755 }
13756 }
13757
13760 {
13761 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13762 }
13763
13765 {
13766 if (!hasRootAsPlayer)
13767 {
13768 if (refParentIB)
13769 {
13770
13771 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13772 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13773
13774 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13775 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13776
13779 }
13780 else
13781 {
13782
13785 }
13786 }
13787 }
13788
13790 {
13792 {
13793 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13794 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13795 {
13796 float heatPermCoef = 1.0;
13798 while (ent)
13799 {
13800 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13801 ent = ent.GetHierarchyParent();
13802 }
13803
13804 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13805 }
13806 }
13807 }
13808
13810 {
13811
13812 EntityAI parent = GetHierarchyParent();
13813 if (!parent)
13814 {
13815 hasParent = false;
13816 hasRootAsPlayer = false;
13817 }
13818 else
13819 {
13820 hasParent = true;
13821 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13822 refParentIB =
ItemBase.Cast(parent);
13823 }
13824 }
13825
13826 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13827 {
13828
13829 }
13830
13832 {
13833
13834 return false;
13835 }
13836
13838 {
13839
13840
13841 return false;
13842 }
13843
13845 {
13846
13847 return false;
13848 }
13849
13852 {
13853 return !GetIsFrozen() &&
IsOpen();
13854 }
13855
13857 {
13858 bool hasParent = false, hasRootAsPlayer = false;
13860
13861 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13862 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13863
13864 if (wwtu || foodDecay)
13865 {
13869
13870 if (processWetness || processTemperature || processDecay)
13871 {
13873
13874 if (processWetness)
13875 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13876
13877 if (processTemperature)
13879
13880 if (processDecay)
13881 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13882 }
13883 }
13884 }
13885
13888 {
13890 }
13891
13893 {
13896
13897 return super.GetTemperatureFreezeThreshold();
13898 }
13899
13901 {
13904
13905 return super.GetTemperatureThawThreshold();
13906 }
13907
13909 {
13912
13913 return super.GetItemOverheatThreshold();
13914 }
13915
13917 {
13919 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13920
13921 return super.GetTemperatureFreezeTime();
13922 }
13923
13925 {
13927 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13928
13929 return super.GetTemperatureThawTime();
13930 }
13931
13936
13938 {
13939 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13940 }
13941
13943 {
13944 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13945 }
13946
13949 {
13951 }
13952
13954 {
13956 }
13957
13959 {
13961 }
13962
13965 {
13966 return null;
13967 }
13968
13971 {
13972 return false;
13973 }
13974
13976 {
13978 {
13981 if (!trg)
13982 {
13984 explosive = this;
13985 }
13986
13987 explosive.PairRemote(trg);
13989
13990 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13991 trg.SetPersistentPairID(persistentID);
13992 explosive.SetPersistentPairID(persistentID);
13993
13994 return true;
13995 }
13996 return false;
13997 }
13998
14001 {
14002 float ret = 1.0;
14005 ret *= GetHealth01();
14006
14007 return ret;
14008 }
14009
14010 #ifdef DEVELOPER
14011 override void SetDebugItem()
14012 {
14013 super.SetDebugItem();
14014 _itemBase = this;
14015 }
14016
14018 {
14019 string text = super.GetDebugText();
14020
14022 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14023
14024 return text;
14025 }
14026 #endif
14027
14029 {
14030 return true;
14031 }
14032
14034
14036
14038 {
14041 }
14042
14043
14051
14067
14068 [
Obsolete(
"Use ItemSoundHandler instead")]
14071 {
14072 if (!
g_Game.IsDedicatedServer())
14073 {
14074 if (ConfigIsExisting("attachSoundSet"))
14075 {
14076 string cfg_path = "";
14077 string soundset = "";
14078 string type_name =
GetType();
14079
14082 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14083 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14084
14085 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14086 {
14087 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14088 {
14089 if (cfg_slot_array[i] == slot_type)
14090 {
14091 soundset = cfg_soundset_array[i];
14092 break;
14093 }
14094 }
14095 }
14096
14097 if (soundset != "")
14098 {
14099 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14101 }
14102 }
14103 }
14104 }
14105
14107}
14108
14110{
14112 if (entity)
14113 {
14114 bool is_item = entity.IsInherited(
ItemBase);
14115 if (is_item && full_quantity)
14116 {
14119 }
14120 }
14121 else
14122 {
14124 return NULL;
14125 }
14126 return entity;
14127}
14128
14130{
14131 if (item)
14132 {
14133 if (health > 0)
14134 item.SetHealth("", "", health);
14135
14136 if (item.CanHaveTemperature())
14137 {
14139 if (item.CanFreeze())
14140 item.SetFrozen(false);
14141 }
14142
14143 if (item.HasEnergyManager())
14144 {
14145 if (quantity >= 0)
14146 {
14147 item.GetCompEM().SetEnergy0To1(quantity);
14148 }
14149 else
14150 {
14152 }
14153 }
14154 else if (item.IsMagazine())
14155 {
14156 Magazine mag = Magazine.Cast(item);
14157 if (quantity >= 0)
14158 {
14159 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14160 }
14161 else
14162 {
14164 }
14165
14166 }
14167 else
14168 {
14169 if (quantity >= 0)
14170 {
14171 item.SetQuantityNormalized(quantity, false);
14172 }
14173 else
14174 {
14176 }
14177
14178 }
14179 }
14180}
14181
14182#ifdef DEVELOPER
14184#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.