8423{
8425 {
8426 return true;
8427 }
8428};
8429
8431{
8432
8433};
8434
8435
8436
8438{
8442
8444
8447
8448
8449
8450
8451
8460
8466
8471
8476
8497 protected bool m_IsResultOfSplit
8498
8500
8505
8506
8507
8509
8513
8514
8515
8517
8520
8521
8522
8528
8529
8537
8540
8541
8543
8544
8546
8547
8552
8553
8558
8560
8561
8563
8564
8566 {
8571
8572 if (!
g_Game.IsDedicatedServer())
8573 {
8575 {
8577
8579 {
8581 }
8582 }
8583
8586 }
8587
8588 m_OldLocation = null;
8589
8591 {
8593 }
8594
8595 if (ConfigIsExisting("headSelectionsToHide"))
8596 {
8599 }
8600
8602 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8603 {
8605 }
8606
8608
8609 m_IsResultOfSplit = false;
8610
8612 }
8613
8615 {
8616 super.InitItemVariables();
8617
8623 m_Count = ConfigGetInt(
"count");
8624
8627
8632
8635
8640
8652
8656
8657
8660 if (ConfigIsExisting("canBeSplit"))
8661 {
8664 }
8665
8667 if (ConfigIsExisting("itemBehaviour"))
8669
8670
8673 RegisterNetSyncVariableInt("m_VarLiquidType");
8674 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8675
8676 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8677 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8678 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8679
8680 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8681 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8682 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8683 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8684
8685 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8686 RegisterNetSyncVariableBool("m_IsTakeable");
8687 RegisterNetSyncVariableBool("m_IsHologram");
8688
8691 {
8694 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8695 }
8696
8698
8700 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8702
8704 }
8705
8707 {
8709 }
8710
8712 {
8715 {
8720 }
8721 }
8722
8723 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8724 {
8726 {
8729 }
8730
8732 }
8733
8735 {
8741 }
8742
8744
8746 {
8748
8749 if (!action)
8750 {
8751 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8752 return;
8753 }
8754
8756 if (!ai)
8757 {
8759 return;
8760 }
8761
8763 if (!action_array)
8764 {
8765 action_array = new array<ActionBase_Basic>;
8767 }
8768 if (LogManager.IsActionLogEnable())
8769 {
8770 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8771 }
8772
8773 if (action_array.Find(action) != -1)
8774 {
8775 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8776 }
8777 else
8778 {
8779 action_array.Insert(action);
8780 }
8781 }
8782
8784 {
8785 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8786 ActionBase action = player.GetActionManager().GetAction(actionName);
8789
8790 if (action_array)
8791 {
8792 action_array.RemoveItem(action);
8793 }
8794 }
8795
8796
8797
8799 {
8800 ActionOverrideData overrideData = new ActionOverrideData();
8804
8806 if (!actionMap)
8807 {
8810 }
8811
8812 actionMap.Insert(this.
Type(), overrideData);
8813
8814 }
8815
8817
8819
8820
8822 {
8825
8828
8829 string config_to_search = "CfgVehicles";
8830 string muzzle_owner_config;
8831
8833 {
8834 if (IsInherited(Weapon))
8835 config_to_search = "CfgWeapons";
8836
8837 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8838
8839 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8840
8841 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8842
8843 if (config_OnFire_subclass_count > 0)
8844 {
8845 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8846
8847 for (int i = 0; i < config_OnFire_subclass_count; i++)
8848 {
8849 string particle_class = "";
8850 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8851 string config_OnFire_entry = config_OnFire_class + particle_class;
8852 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8853 WPOF_array.Insert(WPOF);
8854 }
8855
8856
8858 }
8859 }
8860
8862 {
8863 config_to_search = "CfgWeapons";
8864 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8865
8866 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8867
8868 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8869
8870 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8871 {
8872 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8873
8874 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8875 {
8876 string particle_class2 = "";
8877 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8878 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8879 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8880 WPOBE_array.Insert(WPOBE);
8881 }
8882
8883
8885 }
8886 }
8887 }
8888
8889
8891 {
8894
8896 {
8897 string config_to_search = "CfgVehicles";
8898
8899 if (IsInherited(Weapon))
8900 config_to_search = "CfgWeapons";
8901
8902 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8903 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8904
8905 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8906 {
8907
8909
8911 {
8913 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8915 return;
8916 }
8917
8920
8921
8922
8923 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8924 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8925
8926 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8927 {
8928 string particle_class = "";
8929 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8930 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8931 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8932
8933 if (entry_type == CT_CLASS)
8934 {
8935 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8936 WPOOH_array.Insert(WPOF);
8937 }
8938 }
8939
8940
8942 }
8943 }
8944 }
8945
8947 {
8949 }
8950
8952 {
8954 {
8956
8959
8962
8963 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8964 }
8965 }
8966
8968 {
8970 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8971
8973 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8974
8976 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8977
8979 {
8981 }
8982 }
8983
8985 {
8987 }
8988
8990 {
8993 else
8995
8997 {
9000 }
9001 else
9002 {
9005
9008 }
9009
9011 }
9012
9014 {
9016 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9017 }
9018
9020 {
9022 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9024 }
9025
9027 {
9029 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9030 }
9031
9033 {
9036
9037 OverheatingParticle OP = new OverheatingParticle();
9042
9044 }
9045
9047 {
9050
9051 return -1;
9052 }
9053
9055 {
9057 {
9060
9061 for (int i = count; i > 0; --i)
9062 {
9063 int id = i - 1;
9066
9069
9070 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9071 {
9072 if (p)
9073 {
9076 }
9077 }
9078 }
9079 }
9080 }
9081
9083 {
9085 {
9087 {
9088 int id = i - 1;
9090
9091 if (OP)
9092 {
9094
9095 if (p)
9096 {
9098 }
9099
9100 delete OP;
9101 }
9102 }
9103
9106 }
9107 }
9108
9111 {
9112 return 0.0;
9113 }
9114
9115
9117 {
9118 return 250;
9119 }
9120
9122 {
9123 return 0;
9124 }
9125
9128 {
9130 return true;
9131
9132 return false;
9133 }
9134
9137 {
9140
9142 {
9144 }
9145 else
9146 {
9147
9149 }
9150
9152 }
9153
9160 {
9161 return -1;
9162 }
9163
9164
9165
9166
9168 {
9170 {
9171 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9172 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9173
9174 if (r_index >= 0)
9175 {
9176 InventoryLocation r_il = new InventoryLocation;
9177 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9178
9179 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9182 {
9183 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9184 }
9186 {
9187 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9188 }
9189
9190 }
9191
9192 player.GetHumanInventory().ClearUserReservedLocation(this);
9193 }
9194
9197 }
9198
9199
9200
9201
9203 {
9204 return ItemBase.m_DebugActionsMask;
9205 }
9206
9208 {
9209 return ItemBase.m_DebugActionsMask & mask;
9210 }
9211
9213 {
9214 ItemBase.m_DebugActionsMask = mask;
9215 }
9216
9218 {
9219 ItemBase.m_DebugActionsMask |= mask;
9220 }
9221
9223 {
9224 ItemBase.m_DebugActionsMask &= ~mask;
9225 }
9226
9228 {
9230 {
9232 }
9233 else
9234 {
9236 }
9237 }
9238
9239
9241 {
9242 if (GetEconomyProfile())
9243 {
9244 float q_max = GetEconomyProfile().GetQuantityMax();
9245 if (q_max > 0)
9246 {
9247 float q_min = GetEconomyProfile().GetQuantityMin();
9248 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9249
9251 {
9252 ComponentEnergyManager comp = GetCompEM();
9254 {
9256 }
9257 }
9259 {
9261
9262 }
9263
9264 }
9265 }
9266 }
9267
9270 {
9271 EntityAI parent = GetHierarchyParent();
9272
9273 if (parent)
9274 {
9275 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9276 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9277 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9278 }
9279 }
9280
9283 {
9284 EntityAI parent = GetHierarchyParent();
9285
9286 if (parent)
9287 {
9288 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9289 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9290 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9291 }
9292 }
9293
9295 {
9296
9297
9298
9299
9301
9303 {
9304 if (ScriptInputUserData.CanStoreInputUserData())
9305 {
9306 ScriptInputUserData ctx = new ScriptInputUserData;
9312 ctx.
Write(use_stack_max);
9315
9317 {
9318 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9319 }
9320 }
9321 }
9322 else if (!
g_Game.IsMultiplayer())
9323 {
9325 }
9326 }
9327
9329 {
9331 }
9332
9334 {
9336 }
9337
9339 {
9341 }
9342
9344 {
9345
9346 return false;
9347 }
9348
9350 {
9351 return false;
9352 }
9353
9357 {
9358 return false;
9359 }
9360
9362 {
9363 return "";
9364 }
9365
9367
9369 {
9370 return false;
9371 }
9372
9374 {
9375 return true;
9376 }
9377
9378
9379
9381 {
9382 return true;
9383 }
9384
9386 {
9387 return true;
9388 }
9389
9391 {
9392 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9394 }
9395
9397 {
9399 }
9400
9402 {
9404 if (!is_being_placed)
9406 SetSynchDirty();
9407 }
9408
9409
9411
9413 {
9415 }
9416
9418 {
9420 }
9421
9423 {
9424 return 1;
9425 }
9426
9428 {
9429 return false;
9430 }
9431
9433 {
9435 SetSynchDirty();
9436 }
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9473 {
9474 super.OnMovedInsideCargo(container);
9475
9476 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9477 }
9478
9479 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9480 {
9481 super.EEItemLocationChanged(oldLoc, newLoc);
9482
9483 PlayerBase newPlayer = null;
9484 PlayerBase oldPlayer = null;
9485
9486 if (newLoc.GetParent())
9487 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9488
9489 if (oldLoc.GetParent())
9490 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9491
9493 {
9494 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9495
9496 if (rIndex >= 0)
9497 {
9498 InventoryLocation rIl = new InventoryLocation;
9499 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9500
9501 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9504 {
9505 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9506 }
9508 {
9510 }
9511
9512 }
9513 }
9514
9516 {
9517 if (newPlayer)
9518 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9519
9520 if (newPlayer == oldPlayer)
9521 {
9522 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9523 {
9525 {
9526 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9527 {
9528 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9529 }
9530 }
9531 else
9532 {
9533 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9534 }
9535 }
9536
9537 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9538 {
9539 int type = oldLoc.GetType();
9541 {
9542 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9543 }
9545 {
9546 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9547 }
9548 }
9549 if (!m_OldLocation)
9550 {
9551 m_OldLocation = new InventoryLocation;
9552 }
9553 m_OldLocation.Copy(oldLoc);
9554 }
9555 else
9556 {
9557 if (m_OldLocation)
9558 {
9559 m_OldLocation.Reset();
9560 }
9561 }
9562
9563 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9564 }
9565 else
9566 {
9567 if (newPlayer)
9568 {
9569 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9570 if (resIndex >= 0)
9571 {
9572 InventoryLocation il = new InventoryLocation;
9573 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9575 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9578 {
9579 il.
GetParent().GetOnReleaseLock().Invoke(it);
9580 }
9582 {
9584 }
9585
9586 }
9587 }
9589 {
9590
9592 }
9593
9594 if (m_OldLocation)
9595 {
9596 m_OldLocation.Reset();
9597 }
9598 }
9599
9601 {
9602 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9603 }
9604
9606 {
9607 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9608 }
9609 }
9610
9611 override void EOnContact(IEntity other, Contact extra)
9612 {
9614 {
9615 int liquidType = -1;
9617 if (impactSpeed > 0.0)
9618 {
9620 #ifndef SERVER
9622 #else
9624 SetSynchDirty();
9625 #endif
9627 }
9628 }
9629
9630 #ifdef SERVER
9631 if (GetCompEM() && GetCompEM().IsPlugged())
9632 {
9633 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9634 GetCompEM().UnplugThis();
9635 }
9636 #endif
9637 }
9638
9640
9642 {
9644 }
9645
9647 {
9648
9649 }
9650
9652 {
9653 super.OnItemLocationChanged(old_owner, new_owner);
9654
9655 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9656 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9657
9658 if (!relatedPlayer && playerNew)
9659 relatedPlayer = playerNew;
9660
9661 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9662 {
9664 if (actionMgr)
9665 {
9666 ActionBase currentAction = actionMgr.GetRunningAction();
9667 if (currentAction)
9669 }
9670 }
9671
9672 Man ownerPlayerOld = null;
9673 Man ownerPlayerNew = null;
9674
9675 if (old_owner)
9676 {
9677 if (old_owner.
IsMan())
9678 {
9679 ownerPlayerOld = Man.Cast(old_owner);
9680 }
9681 else
9682 {
9683 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9684 }
9685 }
9686 else
9687 {
9689 {
9691
9692 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9693 {
9694 GetCompEM().UnplugThis();
9695 }
9696 }
9697 }
9698
9699 if (new_owner)
9700 {
9701 if (new_owner.
IsMan())
9702 {
9703 ownerPlayerNew = Man.Cast(new_owner);
9704 }
9705 else
9706 {
9707 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9708 }
9709 }
9710
9711 if (ownerPlayerOld != ownerPlayerNew)
9712 {
9713 if (ownerPlayerOld)
9714 {
9715 array<EntityAI> subItemsExit = new array<EntityAI>;
9717 for (int i = 0; i < subItemsExit.Count(); i++)
9718 {
9721 }
9722 }
9723
9724 if (ownerPlayerNew)
9725 {
9726 array<EntityAI> subItemsEnter = new array<EntityAI>;
9728 for (int j = 0; j < subItemsEnter.Count(); j++)
9729 {
9732 }
9733 }
9734 }
9735 else if (ownerPlayerNew != null)
9736 {
9737 PlayerBase nplayer;
9738 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9739 {
9740 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9742 for (int k = 0; k < subItemsUpdate.Count(); k++)
9743 {
9745 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9746 }
9747 }
9748 }
9749
9750 if (old_owner)
9751 old_owner.OnChildItemRemoved(this);
9752 if (new_owner)
9753 new_owner.OnChildItemReceived(this);
9754 }
9755
9756
9758 {
9759 super.EEDelete(parent);
9760 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9761 if (player)
9762 {
9764
9765 if (player.IsAlive())
9766 {
9767 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9768 if (r_index >= 0)
9769 {
9770 InventoryLocation r_il = new InventoryLocation;
9771 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9772
9773 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9776 {
9777 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9778 }
9780 {
9781 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9782 }
9783
9784 }
9785
9786 player.RemoveQuickBarEntityShortcut(this);
9787 }
9788 }
9789 }
9790
9792 {
9793 super.EEKilled(killer);
9794
9797 {
9798 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9799 {
9800 if (IsMagazine())
9801 {
9802 if (Magazine.Cast(this).GetAmmoCount() > 0)
9803 {
9805 }
9806 }
9807 else
9808 {
9810 }
9811 }
9812 }
9813 }
9814
9816 {
9817 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9818
9819 super.OnWasAttached(parent, slot_id);
9820
9823
9826 }
9827
9829 {
9830 super.OnWasDetached(parent, slot_id);
9831
9834
9837 }
9838
9840 {
9841 int idx;
9844
9845 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9846 if (inventory_slots.Count() < 1)
9847 {
9848 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9849 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9850 }
9851 else
9852 {
9853 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9854 }
9855
9856 idx = inventory_slots.Find(slot);
9857 if (idx < 0)
9858 return "";
9859
9860 return attach_types.Get(idx);
9861 }
9862
9864 {
9865 int idx = -1;
9866 string slot;
9867
9870
9871 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9872 if (inventory_slots.Count() < 1)
9873 {
9874 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9875 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9876 }
9877 else
9878 {
9879 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9880 if (detach_types.Count() < 1)
9881 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9882 }
9883
9884 for (int i = 0; i < inventory_slots.Count(); i++)
9885 {
9886 slot = inventory_slots.Get(i);
9887 }
9888
9889 if (slot != "")
9890 {
9891 if (detach_types.Count() == 1)
9892 idx = 0;
9893 else
9894 idx = inventory_slots.Find(slot);
9895 }
9896 if (idx < 0)
9897 return "";
9898
9899 return detach_types.Get(idx);
9900 }
9901
9903 {
9904
9906
9907
9908 float min_time = 1;
9909 float max_time = 3;
9910 float delay = Math.RandomFloat(min_time, max_time);
9911
9912 explode_timer.Run(delay, this, "DoAmmoExplosion");
9913 }
9914
9916 {
9917 Magazine magazine = Magazine.Cast(this);
9918 int pop_sounds_count = 6;
9919 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9920
9921
9922 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9923 string sound_name = pop_sounds[ sound_idx ];
9924 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9925
9926
9927 magazine.ServerAddAmmoCount(-1);
9928
9929
9930 float min_temp_to_explode = 100;
9931
9932 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9933 {
9935 }
9936 }
9937
9938
9939 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9940 {
9941 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9942
9943 const int CHANCE_DAMAGE_CARGO = 4;
9944 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9945 const int CHANCE_DAMAGE_NOTHING = 2;
9946
9948 {
9949 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9950 int chances;
9951 int rnd;
9952
9953 if (GetInventory().GetCargo())
9954 {
9955 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9956 rnd = Math.RandomInt(0,chances);
9957
9958 if (rnd < CHANCE_DAMAGE_CARGO)
9959 {
9961 }
9962 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9963 {
9965 }
9966 }
9967 else
9968 {
9969 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9970 rnd = Math.RandomInt(0,chances);
9971
9972 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9973 {
9975 }
9976 }
9977 }
9978 }
9979
9981 {
9982 CargoBase cargo = GetInventory().GetCargo();
9983 if (cargo)
9984 {
9986 if (item_count > 0)
9987 {
9988 int random_pick = Math.RandomInt(0, item_count);
9990 if (!item.IsExplosive())
9991 {
9992 item.AddHealth("","",damage);
9993 return true;
9994 }
9995 }
9996 }
9997 return false;
9998 }
9999
10001 {
10002 GameInventory inventory = GetInventory();
10004 if (attachment_count > 0)
10005 {
10006 int random_pick = Math.RandomInt(0, attachment_count);
10008 if (!attachment.IsExplosive())
10009 {
10010 attachment.AddHealth("","",damage);
10011 return true;
10012 }
10013 }
10014 return false;
10015 }
10016
10018 {
10020 }
10021
10023 {
10025 return GetInventory().CanRemoveEntity();
10026
10027 return false;
10028 }
10029
10031 {
10032
10034 return false;
10035
10036
10038 return false;
10039
10040
10041
10043 if (delta == 0)
10044 return false;
10045
10046
10047 return true;
10048 }
10049
10051 {
10053 {
10054 if (ScriptInputUserData.CanStoreInputUserData())
10055 {
10056 ScriptInputUserData ctx = new ScriptInputUserData;
10061 ctx.
Write(destination_entity);
10063 ctx.
Write(slot_id);
10065 }
10066 }
10067 else if (!
g_Game.IsMultiplayer())
10068 {
10070 }
10071 }
10072
10074 {
10075 float split_quantity_new;
10079 InventoryLocation loc = new InventoryLocation;
10080
10081 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10082 {
10084 split_quantity_new = stack_max;
10085 else
10087
10089 {
10090 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10091 if (new_item)
10092 {
10093 new_item.SetResultOfSplit(true);
10094 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10096 new_item.
SetQuantity(split_quantity_new,
false,
true);
10097 }
10098 }
10099 }
10100 else if (destination_entity && slot_id == -1)
10101 {
10102 if (quantity > stack_max)
10103 split_quantity_new = stack_max;
10104 else
10105 split_quantity_new = quantity;
10106
10108 {
10109 GameInventory destinationInventory = destination_entity.GetInventory();
10111 {
10114 }
10115
10116 if (new_item)
10117 {
10118 new_item.SetResultOfSplit(true);
10119 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10121 new_item.
SetQuantity(split_quantity_new,
false,
true);
10122 }
10123 }
10124 }
10125 else
10126 {
10127 if (stack_max != 0)
10128 {
10130 {
10132 }
10133
10134 if (split_quantity_new == 0)
10135 {
10136 if (!
g_Game.IsMultiplayer())
10137 player.PhysicalPredictiveDropItem(this);
10138 else
10139 player.ServerDropEntity(this);
10140 return;
10141 }
10142
10144 {
10146
10147 if (new_item)
10148 {
10149 new_item.SetResultOfSplit(true);
10150 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10153 new_item.PlaceOnSurface();
10154 }
10155 }
10156 }
10157 }
10158 }
10159
10161 {
10162 float split_quantity_new;
10166 InventoryLocation loc = new InventoryLocation;
10167
10168 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10169 {
10171 split_quantity_new = stack_max;
10172 else
10174
10176 {
10177 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10178 if (new_item)
10179 {
10180 new_item.SetResultOfSplit(true);
10181 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10183 new_item.
SetQuantity(split_quantity_new,
false,
true);
10184 }
10185 }
10186 }
10187 else if (destination_entity && slot_id == -1)
10188 {
10189 if (quantity > stack_max)
10190 split_quantity_new = stack_max;
10191 else
10192 split_quantity_new = quantity;
10193
10195 {
10196 GameInventory destinationInventory = destination_entity.GetInventory();
10198 {
10201 }
10202
10203 if (new_item)
10204 {
10205 new_item.SetResultOfSplit(true);
10206 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10208 new_item.
SetQuantity(split_quantity_new,
false,
true);
10209 }
10210 }
10211 }
10212 else
10213 {
10214 if (stack_max != 0)
10215 {
10217 {
10219 }
10220
10222 {
10224
10225 if (new_item)
10226 {
10227 new_item.SetResultOfSplit(true);
10228 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10231 new_item.PlaceOnSurface();
10232 }
10233 }
10234 }
10235 }
10236 }
10237
10239 {
10241 {
10242 if (ScriptInputUserData.CanStoreInputUserData())
10243 {
10244 ScriptInputUserData ctx = new ScriptInputUserData;
10249 dst.WriteToContext(ctx);
10251 }
10252 }
10253 else if (!
g_Game.IsMultiplayer())
10254 {
10256 }
10257 }
10258
10260 {
10262 {
10263 if (ScriptInputUserData.CanStoreInputUserData())
10264 {
10265 ScriptInputUserData ctx = new ScriptInputUserData;
10270 ctx.
Write(destination_entity);
10276 }
10277 }
10278 else if (!
g_Game.IsMultiplayer())
10279 {
10281 }
10282 }
10283
10285 {
10287 }
10288
10290 {
10292 float split_quantity_new;
10294 if (dst.IsValid())
10295 {
10296 int slot_id = dst.GetSlot();
10298
10299 if (quantity > stack_max)
10300 split_quantity_new = stack_max;
10301 else
10302 split_quantity_new = quantity;
10303
10305 {
10307
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 return new_item;
10317 }
10318 }
10319
10320 return null;
10321 }
10322
10324 {
10326 float split_quantity_new;
10328 if (destination_entity)
10329 {
10331 if (quantity > stackable)
10332 split_quantity_new = stackable;
10333 else
10334 split_quantity_new = quantity;
10335
10337 {
10338 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10339 if (new_item)
10340 {
10341 new_item.SetResultOfSplit(true);
10342 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10344 new_item.
SetQuantity(split_quantity_new,
false,
true);
10345 }
10346 }
10347 }
10348 }
10349
10351 {
10353 {
10354 if (ScriptInputUserData.CanStoreInputUserData())
10355 {
10356 ScriptInputUserData ctx = new ScriptInputUserData;
10361 ItemBase destination_entity =
this;
10362 ctx.
Write(destination_entity);
10366 }
10367 }
10368 else if (!
g_Game.IsMultiplayer())
10369 {
10371 }
10372 }
10373
10375 {
10377 float split_quantity_new;
10379 if (player)
10380 {
10382 if (quantity > stackable)
10383 split_quantity_new = stackable;
10384 else
10385 split_quantity_new = quantity;
10386
10388 {
10389 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10390 new_item =
ItemBase.Cast(in_hands);
10391 if (new_item)
10392 {
10393 new_item.SetResultOfSplit(true);
10394 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10396 new_item.SetQuantity(split_quantity_new, false, true);
10397 }
10398 }
10399 }
10400 }
10401
10403 {
10405 float split_quantity_new = Math.Floor(quantity * 0.5);
10406
10408 return;
10409
10411
10412 if (new_item)
10413 {
10414 if (new_item.GetQuantityMax() < split_quantity_new)
10415 {
10416 split_quantity_new = new_item.GetQuantityMax();
10417 }
10418
10419 new_item.SetResultOfSplit(true);
10420 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10421
10423 {
10426 }
10427 else
10428 {
10430 new_item.
SetQuantity(split_quantity_new,
false,
true);
10431 }
10432 }
10433 }
10434
10436 {
10438 float split_quantity_new = Math.Floor(quantity / 2);
10439
10441 return;
10442
10443 InventoryLocation invloc = new InventoryLocation;
10445
10447 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10448
10449 if (new_item)
10450 {
10451 if (new_item.GetQuantityMax() < split_quantity_new)
10452 {
10453 split_quantity_new = new_item.GetQuantityMax();
10454 }
10456 {
10459 }
10460 else if (split_quantity_new > 1)
10461 {
10463 new_item.
SetQuantity(split_quantity_new,
false,
true);
10464 }
10465 }
10466 }
10467
10470 {
10471 SetWeightDirty();
10473
10474 if (parent)
10475 parent.OnAttachmentQuantityChangedEx(this, delta);
10476
10478 {
10480 {
10482 }
10484 {
10485 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10487 }
10488 }
10489 }
10490
10493 {
10494
10495 }
10496
10499 {
10501 }
10502
10504 {
10505 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10506
10508 {
10509 if (newLevel == GameConstants.STATE_RUINED)
10510 {
10512 EntityAI parent = GetHierarchyParent();
10513 if (parent && parent.IsFireplace())
10514 {
10515 CargoBase cargo = GetInventory().GetCargo();
10516 if (cargo)
10517 {
10519 {
10521 }
10522 }
10523 }
10524 }
10525
10527 {
10528
10530 return;
10531 }
10532
10533 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10534 {
10536 }
10537 }
10538 }
10539
10540
10542 {
10543 super.OnRightClick();
10544
10546 {
10548 {
10549 if (ScriptInputUserData.CanStoreInputUserData())
10550 {
10551 EntityAI root = GetHierarchyRoot();
10552 Man playerOwner = GetHierarchyRootPlayer();
10553 InventoryLocation dst = new InventoryLocation;
10554
10555
10556 if (!playerOwner && root && root == this)
10557 {
10559 }
10560 else
10561 {
10562
10563 GetInventory().GetCurrentInventoryLocation(dst);
10565 {
10566 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10568 {
10570 }
10571 else
10572 {
10574
10575
10576 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10577 {
10579 }
10580 else
10581 {
10582 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10583 }
10584 }
10585 }
10586 }
10587
10588 ScriptInputUserData ctx = new ScriptInputUserData;
10596 }
10597 }
10598 else if (!
g_Game.IsMultiplayer())
10599 {
10601 }
10602 }
10603 }
10604
10606 {
10607 if (root)
10608 {
10609 vector m4[4];
10610 root.GetTransform(m4);
10611 dst.SetGround(this, m4);
10612 }
10613 else
10614 {
10615 GetInventory().GetCurrentInventoryLocation(dst);
10616 }
10617 }
10618
10619 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10620 {
10621
10622 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10623 return false;
10624
10625 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10626 return false;
10627
10628
10630 return false;
10631
10632
10633 Magazine mag = Magazine.Cast(this);
10634 if (mag)
10635 {
10636 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10637 return false;
10638
10639 if (stack_max_limit)
10640 {
10641 Magazine other_mag = Magazine.Cast(other_item);
10642 if (other_item)
10643 {
10644 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10645 return false;
10646 }
10647
10648 }
10649 }
10650 else
10651 {
10652
10654 return false;
10655
10657 return false;
10658 }
10659
10660 PlayerBase player = null;
10661 if (CastTo(player, GetHierarchyRootPlayer()))
10662 {
10663 if (player.GetInventory().HasAttachment(this))
10664 return false;
10665
10666 if (player.IsItemsToDelete())
10667 return false;
10668 }
10669
10670 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10671 return false;
10672
10673 int slotID;
10675 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10676 return false;
10677
10678 return true;
10679 }
10680
10682 {
10684 }
10685
10687 {
10688 return m_IsResultOfSplit;
10689 }
10690
10692 {
10693 m_IsResultOfSplit = value;
10694 }
10695
10697 {
10699 }
10700
10702 {
10703 float other_item_quantity = other_item.GetQuantity();
10704 float this_free_space;
10705
10707
10709
10710 if (other_item_quantity > this_free_space)
10711 {
10712 return this_free_space;
10713 }
10714 else
10715 {
10716 return other_item_quantity;
10717 }
10718 }
10719
10721 {
10723 }
10724
10726 {
10728 return;
10729
10730 if (!IsMagazine() && other_item)
10731 {
10733 if (quantity_used != 0)
10734 {
10735 float hp1 = GetHealth01("","");
10736 float hp2 = other_item.GetHealth01("","");
10737 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10738 hpResult = hpResult / (
GetQuantity() + quantity_used);
10739
10740 hpResult *= GetMaxHealth();
10741 Math.Round(hpResult);
10742 SetHealth("", "Health", hpResult);
10743
10745 other_item.AddQuantity(-quantity_used);
10746 }
10747 }
10749 }
10750
10752 {
10753 #ifdef SERVER
10754 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10755 GetHierarchyParent().IncreaseLifetimeUp();
10756 #endif
10757 };
10758
10760 {
10761 PlayerBase p = PlayerBase.Cast(player);
10762
10763 array<int> recipesIds = p.m_Recipes;
10764 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10765 if (moduleRecipesManager)
10766 {
10767 EntityAI itemInHands = player.GetEntityInHands();
10768 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10769 }
10770
10771 for (int i = 0;i < recipesIds.Count(); i++)
10772 {
10773 int key = recipesIds.Get(i);
10774 string recipeName = moduleRecipesManager.GetRecipeName(key);
10776 }
10777 }
10778
10779
10780 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10781 {
10782 super.GetDebugActions(outputList);
10783
10784
10790
10791
10796
10801
10802
10806
10807
10809 {
10813 }
10814
10817
10818
10822
10824
10825 InventoryLocation loc = new InventoryLocation();
10826 GetInventory().GetCurrentInventoryLocation(loc);
10828 {
10829 if (Gizmo_IsSupported())
10832 }
10833
10835 }
10836
10837
10838
10839
10841 {
10842 super.OnAction(action_id, player, ctx);
10843
10845 {
10846 switch (action_id)
10847 {
10851 return true;
10855 return true;
10856 }
10857 }
10858
10860 {
10861 switch (action_id)
10862 {
10864 Delete();
10865 return true;
10866 }
10867 }
10868
10869 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10870 {
10871 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10872 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10873 PlayerBase p = PlayerBase.Cast(player);
10874 if (
EActions.RECIPES_RANGE_START < 1000)
10875 {
10876 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10877 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10878 }
10879 }
10880 #ifndef SERVER
10881 else if (action_id ==
EActions.WATCH_PLAYER)
10882 {
10883 PluginDeveloper.SetDeveloperItemClientEx(player);
10884 }
10885 #endif
10887 {
10888 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10889 {
10890 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10891 OnDebugButtonPressServer(id + 1);
10892 }
10893
10894 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10895 {
10896 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10898 }
10899
10900 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10901 {
10902 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10904 }
10905
10906 else if (action_id ==
EActions.ADD_QUANTITY)
10907 {
10908 if (IsMagazine())
10909 {
10910 Magazine mag = Magazine.Cast(this);
10911 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10912 }
10913 else
10914 {
10916 }
10917
10918 if (m_EM)
10919 {
10920 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10921 }
10922
10923 }
10924
10925 else if (action_id ==
EActions.REMOVE_QUANTITY)
10926 {
10927 if (IsMagazine())
10928 {
10929 Magazine mag2 = Magazine.Cast(this);
10930 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10931 }
10932 else
10933 {
10935 }
10936 if (m_EM)
10937 {
10938 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10939 }
10940
10941 }
10942
10943 else if (action_id ==
EActions.SET_QUANTITY_0)
10944 {
10946
10947 if (m_EM)
10948 {
10949 m_EM.SetEnergy(0);
10950 }
10951 }
10952
10953 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10954 {
10956
10957 if (m_EM)
10958 {
10959 m_EM.SetEnergy(m_EM.GetEnergyMax());
10960 }
10961 }
10962
10963 else if (action_id ==
EActions.ADD_HEALTH)
10964 {
10965 AddHealth("","",GetMaxHealth("","Health")/5);
10966 }
10967 else if (action_id ==
EActions.REMOVE_HEALTH)
10968 {
10969 AddHealth("","",-GetMaxHealth("","Health")/5);
10970 }
10971 else if (action_id ==
EActions.DESTROY_HEALTH)
10972 {
10973 SetHealth01("","",0);
10974 }
10975 else if (action_id ==
EActions.WATCH_ITEM)
10976 {
10978 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10979 #ifdef DEVELOPER
10980 SetDebugDeveloper_item(this);
10981 #endif
10982 }
10983
10984 else if (action_id ==
EActions.ADD_TEMPERATURE)
10985 {
10986 AddTemperature(20);
10987
10988 }
10989
10990 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10991 {
10992 AddTemperature(-20);
10993
10994 }
10995
10996 else if (action_id ==
EActions.FLIP_FROZEN)
10997 {
10998 SetFrozen(!GetIsFrozen());
10999
11000 }
11001
11002 else if (action_id ==
EActions.ADD_WETNESS)
11003 {
11005
11006 }
11007
11008 else if (action_id ==
EActions.REMOVE_WETNESS)
11009 {
11011
11012 }
11013
11014 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11015 {
11018
11019
11020 }
11021
11022 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11023 {
11026 }
11027
11028 else if (action_id ==
EActions.MAKE_SPECIAL)
11029 {
11030 auto debugParams = DebugSpawnParams.WithPlayer(player);
11031 OnDebugSpawnEx(debugParams);
11032 }
11033
11034 }
11035
11036
11037 return false;
11038 }
11039
11040
11041
11042
11046
11049
11050
11051
11053 {
11054 return false;
11055 }
11056
11057
11059 {
11060 return true;
11061 }
11062
11063
11065 {
11066 return true;
11067 }
11068
11069
11070
11072 {
11073 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11074 return g_Game.ConfigIsExisting(config_path);
11075 }
11076
11079 {
11080 return null;
11081 }
11082
11084 {
11085 return false;
11086 }
11087
11089 {
11090 return false;
11091 }
11092
11096
11097
11099 {
11100 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11101 return module_repairing.CanRepair(this, item_repair_kit);
11102 }
11103
11104
11105 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11106 {
11107 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11108 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11109 }
11110
11111
11113 {
11114
11115
11116
11117
11118
11119
11120
11121
11122 return 1;
11123 }
11124
11125
11126
11128 {
11130 }
11131
11132
11133
11135 {
11137 }
11138
11139
11148 {
11149 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11150
11151 if (player)
11152 {
11153 player.MessageStatus(text);
11154 }
11155 }
11156
11157
11166 {
11167 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11168
11169 if (player)
11170 {
11171 player.MessageAction(text);
11172 }
11173 }
11174
11175
11184 {
11185 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11186
11187 if (player)
11188 {
11189 player.MessageFriendly(text);
11190 }
11191 }
11192
11193
11202 {
11203 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11204
11205 if (player)
11206 {
11207 player.MessageImportant(text);
11208 }
11209 }
11210
11212 {
11213 return true;
11214 }
11215
11216
11217 override bool KindOf(
string tag)
11218 {
11219 bool found = false;
11220 string item_name = this.
GetType();
11222 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11223
11224 int array_size = item_tag_array.Count();
11225 for (int i = 0; i < array_size; i++)
11226 {
11227 if (item_tag_array.Get(i) == tag)
11228 {
11229 found = true;
11230 break;
11231 }
11232 }
11233 return found;
11234 }
11235
11236
11238 {
11239
11240 super.OnRPC(sender, rpc_type,ctx);
11241
11242
11243 switch (rpc_type)
11244 {
11245 #ifndef SERVER
11246 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11247 Param2<bool, string> p = new Param2<bool, string>(false, "");
11248
11250 return;
11251
11252 bool play = p.param1;
11253 string soundSet = p.param2;
11254
11255 if (play)
11256 {
11258 {
11260 {
11262 }
11263 }
11264 else
11265 {
11267 }
11268 }
11269 else
11270 {
11272 }
11273
11274 break;
11275 #endif
11276
11277 }
11278
11280 {
11282 }
11283 }
11284
11285
11286
11287
11289 {
11290 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11291 return plugin.GetID(
name);
11292 }
11293
11295 {
11296 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11297 return plugin.GetName(id);
11298 }
11299
11302 {
11303
11304
11305 int varFlags;
11306 if (!ctx.
Read(varFlags))
11307 return;
11308
11309 if (varFlags & ItemVariableFlags.FLOAT)
11310 {
11312 }
11313 }
11314
11316 {
11317
11318 super.SerializeNumericalVars(floats_out);
11319
11320
11321
11323 {
11325 }
11326
11328 {
11330 }
11331
11333 {
11335 }
11336
11338 {
11343 }
11344
11346 {
11348 }
11349 }
11350
11352 {
11353
11354 super.DeSerializeNumericalVars(floats);
11355
11356
11357 int index = 0;
11358 int mask = Math.Round(floats.Get(index));
11359
11360 index++;
11361
11363 {
11365 {
11367 }
11368 else
11369 {
11370 float quantity = floats.Get(index);
11371 SetQuantity(quantity,
true,
false,
false,
false);
11372 }
11373 index++;
11374 }
11375
11377 {
11378 float wet = floats.Get(index);
11380 index++;
11381 }
11382
11384 {
11385 int liquidtype = Math.Round(floats.Get(index));
11387 index++;
11388 }
11389
11391 {
11393 index++;
11395 index++;
11397 index++;
11399 index++;
11400 }
11401
11403 {
11404 int cleanness = Math.Round(floats.Get(index));
11406 index++;
11407 }
11408 }
11409
11411 {
11412 super.WriteVarsToCTX(ctx);
11413
11414
11416 {
11418 }
11419
11421 {
11423 }
11424
11426 {
11428 }
11429
11431 {
11432 int r,g,b,a;
11438 }
11439
11441 {
11443 }
11444 }
11445
11447 {
11448 if (!super.ReadVarsFromCTX(ctx,version))
11449 return false;
11450
11451 int intValue;
11452 float value;
11453
11454 if (version < 140)
11455 {
11456 if (!ctx.
Read(intValue))
11457 return false;
11458
11459 m_VariablesMask = intValue;
11460 }
11461
11463 {
11464 if (!ctx.
Read(value))
11465 return false;
11466
11468 {
11470 }
11471 else
11472 {
11474 }
11475 }
11476
11477 if (version < 140)
11478 {
11480 {
11481 if (!ctx.
Read(value))
11482 return false;
11483 SetTemperatureDirect(value);
11484 }
11485 }
11486
11488 {
11489 if (!ctx.
Read(value))
11490 return false;
11492 }
11493
11495 {
11496 if (!ctx.
Read(intValue))
11497 return false;
11499 }
11500
11502 {
11503 int r,g,b,a;
11505 return false;
11507 return false;
11509 return false;
11511 return false;
11512
11514 }
11515
11517 {
11518 if (!ctx.
Read(intValue))
11519 return false;
11521 }
11522
11523 if (version >= 138 && version < 140)
11524 {
11526 {
11527 if (!ctx.
Read(intValue))
11528 return false;
11529 SetFrozen(intValue);
11530 }
11531 }
11532
11533 return true;
11534 }
11535
11536
11538 {
11541 {
11543 }
11544
11545 if (!super.OnStoreLoad(ctx, version))
11546 {
11548 return false;
11549 }
11550
11551 if (version >= 114)
11552 {
11553 bool hasQuickBarIndexSaved;
11554
11555 if (!ctx.
Read(hasQuickBarIndexSaved))
11556 {
11558 return false;
11559 }
11560
11561 if (hasQuickBarIndexSaved)
11562 {
11563 int itmQBIndex;
11564
11565
11566 if (!ctx.
Read(itmQBIndex))
11567 {
11569 return false;
11570 }
11571
11572 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11573 if (itmQBIndex != -1 && parentPlayer)
11574 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11575 }
11576 }
11577 else
11578 {
11579
11580 PlayerBase player;
11581 int itemQBIndex;
11582 if (version ==
int.
MAX)
11583 {
11584 if (!ctx.
Read(itemQBIndex))
11585 {
11587 return false;
11588 }
11589 }
11590 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11591 {
11592
11593 if (!ctx.
Read(itemQBIndex))
11594 {
11596 return false;
11597 }
11598 if (itemQBIndex != -1 && player)
11599 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11600 }
11601 }
11602
11603 if (version < 140)
11604 {
11605
11606 if (!LoadVariables(ctx, version))
11607 {
11609 return false;
11610 }
11611 }
11612
11613
11615 {
11617 return false;
11618 }
11619 if (version >= 132)
11620 {
11622 if (raib)
11623 {
11625 {
11627 return false;
11628 }
11629 }
11630 }
11631
11633 return true;
11634 }
11635
11636
11637
11639 {
11640 super.OnStoreSave(ctx);
11641
11642 PlayerBase player;
11643 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11644 {
11646
11647 int itemQBIndex = -1;
11648 itemQBIndex = player.FindQuickBarEntityIndex(this);
11649 ctx.
Write(itemQBIndex);
11650 }
11651 else
11652 {
11654 }
11655
11657
11659 if (raib)
11660 {
11662 }
11663 }
11664
11665
11667 {
11668 super.AfterStoreLoad();
11669
11671 {
11673 }
11674
11676 {
11679 }
11680 }
11681
11683 {
11684 super.EEOnAfterLoad();
11685
11687 {
11689 }
11690
11693 }
11694
11696 {
11697 return false;
11698 }
11699
11700
11701
11703 {
11705 {
11706 #ifdef PLATFORM_CONSOLE
11707
11709 {
11711 if (menu)
11712 {
11714 }
11715 }
11716 #endif
11717 }
11718
11720 {
11723 }
11724
11726 {
11727 SetWeightDirty();
11729 }
11731 {
11734 }
11735
11737 {
11740
11743 }
11745 {
11749 }
11750
11751 super.OnVariablesSynchronized();
11752 }
11753
11754
11755
11757 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11758 {
11759 if (!IsServerCheck(allow_client))
11760 return false;
11761
11763 return false;
11764
11767
11768 if (value <= (min + 0.001))
11769 value = min;
11770
11771 if (value == min)
11772 {
11773 if (destroy_config)
11774 {
11775 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11776 if (dstr)
11777 {
11779 this.Delete();
11780 return true;
11781 }
11782 }
11783 else if (destroy_forced)
11784 {
11786 this.Delete();
11787 return true;
11788 }
11789
11791 }
11792
11795
11797 {
11798 EntityAI parent = GetHierarchyRoot();
11799 InventoryLocation iLoc = new InventoryLocation();
11800 GetInventory().GetCurrentInventoryLocation(iLoc);
11802 {
11803 int iLocSlot = iLoc.
GetSlot();
11805 {
11807 }
11809 {
11811 }
11812 }
11813 }
11814
11816 {
11818
11819 if (delta)
11821 }
11822
11824
11825 return false;
11826 }
11827
11828
11830 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11831 {
11833 }
11834
11836 {
11839 }
11840
11842 {
11845 }
11846
11848 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11849 {
11850 float value_clamped = Math.Clamp(value, 0, 1);
11852 SetQuantity(result, destroy_config, destroy_forced);
11853 }
11854
11855
11858 {
11860 }
11861
11863 {
11865 }
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11877 {
11878 int slot = -1;
11879 GameInventory inventory = GetInventory();
11880 if (inventory)
11881 {
11882 InventoryLocation il = new InventoryLocation;
11885 }
11886
11888 }
11889
11891 {
11892 float quantity_max = 0;
11893
11895 {
11896 if (attSlotID != -1)
11897 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11898
11899 if (quantity_max <= 0)
11901 }
11902
11903 if (quantity_max <= 0)
11905
11906 return quantity_max;
11907 }
11908
11910 {
11912 }
11913
11915 {
11917 }
11918
11919
11921 {
11923 }
11924
11926 {
11928 }
11929
11931 {
11933 }
11934
11935
11937 {
11938
11939 float weightEx = GetWeightEx();
11940 float special = GetInventoryAndCargoWeight();
11941 return weightEx - special;
11942 }
11943
11944
11946 {
11948 }
11949
11951 {
11953 {
11954 #ifdef DEVELOPER
11955 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11956 {
11957 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11959 }
11960 #endif
11961
11962 return GetQuantity() * GetConfigWeightModified();
11963 }
11964 else if (HasEnergyManager())
11965 {
11966 #ifdef DEVELOPER
11967 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11968 {
11969 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11970 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11971 }
11972 #endif
11973 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11974 }
11975 else
11976 {
11977 #ifdef DEVELOPER
11978 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11979 {
11980 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11981 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11982 }
11983 #endif
11984 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11985 }
11986 }
11987
11990 {
11991 int item_count = 0;
11993
11994 GameInventory inventory = GetInventory();
11995 CargoBase cargo = inventory.
GetCargo();
11996 if (cargo != NULL)
11997 {
11999 }
12000
12002 for (int i = 0; i < nAttachments; ++i)
12003 {
12005 if (item)
12006 item_count += item.GetNumberOfItems();
12007 }
12008 return item_count;
12009 }
12010
12013 {
12014 float weight = 0;
12015 float wetness = 1;
12016 if (include_wetness)
12019 {
12020 weight = wetness * m_ConfigWeight;
12021 }
12023 {
12024 weight = 1;
12025 }
12026 return weight;
12027 }
12028
12029
12030
12032 {
12033 GameInventory inventory = GetInventory();
12034 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12035 {
12036 array<EntityAI> items = new array<EntityAI>;
12038 for (int i = 0; i < items.Count(); ++i)
12039 {
12041 if (item)
12042 {
12043 g_Game.ObjectDelete(item);
12044 }
12045 }
12046 }
12047 }
12048
12049
12050
12051
12053 {
12054 float energy = 0;
12055 if (HasEnergyManager())
12056 {
12057 energy = GetCompEM().GetEnergy();
12058 }
12059 return energy;
12060 }
12061
12062
12064 {
12065 super.OnEnergyConsumed();
12066
12068 }
12069
12071 {
12072 super.OnEnergyAdded();
12073
12075 }
12076
12077
12079 {
12080 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12081 {
12083 {
12084 float energy_0to1 = GetCompEM().GetEnergy0To1();
12086 }
12087 }
12088 }
12089
12090
12092 {
12093 return ConfigGetFloat("heatIsolation");
12094 }
12095
12097 {
12099 }
12100
12102 {
12103 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12104 if (
g_Game.ConfigIsExisting(paramPath))
12105 return g_Game.ConfigGetFloat(paramPath);
12106
12107 return 0.0;
12108 }
12109
12111 {
12112 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12113 if (
g_Game.ConfigIsExisting(paramPath))
12114 return g_Game.ConfigGetFloat(paramPath);
12115
12116 return 0.0;
12117 }
12118
12119 override void SetWet(
float value,
bool allow_client =
false)
12120 {
12121 if (!IsServerCheck(allow_client))
12122 return;
12123
12126
12128
12129 m_VarWet = Math.Clamp(value, min, max);
12130
12132 {
12135 }
12136 }
12137
12138 override void AddWet(
float value)
12139 {
12141 }
12142
12144 {
12146 }
12147
12149 {
12151 }
12152
12154 {
12156 }
12157
12159 {
12161 }
12162
12164 {
12166 }
12167
12168 override void OnWetChanged(
float newVal,
float oldVal)
12169 {
12172 if (newLevel != oldLevel)
12173 {
12175 }
12176 }
12177
12179 {
12180 SetWeightDirty();
12181 }
12182
12184 {
12185 return GetWetLevelInternal(
m_VarWet);
12186 }
12187
12188
12189
12191 {
12193 }
12194
12196 {
12198 }
12199
12201 {
12203 }
12204
12206 {
12208 }
12209
12210
12211
12213 {
12214 if (ConfigIsExisting("itemModelLength"))
12215 {
12216 return ConfigGetFloat("itemModelLength");
12217 }
12218 return 0;
12219 }
12220
12222 {
12223 if (ConfigIsExisting("itemAttachOffset"))
12224 {
12225 return ConfigGetFloat("itemAttachOffset");
12226 }
12227 return 0;
12228 }
12229
12230 override void SetCleanness(
int value,
bool allow_client =
false)
12231 {
12232 if (!IsServerCheck(allow_client))
12233 return;
12234
12236
12238
12241 }
12242
12244 {
12246 }
12247
12249 {
12250 return true;
12251 }
12252
12253
12254
12255
12257 {
12259 }
12260
12262 {
12264 }
12265
12266
12267
12268
12269 override void SetColor(
int r,
int g,
int b,
int a)
12270 {
12276 }
12278 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12279 {
12284 }
12285
12287 {
12289 }
12290
12293 {
12294 int r,g,b,a;
12296 r = r/255;
12297 g = g/255;
12298 b = b/255;
12299 a = a/255;
12300 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12301 }
12302
12303
12304
12305 override void SetLiquidType(
int value,
bool allow_client =
false)
12306 {
12307 if (!IsServerCheck(allow_client))
12308 return;
12309
12314 }
12315
12317 {
12318 return ConfigGetInt("varLiquidTypeInit");
12319 }
12320
12322 {
12324 }
12325
12327 {
12329 SetFrozen(false);
12330 }
12331
12334 {
12335 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12336 }
12337
12338
12341 {
12342 PlayerBase nplayer;
12343 if (PlayerBase.CastTo(nplayer, player))
12344 {
12346 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12347 }
12348 }
12349
12350
12353 {
12354 PlayerBase nplayer;
12355 if (PlayerBase.CastTo(nplayer,player))
12356 {
12357 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12358 }
12359
12360 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12361
12362 if (HasEnergyManager())
12363 {
12364 GetCompEM().UpdatePlugState();
12365 }
12366 }
12367
12368
12370 {
12371 super.OnPlacementStarted(player);
12372
12374 }
12375
12376 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12377 {
12379 {
12380 m_AdminLog.OnPlacementComplete(player,
this);
12381 }
12382
12383 super.OnPlacementComplete(player, position, orientation);
12384 }
12385
12386
12387
12388
12389
12391 {
12393 {
12394 return true;
12395 }
12396 else
12397 {
12398 return false;
12399 }
12400 }
12401
12402
12404 {
12406 {
12408 }
12409 }
12410
12411
12413 {
12415 }
12416
12418 {
12420 }
12421
12422 override void InsertAgent(
int agent,
float count = 1)
12423 {
12424 if (count < 1)
12425 return;
12426
12428 }
12429
12432 {
12434 }
12435
12436
12438 {
12440 }
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12484 {
12486 return false;
12487 return true;
12488 }
12489
12491 {
12492
12494 }
12495
12496
12499 {
12500 super.CheckForRoofLimited(timeTresholdMS);
12501
12502 float time =
g_Game.GetTime();
12503 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12504 {
12505 m_PreviousRoofTestTime = time;
12506 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12507 }
12508 }
12509
12510
12512 {
12514 {
12515 return 0;
12516 }
12517
12518 if (GetInventory().GetAttachmentSlotsCount() != 0)
12519 {
12520 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12521 if (filter)
12522 return filter.GetProtectionLevel(type, false, system);
12523 else
12524 return 0;
12525 }
12526
12527 string subclassPath, entryName;
12528
12529 switch (type)
12530 {
12532 entryName = "biological";
12533 break;
12535 entryName = "chemical";
12536 break;
12537 default:
12538 entryName = "biological";
12539 break;
12540 }
12541
12542 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12543
12544 return g_Game.ConfigGetFloat(subclassPath + entryName);
12545 }
12546
12547
12548
12551 {
12552 if (!IsMagazine())
12554
12556 }
12557
12558
12559
12560
12561
12566 {
12567 return true;
12568 }
12569
12571 {
12573 }
12574
12575
12576
12577
12578
12580 {
12581 if (parent)
12582 {
12583 if (parent.IsInherited(DayZInfected))
12584 return true;
12585
12586 if (!parent.IsRuined())
12587 return true;
12588 }
12589
12590 return true;
12591 }
12592
12594 {
12595 if (!super.CanPutAsAttachment(parent))
12596 {
12597 return false;
12598 }
12599
12600 if (!IsRuined() && !parent.IsRuined())
12601 {
12602 return true;
12603 }
12604
12605 return false;
12606 }
12607
12609 {
12610
12611
12612
12613
12614 return super.CanReceiveItemIntoCargo(item);
12615 }
12616
12618 {
12619
12620
12621
12622
12623 GameInventory attachmentInv = attachment.GetInventory();
12625 {
12626 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12627 return false;
12628 }
12629
12630 InventoryLocation loc = new InventoryLocation();
12631 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12632 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12633 return false;
12634
12635 return super.CanReceiveAttachment(attachment, slotId);
12636 }
12637
12639 {
12640 if (!super.CanReleaseAttachment(attachment))
12641 return false;
12642
12643 return GetInventory().AreChildrenAccessible();
12644 }
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12667 {
12668 int id = muzzle_owner.GetMuzzleID();
12669 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12670
12671 if (WPOF_array)
12672 {
12673 for (int i = 0; i < WPOF_array.Count(); i++)
12674 {
12675 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12676
12677 if (WPOF)
12678 {
12679 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12680 }
12681 }
12682 }
12683 }
12684
12685
12687 {
12688 int id = muzzle_owner.GetMuzzleID();
12690
12691 if (WPOBE_array)
12692 {
12693 for (int i = 0; i < WPOBE_array.Count(); i++)
12694 {
12695 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12696
12697 if (WPOBE)
12698 {
12699 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12700 }
12701 }
12702 }
12703 }
12704
12705
12707 {
12708 int id = muzzle_owner.GetMuzzleID();
12709 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12710
12711 if (WPOOH_array)
12712 {
12713 for (int i = 0; i < WPOOH_array.Count(); i++)
12714 {
12715 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12716
12717 if (WPOOH)
12718 {
12719 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12720 }
12721 }
12722 }
12723 }
12724
12725
12727 {
12728 int id = muzzle_owner.GetMuzzleID();
12729 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12730
12731 if (WPOOH_array)
12732 {
12733 for (int i = 0; i < WPOOH_array.Count(); i++)
12734 {
12735 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12736
12737 if (WPOOH)
12738 {
12739 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12740 }
12741 }
12742 }
12743 }
12744
12745
12747 {
12748 int id = muzzle_owner.GetMuzzleID();
12749 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12750
12751 if (WPOOH_array)
12752 {
12753 for (int i = 0; i < WPOOH_array.Count(); i++)
12754 {
12755 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12756
12757 if (WPOOH)
12758 {
12759 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12760 }
12761 }
12762 }
12763 }
12764
12765
12766
12768 {
12770 {
12771 return true;
12772 }
12773
12774 return false;
12775 }
12776
12778 {
12780 {
12781 return true;
12782 }
12783
12784 return false;
12785 }
12786
12788 {
12790 {
12791 return true;
12792 }
12793
12794 return false;
12795 }
12796
12798 {
12799 return false;
12800 }
12801
12804 {
12805 return UATimeSpent.DEFAULT_DEPLOY;
12806 }
12807
12808
12809
12810
12812 {
12814 SetSynchDirty();
12815 }
12816
12818 {
12820 }
12821
12822
12824 {
12825 return false;
12826 }
12827
12830 {
12831 string att_type = "None";
12832
12833 if (ConfigIsExisting("soundAttType"))
12834 {
12835 att_type = ConfigGetString("soundAttType");
12836 }
12837
12839 }
12840
12842 {
12844 }
12845
12846
12847
12848
12849
12855
12857 {
12860
12862 }
12863
12864
12866 {
12868 return;
12869
12871
12874
12877
12878 SoundParameters params = new SoundParameters();
12882 }
12883
12884
12886 {
12888 {
12891
12892 SetSynchDirty();
12893
12896 }
12897 }
12898
12900 {
12902 }
12903
12904
12906 {
12908 return;
12909
12911 SetSynchDirty();
12912
12915 }
12916
12918 {
12921 }
12922
12924 {
12926 }
12927
12928 void OnApply(PlayerBase player);
12929
12931 {
12932 return 1.0;
12933 };
12934
12936 {
12938 }
12939
12941 {
12943 }
12944
12946
12948 {
12949 SetDynamicPhysicsLifeTime(0.01);
12951 }
12952
12954 {
12955 array<string> zone_names = new array<string>;
12956 GetDamageZones(zone_names);
12957 for (int i = 0; i < zone_names.Count(); i++)
12958 {
12959 SetHealthMax(zone_names.Get(i),"Health");
12960 }
12961 SetHealthMax("","Health");
12962 }
12963
12966 {
12967 float global_health = GetHealth01("","Health");
12968 array<string> zones = new array<string>;
12969 GetDamageZones(zones);
12970
12971 for (int i = 0; i < zones.Count(); i++)
12972 {
12973 SetHealth01(zones.Get(i),"Health",global_health);
12974 }
12975 }
12976
12979 {
12980 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12981 }
12982
12984 {
12985 if (!hasRootAsPlayer)
12986 {
12987 if (refParentIB)
12988 {
12989
12990 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12991 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12992
12993 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12994 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12995
12998 }
12999 else
13000 {
13001
13004 }
13005 }
13006 }
13007
13009 {
13011 {
13012 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13013 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13014 {
13015 float heatPermCoef = 1.0;
13017 while (ent)
13018 {
13019 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13020 ent = ent.GetHierarchyParent();
13021 }
13022
13023 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13024 }
13025 }
13026 }
13027
13029 {
13030
13031 EntityAI parent = GetHierarchyParent();
13032 if (!parent)
13033 {
13034 hasParent = false;
13035 hasRootAsPlayer = false;
13036 }
13037 else
13038 {
13039 hasParent = true;
13040 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13041 refParentIB =
ItemBase.Cast(parent);
13042 }
13043 }
13044
13045 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13046 {
13047
13048 }
13049
13051 {
13052
13053 return false;
13054 }
13055
13057 {
13058
13059
13060 return false;
13061 }
13062
13064 {
13065
13066 return false;
13067 }
13068
13071 {
13072 return !GetIsFrozen() &&
IsOpen();
13073 }
13074
13076 {
13077 bool hasParent = false, hasRootAsPlayer = false;
13079
13080 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13081 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13082
13083 if (wwtu || foodDecay)
13084 {
13088
13089 if (processWetness || processTemperature || processDecay)
13090 {
13092
13093 if (processWetness)
13094 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13095
13096 if (processTemperature)
13098
13099 if (processDecay)
13100 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13101 }
13102 }
13103 }
13104
13107 {
13109 }
13110
13112 {
13115
13116 return super.GetTemperatureFreezeThreshold();
13117 }
13118
13120 {
13123
13124 return super.GetTemperatureThawThreshold();
13125 }
13126
13128 {
13131
13132 return super.GetItemOverheatThreshold();
13133 }
13134
13136 {
13138 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13139
13140 return super.GetTemperatureFreezeTime();
13141 }
13142
13144 {
13146 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13147
13148 return super.GetTemperatureThawTime();
13149 }
13150
13155
13157 {
13158 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13159 }
13160
13162 {
13163 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13164 }
13165
13168 {
13170 }
13171
13173 {
13175 }
13176
13178 {
13180 }
13181
13184 {
13185 return null;
13186 }
13187
13190 {
13191 return false;
13192 }
13193
13195 {
13197 {
13200 if (!trg)
13201 {
13203 explosive = this;
13204 }
13205
13206 explosive.PairRemote(trg);
13208
13209 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13210 trg.SetPersistentPairID(persistentID);
13211 explosive.SetPersistentPairID(persistentID);
13212
13213 return true;
13214 }
13215 return false;
13216 }
13217
13220 {
13221 float ret = 1.0;
13224 ret *= GetHealth01();
13225
13226 return ret;
13227 }
13228
13229 #ifdef DEVELOPER
13230 override void SetDebugItem()
13231 {
13232 super.SetDebugItem();
13233 _itemBase = this;
13234 }
13235
13237 {
13238 string text = super.GetDebugText();
13239
13241 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13242
13243 return text;
13244 }
13245 #endif
13246
13248 {
13249 return true;
13250 }
13251
13253
13255
13257 {
13260 }
13261
13262
13270
13286
13287 [
Obsolete(
"Use ItemSoundHandler instead")]
13290 {
13291 if (!
g_Game.IsDedicatedServer())
13292 {
13293 if (ConfigIsExisting("attachSoundSet"))
13294 {
13295 string cfg_path = "";
13296 string soundset = "";
13297 string type_name =
GetType();
13298
13301 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13302 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13303
13304 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13305 {
13306 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13307 {
13308 if (cfg_slot_array[i] == slot_type)
13309 {
13310 soundset = cfg_soundset_array[i];
13311 break;
13312 }
13313 }
13314 }
13315
13316 if (soundset != "")
13317 {
13318 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13320 }
13321 }
13322 }
13323 }
13324
13326}
13327
13329{
13331 if (entity)
13332 {
13333 bool is_item = entity.IsInherited(
ItemBase);
13334 if (is_item && full_quantity)
13335 {
13338 }
13339 }
13340 else
13341 {
13343 return NULL;
13344 }
13345 return entity;
13346}
13347
13349{
13350 if (item)
13351 {
13352 if (health > 0)
13353 item.SetHealth("", "", health);
13354
13355 if (item.CanHaveTemperature())
13356 {
13358 if (item.CanFreeze())
13359 item.SetFrozen(false);
13360 }
13361
13362 if (item.HasEnergyManager())
13363 {
13364 if (quantity >= 0)
13365 {
13366 item.GetCompEM().SetEnergy0To1(quantity);
13367 }
13368 else
13369 {
13371 }
13372 }
13373 else if (item.IsMagazine())
13374 {
13375 Magazine mag = Magazine.Cast(item);
13376 if (quantity >= 0)
13377 {
13378 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13379 }
13380 else
13381 {
13383 }
13384
13385 }
13386 else
13387 {
13388 if (quantity >= 0)
13389 {
13390 item.SetQuantityNormalized(quantity, false);
13391 }
13392 else
13393 {
13395 }
13396
13397 }
13398 }
13399}
13400
13401#ifdef DEVELOPER
13403#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.