8340{
8342 {
8343 return true;
8344 }
8345};
8346
8348{
8349
8350};
8351
8352
8353
8355{
8359
8361
8364
8365
8366
8367
8368
8377
8383
8388
8393
8414 protected bool m_IsResultOfSplit
8415
8417
8422
8423
8424
8426
8430
8431
8432
8434
8437
8438
8439
8445
8446
8454
8457
8458
8460
8461
8463
8464
8469
8470
8475
8477
8478
8480
8481
8483 {
8488
8489 if (!
g_Game.IsDedicatedServer())
8490 {
8492 {
8494
8496 {
8498 }
8499 }
8500
8503 }
8504
8505 m_OldLocation = null;
8506
8508 {
8510 }
8511
8512 if (ConfigIsExisting("headSelectionsToHide"))
8513 {
8516 }
8517
8519 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8520 {
8522 }
8523
8525
8526 m_IsResultOfSplit = false;
8527
8529 }
8530
8532 {
8533 super.InitItemVariables();
8534
8540 m_Count = ConfigGetInt(
"count");
8541
8544
8549
8552
8557
8569
8573
8574
8577 if (ConfigIsExisting("canBeSplit"))
8578 {
8581 }
8582
8584 if (ConfigIsExisting("itemBehaviour"))
8586
8587
8590 RegisterNetSyncVariableInt("m_VarLiquidType");
8591 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8592
8593 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8594 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8595 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8596
8597 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8598 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8599 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8600 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8601
8602 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8603 RegisterNetSyncVariableBool("m_IsTakeable");
8604 RegisterNetSyncVariableBool("m_IsHologram");
8605
8608 {
8611 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8612 }
8613
8615
8617 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8619
8621 }
8622
8624 {
8626 }
8627
8629 {
8632 {
8637 }
8638 }
8639
8640 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8641 {
8643 {
8646 }
8647
8649 }
8650
8652 {
8658 }
8659
8661
8663 {
8665
8666 if (!action)
8667 {
8668 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8669 return;
8670 }
8671
8673 if (!ai)
8674 {
8676 return;
8677 }
8678
8680 if (!action_array)
8681 {
8682 action_array = new array<ActionBase_Basic>;
8684 }
8685 if (LogManager.IsActionLogEnable())
8686 {
8687 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8688 }
8689
8690 if (action_array.Find(action) != -1)
8691 {
8692 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8693 }
8694 else
8695 {
8696 action_array.Insert(action);
8697 }
8698 }
8699
8701 {
8702 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8703 ActionBase action = player.GetActionManager().GetAction(actionName);
8706
8707 if (action_array)
8708 {
8709 action_array.RemoveItem(action);
8710 }
8711 }
8712
8713
8714
8716 {
8717 ActionOverrideData overrideData = new ActionOverrideData();
8721
8723 if (!actionMap)
8724 {
8727 }
8728
8729 actionMap.Insert(this.
Type(), overrideData);
8730
8731 }
8732
8734
8736
8737
8739 {
8742
8745
8746 string config_to_search = "CfgVehicles";
8747 string muzzle_owner_config;
8748
8750 {
8751 if (IsInherited(Weapon))
8752 config_to_search = "CfgWeapons";
8753
8754 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8755
8756 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8757
8758 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8759
8760 if (config_OnFire_subclass_count > 0)
8761 {
8762 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8763
8764 for (int i = 0; i < config_OnFire_subclass_count; i++)
8765 {
8766 string particle_class = "";
8767 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8768 string config_OnFire_entry = config_OnFire_class + particle_class;
8769 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8770 WPOF_array.Insert(WPOF);
8771 }
8772
8773
8775 }
8776 }
8777
8779 {
8780 config_to_search = "CfgWeapons";
8781 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8782
8783 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8784
8785 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8786
8787 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8788 {
8789 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8790
8791 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8792 {
8793 string particle_class2 = "";
8794 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8795 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8796 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8797 WPOBE_array.Insert(WPOBE);
8798 }
8799
8800
8802 }
8803 }
8804 }
8805
8806
8808 {
8811
8813 {
8814 string config_to_search = "CfgVehicles";
8815
8816 if (IsInherited(Weapon))
8817 config_to_search = "CfgWeapons";
8818
8819 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8820 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8821
8822 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8823 {
8824
8826
8828 {
8830 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8832 return;
8833 }
8834
8837
8838
8839
8840 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8841 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8842
8843 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8844 {
8845 string particle_class = "";
8846 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8847 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8848 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8849
8850 if (entry_type == CT_CLASS)
8851 {
8852 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8853 WPOOH_array.Insert(WPOF);
8854 }
8855 }
8856
8857
8859 }
8860 }
8861 }
8862
8864 {
8866 }
8867
8869 {
8871 {
8873
8876
8879
8880 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8881 }
8882 }
8883
8885 {
8887 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8888
8890 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8891
8893 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8894
8896 {
8898 }
8899 }
8900
8902 {
8904 }
8905
8907 {
8910 else
8912
8914 {
8917 }
8918 else
8919 {
8922
8925 }
8926
8928 }
8929
8931 {
8933 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8934 }
8935
8937 {
8939 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8941 }
8942
8944 {
8946 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8947 }
8948
8950 {
8953
8954 OverheatingParticle OP = new OverheatingParticle();
8959
8961 }
8962
8964 {
8967
8968 return -1;
8969 }
8970
8972 {
8974 {
8977
8978 for (int i = count; i > 0; --i)
8979 {
8980 int id = i - 1;
8983
8986
8987 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8988 {
8989 if (p)
8990 {
8993 }
8994 }
8995 }
8996 }
8997 }
8998
9000 {
9002 {
9004 {
9005 int id = i - 1;
9007
9008 if (OP)
9009 {
9011
9012 if (p)
9013 {
9015 }
9016
9017 delete OP;
9018 }
9019 }
9020
9023 }
9024 }
9025
9028 {
9029 return 0.0;
9030 }
9031
9032
9034 {
9035 return 250;
9036 }
9037
9039 {
9040 return 0;
9041 }
9042
9045 {
9047 return true;
9048
9049 return false;
9050 }
9051
9054 {
9057
9059 {
9061 }
9062 else
9063 {
9064
9066 }
9067
9069 }
9070
9077 {
9078 return -1;
9079 }
9080
9081
9082
9083
9085 {
9087 {
9088 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9089 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9090
9091 if (r_index >= 0)
9092 {
9093 InventoryLocation r_il = new InventoryLocation;
9094 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9095
9096 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9099 {
9100 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9101 }
9103 {
9104 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9105 }
9106
9107 }
9108
9109 player.GetHumanInventory().ClearUserReservedLocation(this);
9110 }
9111
9114 }
9115
9116
9117
9118
9120 {
9121 return ItemBase.m_DebugActionsMask;
9122 }
9123
9125 {
9126 return ItemBase.m_DebugActionsMask & mask;
9127 }
9128
9130 {
9131 ItemBase.m_DebugActionsMask = mask;
9132 }
9133
9135 {
9136 ItemBase.m_DebugActionsMask |= mask;
9137 }
9138
9140 {
9141 ItemBase.m_DebugActionsMask &= ~mask;
9142 }
9143
9145 {
9147 {
9149 }
9150 else
9151 {
9153 }
9154 }
9155
9156
9158 {
9159 if (GetEconomyProfile())
9160 {
9161 float q_max = GetEconomyProfile().GetQuantityMax();
9162 if (q_max > 0)
9163 {
9164 float q_min = GetEconomyProfile().GetQuantityMin();
9165 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9166
9168 {
9169 ComponentEnergyManager comp = GetCompEM();
9171 {
9173 }
9174 }
9176 {
9178
9179 }
9180
9181 }
9182 }
9183 }
9184
9187 {
9188 EntityAI parent = GetHierarchyParent();
9189
9190 if (parent)
9191 {
9192 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9193 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9194 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9195 }
9196 }
9197
9200 {
9201 EntityAI parent = GetHierarchyParent();
9202
9203 if (parent)
9204 {
9205 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9206 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9207 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9208 }
9209 }
9210
9212 {
9213
9214
9215
9216
9218
9220 {
9221 if (ScriptInputUserData.CanStoreInputUserData())
9222 {
9223 ScriptInputUserData ctx = new ScriptInputUserData;
9229 ctx.
Write(use_stack_max);
9232
9234 {
9235 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9236 }
9237 }
9238 }
9239 else if (!
g_Game.IsMultiplayer())
9240 {
9242 }
9243 }
9244
9246 {
9248 }
9249
9251 {
9253 }
9254
9256 {
9258 }
9259
9261 {
9262
9263 return false;
9264 }
9265
9267 {
9268 return false;
9269 }
9270
9274 {
9275 return false;
9276 }
9277
9279 {
9280 return "";
9281 }
9282
9284
9286 {
9287 return false;
9288 }
9289
9291 {
9292 return true;
9293 }
9294
9295
9296
9298 {
9299 return true;
9300 }
9301
9303 {
9304 return true;
9305 }
9306
9308 {
9309 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9311 }
9312
9314 {
9316 }
9317
9319 {
9321 if (!is_being_placed)
9323 SetSynchDirty();
9324 }
9325
9326
9328
9330 {
9332 }
9333
9335 {
9337 }
9338
9340 {
9341 return 1;
9342 }
9343
9345 {
9346 return false;
9347 }
9348
9350 {
9352 SetSynchDirty();
9353 }
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9390 {
9391 super.OnMovedInsideCargo(container);
9392
9393 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9394 }
9395
9396 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9397 {
9398 super.EEItemLocationChanged(oldLoc, newLoc);
9399
9400 PlayerBase newPlayer = null;
9401 PlayerBase oldPlayer = null;
9402
9403 if (newLoc.GetParent())
9404 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9405
9406 if (oldLoc.GetParent())
9407 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9408
9410 {
9411 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9412
9413 if (rIndex >= 0)
9414 {
9415 InventoryLocation rIl = new InventoryLocation;
9416 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9417
9418 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9421 {
9422 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9423 }
9425 {
9427 }
9428
9429 }
9430 }
9431
9433 {
9434 if (newPlayer)
9435 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9436
9437 if (newPlayer == oldPlayer)
9438 {
9439 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9440 {
9442 {
9443 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9444 {
9445 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9446 }
9447 }
9448 else
9449 {
9450 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9451 }
9452 }
9453
9454 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9455 {
9456 int type = oldLoc.GetType();
9458 {
9459 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9460 }
9462 {
9463 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9464 }
9465 }
9466 if (!m_OldLocation)
9467 {
9468 m_OldLocation = new InventoryLocation;
9469 }
9470 m_OldLocation.Copy(oldLoc);
9471 }
9472 else
9473 {
9474 if (m_OldLocation)
9475 {
9476 m_OldLocation.Reset();
9477 }
9478 }
9479
9480 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9481 }
9482 else
9483 {
9484 if (newPlayer)
9485 {
9486 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9487 if (resIndex >= 0)
9488 {
9489 InventoryLocation il = new InventoryLocation;
9490 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9492 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9495 {
9496 il.
GetParent().GetOnReleaseLock().Invoke(it);
9497 }
9499 {
9501 }
9502
9503 }
9504 }
9506 {
9507
9509 }
9510
9511 if (m_OldLocation)
9512 {
9513 m_OldLocation.Reset();
9514 }
9515 }
9516
9518 {
9519 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9520 }
9521
9523 {
9524 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9525 }
9526 }
9527
9528 override void EOnContact(IEntity other, Contact extra)
9529 {
9531 {
9532 int liquidType = -1;
9534 if (impactSpeed > 0.0)
9535 {
9537 #ifndef SERVER
9539 #else
9541 SetSynchDirty();
9542 #endif
9544 }
9545 }
9546
9547 #ifdef SERVER
9548 if (GetCompEM() && GetCompEM().IsPlugged())
9549 {
9550 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9551 GetCompEM().UnplugThis();
9552 }
9553 #endif
9554 }
9555
9557
9559 {
9561 }
9562
9564 {
9565
9566 }
9567
9569 {
9570 super.OnItemLocationChanged(old_owner, new_owner);
9571
9572 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9573 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9574
9575 if (!relatedPlayer && playerNew)
9576 relatedPlayer = playerNew;
9577
9578 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9579 {
9581 if (actionMgr)
9582 {
9583 ActionBase currentAction = actionMgr.GetRunningAction();
9584 if (currentAction)
9586 }
9587 }
9588
9589 Man ownerPlayerOld = null;
9590 Man ownerPlayerNew = null;
9591
9592 if (old_owner)
9593 {
9594 if (old_owner.
IsMan())
9595 {
9596 ownerPlayerOld = Man.Cast(old_owner);
9597 }
9598 else
9599 {
9600 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9601 }
9602 }
9603 else
9604 {
9606 {
9608
9609 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9610 {
9611 GetCompEM().UnplugThis();
9612 }
9613 }
9614 }
9615
9616 if (new_owner)
9617 {
9618 if (new_owner.
IsMan())
9619 {
9620 ownerPlayerNew = Man.Cast(new_owner);
9621 }
9622 else
9623 {
9624 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9625 }
9626 }
9627
9628 if (ownerPlayerOld != ownerPlayerNew)
9629 {
9630 if (ownerPlayerOld)
9631 {
9632 array<EntityAI> subItemsExit = new array<EntityAI>;
9634 for (int i = 0; i < subItemsExit.Count(); i++)
9635 {
9638 }
9639 }
9640
9641 if (ownerPlayerNew)
9642 {
9643 array<EntityAI> subItemsEnter = new array<EntityAI>;
9645 for (int j = 0; j < subItemsEnter.Count(); j++)
9646 {
9649 }
9650 }
9651 }
9652 else if (ownerPlayerNew != null)
9653 {
9654 PlayerBase nplayer;
9655 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9656 {
9657 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9659 for (int k = 0; k < subItemsUpdate.Count(); k++)
9660 {
9662 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9663 }
9664 }
9665 }
9666
9667 if (old_owner)
9668 old_owner.OnChildItemRemoved(this);
9669 if (new_owner)
9670 new_owner.OnChildItemReceived(this);
9671 }
9672
9673
9675 {
9676 super.EEDelete(parent);
9677 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9678 if (player)
9679 {
9681
9682 if (player.IsAlive())
9683 {
9684 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9685 if (r_index >= 0)
9686 {
9687 InventoryLocation r_il = new InventoryLocation;
9688 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9689
9690 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9693 {
9694 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9695 }
9697 {
9698 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9699 }
9700
9701 }
9702
9703 player.RemoveQuickBarEntityShortcut(this);
9704 }
9705 }
9706 }
9707
9709 {
9710 super.EEKilled(killer);
9711
9714 {
9715 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9716 {
9717 if (IsMagazine())
9718 {
9719 if (Magazine.Cast(this).GetAmmoCount() > 0)
9720 {
9722 }
9723 }
9724 else
9725 {
9727 }
9728 }
9729 }
9730 }
9731
9733 {
9734 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9735
9736 super.OnWasAttached(parent, slot_id);
9737
9740
9743 }
9744
9746 {
9747 super.OnWasDetached(parent, slot_id);
9748
9751
9754 }
9755
9757 {
9758 int idx;
9761
9762 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9763 if (inventory_slots.Count() < 1)
9764 {
9765 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9766 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9767 }
9768 else
9769 {
9770 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9771 }
9772
9773 idx = inventory_slots.Find(slot);
9774 if (idx < 0)
9775 return "";
9776
9777 return attach_types.Get(idx);
9778 }
9779
9781 {
9782 int idx = -1;
9783 string slot;
9784
9787
9788 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9789 if (inventory_slots.Count() < 1)
9790 {
9791 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9792 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9793 }
9794 else
9795 {
9796 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9797 if (detach_types.Count() < 1)
9798 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9799 }
9800
9801 for (int i = 0; i < inventory_slots.Count(); i++)
9802 {
9803 slot = inventory_slots.Get(i);
9804 }
9805
9806 if (slot != "")
9807 {
9808 if (detach_types.Count() == 1)
9809 idx = 0;
9810 else
9811 idx = inventory_slots.Find(slot);
9812 }
9813 if (idx < 0)
9814 return "";
9815
9816 return detach_types.Get(idx);
9817 }
9818
9820 {
9821
9823
9824
9825 float min_time = 1;
9826 float max_time = 3;
9827 float delay = Math.RandomFloat(min_time, max_time);
9828
9829 explode_timer.Run(delay, this, "DoAmmoExplosion");
9830 }
9831
9833 {
9834 Magazine magazine = Magazine.Cast(this);
9835 int pop_sounds_count = 6;
9836 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9837
9838
9839 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9840 string sound_name = pop_sounds[ sound_idx ];
9841 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9842
9843
9844 magazine.ServerAddAmmoCount(-1);
9845
9846
9847 float min_temp_to_explode = 100;
9848
9849 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9850 {
9852 }
9853 }
9854
9855
9856 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9857 {
9858 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9859
9860 const int CHANCE_DAMAGE_CARGO = 4;
9861 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9862 const int CHANCE_DAMAGE_NOTHING = 2;
9863
9865 {
9866 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9867 int chances;
9868 int rnd;
9869
9870 if (GetInventory().GetCargo())
9871 {
9872 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9873 rnd = Math.RandomInt(0,chances);
9874
9875 if (rnd < CHANCE_DAMAGE_CARGO)
9876 {
9878 }
9879 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9880 {
9882 }
9883 }
9884 else
9885 {
9886 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9887 rnd = Math.RandomInt(0,chances);
9888
9889 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9890 {
9892 }
9893 }
9894 }
9895 }
9896
9898 {
9899 CargoBase cargo = GetInventory().GetCargo();
9900 if (cargo)
9901 {
9903 if (item_count > 0)
9904 {
9905 int random_pick = Math.RandomInt(0, item_count);
9907 if (!item.IsExplosive())
9908 {
9909 item.AddHealth("","",damage);
9910 return true;
9911 }
9912 }
9913 }
9914 return false;
9915 }
9916
9918 {
9919 GameInventory inventory = GetInventory();
9921 if (attachment_count > 0)
9922 {
9923 int random_pick = Math.RandomInt(0, attachment_count);
9925 if (!attachment.IsExplosive())
9926 {
9927 attachment.AddHealth("","",damage);
9928 return true;
9929 }
9930 }
9931 return false;
9932 }
9933
9935 {
9937 }
9938
9940 {
9942 return GetInventory().CanRemoveEntity();
9943
9944 return false;
9945 }
9946
9948 {
9949
9951 return false;
9952
9953
9955 return false;
9956
9957
9958
9960 if (delta == 0)
9961 return false;
9962
9963
9964 return true;
9965 }
9966
9968 {
9970 {
9971 if (ScriptInputUserData.CanStoreInputUserData())
9972 {
9973 ScriptInputUserData ctx = new ScriptInputUserData;
9978 ctx.
Write(destination_entity);
9982 }
9983 }
9984 else if (!
g_Game.IsMultiplayer())
9985 {
9987 }
9988 }
9989
9991 {
9992 float split_quantity_new;
9996 InventoryLocation loc = new InventoryLocation;
9997
9998 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9999 {
10001 split_quantity_new = stack_max;
10002 else
10004
10006 {
10007 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10008 if (new_item)
10009 {
10010 new_item.SetResultOfSplit(true);
10011 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10013 new_item.
SetQuantity(split_quantity_new,
false,
true);
10014 }
10015 }
10016 }
10017 else if (destination_entity && slot_id == -1)
10018 {
10019 if (quantity > stack_max)
10020 split_quantity_new = stack_max;
10021 else
10022 split_quantity_new = quantity;
10023
10025 {
10026 GameInventory destinationInventory = destination_entity.GetInventory();
10028 {
10031 }
10032
10033 if (new_item)
10034 {
10035 new_item.SetResultOfSplit(true);
10036 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10038 new_item.
SetQuantity(split_quantity_new,
false,
true);
10039 }
10040 }
10041 }
10042 else
10043 {
10044 if (stack_max != 0)
10045 {
10047 {
10049 }
10050
10051 if (split_quantity_new == 0)
10052 {
10053 if (!
g_Game.IsMultiplayer())
10054 player.PhysicalPredictiveDropItem(this);
10055 else
10056 player.ServerDropEntity(this);
10057 return;
10058 }
10059
10061 {
10063
10064 if (new_item)
10065 {
10066 new_item.SetResultOfSplit(true);
10067 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10070 new_item.PlaceOnSurface();
10071 }
10072 }
10073 }
10074 }
10075 }
10076
10078 {
10079 float split_quantity_new;
10083 InventoryLocation loc = new InventoryLocation;
10084
10085 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10086 {
10088 split_quantity_new = stack_max;
10089 else
10091
10093 {
10094 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10095 if (new_item)
10096 {
10097 new_item.SetResultOfSplit(true);
10098 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10100 new_item.
SetQuantity(split_quantity_new,
false,
true);
10101 }
10102 }
10103 }
10104 else if (destination_entity && slot_id == -1)
10105 {
10106 if (quantity > stack_max)
10107 split_quantity_new = stack_max;
10108 else
10109 split_quantity_new = quantity;
10110
10112 {
10113 GameInventory destinationInventory = destination_entity.GetInventory();
10115 {
10118 }
10119
10120 if (new_item)
10121 {
10122 new_item.SetResultOfSplit(true);
10123 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10125 new_item.
SetQuantity(split_quantity_new,
false,
true);
10126 }
10127 }
10128 }
10129 else
10130 {
10131 if (stack_max != 0)
10132 {
10134 {
10136 }
10137
10139 {
10141
10142 if (new_item)
10143 {
10144 new_item.SetResultOfSplit(true);
10145 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10148 new_item.PlaceOnSurface();
10149 }
10150 }
10151 }
10152 }
10153 }
10154
10156 {
10158 {
10159 if (ScriptInputUserData.CanStoreInputUserData())
10160 {
10161 ScriptInputUserData ctx = new ScriptInputUserData;
10166 dst.WriteToContext(ctx);
10168 }
10169 }
10170 else if (!
g_Game.IsMultiplayer())
10171 {
10173 }
10174 }
10175
10177 {
10179 {
10180 if (ScriptInputUserData.CanStoreInputUserData())
10181 {
10182 ScriptInputUserData ctx = new ScriptInputUserData;
10187 ctx.
Write(destination_entity);
10193 }
10194 }
10195 else if (!
g_Game.IsMultiplayer())
10196 {
10198 }
10199 }
10200
10202 {
10204 }
10205
10207 {
10209 float split_quantity_new;
10211 if (dst.IsValid())
10212 {
10213 int slot_id = dst.GetSlot();
10215
10216 if (quantity > stack_max)
10217 split_quantity_new = stack_max;
10218 else
10219 split_quantity_new = quantity;
10220
10222 {
10224
10225 if (new_item)
10226 {
10227 new_item.SetResultOfSplit(true);
10228 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10230 new_item.
SetQuantity(split_quantity_new,
false,
true);
10231 }
10232
10233 return new_item;
10234 }
10235 }
10236
10237 return null;
10238 }
10239
10241 {
10243 float split_quantity_new;
10245 if (destination_entity)
10246 {
10248 if (quantity > stackable)
10249 split_quantity_new = stackable;
10250 else
10251 split_quantity_new = quantity;
10252
10254 {
10255 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10256 if (new_item)
10257 {
10258 new_item.SetResultOfSplit(true);
10259 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10261 new_item.
SetQuantity(split_quantity_new,
false,
true);
10262 }
10263 }
10264 }
10265 }
10266
10268 {
10270 {
10271 if (ScriptInputUserData.CanStoreInputUserData())
10272 {
10273 ScriptInputUserData ctx = new ScriptInputUserData;
10278 ItemBase destination_entity =
this;
10279 ctx.
Write(destination_entity);
10283 }
10284 }
10285 else if (!
g_Game.IsMultiplayer())
10286 {
10288 }
10289 }
10290
10292 {
10294 float split_quantity_new;
10296 if (player)
10297 {
10299 if (quantity > stackable)
10300 split_quantity_new = stackable;
10301 else
10302 split_quantity_new = quantity;
10303
10305 {
10306 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10307 new_item =
ItemBase.Cast(in_hands);
10308 if (new_item)
10309 {
10310 new_item.SetResultOfSplit(true);
10311 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10313 new_item.SetQuantity(split_quantity_new, false, true);
10314 }
10315 }
10316 }
10317 }
10318
10320 {
10322 float split_quantity_new = Math.Floor(quantity * 0.5);
10323
10325 return;
10326
10328
10329 if (new_item)
10330 {
10331 if (new_item.GetQuantityMax() < split_quantity_new)
10332 {
10333 split_quantity_new = new_item.GetQuantityMax();
10334 }
10335
10336 new_item.SetResultOfSplit(true);
10337 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10338
10340 {
10343 }
10344 else
10345 {
10347 new_item.
SetQuantity(split_quantity_new,
false,
true);
10348 }
10349 }
10350 }
10351
10353 {
10355 float split_quantity_new = Math.Floor(quantity / 2);
10356
10358 return;
10359
10360 InventoryLocation invloc = new InventoryLocation;
10362
10364 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10365
10366 if (new_item)
10367 {
10368 if (new_item.GetQuantityMax() < split_quantity_new)
10369 {
10370 split_quantity_new = new_item.GetQuantityMax();
10371 }
10373 {
10376 }
10377 else if (split_quantity_new > 1)
10378 {
10380 new_item.
SetQuantity(split_quantity_new,
false,
true);
10381 }
10382 }
10383 }
10384
10387 {
10388 SetWeightDirty();
10390
10391 if (parent)
10392 parent.OnAttachmentQuantityChangedEx(this, delta);
10393
10395 {
10397 {
10399 }
10401 {
10402 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10404 }
10405 }
10406 }
10407
10410 {
10411
10412 }
10413
10416 {
10418 }
10419
10421 {
10422 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10423
10425 {
10426 if (newLevel == GameConstants.STATE_RUINED)
10427 {
10429 EntityAI parent = GetHierarchyParent();
10430 if (parent && parent.IsFireplace())
10431 {
10432 CargoBase cargo = GetInventory().GetCargo();
10433 if (cargo)
10434 {
10436 {
10438 }
10439 }
10440 }
10441 }
10442
10444 {
10445
10447 return;
10448 }
10449
10450 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10451 {
10453 }
10454 }
10455 }
10456
10457
10459 {
10460 super.OnRightClick();
10461
10463 {
10465 {
10466 if (ScriptInputUserData.CanStoreInputUserData())
10467 {
10468 EntityAI root = GetHierarchyRoot();
10469 Man playerOwner = GetHierarchyRootPlayer();
10470 InventoryLocation dst = new InventoryLocation;
10471
10472
10473 if (!playerOwner && root && root == this)
10474 {
10476 }
10477 else
10478 {
10479
10480 GetInventory().GetCurrentInventoryLocation(dst);
10482 {
10483 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10485 {
10487 }
10488 else
10489 {
10491
10492
10493 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10494 {
10496 }
10497 else
10498 {
10499 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10500 }
10501 }
10502 }
10503 }
10504
10505 ScriptInputUserData ctx = new ScriptInputUserData;
10513 }
10514 }
10515 else if (!
g_Game.IsMultiplayer())
10516 {
10518 }
10519 }
10520 }
10521
10523 {
10524 if (root)
10525 {
10526 vector m4[4];
10527 root.GetTransform(m4);
10528 dst.SetGround(this, m4);
10529 }
10530 else
10531 {
10532 GetInventory().GetCurrentInventoryLocation(dst);
10533 }
10534 }
10535
10536 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10537 {
10538
10539 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10540 return false;
10541
10542 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10543 return false;
10544
10545
10547 return false;
10548
10549
10550 Magazine mag = Magazine.Cast(this);
10551 if (mag)
10552 {
10553 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10554 return false;
10555
10556 if (stack_max_limit)
10557 {
10558 Magazine other_mag = Magazine.Cast(other_item);
10559 if (other_item)
10560 {
10561 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10562 return false;
10563 }
10564
10565 }
10566 }
10567 else
10568 {
10569
10571 return false;
10572
10574 return false;
10575 }
10576
10577 PlayerBase player = null;
10578 if (CastTo(player, GetHierarchyRootPlayer()))
10579 {
10580 if (player.GetInventory().HasAttachment(this))
10581 return false;
10582
10583 if (player.IsItemsToDelete())
10584 return false;
10585 }
10586
10587 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10588 return false;
10589
10590 int slotID;
10592 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10593 return false;
10594
10595 return true;
10596 }
10597
10599 {
10601 }
10602
10604 {
10605 return m_IsResultOfSplit;
10606 }
10607
10609 {
10610 m_IsResultOfSplit = value;
10611 }
10612
10614 {
10616 }
10617
10619 {
10620 float other_item_quantity = other_item.GetQuantity();
10621 float this_free_space;
10622
10624
10626
10627 if (other_item_quantity > this_free_space)
10628 {
10629 return this_free_space;
10630 }
10631 else
10632 {
10633 return other_item_quantity;
10634 }
10635 }
10636
10638 {
10640 }
10641
10643 {
10645 return;
10646
10647 if (!IsMagazine() && other_item)
10648 {
10650 if (quantity_used != 0)
10651 {
10652 float hp1 = GetHealth01("","");
10653 float hp2 = other_item.GetHealth01("","");
10654 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10655 hpResult = hpResult / (
GetQuantity() + quantity_used);
10656
10657 hpResult *= GetMaxHealth();
10658 Math.Round(hpResult);
10659 SetHealth("", "Health", hpResult);
10660
10662 other_item.AddQuantity(-quantity_used);
10663 }
10664 }
10666 }
10667
10669 {
10670 #ifdef SERVER
10671 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10672 GetHierarchyParent().IncreaseLifetimeUp();
10673 #endif
10674 };
10675
10677 {
10678 PlayerBase p = PlayerBase.Cast(player);
10679
10680 array<int> recipesIds = p.m_Recipes;
10681 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10682 if (moduleRecipesManager)
10683 {
10684 EntityAI itemInHands = player.GetEntityInHands();
10685 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10686 }
10687
10688 for (int i = 0;i < recipesIds.Count(); i++)
10689 {
10690 int key = recipesIds.Get(i);
10691 string recipeName = moduleRecipesManager.GetRecipeName(key);
10693 }
10694 }
10695
10696
10697 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10698 {
10699 super.GetDebugActions(outputList);
10700
10701
10707
10708
10713
10718
10719
10723
10724
10726 {
10730 }
10731
10734
10735
10739
10741
10742 InventoryLocation loc = new InventoryLocation();
10743 GetInventory().GetCurrentInventoryLocation(loc);
10745 {
10746 if (Gizmo_IsSupported())
10749 }
10750
10752 }
10753
10754
10755
10756
10758 {
10759 super.OnAction(action_id, player, ctx);
10760
10762 {
10763 switch (action_id)
10764 {
10768 return true;
10772 return true;
10773 }
10774 }
10775
10777 {
10778 switch (action_id)
10779 {
10781 Delete();
10782 return true;
10783 }
10784 }
10785
10786 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10787 {
10788 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10789 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10790 PlayerBase p = PlayerBase.Cast(player);
10791 if (
EActions.RECIPES_RANGE_START < 1000)
10792 {
10793 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10794 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10795 }
10796 }
10797 #ifndef SERVER
10798 else if (action_id ==
EActions.WATCH_PLAYER)
10799 {
10800 PluginDeveloper.SetDeveloperItemClientEx(player);
10801 }
10802 #endif
10804 {
10805 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10806 {
10807 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10808 OnDebugButtonPressServer(id + 1);
10809 }
10810
10811 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10812 {
10813 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10815 }
10816
10817 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10818 {
10819 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10821 }
10822
10823 else if (action_id ==
EActions.ADD_QUANTITY)
10824 {
10825 if (IsMagazine())
10826 {
10827 Magazine mag = Magazine.Cast(this);
10828 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10829 }
10830 else
10831 {
10833 }
10834
10835 if (m_EM)
10836 {
10837 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10838 }
10839
10840 }
10841
10842 else if (action_id ==
EActions.REMOVE_QUANTITY)
10843 {
10844 if (IsMagazine())
10845 {
10846 Magazine mag2 = Magazine.Cast(this);
10847 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10848 }
10849 else
10850 {
10852 }
10853 if (m_EM)
10854 {
10855 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10856 }
10857
10858 }
10859
10860 else if (action_id ==
EActions.SET_QUANTITY_0)
10861 {
10863
10864 if (m_EM)
10865 {
10866 m_EM.SetEnergy(0);
10867 }
10868 }
10869
10870 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10871 {
10873
10874 if (m_EM)
10875 {
10876 m_EM.SetEnergy(m_EM.GetEnergyMax());
10877 }
10878 }
10879
10880 else if (action_id ==
EActions.ADD_HEALTH)
10881 {
10882 AddHealth("","",GetMaxHealth("","Health")/5);
10883 }
10884 else if (action_id ==
EActions.REMOVE_HEALTH)
10885 {
10886 AddHealth("","",-GetMaxHealth("","Health")/5);
10887 }
10888 else if (action_id ==
EActions.DESTROY_HEALTH)
10889 {
10890 SetHealth01("","",0);
10891 }
10892 else if (action_id ==
EActions.WATCH_ITEM)
10893 {
10895 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10896 #ifdef DEVELOPER
10897 SetDebugDeveloper_item(this);
10898 #endif
10899 }
10900
10901 else if (action_id ==
EActions.ADD_TEMPERATURE)
10902 {
10903 AddTemperature(20);
10904
10905 }
10906
10907 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10908 {
10909 AddTemperature(-20);
10910
10911 }
10912
10913 else if (action_id ==
EActions.FLIP_FROZEN)
10914 {
10915 SetFrozen(!GetIsFrozen());
10916
10917 }
10918
10919 else if (action_id ==
EActions.ADD_WETNESS)
10920 {
10922
10923 }
10924
10925 else if (action_id ==
EActions.REMOVE_WETNESS)
10926 {
10928
10929 }
10930
10931 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10932 {
10935
10936
10937 }
10938
10939 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10940 {
10943 }
10944
10945 else if (action_id ==
EActions.MAKE_SPECIAL)
10946 {
10947 auto debugParams = DebugSpawnParams.WithPlayer(player);
10948 OnDebugSpawnEx(debugParams);
10949 }
10950
10951 }
10952
10953
10954 return false;
10955 }
10956
10957
10958
10959
10963
10966
10967
10968
10970 {
10971 return false;
10972 }
10973
10974
10976 {
10977 return true;
10978 }
10979
10980
10982 {
10983 return true;
10984 }
10985
10986
10987
10989 {
10990 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10991 return g_Game.ConfigIsExisting(config_path);
10992 }
10993
10996 {
10997 return null;
10998 }
10999
11001 {
11002 return false;
11003 }
11004
11006 {
11007 return false;
11008 }
11009
11013
11014
11016 {
11017 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11018 return module_repairing.CanRepair(this, item_repair_kit);
11019 }
11020
11021
11022 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11023 {
11024 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11025 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11026 }
11027
11028
11030 {
11031
11032
11033
11034
11035
11036
11037
11038
11039 return 1;
11040 }
11041
11042
11043
11045 {
11047 }
11048
11049
11050
11052 {
11054 }
11055
11056
11065 {
11066 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11067
11068 if (player)
11069 {
11070 player.MessageStatus(text);
11071 }
11072 }
11073
11074
11083 {
11084 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11085
11086 if (player)
11087 {
11088 player.MessageAction(text);
11089 }
11090 }
11091
11092
11101 {
11102 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11103
11104 if (player)
11105 {
11106 player.MessageFriendly(text);
11107 }
11108 }
11109
11110
11119 {
11120 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11121
11122 if (player)
11123 {
11124 player.MessageImportant(text);
11125 }
11126 }
11127
11129 {
11130 return true;
11131 }
11132
11133
11134 override bool KindOf(
string tag)
11135 {
11136 bool found = false;
11137 string item_name = this.
GetType();
11139 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11140
11141 int array_size = item_tag_array.Count();
11142 for (int i = 0; i < array_size; i++)
11143 {
11144 if (item_tag_array.Get(i) == tag)
11145 {
11146 found = true;
11147 break;
11148 }
11149 }
11150 return found;
11151 }
11152
11153
11155 {
11156
11157 super.OnRPC(sender, rpc_type,ctx);
11158
11159
11160 switch (rpc_type)
11161 {
11162 #ifndef SERVER
11163 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11164 Param2<bool, string> p = new Param2<bool, string>(false, "");
11165
11167 return;
11168
11169 bool play = p.param1;
11170 string soundSet = p.param2;
11171
11172 if (play)
11173 {
11175 {
11177 {
11179 }
11180 }
11181 else
11182 {
11184 }
11185 }
11186 else
11187 {
11189 }
11190
11191 break;
11192 #endif
11193
11194 }
11195
11197 {
11199 }
11200 }
11201
11202
11203
11204
11206 {
11207 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11208 return plugin.GetID(
name);
11209 }
11210
11212 {
11213 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11214 return plugin.GetName(id);
11215 }
11216
11219 {
11220
11221
11222 int varFlags;
11223 if (!ctx.
Read(varFlags))
11224 return;
11225
11226 if (varFlags & ItemVariableFlags.FLOAT)
11227 {
11229 }
11230 }
11231
11233 {
11234
11235 super.SerializeNumericalVars(floats_out);
11236
11237
11238
11240 {
11242 }
11243
11245 {
11247 }
11248
11250 {
11252 }
11253
11255 {
11260 }
11261
11263 {
11265 }
11266 }
11267
11269 {
11270
11271 super.DeSerializeNumericalVars(floats);
11272
11273
11274 int index = 0;
11275 int mask = Math.Round(floats.Get(index));
11276
11277 index++;
11278
11280 {
11282 {
11284 }
11285 else
11286 {
11287 float quantity = floats.Get(index);
11288 SetQuantity(quantity,
true,
false,
false,
false);
11289 }
11290 index++;
11291 }
11292
11294 {
11295 float wet = floats.Get(index);
11297 index++;
11298 }
11299
11301 {
11302 int liquidtype = Math.Round(floats.Get(index));
11304 index++;
11305 }
11306
11308 {
11310 index++;
11312 index++;
11314 index++;
11316 index++;
11317 }
11318
11320 {
11321 int cleanness = Math.Round(floats.Get(index));
11323 index++;
11324 }
11325 }
11326
11328 {
11329 super.WriteVarsToCTX(ctx);
11330
11331
11333 {
11335 }
11336
11338 {
11340 }
11341
11343 {
11345 }
11346
11348 {
11349 int r,g,b,a;
11355 }
11356
11358 {
11360 }
11361 }
11362
11364 {
11365 if (!super.ReadVarsFromCTX(ctx,version))
11366 return false;
11367
11368 int intValue;
11369 float value;
11370
11371 if (version < 140)
11372 {
11373 if (!ctx.
Read(intValue))
11374 return false;
11375
11376 m_VariablesMask = intValue;
11377 }
11378
11380 {
11381 if (!ctx.
Read(value))
11382 return false;
11383
11385 {
11387 }
11388 else
11389 {
11391 }
11392 }
11393
11394 if (version < 140)
11395 {
11397 {
11398 if (!ctx.
Read(value))
11399 return false;
11400 SetTemperatureDirect(value);
11401 }
11402 }
11403
11405 {
11406 if (!ctx.
Read(value))
11407 return false;
11409 }
11410
11412 {
11413 if (!ctx.
Read(intValue))
11414 return false;
11416 }
11417
11419 {
11420 int r,g,b,a;
11422 return false;
11424 return false;
11426 return false;
11428 return false;
11429
11431 }
11432
11434 {
11435 if (!ctx.
Read(intValue))
11436 return false;
11438 }
11439
11440 if (version >= 138 && version < 140)
11441 {
11443 {
11444 if (!ctx.
Read(intValue))
11445 return false;
11446 SetFrozen(intValue);
11447 }
11448 }
11449
11450 return true;
11451 }
11452
11453
11455 {
11458 {
11460 }
11461
11462 if (!super.OnStoreLoad(ctx, version))
11463 {
11465 return false;
11466 }
11467
11468 if (version >= 114)
11469 {
11470 bool hasQuickBarIndexSaved;
11471
11472 if (!ctx.
Read(hasQuickBarIndexSaved))
11473 {
11475 return false;
11476 }
11477
11478 if (hasQuickBarIndexSaved)
11479 {
11480 int itmQBIndex;
11481
11482
11483 if (!ctx.
Read(itmQBIndex))
11484 {
11486 return false;
11487 }
11488
11489 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11490 if (itmQBIndex != -1 && parentPlayer)
11491 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11492 }
11493 }
11494 else
11495 {
11496
11497 PlayerBase player;
11498 int itemQBIndex;
11499 if (version ==
int.
MAX)
11500 {
11501 if (!ctx.
Read(itemQBIndex))
11502 {
11504 return false;
11505 }
11506 }
11507 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11508 {
11509
11510 if (!ctx.
Read(itemQBIndex))
11511 {
11513 return false;
11514 }
11515 if (itemQBIndex != -1 && player)
11516 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11517 }
11518 }
11519
11520 if (version < 140)
11521 {
11522
11523 if (!LoadVariables(ctx, version))
11524 {
11526 return false;
11527 }
11528 }
11529
11530
11532 {
11534 return false;
11535 }
11536 if (version >= 132)
11537 {
11539 if (raib)
11540 {
11542 {
11544 return false;
11545 }
11546 }
11547 }
11548
11550 return true;
11551 }
11552
11553
11554
11556 {
11557 super.OnStoreSave(ctx);
11558
11559 PlayerBase player;
11560 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11561 {
11563
11564 int itemQBIndex = -1;
11565 itemQBIndex = player.FindQuickBarEntityIndex(this);
11566 ctx.
Write(itemQBIndex);
11567 }
11568 else
11569 {
11571 }
11572
11574
11576 if (raib)
11577 {
11579 }
11580 }
11581
11582
11584 {
11585 super.AfterStoreLoad();
11586
11588 {
11590 }
11591
11593 {
11596 }
11597 }
11598
11600 {
11601 super.EEOnAfterLoad();
11602
11604 {
11606 }
11607
11610 }
11611
11613 {
11614 return false;
11615 }
11616
11617
11618
11620 {
11622 {
11623 #ifdef PLATFORM_CONSOLE
11624
11626 {
11628 if (menu)
11629 {
11631 }
11632 }
11633 #endif
11634 }
11635
11637 {
11640 }
11641
11643 {
11644 SetWeightDirty();
11646 }
11648 {
11651 }
11652
11654 {
11657
11660 }
11662 {
11666 }
11667
11668 super.OnVariablesSynchronized();
11669 }
11670
11671
11672
11674 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11675 {
11676 if (!IsServerCheck(allow_client))
11677 return false;
11678
11680 return false;
11681
11684
11685 if (value <= (min + 0.001))
11686 value = min;
11687
11688 if (value == min)
11689 {
11690 if (destroy_config)
11691 {
11692 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11693 if (dstr)
11694 {
11696 this.Delete();
11697 return true;
11698 }
11699 }
11700 else if (destroy_forced)
11701 {
11703 this.Delete();
11704 return true;
11705 }
11706
11708 }
11709
11712
11714 {
11715 EntityAI parent = GetHierarchyRoot();
11716 InventoryLocation iLoc = new InventoryLocation();
11717 GetInventory().GetCurrentInventoryLocation(iLoc);
11719 {
11720 int iLocSlot = iLoc.
GetSlot();
11722 {
11724 }
11726 {
11728 }
11729 }
11730 }
11731
11733 {
11735
11736 if (delta)
11738 }
11739
11741
11742 return false;
11743 }
11744
11745
11747 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11748 {
11750 }
11751
11753 {
11756 }
11757
11759 {
11762 }
11763
11765 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11766 {
11767 float value_clamped = Math.Clamp(value, 0, 1);
11769 SetQuantity(result, destroy_config, destroy_forced);
11770 }
11771
11772
11775 {
11777 }
11778
11780 {
11782 }
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11794 {
11795 int slot = -1;
11796 GameInventory inventory = GetInventory();
11797 if (inventory)
11798 {
11799 InventoryLocation il = new InventoryLocation;
11802 }
11803
11805 }
11806
11808 {
11809 float quantity_max = 0;
11810
11812 {
11813 if (attSlotID != -1)
11814 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11815
11816 if (quantity_max <= 0)
11818 }
11819
11820 if (quantity_max <= 0)
11822
11823 return quantity_max;
11824 }
11825
11827 {
11829 }
11830
11832 {
11834 }
11835
11836
11838 {
11840 }
11841
11843 {
11845 }
11846
11848 {
11850 }
11851
11852
11854 {
11855
11856 float weightEx = GetWeightEx();
11857 float special = GetInventoryAndCargoWeight();
11858 return weightEx - special;
11859 }
11860
11861
11863 {
11865 }
11866
11868 {
11870 {
11871 #ifdef DEVELOPER
11872 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11873 {
11874 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11876 }
11877 #endif
11878
11879 return GetQuantity() * GetConfigWeightModified();
11880 }
11881 else if (HasEnergyManager())
11882 {
11883 #ifdef DEVELOPER
11884 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11885 {
11886 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11887 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11888 }
11889 #endif
11890 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11891 }
11892 else
11893 {
11894 #ifdef DEVELOPER
11895 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11896 {
11897 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11898 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11899 }
11900 #endif
11901 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11902 }
11903 }
11904
11907 {
11908 int item_count = 0;
11910
11911 GameInventory inventory = GetInventory();
11912 CargoBase cargo = inventory.
GetCargo();
11913 if (cargo != NULL)
11914 {
11916 }
11917
11919 for (int i = 0; i < nAttachments; ++i)
11920 {
11922 if (item)
11923 item_count += item.GetNumberOfItems();
11924 }
11925 return item_count;
11926 }
11927
11930 {
11931 float weight = 0;
11932 float wetness = 1;
11933 if (include_wetness)
11936 {
11937 weight = wetness * m_ConfigWeight;
11938 }
11940 {
11941 weight = 1;
11942 }
11943 return weight;
11944 }
11945
11946
11947
11949 {
11950 GameInventory inventory = GetInventory();
11951 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11952 {
11953 array<EntityAI> items = new array<EntityAI>;
11955 for (int i = 0; i < items.Count(); ++i)
11956 {
11958 if (item)
11959 {
11960 g_Game.ObjectDelete(item);
11961 }
11962 }
11963 }
11964 }
11965
11966
11967
11968
11970 {
11971 float energy = 0;
11972 if (HasEnergyManager())
11973 {
11974 energy = GetCompEM().GetEnergy();
11975 }
11976 return energy;
11977 }
11978
11979
11981 {
11982 super.OnEnergyConsumed();
11983
11985 }
11986
11988 {
11989 super.OnEnergyAdded();
11990
11992 }
11993
11994
11996 {
11997 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11998 {
12000 {
12001 float energy_0to1 = GetCompEM().GetEnergy0To1();
12003 }
12004 }
12005 }
12006
12007
12009 {
12010 return ConfigGetFloat("heatIsolation");
12011 }
12012
12014 {
12016 }
12017
12019 {
12020 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12021 if (
g_Game.ConfigIsExisting(paramPath))
12022 return g_Game.ConfigGetFloat(paramPath);
12023
12024 return 0.0;
12025 }
12026
12028 {
12029 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12030 if (
g_Game.ConfigIsExisting(paramPath))
12031 return g_Game.ConfigGetFloat(paramPath);
12032
12033 return 0.0;
12034 }
12035
12036 override void SetWet(
float value,
bool allow_client =
false)
12037 {
12038 if (!IsServerCheck(allow_client))
12039 return;
12040
12043
12045
12046 m_VarWet = Math.Clamp(value, min, max);
12047
12049 {
12052 }
12053 }
12054
12055 override void AddWet(
float value)
12056 {
12058 }
12059
12061 {
12063 }
12064
12066 {
12068 }
12069
12071 {
12073 }
12074
12076 {
12078 }
12079
12081 {
12083 }
12084
12085 override void OnWetChanged(
float newVal,
float oldVal)
12086 {
12089 if (newLevel != oldLevel)
12090 {
12092 }
12093 }
12094
12096 {
12097 SetWeightDirty();
12098 }
12099
12101 {
12102 return GetWetLevelInternal(
m_VarWet);
12103 }
12104
12105
12106
12108 {
12110 }
12111
12113 {
12115 }
12116
12118 {
12120 }
12121
12123 {
12125 }
12126
12127
12128
12130 {
12131 if (ConfigIsExisting("itemModelLength"))
12132 {
12133 return ConfigGetFloat("itemModelLength");
12134 }
12135 return 0;
12136 }
12137
12139 {
12140 if (ConfigIsExisting("itemAttachOffset"))
12141 {
12142 return ConfigGetFloat("itemAttachOffset");
12143 }
12144 return 0;
12145 }
12146
12147 override void SetCleanness(
int value,
bool allow_client =
false)
12148 {
12149 if (!IsServerCheck(allow_client))
12150 return;
12151
12153
12155
12158 }
12159
12161 {
12163 }
12164
12166 {
12167 return true;
12168 }
12169
12170
12171
12172
12174 {
12176 }
12177
12179 {
12181 }
12182
12183
12184
12185
12186 override void SetColor(
int r,
int g,
int b,
int a)
12187 {
12193 }
12195 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12196 {
12201 }
12202
12204 {
12206 }
12207
12210 {
12211 int r,g,b,a;
12213 r = r/255;
12214 g = g/255;
12215 b = b/255;
12216 a = a/255;
12217 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12218 }
12219
12220
12221
12222 override void SetLiquidType(
int value,
bool allow_client =
false)
12223 {
12224 if (!IsServerCheck(allow_client))
12225 return;
12226
12231 }
12232
12234 {
12235 return ConfigGetInt("varLiquidTypeInit");
12236 }
12237
12239 {
12241 }
12242
12244 {
12246 SetFrozen(false);
12247 }
12248
12251 {
12252 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12253 }
12254
12255
12258 {
12259 PlayerBase nplayer;
12260 if (PlayerBase.CastTo(nplayer, player))
12261 {
12263 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12264 }
12265 }
12266
12267
12270 {
12271 PlayerBase nplayer;
12272 if (PlayerBase.CastTo(nplayer,player))
12273 {
12274 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12275 }
12276
12277 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12278
12279 if (HasEnergyManager())
12280 {
12281 GetCompEM().UpdatePlugState();
12282 }
12283 }
12284
12285
12287 {
12288 super.OnPlacementStarted(player);
12289
12291 }
12292
12293 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12294 {
12296 {
12297 m_AdminLog.OnPlacementComplete(player,
this);
12298 }
12299
12300 super.OnPlacementComplete(player, position, orientation);
12301 }
12302
12303
12304
12305
12306
12308 {
12310 {
12311 return true;
12312 }
12313 else
12314 {
12315 return false;
12316 }
12317 }
12318
12319
12321 {
12323 {
12325 }
12326 }
12327
12328
12330 {
12332 }
12333
12335 {
12337 }
12338
12339 override void InsertAgent(
int agent,
float count = 1)
12340 {
12341 if (count < 1)
12342 return;
12343
12345 }
12346
12349 {
12351 }
12352
12353
12355 {
12357 }
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12401 {
12403 return false;
12404 return true;
12405 }
12406
12408 {
12409
12411 }
12412
12413
12416 {
12417 super.CheckForRoofLimited(timeTresholdMS);
12418
12419 float time =
g_Game.GetTime();
12420 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12421 {
12422 m_PreviousRoofTestTime = time;
12423 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12424 }
12425 }
12426
12427
12429 {
12431 {
12432 return 0;
12433 }
12434
12435 if (GetInventory().GetAttachmentSlotsCount() != 0)
12436 {
12437 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12438 if (filter)
12439 return filter.GetProtectionLevel(type, false, system);
12440 else
12441 return 0;
12442 }
12443
12444 string subclassPath, entryName;
12445
12446 switch (type)
12447 {
12449 entryName = "biological";
12450 break;
12452 entryName = "chemical";
12453 break;
12454 default:
12455 entryName = "biological";
12456 break;
12457 }
12458
12459 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12460
12461 return g_Game.ConfigGetFloat(subclassPath + entryName);
12462 }
12463
12464
12465
12468 {
12469 if (!IsMagazine())
12471
12473 }
12474
12475
12476
12477
12478
12483 {
12484 return true;
12485 }
12486
12488 {
12490 }
12491
12492
12493
12494
12495
12497 {
12498 if (parent)
12499 {
12500 if (parent.IsInherited(DayZInfected))
12501 return true;
12502
12503 if (!parent.IsRuined())
12504 return true;
12505 }
12506
12507 return true;
12508 }
12509
12511 {
12512 if (!super.CanPutAsAttachment(parent))
12513 {
12514 return false;
12515 }
12516
12517 if (!IsRuined() && !parent.IsRuined())
12518 {
12519 return true;
12520 }
12521
12522 return false;
12523 }
12524
12526 {
12527
12528
12529
12530
12531 return super.CanReceiveItemIntoCargo(item);
12532 }
12533
12535 {
12536
12537
12538
12539
12540 GameInventory attachmentInv = attachment.GetInventory();
12542 {
12543 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12544 return false;
12545 }
12546
12547 InventoryLocation loc = new InventoryLocation();
12548 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12549 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12550 return false;
12551
12552 return super.CanReceiveAttachment(attachment, slotId);
12553 }
12554
12556 {
12557 if (!super.CanReleaseAttachment(attachment))
12558 return false;
12559
12560 return GetInventory().AreChildrenAccessible();
12561 }
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12584 {
12585 int id = muzzle_owner.GetMuzzleID();
12586 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12587
12588 if (WPOF_array)
12589 {
12590 for (int i = 0; i < WPOF_array.Count(); i++)
12591 {
12592 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12593
12594 if (WPOF)
12595 {
12596 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12597 }
12598 }
12599 }
12600 }
12601
12602
12604 {
12605 int id = muzzle_owner.GetMuzzleID();
12607
12608 if (WPOBE_array)
12609 {
12610 for (int i = 0; i < WPOBE_array.Count(); i++)
12611 {
12612 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12613
12614 if (WPOBE)
12615 {
12616 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12617 }
12618 }
12619 }
12620 }
12621
12622
12624 {
12625 int id = muzzle_owner.GetMuzzleID();
12626 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12627
12628 if (WPOOH_array)
12629 {
12630 for (int i = 0; i < WPOOH_array.Count(); i++)
12631 {
12632 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12633
12634 if (WPOOH)
12635 {
12636 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12637 }
12638 }
12639 }
12640 }
12641
12642
12644 {
12645 int id = muzzle_owner.GetMuzzleID();
12646 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12647
12648 if (WPOOH_array)
12649 {
12650 for (int i = 0; i < WPOOH_array.Count(); i++)
12651 {
12652 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12653
12654 if (WPOOH)
12655 {
12656 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12657 }
12658 }
12659 }
12660 }
12661
12662
12664 {
12665 int id = muzzle_owner.GetMuzzleID();
12666 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12667
12668 if (WPOOH_array)
12669 {
12670 for (int i = 0; i < WPOOH_array.Count(); i++)
12671 {
12672 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12673
12674 if (WPOOH)
12675 {
12676 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12677 }
12678 }
12679 }
12680 }
12681
12682
12683
12685 {
12687 {
12688 return true;
12689 }
12690
12691 return false;
12692 }
12693
12695 {
12697 {
12698 return true;
12699 }
12700
12701 return false;
12702 }
12703
12705 {
12707 {
12708 return true;
12709 }
12710
12711 return false;
12712 }
12713
12715 {
12716 return false;
12717 }
12718
12721 {
12722 return UATimeSpent.DEFAULT_DEPLOY;
12723 }
12724
12725
12726
12727
12729 {
12731 SetSynchDirty();
12732 }
12733
12735 {
12737 }
12738
12739
12741 {
12742 return false;
12743 }
12744
12747 {
12748 string att_type = "None";
12749
12750 if (ConfigIsExisting("soundAttType"))
12751 {
12752 att_type = ConfigGetString("soundAttType");
12753 }
12754
12756 }
12757
12759 {
12761 }
12762
12763
12764
12765
12766
12772
12774 {
12777
12779 }
12780
12781
12783 {
12785 return;
12786
12788
12791
12794
12795 SoundParameters params = new SoundParameters();
12799 }
12800
12801
12803 {
12805 {
12808
12809 SetSynchDirty();
12810
12813 }
12814 }
12815
12817 {
12819 }
12820
12821
12823 {
12825 return;
12826
12828 SetSynchDirty();
12829
12832 }
12833
12835 {
12838 }
12839
12841 {
12843 }
12844
12845 void OnApply(PlayerBase player);
12846
12848 {
12849 return 1.0;
12850 };
12851
12853 {
12855 }
12856
12858 {
12860 }
12861
12863
12865 {
12866 SetDynamicPhysicsLifeTime(0.01);
12868 }
12869
12871 {
12872 array<string> zone_names = new array<string>;
12873 GetDamageZones(zone_names);
12874 for (int i = 0; i < zone_names.Count(); i++)
12875 {
12876 SetHealthMax(zone_names.Get(i),"Health");
12877 }
12878 SetHealthMax("","Health");
12879 }
12880
12883 {
12884 float global_health = GetHealth01("","Health");
12885 array<string> zones = new array<string>;
12886 GetDamageZones(zones);
12887
12888 for (int i = 0; i < zones.Count(); i++)
12889 {
12890 SetHealth01(zones.Get(i),"Health",global_health);
12891 }
12892 }
12893
12896 {
12897 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12898 }
12899
12901 {
12902 if (!hasRootAsPlayer)
12903 {
12904 if (refParentIB)
12905 {
12906
12907 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12908 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12909
12910 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12911 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12912
12915 }
12916 else
12917 {
12918
12921 }
12922 }
12923 }
12924
12926 {
12928 {
12929 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12930 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12931 {
12932 float heatPermCoef = 1.0;
12934 while (ent)
12935 {
12936 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12937 ent = ent.GetHierarchyParent();
12938 }
12939
12940 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12941 }
12942 }
12943 }
12944
12946 {
12947
12948 EntityAI parent = GetHierarchyParent();
12949 if (!parent)
12950 {
12951 hasParent = false;
12952 hasRootAsPlayer = false;
12953 }
12954 else
12955 {
12956 hasParent = true;
12957 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12958 refParentIB =
ItemBase.Cast(parent);
12959 }
12960 }
12961
12962 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12963 {
12964
12965 }
12966
12968 {
12969
12970 return false;
12971 }
12972
12974 {
12975
12976
12977 return false;
12978 }
12979
12981 {
12982
12983 return false;
12984 }
12985
12988 {
12989 return !GetIsFrozen() &&
IsOpen();
12990 }
12991
12993 {
12994 bool hasParent = false, hasRootAsPlayer = false;
12996
12997 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12998 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12999
13000 if (wwtu || foodDecay)
13001 {
13005
13006 if (processWetness || processTemperature || processDecay)
13007 {
13009
13010 if (processWetness)
13011 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13012
13013 if (processTemperature)
13015
13016 if (processDecay)
13017 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13018 }
13019 }
13020 }
13021
13024 {
13026 }
13027
13029 {
13032
13033 return super.GetTemperatureFreezeThreshold();
13034 }
13035
13037 {
13040
13041 return super.GetTemperatureThawThreshold();
13042 }
13043
13045 {
13048
13049 return super.GetItemOverheatThreshold();
13050 }
13051
13053 {
13055 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13056
13057 return super.GetTemperatureFreezeTime();
13058 }
13059
13061 {
13063 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13064
13065 return super.GetTemperatureThawTime();
13066 }
13067
13072
13074 {
13075 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13076 }
13077
13079 {
13080 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13081 }
13082
13085 {
13087 }
13088
13090 {
13092 }
13093
13095 {
13097 }
13098
13101 {
13102 return null;
13103 }
13104
13107 {
13108 return false;
13109 }
13110
13112 {
13114 {
13117 if (!trg)
13118 {
13120 explosive = this;
13121 }
13122
13123 explosive.PairRemote(trg);
13125
13126 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13127 trg.SetPersistentPairID(persistentID);
13128 explosive.SetPersistentPairID(persistentID);
13129
13130 return true;
13131 }
13132 return false;
13133 }
13134
13137 {
13138 float ret = 1.0;
13141 ret *= GetHealth01();
13142
13143 return ret;
13144 }
13145
13146 #ifdef DEVELOPER
13147 override void SetDebugItem()
13148 {
13149 super.SetDebugItem();
13150 _itemBase = this;
13151 }
13152
13154 {
13155 string text = super.GetDebugText();
13156
13158 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13159
13160 return text;
13161 }
13162 #endif
13163
13165 {
13166 return true;
13167 }
13168
13170
13172
13174 {
13177 }
13178
13179
13187
13203
13204 [
Obsolete(
"Use ItemSoundHandler instead")]
13207 {
13208 if (!
g_Game.IsDedicatedServer())
13209 {
13210 if (ConfigIsExisting("attachSoundSet"))
13211 {
13212 string cfg_path = "";
13213 string soundset = "";
13214 string type_name =
GetType();
13215
13218 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13219 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13220
13221 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13222 {
13223 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13224 {
13225 if (cfg_slot_array[i] == slot_type)
13226 {
13227 soundset = cfg_soundset_array[i];
13228 break;
13229 }
13230 }
13231 }
13232
13233 if (soundset != "")
13234 {
13235 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13237 }
13238 }
13239 }
13240 }
13241
13243}
13244
13246{
13248 if (entity)
13249 {
13250 bool is_item = entity.IsInherited(
ItemBase);
13251 if (is_item && full_quantity)
13252 {
13255 }
13256 }
13257 else
13258 {
13260 return NULL;
13261 }
13262 return entity;
13263}
13264
13266{
13267 if (item)
13268 {
13269 if (health > 0)
13270 item.SetHealth("", "", health);
13271
13272 if (item.CanHaveTemperature())
13273 {
13275 if (item.CanFreeze())
13276 item.SetFrozen(false);
13277 }
13278
13279 if (item.HasEnergyManager())
13280 {
13281 if (quantity >= 0)
13282 {
13283 item.GetCompEM().SetEnergy0To1(quantity);
13284 }
13285 else
13286 {
13288 }
13289 }
13290 else if (item.IsMagazine())
13291 {
13292 Magazine mag = Magazine.Cast(item);
13293 if (quantity >= 0)
13294 {
13295 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13296 }
13297 else
13298 {
13300 }
13301
13302 }
13303 else
13304 {
13305 if (quantity >= 0)
13306 {
13307 item.SetQuantityNormalized(quantity, false);
13308 }
13309 else
13310 {
13312 }
13313
13314 }
13315 }
13316}
13317
13318#ifdef DEVELOPER
13320#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.