8428{
8430 {
8431 return true;
8432 }
8433};
8434
8436{
8437
8438};
8439
8440
8441
8443{
8447
8449
8452
8453
8454
8455
8456
8465
8471
8476
8481
8502 protected bool m_IsResultOfSplit
8503
8505
8510
8511
8512
8514
8518
8519
8520
8522
8525
8526
8527
8533
8534
8542
8545
8546
8548
8549
8551
8552
8557
8558
8563
8565
8566
8568
8569
8571 {
8576
8577 if (!
g_Game.IsDedicatedServer())
8578 {
8580 {
8582
8584 {
8586 }
8587 }
8588
8591 }
8592
8593 m_OldLocation = null;
8594
8596 {
8598 }
8599
8600 if (ConfigIsExisting("headSelectionsToHide"))
8601 {
8604 }
8605
8607 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8608 {
8610 }
8611
8613
8614 m_IsResultOfSplit = false;
8615
8617 }
8618
8620 {
8621 super.InitItemVariables();
8622
8628 m_Count = ConfigGetInt(
"count");
8629
8632
8637
8640
8645
8657
8661
8662
8665 if (ConfigIsExisting("canBeSplit"))
8666 {
8669 }
8670
8672 if (ConfigIsExisting("itemBehaviour"))
8674
8675
8678 RegisterNetSyncVariableInt("m_VarLiquidType");
8679 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8680
8681 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8682 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8683 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8684
8685 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8686 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8687 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8688 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8689
8690 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8691 RegisterNetSyncVariableBool("m_IsTakeable");
8692 RegisterNetSyncVariableBool("m_IsHologram");
8693
8696 {
8699 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8700 }
8701
8703
8705 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8707
8709 }
8710
8712 {
8714 }
8715
8717 {
8720 {
8725 }
8726 }
8727
8728 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8729 {
8731 {
8734 }
8735
8737 }
8738
8740 {
8746 }
8747
8749
8751 {
8753
8754 if (!action)
8755 {
8756 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8757 return;
8758 }
8759
8761 if (!ai)
8762 {
8764 return;
8765 }
8766
8768 if (!action_array)
8769 {
8770 action_array = new array<ActionBase_Basic>;
8772 }
8773 if (LogManager.IsActionLogEnable())
8774 {
8775 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8776 }
8777
8778 if (action_array.Find(action) != -1)
8779 {
8780 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8781 }
8782 else
8783 {
8784 action_array.Insert(action);
8785 }
8786 }
8787
8789 {
8790 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8791 ActionBase action = player.GetActionManager().GetAction(actionName);
8794
8795 if (action_array)
8796 {
8797 action_array.RemoveItem(action);
8798 }
8799 }
8800
8801
8802
8804 {
8805 ActionOverrideData overrideData = new ActionOverrideData();
8809
8811 if (!actionMap)
8812 {
8815 }
8816
8817 actionMap.Insert(this.
Type(), overrideData);
8818
8819 }
8820
8822
8824
8825
8827 {
8830
8833
8834 string config_to_search = "CfgVehicles";
8835 string muzzle_owner_config;
8836
8838 {
8839 if (IsInherited(Weapon))
8840 config_to_search = "CfgWeapons";
8841
8842 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8843
8844 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8845
8846 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8847
8848 if (config_OnFire_subclass_count > 0)
8849 {
8850 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8851
8852 for (int i = 0; i < config_OnFire_subclass_count; i++)
8853 {
8854 string particle_class = "";
8855 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8856 string config_OnFire_entry = config_OnFire_class + particle_class;
8857 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8858 WPOF_array.Insert(WPOF);
8859 }
8860
8861
8863 }
8864 }
8865
8867 {
8868 config_to_search = "CfgWeapons";
8869 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8870
8871 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8872
8873 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8874
8875 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8876 {
8877 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8878
8879 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8880 {
8881 string particle_class2 = "";
8882 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8883 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8884 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8885 WPOBE_array.Insert(WPOBE);
8886 }
8887
8888
8890 }
8891 }
8892 }
8893
8894
8896 {
8899
8901 {
8902 string config_to_search = "CfgVehicles";
8903
8904 if (IsInherited(Weapon))
8905 config_to_search = "CfgWeapons";
8906
8907 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8908 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8909
8910 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8911 {
8912
8914
8916 {
8918 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8920 return;
8921 }
8922
8925
8926
8927
8928 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8929 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8930
8931 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8932 {
8933 string particle_class = "";
8934 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8935 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8936 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8937
8938 if (entry_type == CT_CLASS)
8939 {
8940 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8941 WPOOH_array.Insert(WPOF);
8942 }
8943 }
8944
8945
8947 }
8948 }
8949 }
8950
8952 {
8954 }
8955
8957 {
8959 {
8961
8964
8967
8968 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8969 }
8970 }
8971
8973 {
8975 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8976
8978 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8979
8981 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8982
8984 {
8986 }
8987 }
8988
8990 {
8992 }
8993
8995 {
8998 else
9000
9002 {
9005 }
9006 else
9007 {
9010
9013 }
9014
9016 }
9017
9019 {
9021 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9022 }
9023
9025 {
9027 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9029 }
9030
9032 {
9034 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9035 }
9036
9038 {
9041
9042 OverheatingParticle OP = new OverheatingParticle();
9047
9049 }
9050
9052 {
9055
9056 return -1;
9057 }
9058
9060 {
9062 {
9065
9066 for (int i = count; i > 0; --i)
9067 {
9068 int id = i - 1;
9071
9074
9075 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9076 {
9077 if (p)
9078 {
9081 }
9082 }
9083 }
9084 }
9085 }
9086
9088 {
9090 {
9092 {
9093 int id = i - 1;
9095
9096 if (OP)
9097 {
9099
9100 if (p)
9101 {
9103 }
9104
9105 delete OP;
9106 }
9107 }
9108
9111 }
9112 }
9113
9116 {
9117 return 0.0;
9118 }
9119
9120
9122 {
9123 return 250;
9124 }
9125
9127 {
9128 return 0;
9129 }
9130
9133 {
9135 return true;
9136
9137 return false;
9138 }
9139
9142 {
9145
9147 {
9149 }
9150 else
9151 {
9152
9154 }
9155
9157 }
9158
9165 {
9166 return -1;
9167 }
9168
9169
9170
9171
9173 {
9175 {
9176 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9177 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9178
9179 if (r_index >= 0)
9180 {
9181 InventoryLocation r_il = new InventoryLocation;
9182 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9183
9184 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9187 {
9188 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9189 }
9191 {
9192 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9193 }
9194
9195 }
9196
9197 player.GetHumanInventory().ClearUserReservedLocation(this);
9198 }
9199
9202 }
9203
9204
9205
9206
9208 {
9209 return ItemBase.m_DebugActionsMask;
9210 }
9211
9213 {
9214 return ItemBase.m_DebugActionsMask & mask;
9215 }
9216
9218 {
9219 ItemBase.m_DebugActionsMask = mask;
9220 }
9221
9223 {
9224 ItemBase.m_DebugActionsMask |= mask;
9225 }
9226
9228 {
9229 ItemBase.m_DebugActionsMask &= ~mask;
9230 }
9231
9233 {
9235 {
9237 }
9238 else
9239 {
9241 }
9242 }
9243
9244
9246 {
9247 if (GetEconomyProfile())
9248 {
9249 float q_max = GetEconomyProfile().GetQuantityMax();
9250 if (q_max > 0)
9251 {
9252 float q_min = GetEconomyProfile().GetQuantityMin();
9253 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9254
9256 {
9257 ComponentEnergyManager comp = GetCompEM();
9259 {
9261 }
9262 }
9264 {
9266
9267 }
9268
9269 }
9270 }
9271 }
9272
9275 {
9276 EntityAI parent = GetHierarchyParent();
9277
9278 if (parent)
9279 {
9280 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9281 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9282 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9283 }
9284 }
9285
9288 {
9289 EntityAI parent = GetHierarchyParent();
9290
9291 if (parent)
9292 {
9293 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9294 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9295 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9296 }
9297 }
9298
9300 {
9301
9302
9303
9304
9306
9308 {
9309 if (ScriptInputUserData.CanStoreInputUserData())
9310 {
9311 ScriptInputUserData ctx = new ScriptInputUserData;
9317 ctx.
Write(use_stack_max);
9320
9322 {
9323 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9324 }
9325 }
9326 }
9327 else if (!
g_Game.IsMultiplayer())
9328 {
9330 }
9331 }
9332
9334 {
9336 }
9337
9339 {
9341 }
9342
9344 {
9346 }
9347
9349 {
9350
9351 return false;
9352 }
9353
9355 {
9356 return false;
9357 }
9358
9362 {
9363 return false;
9364 }
9365
9367 {
9368 return "";
9369 }
9370
9372
9374 {
9375 return false;
9376 }
9377
9379 {
9380 return true;
9381 }
9382
9383
9384
9386 {
9387 return true;
9388 }
9389
9391 {
9392 return true;
9393 }
9394
9396 {
9397 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9399 }
9400
9402 {
9404 }
9405
9407 {
9409 if (!is_being_placed)
9411 SetSynchDirty();
9412 }
9413
9414
9416
9418 {
9420 }
9421
9423 {
9425 }
9426
9428 {
9429 return 1;
9430 }
9431
9433 {
9434 return false;
9435 }
9436
9438 {
9440 SetSynchDirty();
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
9472
9473
9474
9475
9476
9478 {
9479 super.OnMovedInsideCargo(container);
9480
9481 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9482 }
9483
9484 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9485 {
9486 super.EEItemLocationChanged(oldLoc, newLoc);
9487
9488 PlayerBase newPlayer = null;
9489 PlayerBase oldPlayer = null;
9490
9491 if (newLoc.GetParent())
9492 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9493
9494 if (oldLoc.GetParent())
9495 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9496
9498 {
9499 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9500
9501 if (rIndex >= 0)
9502 {
9503 InventoryLocation rIl = new InventoryLocation;
9504 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9505
9506 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9509 {
9510 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9511 }
9513 {
9515 }
9516
9517 }
9518 }
9519
9521 {
9522 if (newPlayer)
9523 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9524
9525 if (newPlayer == oldPlayer)
9526 {
9527 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9528 {
9530 {
9531 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9532 {
9533 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9534 }
9535 }
9536 else
9537 {
9538 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9539 }
9540 }
9541
9542 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9543 {
9544 int type = oldLoc.GetType();
9546 {
9547 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9548 }
9550 {
9551 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9552 }
9553 }
9554 if (!m_OldLocation)
9555 {
9556 m_OldLocation = new InventoryLocation;
9557 }
9558 m_OldLocation.Copy(oldLoc);
9559 }
9560 else
9561 {
9562 if (m_OldLocation)
9563 {
9564 m_OldLocation.Reset();
9565 }
9566 }
9567
9568 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9569 }
9570 else
9571 {
9572 if (newPlayer)
9573 {
9574 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9575 if (resIndex >= 0)
9576 {
9577 InventoryLocation il = new InventoryLocation;
9578 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9580 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9583 {
9584 il.
GetParent().GetOnReleaseLock().Invoke(it);
9585 }
9587 {
9589 }
9590
9591 }
9592 }
9594 {
9595
9597 }
9598
9599 if (m_OldLocation)
9600 {
9601 m_OldLocation.Reset();
9602 }
9603 }
9604
9606 {
9607 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9608 }
9609
9611 {
9612 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9613 }
9614 }
9615
9616 override void EOnContact(IEntity other, Contact extra)
9617 {
9619 {
9620 int liquidType = -1;
9622 if (impactSpeed > 0.0)
9623 {
9625 #ifndef SERVER
9627 #else
9629 SetSynchDirty();
9630 #endif
9632 }
9633 }
9634
9635 #ifdef SERVER
9636 if (GetCompEM() && GetCompEM().IsPlugged())
9637 {
9638 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9639 GetCompEM().UnplugThis();
9640 }
9641 #endif
9642 }
9643
9645
9647 {
9649 }
9650
9652 {
9653
9654 }
9655
9657 {
9658 super.OnItemLocationChanged(old_owner, new_owner);
9659
9660 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9661 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9662
9663 if (!relatedPlayer && playerNew)
9664 relatedPlayer = playerNew;
9665
9666 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9667 {
9669 if (actionMgr)
9670 {
9671 ActionBase currentAction = actionMgr.GetRunningAction();
9672 if (currentAction)
9674 }
9675 }
9676
9677 Man ownerPlayerOld = null;
9678 Man ownerPlayerNew = null;
9679
9680 if (old_owner)
9681 {
9682 if (old_owner.
IsMan())
9683 {
9684 ownerPlayerOld = Man.Cast(old_owner);
9685 }
9686 else
9687 {
9688 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9689 }
9690 }
9691 else
9692 {
9694 {
9696
9697 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9698 {
9699 GetCompEM().UnplugThis();
9700 }
9701 }
9702 }
9703
9704 if (new_owner)
9705 {
9706 if (new_owner.
IsMan())
9707 {
9708 ownerPlayerNew = Man.Cast(new_owner);
9709 }
9710 else
9711 {
9712 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9713 }
9714 }
9715
9716 if (ownerPlayerOld != ownerPlayerNew)
9717 {
9718 if (ownerPlayerOld)
9719 {
9720 array<EntityAI> subItemsExit = new array<EntityAI>;
9722 for (int i = 0; i < subItemsExit.Count(); i++)
9723 {
9726 }
9727 }
9728
9729 if (ownerPlayerNew)
9730 {
9731 array<EntityAI> subItemsEnter = new array<EntityAI>;
9733 for (int j = 0; j < subItemsEnter.Count(); j++)
9734 {
9737 }
9738 }
9739 }
9740 else if (ownerPlayerNew != null)
9741 {
9742 PlayerBase nplayer;
9743 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9744 {
9745 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9747 for (int k = 0; k < subItemsUpdate.Count(); k++)
9748 {
9750 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9751 }
9752 }
9753 }
9754
9755 if (old_owner)
9756 old_owner.OnChildItemRemoved(this);
9757 if (new_owner)
9758 new_owner.OnChildItemReceived(this);
9759 }
9760
9761
9763 {
9764 super.EEDelete(parent);
9765 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9766 if (player)
9767 {
9769
9770 if (player.IsAlive())
9771 {
9772 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9773 if (r_index >= 0)
9774 {
9775 InventoryLocation r_il = new InventoryLocation;
9776 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9777
9778 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9781 {
9782 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9783 }
9785 {
9786 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9787 }
9788
9789 }
9790
9791 player.RemoveQuickBarEntityShortcut(this);
9792 }
9793 }
9794 }
9795
9797 {
9798 super.EEKilled(killer);
9799
9802 {
9803 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9804 {
9805 if (IsMagazine())
9806 {
9807 if (Magazine.Cast(this).GetAmmoCount() > 0)
9808 {
9810 }
9811 }
9812 else
9813 {
9815 }
9816 }
9817 }
9818 }
9819
9821 {
9822 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9823
9824 super.OnWasAttached(parent, slot_id);
9825
9828
9831 }
9832
9834 {
9835 super.OnWasDetached(parent, slot_id);
9836
9839
9842 }
9843
9845 {
9846 int idx;
9849
9850 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9851 if (inventory_slots.Count() < 1)
9852 {
9853 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9854 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9855 }
9856 else
9857 {
9858 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9859 }
9860
9861 idx = inventory_slots.Find(slot);
9862 if (idx < 0)
9863 return "";
9864
9865 return attach_types.Get(idx);
9866 }
9867
9869 {
9870 int idx = -1;
9871 string slot;
9872
9875
9876 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9877 if (inventory_slots.Count() < 1)
9878 {
9879 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9880 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9881 }
9882 else
9883 {
9884 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9885 if (detach_types.Count() < 1)
9886 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9887 }
9888
9889 for (int i = 0; i < inventory_slots.Count(); i++)
9890 {
9891 slot = inventory_slots.Get(i);
9892 }
9893
9894 if (slot != "")
9895 {
9896 if (detach_types.Count() == 1)
9897 idx = 0;
9898 else
9899 idx = inventory_slots.Find(slot);
9900 }
9901 if (idx < 0)
9902 return "";
9903
9904 return detach_types.Get(idx);
9905 }
9906
9908 {
9909
9911
9912
9913 float min_time = 1;
9914 float max_time = 3;
9915 float delay = Math.RandomFloat(min_time, max_time);
9916
9917 explode_timer.Run(delay, this, "DoAmmoExplosion");
9918 }
9919
9921 {
9922 Magazine magazine = Magazine.Cast(this);
9923 int pop_sounds_count = 6;
9924 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9925
9926
9927 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9928 string sound_name = pop_sounds[ sound_idx ];
9929 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9930
9931
9932 magazine.ServerAddAmmoCount(-1);
9933
9934
9935 float min_temp_to_explode = 100;
9936
9937 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9938 {
9940 }
9941 }
9942
9943
9944 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9945 {
9946 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9947
9948 const int CHANCE_DAMAGE_CARGO = 4;
9949 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9950 const int CHANCE_DAMAGE_NOTHING = 2;
9951
9953 {
9954 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9955 int chances;
9956 int rnd;
9957
9958 if (GetInventory().GetCargo())
9959 {
9960 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9961 rnd = Math.RandomInt(0,chances);
9962
9963 if (rnd < CHANCE_DAMAGE_CARGO)
9964 {
9966 }
9967 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9968 {
9970 }
9971 }
9972 else
9973 {
9974 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9975 rnd = Math.RandomInt(0,chances);
9976
9977 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9978 {
9980 }
9981 }
9982 }
9983 }
9984
9986 {
9987 CargoBase cargo = GetInventory().GetCargo();
9988 if (cargo)
9989 {
9991 if (item_count > 0)
9992 {
9993 int random_pick = Math.RandomInt(0, item_count);
9995 if (!item.IsExplosive())
9996 {
9997 item.AddHealth("","",damage);
9998 return true;
9999 }
10000 }
10001 }
10002 return false;
10003 }
10004
10006 {
10007 GameInventory inventory = GetInventory();
10009 if (attachment_count > 0)
10010 {
10011 int random_pick = Math.RandomInt(0, attachment_count);
10013 if (!attachment.IsExplosive())
10014 {
10015 attachment.AddHealth("","",damage);
10016 return true;
10017 }
10018 }
10019 return false;
10020 }
10021
10023 {
10025 }
10026
10028 {
10030 return GetInventory().CanRemoveEntity();
10031
10032 return false;
10033 }
10034
10036 {
10037
10039 return false;
10040
10041
10043 return false;
10044
10045
10046
10048 if (delta == 0)
10049 return false;
10050
10051
10052 return true;
10053 }
10054
10056 {
10058 {
10059 if (ScriptInputUserData.CanStoreInputUserData())
10060 {
10061 ScriptInputUserData ctx = new ScriptInputUserData;
10066 ctx.
Write(destination_entity);
10068 ctx.
Write(slot_id);
10070 }
10071 }
10072 else if (!
g_Game.IsMultiplayer())
10073 {
10075 }
10076 }
10077
10079 {
10080 float split_quantity_new;
10084 InventoryLocation loc = new InventoryLocation;
10085
10086 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10087 {
10089 split_quantity_new = stack_max;
10090 else
10092
10094 {
10095 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10096 if (new_item)
10097 {
10098 new_item.SetResultOfSplit(true);
10099 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10101 new_item.
SetQuantity(split_quantity_new,
false,
true);
10102 }
10103 }
10104 }
10105 else if (destination_entity && slot_id == -1)
10106 {
10107 if (quantity > stack_max)
10108 split_quantity_new = stack_max;
10109 else
10110 split_quantity_new = quantity;
10111
10113 {
10114 GameInventory destinationInventory = destination_entity.GetInventory();
10116 {
10119 }
10120
10121 if (new_item)
10122 {
10123 new_item.SetResultOfSplit(true);
10124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10126 new_item.
SetQuantity(split_quantity_new,
false,
true);
10127 }
10128 }
10129 }
10130 else
10131 {
10132 if (stack_max != 0)
10133 {
10135 {
10137 }
10138
10139 if (split_quantity_new == 0)
10140 {
10141 if (!
g_Game.IsMultiplayer())
10142 player.PhysicalPredictiveDropItem(this);
10143 else
10144 player.ServerDropEntity(this);
10145 return;
10146 }
10147
10149 {
10151
10152 if (new_item)
10153 {
10154 new_item.SetResultOfSplit(true);
10155 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10158 new_item.PlaceOnSurface();
10159 }
10160 }
10161 }
10162 }
10163 }
10164
10166 {
10167 float split_quantity_new;
10171 InventoryLocation loc = new InventoryLocation;
10172
10173 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10174 {
10176 split_quantity_new = stack_max;
10177 else
10179
10181 {
10182 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10183 if (new_item)
10184 {
10185 new_item.SetResultOfSplit(true);
10186 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10188 new_item.
SetQuantity(split_quantity_new,
false,
true);
10189 }
10190 }
10191 }
10192 else if (destination_entity && slot_id == -1)
10193 {
10194 if (quantity > stack_max)
10195 split_quantity_new = stack_max;
10196 else
10197 split_quantity_new = quantity;
10198
10200 {
10201 GameInventory destinationInventory = destination_entity.GetInventory();
10203 {
10206 }
10207
10208 if (new_item)
10209 {
10210 new_item.SetResultOfSplit(true);
10211 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10213 new_item.
SetQuantity(split_quantity_new,
false,
true);
10214 }
10215 }
10216 }
10217 else
10218 {
10219 if (stack_max != 0)
10220 {
10222 {
10224 }
10225
10227 {
10229
10230 if (new_item)
10231 {
10232 new_item.SetResultOfSplit(true);
10233 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10236 new_item.PlaceOnSurface();
10237 }
10238 }
10239 }
10240 }
10241 }
10242
10244 {
10246 {
10247 if (ScriptInputUserData.CanStoreInputUserData())
10248 {
10249 ScriptInputUserData ctx = new ScriptInputUserData;
10254 dst.WriteToContext(ctx);
10256 }
10257 }
10258 else if (!
g_Game.IsMultiplayer())
10259 {
10261 }
10262 }
10263
10265 {
10267 {
10268 if (ScriptInputUserData.CanStoreInputUserData())
10269 {
10270 ScriptInputUserData ctx = new ScriptInputUserData;
10275 ctx.
Write(destination_entity);
10281 }
10282 }
10283 else if (!
g_Game.IsMultiplayer())
10284 {
10286 }
10287 }
10288
10290 {
10292 }
10293
10295 {
10297 float split_quantity_new;
10299 if (dst.IsValid())
10300 {
10301 int slot_id = dst.GetSlot();
10303
10304 if (quantity > stack_max)
10305 split_quantity_new = stack_max;
10306 else
10307 split_quantity_new = quantity;
10308
10310 {
10312
10313 if (new_item)
10314 {
10315 new_item.SetResultOfSplit(true);
10316 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10318 new_item.
SetQuantity(split_quantity_new,
false,
true);
10319 }
10320
10321 return new_item;
10322 }
10323 }
10324
10325 return null;
10326 }
10327
10329 {
10331 float split_quantity_new;
10333 if (destination_entity)
10334 {
10336 if (quantity > stackable)
10337 split_quantity_new = stackable;
10338 else
10339 split_quantity_new = quantity;
10340
10342 {
10343 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10344 if (new_item)
10345 {
10346 new_item.SetResultOfSplit(true);
10347 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10349 new_item.
SetQuantity(split_quantity_new,
false,
true);
10350 }
10351 }
10352 }
10353 }
10354
10356 {
10358 {
10359 if (ScriptInputUserData.CanStoreInputUserData())
10360 {
10361 ScriptInputUserData ctx = new ScriptInputUserData;
10366 ItemBase destination_entity =
this;
10367 ctx.
Write(destination_entity);
10371 }
10372 }
10373 else if (!
g_Game.IsMultiplayer())
10374 {
10376 }
10377 }
10378
10380 {
10382 float split_quantity_new;
10384 if (player)
10385 {
10387 if (quantity > stackable)
10388 split_quantity_new = stackable;
10389 else
10390 split_quantity_new = quantity;
10391
10393 {
10394 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10395 new_item =
ItemBase.Cast(in_hands);
10396 if (new_item)
10397 {
10398 new_item.SetResultOfSplit(true);
10399 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10401 new_item.SetQuantity(split_quantity_new, false, true);
10402 }
10403 }
10404 }
10405 }
10406
10408 {
10410 float split_quantity_new = Math.Floor(quantity * 0.5);
10411
10413 return;
10414
10416
10417 if (new_item)
10418 {
10419 if (new_item.GetQuantityMax() < split_quantity_new)
10420 {
10421 split_quantity_new = new_item.GetQuantityMax();
10422 }
10423
10424 new_item.SetResultOfSplit(true);
10425 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10426
10428 {
10431 }
10432 else
10433 {
10435 new_item.
SetQuantity(split_quantity_new,
false,
true);
10436 }
10437 }
10438 }
10439
10441 {
10443 float split_quantity_new = Math.Floor(quantity / 2);
10444
10446 return;
10447
10448 InventoryLocation invloc = new InventoryLocation;
10450
10452 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10453
10454 if (new_item)
10455 {
10456 if (new_item.GetQuantityMax() < split_quantity_new)
10457 {
10458 split_quantity_new = new_item.GetQuantityMax();
10459 }
10461 {
10464 }
10465 else if (split_quantity_new > 1)
10466 {
10468 new_item.
SetQuantity(split_quantity_new,
false,
true);
10469 }
10470 }
10471 }
10472
10475 {
10476 SetWeightDirty();
10478
10479 if (parent)
10480 parent.OnAttachmentQuantityChangedEx(this, delta);
10481
10483 {
10485 {
10487 }
10489 {
10490 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10492 }
10493 }
10494 }
10495
10498 {
10499
10500 }
10501
10504 {
10506 }
10507
10509 {
10510 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10511
10513 {
10514 if (newLevel == GameConstants.STATE_RUINED)
10515 {
10517 EntityAI parent = GetHierarchyParent();
10518 if (parent && parent.IsFireplace())
10519 {
10520 CargoBase cargo = GetInventory().GetCargo();
10521 if (cargo)
10522 {
10524 {
10526 }
10527 }
10528 }
10529 }
10530
10532 {
10533
10535 return;
10536 }
10537
10538 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10539 {
10541 }
10542 }
10543 }
10544
10545
10547 {
10548 super.OnRightClick();
10549
10551 {
10553 {
10554 if (ScriptInputUserData.CanStoreInputUserData())
10555 {
10556 EntityAI root = GetHierarchyRoot();
10557 Man playerOwner = GetHierarchyRootPlayer();
10558 InventoryLocation dst = new InventoryLocation;
10559
10560
10561 if (!playerOwner && root && root == this)
10562 {
10564 }
10565 else
10566 {
10567
10568 GetInventory().GetCurrentInventoryLocation(dst);
10570 {
10571 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10573 {
10575 }
10576 else
10577 {
10579
10580
10581 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10582 {
10584 }
10585 else
10586 {
10587 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10588 }
10589 }
10590 }
10591 }
10592
10593 ScriptInputUserData ctx = new ScriptInputUserData;
10601 }
10602 }
10603 else if (!
g_Game.IsMultiplayer())
10604 {
10606 }
10607 }
10608 }
10609
10611 {
10612 if (root)
10613 {
10614 vector m4[4];
10615 root.GetTransform(m4);
10616 dst.SetGround(this, m4);
10617 }
10618 else
10619 {
10620 GetInventory().GetCurrentInventoryLocation(dst);
10621 }
10622 }
10623
10624 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10625 {
10626
10627 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10628 return false;
10629
10630 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10631 return false;
10632
10633
10635 return false;
10636
10637
10638 Magazine mag = Magazine.Cast(this);
10639 if (mag)
10640 {
10641 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10642 return false;
10643
10644 if (stack_max_limit)
10645 {
10646 Magazine other_mag = Magazine.Cast(other_item);
10647 if (other_item)
10648 {
10649 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10650 return false;
10651 }
10652
10653 }
10654 }
10655 else
10656 {
10657
10659 return false;
10660
10662 return false;
10663 }
10664
10665 PlayerBase player = null;
10666 if (CastTo(player, GetHierarchyRootPlayer()))
10667 {
10668 if (player.GetInventory().HasAttachment(this))
10669 return false;
10670
10671 if (player.IsItemsToDelete())
10672 return false;
10673 }
10674
10675 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10676 return false;
10677
10678 int slotID;
10680 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10681 return false;
10682
10683 return true;
10684 }
10685
10687 {
10689 }
10690
10692 {
10693 return m_IsResultOfSplit;
10694 }
10695
10697 {
10698 m_IsResultOfSplit = value;
10699 }
10700
10702 {
10704 }
10705
10707 {
10708 float other_item_quantity = other_item.GetQuantity();
10709 float this_free_space;
10710
10712
10714
10715 if (other_item_quantity > this_free_space)
10716 {
10717 return this_free_space;
10718 }
10719 else
10720 {
10721 return other_item_quantity;
10722 }
10723 }
10724
10726 {
10728 }
10729
10731 {
10733 return;
10734
10735 if (!IsMagazine() && other_item)
10736 {
10738 if (quantity_used != 0)
10739 {
10740 float hp1 = GetHealth01("","");
10741 float hp2 = other_item.GetHealth01("","");
10742 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10743 hpResult = hpResult / (
GetQuantity() + quantity_used);
10744
10745 hpResult *= GetMaxHealth();
10746 Math.Round(hpResult);
10747 SetHealth("", "Health", hpResult);
10748
10750 other_item.AddQuantity(-quantity_used);
10751 }
10752 }
10754 }
10755
10757 {
10758 #ifdef SERVER
10759 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10760 GetHierarchyParent().IncreaseLifetimeUp();
10761 #endif
10762 };
10763
10765 {
10766 PlayerBase p = PlayerBase.Cast(player);
10767
10768 array<int> recipesIds = p.m_Recipes;
10769 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10770 if (moduleRecipesManager)
10771 {
10772 EntityAI itemInHands = player.GetEntityInHands();
10773 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10774 }
10775
10776 for (int i = 0;i < recipesIds.Count(); i++)
10777 {
10778 int key = recipesIds.Get(i);
10779 string recipeName = moduleRecipesManager.GetRecipeName(key);
10781 }
10782 }
10783
10784
10785 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10786 {
10787 super.GetDebugActions(outputList);
10788
10789
10795
10796
10801
10806
10807
10811
10812
10814 {
10818 }
10819
10822
10823
10827
10829
10830 InventoryLocation loc = new InventoryLocation();
10831 GetInventory().GetCurrentInventoryLocation(loc);
10833 {
10834 if (Gizmo_IsSupported())
10837 }
10838
10840 }
10841
10842
10843
10844
10846 {
10847 super.OnAction(action_id, player, ctx);
10848
10850 {
10851 switch (action_id)
10852 {
10856 return true;
10860 return true;
10861 }
10862 }
10863
10865 {
10866 switch (action_id)
10867 {
10869 Delete();
10870 return true;
10871 }
10872 }
10873
10874 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10875 {
10876 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10877 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10878 PlayerBase p = PlayerBase.Cast(player);
10879 if (
EActions.RECIPES_RANGE_START < 1000)
10880 {
10881 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10882 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10883 }
10884 }
10885 #ifndef SERVER
10886 else if (action_id ==
EActions.WATCH_PLAYER)
10887 {
10888 PluginDeveloper.SetDeveloperItemClientEx(player);
10889 }
10890 #endif
10892 {
10893 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10894 {
10895 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10896 OnDebugButtonPressServer(id + 1);
10897 }
10898
10899 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10900 {
10901 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10903 }
10904
10905 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10906 {
10907 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10909 }
10910
10911 else if (action_id ==
EActions.ADD_QUANTITY)
10912 {
10913 if (IsMagazine())
10914 {
10915 Magazine mag = Magazine.Cast(this);
10916 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10917 }
10918 else
10919 {
10921 }
10922
10923 if (m_EM)
10924 {
10925 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10926 }
10927
10928 }
10929
10930 else if (action_id ==
EActions.REMOVE_QUANTITY)
10931 {
10932 if (IsMagazine())
10933 {
10934 Magazine mag2 = Magazine.Cast(this);
10935 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10936 }
10937 else
10938 {
10940 }
10941 if (m_EM)
10942 {
10943 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10944 }
10945
10946 }
10947
10948 else if (action_id ==
EActions.SET_QUANTITY_0)
10949 {
10951
10952 if (m_EM)
10953 {
10954 m_EM.SetEnergy(0);
10955 }
10956 }
10957
10958 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10959 {
10961
10962 if (m_EM)
10963 {
10964 m_EM.SetEnergy(m_EM.GetEnergyMax());
10965 }
10966 }
10967
10968 else if (action_id ==
EActions.ADD_HEALTH)
10969 {
10970 AddHealth("","",GetMaxHealth("","Health")/5);
10971 }
10972 else if (action_id ==
EActions.REMOVE_HEALTH)
10973 {
10974 AddHealth("","",-GetMaxHealth("","Health")/5);
10975 }
10976 else if (action_id ==
EActions.DESTROY_HEALTH)
10977 {
10978 SetHealth01("","",0);
10979 }
10980 else if (action_id ==
EActions.WATCH_ITEM)
10981 {
10983 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10984 #ifdef DEVELOPER
10985 SetDebugDeveloper_item(this);
10986 #endif
10987 }
10988
10989 else if (action_id ==
EActions.ADD_TEMPERATURE)
10990 {
10991 AddTemperature(20);
10992
10993 }
10994
10995 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10996 {
10997 AddTemperature(-20);
10998
10999 }
11000
11001 else if (action_id ==
EActions.FLIP_FROZEN)
11002 {
11003 SetFrozen(!GetIsFrozen());
11004
11005 }
11006
11007 else if (action_id ==
EActions.ADD_WETNESS)
11008 {
11010
11011 }
11012
11013 else if (action_id ==
EActions.REMOVE_WETNESS)
11014 {
11016
11017 }
11018
11019 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11020 {
11023
11024
11025 }
11026
11027 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11028 {
11031 }
11032
11033 else if (action_id ==
EActions.MAKE_SPECIAL)
11034 {
11035 auto debugParams = DebugSpawnParams.WithPlayer(player);
11036 OnDebugSpawnEx(debugParams);
11037 }
11038
11039 }
11040
11041
11042 return false;
11043 }
11044
11045
11046
11047
11051
11054
11055
11056
11058 {
11059 return false;
11060 }
11061
11062
11064 {
11065 return true;
11066 }
11067
11068
11070 {
11071 return true;
11072 }
11073
11074
11075
11077 {
11078 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11079 return g_Game.ConfigIsExisting(config_path);
11080 }
11081
11084 {
11085 return null;
11086 }
11087
11089 {
11090 return false;
11091 }
11092
11094 {
11095 return false;
11096 }
11097
11101
11102
11104 {
11105 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11106 return module_repairing.CanRepair(this, item_repair_kit);
11107 }
11108
11109
11110 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11111 {
11112 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11113 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11114 }
11115
11116
11118 {
11119
11120
11121
11122
11123
11124
11125
11126
11127 return 1;
11128 }
11129
11130
11131
11133 {
11135 }
11136
11137
11138
11140 {
11142 }
11143
11144
11153 {
11154 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11155
11156 if (player)
11157 {
11158 player.MessageStatus(text);
11159 }
11160 }
11161
11162
11171 {
11172 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11173
11174 if (player)
11175 {
11176 player.MessageAction(text);
11177 }
11178 }
11179
11180
11189 {
11190 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11191
11192 if (player)
11193 {
11194 player.MessageFriendly(text);
11195 }
11196 }
11197
11198
11207 {
11208 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11209
11210 if (player)
11211 {
11212 player.MessageImportant(text);
11213 }
11214 }
11215
11217 {
11218 return true;
11219 }
11220
11221
11222 override bool KindOf(
string tag)
11223 {
11224 bool found = false;
11225 string item_name = this.
GetType();
11227 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11228
11229 int array_size = item_tag_array.Count();
11230 for (int i = 0; i < array_size; i++)
11231 {
11232 if (item_tag_array.Get(i) == tag)
11233 {
11234 found = true;
11235 break;
11236 }
11237 }
11238 return found;
11239 }
11240
11241
11243 {
11244
11245 super.OnRPC(sender, rpc_type,ctx);
11246
11247
11248 switch (rpc_type)
11249 {
11250 #ifndef SERVER
11251 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11252 Param2<bool, string> p = new Param2<bool, string>(false, "");
11253
11255 return;
11256
11257 bool play = p.param1;
11258 string soundSet = p.param2;
11259
11260 if (play)
11261 {
11263 {
11265 {
11267 }
11268 }
11269 else
11270 {
11272 }
11273 }
11274 else
11275 {
11277 }
11278
11279 break;
11280 #endif
11281
11282 }
11283
11285 {
11287 }
11288 }
11289
11290
11291
11292
11294 {
11295 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11296 return plugin.GetID(
name);
11297 }
11298
11300 {
11301 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11302 return plugin.GetName(id);
11303 }
11304
11307 {
11308
11309
11310 int varFlags;
11311 if (!ctx.
Read(varFlags))
11312 return;
11313
11314 if (varFlags & ItemVariableFlags.FLOAT)
11315 {
11317 }
11318 }
11319
11321 {
11322
11323 super.SerializeNumericalVars(floats_out);
11324
11325
11326
11328 {
11330 }
11331
11333 {
11335 }
11336
11338 {
11340 }
11341
11343 {
11348 }
11349
11351 {
11353 }
11354 }
11355
11357 {
11358
11359 super.DeSerializeNumericalVars(floats);
11360
11361
11362 int index = 0;
11363 int mask = Math.Round(floats.Get(index));
11364
11365 index++;
11366
11368 {
11370 {
11372 }
11373 else
11374 {
11375 float quantity = floats.Get(index);
11376 SetQuantity(quantity,
true,
false,
false,
false);
11377 }
11378 index++;
11379 }
11380
11382 {
11383 float wet = floats.Get(index);
11385 index++;
11386 }
11387
11389 {
11390 int liquidtype = Math.Round(floats.Get(index));
11392 index++;
11393 }
11394
11396 {
11398 index++;
11400 index++;
11402 index++;
11404 index++;
11405 }
11406
11408 {
11409 int cleanness = Math.Round(floats.Get(index));
11411 index++;
11412 }
11413 }
11414
11416 {
11417 super.WriteVarsToCTX(ctx);
11418
11419
11421 {
11423 }
11424
11426 {
11428 }
11429
11431 {
11433 }
11434
11436 {
11437 int r,g,b,a;
11443 }
11444
11446 {
11448 }
11449 }
11450
11452 {
11453 if (!super.ReadVarsFromCTX(ctx,version))
11454 return false;
11455
11456 int intValue;
11457 float value;
11458
11459 if (version < 140)
11460 {
11461 if (!ctx.
Read(intValue))
11462 return false;
11463
11464 m_VariablesMask = intValue;
11465 }
11466
11468 {
11469 if (!ctx.
Read(value))
11470 return false;
11471
11473 {
11475 }
11476 else
11477 {
11479 }
11480 }
11481
11482 if (version < 140)
11483 {
11485 {
11486 if (!ctx.
Read(value))
11487 return false;
11488 SetTemperatureDirect(value);
11489 }
11490 }
11491
11493 {
11494 if (!ctx.
Read(value))
11495 return false;
11497 }
11498
11500 {
11501 if (!ctx.
Read(intValue))
11502 return false;
11504 }
11505
11507 {
11508 int r,g,b,a;
11510 return false;
11512 return false;
11514 return false;
11516 return false;
11517
11519 }
11520
11522 {
11523 if (!ctx.
Read(intValue))
11524 return false;
11526 }
11527
11528 if (version >= 138 && version < 140)
11529 {
11531 {
11532 if (!ctx.
Read(intValue))
11533 return false;
11534 SetFrozen(intValue);
11535 }
11536 }
11537
11538 return true;
11539 }
11540
11541
11543 {
11546 {
11548 }
11549
11550 if (!super.OnStoreLoad(ctx, version))
11551 {
11553 return false;
11554 }
11555
11556 if (version >= 114)
11557 {
11558 bool hasQuickBarIndexSaved;
11559
11560 if (!ctx.
Read(hasQuickBarIndexSaved))
11561 {
11563 return false;
11564 }
11565
11566 if (hasQuickBarIndexSaved)
11567 {
11568 int itmQBIndex;
11569
11570
11571 if (!ctx.
Read(itmQBIndex))
11572 {
11574 return false;
11575 }
11576
11577 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11578 if (itmQBIndex != -1 && parentPlayer)
11579 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11580 }
11581 }
11582 else
11583 {
11584
11585 PlayerBase player;
11586 int itemQBIndex;
11587 if (version ==
int.
MAX)
11588 {
11589 if (!ctx.
Read(itemQBIndex))
11590 {
11592 return false;
11593 }
11594 }
11595 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11596 {
11597
11598 if (!ctx.
Read(itemQBIndex))
11599 {
11601 return false;
11602 }
11603 if (itemQBIndex != -1 && player)
11604 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11605 }
11606 }
11607
11608 if (version < 140)
11609 {
11610
11611 if (!LoadVariables(ctx, version))
11612 {
11614 return false;
11615 }
11616 }
11617
11618
11620 {
11622 return false;
11623 }
11624 if (version >= 132)
11625 {
11627 if (raib)
11628 {
11630 {
11632 return false;
11633 }
11634 }
11635 }
11636
11638 return true;
11639 }
11640
11641
11642
11644 {
11645 super.OnStoreSave(ctx);
11646
11647 PlayerBase player;
11648 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11649 {
11651
11652 int itemQBIndex = -1;
11653 itemQBIndex = player.FindQuickBarEntityIndex(this);
11654 ctx.
Write(itemQBIndex);
11655 }
11656 else
11657 {
11659 }
11660
11662
11664 if (raib)
11665 {
11667 }
11668 }
11669
11670
11672 {
11673 super.AfterStoreLoad();
11674
11676 {
11678 }
11679
11681 {
11684 }
11685 }
11686
11688 {
11689 super.EEOnAfterLoad();
11690
11692 {
11694 }
11695
11698 }
11699
11701 {
11702 return false;
11703 }
11704
11705
11706
11708 {
11710 {
11711 #ifdef PLATFORM_CONSOLE
11712
11714 {
11716 if (menu)
11717 {
11719 }
11720 }
11721 #endif
11722 }
11723
11725 {
11728 }
11729
11731 {
11732 SetWeightDirty();
11734 }
11736 {
11739 }
11740
11742 {
11745
11748 }
11750 {
11754 }
11755
11756 super.OnVariablesSynchronized();
11757 }
11758
11759
11760
11762 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11763 {
11764 if (!IsServerCheck(allow_client))
11765 return false;
11766
11768 return false;
11769
11772
11773 if (value <= (min + 0.001))
11774 value = min;
11775
11776 if (value == min)
11777 {
11778 if (destroy_config)
11779 {
11780 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11781 if (dstr)
11782 {
11784 this.Delete();
11785 return true;
11786 }
11787 }
11788 else if (destroy_forced)
11789 {
11791 this.Delete();
11792 return true;
11793 }
11794
11796 }
11797
11800
11802 {
11803 EntityAI parent = GetHierarchyRoot();
11804 InventoryLocation iLoc = new InventoryLocation();
11805 GetInventory().GetCurrentInventoryLocation(iLoc);
11807 {
11808 int iLocSlot = iLoc.
GetSlot();
11810 {
11812 }
11814 {
11816 }
11817 }
11818 }
11819
11821 {
11823
11824 if (delta)
11826 }
11827
11829
11830 return false;
11831 }
11832
11833
11835 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11836 {
11838 }
11839
11841 {
11844 }
11845
11847 {
11850 }
11851
11853 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11854 {
11855 float value_clamped = Math.Clamp(value, 0, 1);
11857 SetQuantity(result, destroy_config, destroy_forced);
11858 }
11859
11860
11863 {
11865 }
11866
11868 {
11870 }
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11882 {
11883 int slot = -1;
11884 GameInventory inventory = GetInventory();
11885 if (inventory)
11886 {
11887 InventoryLocation il = new InventoryLocation;
11890 }
11891
11893 }
11894
11896 {
11897 float quantity_max = 0;
11898
11900 {
11901 if (attSlotID != -1)
11902 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11903
11904 if (quantity_max <= 0)
11906 }
11907
11908 if (quantity_max <= 0)
11910
11911 return quantity_max;
11912 }
11913
11915 {
11917 }
11918
11920 {
11922 }
11923
11924
11926 {
11928 }
11929
11931 {
11933 }
11934
11936 {
11938 }
11939
11940
11942 {
11943
11944 float weightEx = GetWeightEx();
11945 float special = GetInventoryAndCargoWeight();
11946 return weightEx - special;
11947 }
11948
11949
11951 {
11953 }
11954
11956 {
11958 {
11959 #ifdef DEVELOPER
11960 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11961 {
11962 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11964 }
11965 #endif
11966
11967 return GetQuantity() * GetConfigWeightModified();
11968 }
11969 else if (HasEnergyManager())
11970 {
11971 #ifdef DEVELOPER
11972 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11973 {
11974 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11975 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11976 }
11977 #endif
11978 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11979 }
11980 else
11981 {
11982 #ifdef DEVELOPER
11983 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11984 {
11985 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11986 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11987 }
11988 #endif
11989 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11990 }
11991 }
11992
11995 {
11996 int item_count = 0;
11998
11999 GameInventory inventory = GetInventory();
12000 CargoBase cargo = inventory.
GetCargo();
12001 if (cargo != NULL)
12002 {
12004 }
12005
12007 for (int i = 0; i < nAttachments; ++i)
12008 {
12010 if (item)
12011 item_count += item.GetNumberOfItems();
12012 }
12013 return item_count;
12014 }
12015
12018 {
12019 float weight = 0;
12020 float wetness = 1;
12021 if (include_wetness)
12024 {
12025 weight = wetness * m_ConfigWeight;
12026 }
12028 {
12029 weight = 1;
12030 }
12031 return weight;
12032 }
12033
12034
12035
12037 {
12038 GameInventory inventory = GetInventory();
12039 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12040 {
12041 array<EntityAI> items = new array<EntityAI>;
12043 for (int i = 0; i < items.Count(); ++i)
12044 {
12046 if (item)
12047 {
12048 g_Game.ObjectDelete(item);
12049 }
12050 }
12051 }
12052 }
12053
12054
12055
12056
12058 {
12059 float energy = 0;
12060 if (HasEnergyManager())
12061 {
12062 energy = GetCompEM().GetEnergy();
12063 }
12064 return energy;
12065 }
12066
12067
12069 {
12070 super.OnEnergyConsumed();
12071
12073 }
12074
12076 {
12077 super.OnEnergyAdded();
12078
12080 }
12081
12082
12084 {
12085 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12086 {
12088 {
12089 float energy_0to1 = GetCompEM().GetEnergy0To1();
12091 }
12092 }
12093 }
12094
12095
12097 {
12098 return ConfigGetFloat("heatIsolation");
12099 }
12100
12102 {
12104 }
12105
12107 {
12108 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12109 if (
g_Game.ConfigIsExisting(paramPath))
12110 return g_Game.ConfigGetFloat(paramPath);
12111
12112 return 0.0;
12113 }
12114
12116 {
12117 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12118 if (
g_Game.ConfigIsExisting(paramPath))
12119 return g_Game.ConfigGetFloat(paramPath);
12120
12121 return 0.0;
12122 }
12123
12124 override void SetWet(
float value,
bool allow_client =
false)
12125 {
12126 if (!IsServerCheck(allow_client))
12127 return;
12128
12131
12133
12134 m_VarWet = Math.Clamp(value, min, max);
12135
12137 {
12140 }
12141 }
12142
12143 override void AddWet(
float value)
12144 {
12146 }
12147
12149 {
12151 }
12152
12154 {
12156 }
12157
12159 {
12161 }
12162
12164 {
12166 }
12167
12169 {
12171 }
12172
12173 override void OnWetChanged(
float newVal,
float oldVal)
12174 {
12177 if (newLevel != oldLevel)
12178 {
12180 }
12181 }
12182
12184 {
12185 SetWeightDirty();
12186 }
12187
12189 {
12190 return GetWetLevelInternal(
m_VarWet);
12191 }
12192
12193
12194
12196 {
12198 }
12199
12201 {
12203 }
12204
12206 {
12208 }
12209
12211 {
12213 }
12214
12215
12216
12218 {
12219 if (ConfigIsExisting("itemModelLength"))
12220 {
12221 return ConfigGetFloat("itemModelLength");
12222 }
12223 return 0;
12224 }
12225
12227 {
12228 if (ConfigIsExisting("itemAttachOffset"))
12229 {
12230 return ConfigGetFloat("itemAttachOffset");
12231 }
12232 return 0;
12233 }
12234
12235 override void SetCleanness(
int value,
bool allow_client =
false)
12236 {
12237 if (!IsServerCheck(allow_client))
12238 return;
12239
12241
12243
12246 }
12247
12249 {
12251 }
12252
12254 {
12255 return true;
12256 }
12257
12258
12259
12260
12262 {
12264 }
12265
12267 {
12269 }
12270
12271
12272
12273
12274 override void SetColor(
int r,
int g,
int b,
int a)
12275 {
12281 }
12283 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12284 {
12289 }
12290
12292 {
12294 }
12295
12298 {
12299 int r,g,b,a;
12301 r = r/255;
12302 g = g/255;
12303 b = b/255;
12304 a = a/255;
12305 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12306 }
12307
12308
12309
12310 override void SetLiquidType(
int value,
bool allow_client =
false)
12311 {
12312 if (!IsServerCheck(allow_client))
12313 return;
12314
12319 }
12320
12322 {
12323 return ConfigGetInt("varLiquidTypeInit");
12324 }
12325
12327 {
12329 }
12330
12332 {
12334 SetFrozen(false);
12335 }
12336
12339 {
12340 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12341 }
12342
12343
12346 {
12347 PlayerBase nplayer;
12348 if (PlayerBase.CastTo(nplayer, player))
12349 {
12351 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12352 }
12353 }
12354
12355
12358 {
12359 PlayerBase nplayer;
12360 if (PlayerBase.CastTo(nplayer,player))
12361 {
12362 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12363 }
12364
12365 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12366
12367 if (HasEnergyManager())
12368 {
12369 GetCompEM().UpdatePlugState();
12370 }
12371 }
12372
12373
12375 {
12376 super.OnPlacementStarted(player);
12377
12379 }
12380
12381 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12382 {
12384 {
12385 m_AdminLog.OnPlacementComplete(player,
this);
12386 }
12387
12388 super.OnPlacementComplete(player, position, orientation);
12389 }
12390
12391
12392
12393
12394
12396 {
12398 {
12399 return true;
12400 }
12401 else
12402 {
12403 return false;
12404 }
12405 }
12406
12407
12409 {
12411 {
12413 }
12414 }
12415
12416
12418 {
12420 }
12421
12423 {
12425 }
12426
12427 override void InsertAgent(
int agent,
float count = 1)
12428 {
12429 if (count < 1)
12430 return;
12431
12433 }
12434
12437 {
12439 }
12440
12441
12443 {
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
12483
12484
12485
12486
12487
12489 {
12491 return false;
12492 return true;
12493 }
12494
12496 {
12497
12499 }
12500
12501
12504 {
12505 super.CheckForRoofLimited(timeTresholdMS);
12506
12507 float time =
g_Game.GetTime();
12508 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12509 {
12510 m_PreviousRoofTestTime = time;
12511 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12512 }
12513 }
12514
12515
12517 {
12519 {
12520 return 0;
12521 }
12522
12523 if (GetInventory().GetAttachmentSlotsCount() != 0)
12524 {
12525 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12526 if (filter)
12527 return filter.GetProtectionLevel(type, false, system);
12528 else
12529 return 0;
12530 }
12531
12532 string subclassPath, entryName;
12533
12534 switch (type)
12535 {
12537 entryName = "biological";
12538 break;
12540 entryName = "chemical";
12541 break;
12542 default:
12543 entryName = "biological";
12544 break;
12545 }
12546
12547 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12548
12549 return g_Game.ConfigGetFloat(subclassPath + entryName);
12550 }
12551
12552
12553
12556 {
12557 if (!IsMagazine())
12559
12561 }
12562
12563
12564
12565
12566
12571 {
12572 return true;
12573 }
12574
12576 {
12578 }
12579
12580
12581
12582
12583
12585 {
12586 if (parent)
12587 {
12588 if (parent.IsInherited(DayZInfected))
12589 return true;
12590
12591 if (!parent.IsRuined())
12592 return true;
12593 }
12594
12595 return true;
12596 }
12597
12599 {
12600 if (!super.CanPutAsAttachment(parent))
12601 {
12602 return false;
12603 }
12604
12605 if (!IsRuined() && !parent.IsRuined())
12606 {
12607 return true;
12608 }
12609
12610 return false;
12611 }
12612
12614 {
12615
12616
12617
12618
12619 return super.CanReceiveItemIntoCargo(item);
12620 }
12621
12623 {
12624
12625
12626
12627
12628 GameInventory attachmentInv = attachment.GetInventory();
12630 {
12631 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12632 return false;
12633 }
12634
12635 InventoryLocation loc = new InventoryLocation();
12636 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12637 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12638 return false;
12639
12640 return super.CanReceiveAttachment(attachment, slotId);
12641 }
12642
12644 {
12645 if (!super.CanReleaseAttachment(attachment))
12646 return false;
12647
12648 return GetInventory().AreChildrenAccessible();
12649 }
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12672 {
12673 int id = muzzle_owner.GetMuzzleID();
12674 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12675
12676 if (WPOF_array)
12677 {
12678 for (int i = 0; i < WPOF_array.Count(); i++)
12679 {
12680 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12681
12682 if (WPOF)
12683 {
12684 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12685 }
12686 }
12687 }
12688 }
12689
12690
12692 {
12693 int id = muzzle_owner.GetMuzzleID();
12695
12696 if (WPOBE_array)
12697 {
12698 for (int i = 0; i < WPOBE_array.Count(); i++)
12699 {
12700 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12701
12702 if (WPOBE)
12703 {
12704 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12705 }
12706 }
12707 }
12708 }
12709
12710
12712 {
12713 int id = muzzle_owner.GetMuzzleID();
12714 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12715
12716 if (WPOOH_array)
12717 {
12718 for (int i = 0; i < WPOOH_array.Count(); i++)
12719 {
12720 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12721
12722 if (WPOOH)
12723 {
12724 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12725 }
12726 }
12727 }
12728 }
12729
12730
12732 {
12733 int id = muzzle_owner.GetMuzzleID();
12734 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12735
12736 if (WPOOH_array)
12737 {
12738 for (int i = 0; i < WPOOH_array.Count(); i++)
12739 {
12740 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12741
12742 if (WPOOH)
12743 {
12744 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12745 }
12746 }
12747 }
12748 }
12749
12750
12752 {
12753 int id = muzzle_owner.GetMuzzleID();
12754 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12755
12756 if (WPOOH_array)
12757 {
12758 for (int i = 0; i < WPOOH_array.Count(); i++)
12759 {
12760 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12761
12762 if (WPOOH)
12763 {
12764 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12765 }
12766 }
12767 }
12768 }
12769
12770
12771
12773 {
12775 {
12776 return true;
12777 }
12778
12779 return false;
12780 }
12781
12783 {
12785 {
12786 return true;
12787 }
12788
12789 return false;
12790 }
12791
12793 {
12795 {
12796 return true;
12797 }
12798
12799 return false;
12800 }
12801
12803 {
12804 return false;
12805 }
12806
12809 {
12810 return UATimeSpent.DEFAULT_DEPLOY;
12811 }
12812
12813
12814
12815
12817 {
12819 SetSynchDirty();
12820 }
12821
12823 {
12825 }
12826
12827
12829 {
12830 return false;
12831 }
12832
12835 {
12836 string att_type = "None";
12837
12838 if (ConfigIsExisting("soundAttType"))
12839 {
12840 att_type = ConfigGetString("soundAttType");
12841 }
12842
12844 }
12845
12847 {
12849 }
12850
12851
12852
12853
12854
12860
12862 {
12865
12867 }
12868
12869
12871 {
12873 return;
12874
12876
12879
12882
12883 SoundParameters params = new SoundParameters();
12887 }
12888
12889
12891 {
12893 {
12896
12897 SetSynchDirty();
12898
12901 }
12902 }
12903
12905 {
12907 }
12908
12909
12911 {
12913 return;
12914
12916 SetSynchDirty();
12917
12920 }
12921
12923 {
12926 }
12927
12929 {
12931 }
12932
12933 void OnApply(PlayerBase player);
12934
12936 {
12937 return 1.0;
12938 };
12939
12941 {
12943 }
12944
12946 {
12948 }
12949
12951
12953 {
12954 SetDynamicPhysicsLifeTime(0.01);
12956 }
12957
12959 {
12960 array<string> zone_names = new array<string>;
12961 GetDamageZones(zone_names);
12962 for (int i = 0; i < zone_names.Count(); i++)
12963 {
12964 SetHealthMax(zone_names.Get(i),"Health");
12965 }
12966 SetHealthMax("","Health");
12967 }
12968
12971 {
12972 float global_health = GetHealth01("","Health");
12973 array<string> zones = new array<string>;
12974 GetDamageZones(zones);
12975
12976 for (int i = 0; i < zones.Count(); i++)
12977 {
12978 SetHealth01(zones.Get(i),"Health",global_health);
12979 }
12980 }
12981
12984 {
12985 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12986 }
12987
12989 {
12990 if (!hasRootAsPlayer)
12991 {
12992 if (refParentIB)
12993 {
12994
12995 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12996 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12997
12998 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12999 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13000
13003 }
13004 else
13005 {
13006
13009 }
13010 }
13011 }
13012
13014 {
13016 {
13017 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13018 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13019 {
13020 float heatPermCoef = 1.0;
13022 while (ent)
13023 {
13024 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13025 ent = ent.GetHierarchyParent();
13026 }
13027
13028 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13029 }
13030 }
13031 }
13032
13034 {
13035
13036 EntityAI parent = GetHierarchyParent();
13037 if (!parent)
13038 {
13039 hasParent = false;
13040 hasRootAsPlayer = false;
13041 }
13042 else
13043 {
13044 hasParent = true;
13045 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13046 refParentIB =
ItemBase.Cast(parent);
13047 }
13048 }
13049
13050 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13051 {
13052
13053 }
13054
13056 {
13057
13058 return false;
13059 }
13060
13062 {
13063
13064
13065 return false;
13066 }
13067
13069 {
13070
13071 return false;
13072 }
13073
13076 {
13077 return !GetIsFrozen() &&
IsOpen();
13078 }
13079
13081 {
13082 bool hasParent = false, hasRootAsPlayer = false;
13084
13085 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13086 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13087
13088 if (wwtu || foodDecay)
13089 {
13093
13094 if (processWetness || processTemperature || processDecay)
13095 {
13097
13098 if (processWetness)
13099 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13100
13101 if (processTemperature)
13103
13104 if (processDecay)
13105 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13106 }
13107 }
13108 }
13109
13112 {
13114 }
13115
13117 {
13120
13121 return super.GetTemperatureFreezeThreshold();
13122 }
13123
13125 {
13128
13129 return super.GetTemperatureThawThreshold();
13130 }
13131
13133 {
13136
13137 return super.GetItemOverheatThreshold();
13138 }
13139
13141 {
13143 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13144
13145 return super.GetTemperatureFreezeTime();
13146 }
13147
13149 {
13151 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13152
13153 return super.GetTemperatureThawTime();
13154 }
13155
13160
13162 {
13163 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13164 }
13165
13167 {
13168 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13169 }
13170
13173 {
13175 }
13176
13178 {
13180 }
13181
13183 {
13185 }
13186
13189 {
13190 return null;
13191 }
13192
13195 {
13196 return false;
13197 }
13198
13200 {
13202 {
13205 if (!trg)
13206 {
13208 explosive = this;
13209 }
13210
13211 explosive.PairRemote(trg);
13213
13214 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13215 trg.SetPersistentPairID(persistentID);
13216 explosive.SetPersistentPairID(persistentID);
13217
13218 return true;
13219 }
13220 return false;
13221 }
13222
13225 {
13226 float ret = 1.0;
13229 ret *= GetHealth01();
13230
13231 return ret;
13232 }
13233
13234 #ifdef DEVELOPER
13235 override void SetDebugItem()
13236 {
13237 super.SetDebugItem();
13238 _itemBase = this;
13239 }
13240
13242 {
13243 string text = super.GetDebugText();
13244
13246 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13247
13248 return text;
13249 }
13250 #endif
13251
13253 {
13254 return true;
13255 }
13256
13258
13260
13262 {
13265 }
13266
13267
13275
13291
13292 [
Obsolete(
"Use ItemSoundHandler instead")]
13295 {
13296 if (!
g_Game.IsDedicatedServer())
13297 {
13298 if (ConfigIsExisting("attachSoundSet"))
13299 {
13300 string cfg_path = "";
13301 string soundset = "";
13302 string type_name =
GetType();
13303
13306 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13307 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13308
13309 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13310 {
13311 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13312 {
13313 if (cfg_slot_array[i] == slot_type)
13314 {
13315 soundset = cfg_soundset_array[i];
13316 break;
13317 }
13318 }
13319 }
13320
13321 if (soundset != "")
13322 {
13323 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13325 }
13326 }
13327 }
13328 }
13329
13331}
13332
13334{
13336 if (entity)
13337 {
13338 bool is_item = entity.IsInherited(
ItemBase);
13339 if (is_item && full_quantity)
13340 {
13343 }
13344 }
13345 else
13346 {
13348 return NULL;
13349 }
13350 return entity;
13351}
13352
13354{
13355 if (item)
13356 {
13357 if (health > 0)
13358 item.SetHealth("", "", health);
13359
13360 if (item.CanHaveTemperature())
13361 {
13363 if (item.CanFreeze())
13364 item.SetFrozen(false);
13365 }
13366
13367 if (item.HasEnergyManager())
13368 {
13369 if (quantity >= 0)
13370 {
13371 item.GetCompEM().SetEnergy0To1(quantity);
13372 }
13373 else
13374 {
13376 }
13377 }
13378 else if (item.IsMagazine())
13379 {
13380 Magazine mag = Magazine.Cast(item);
13381 if (quantity >= 0)
13382 {
13383 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13384 }
13385 else
13386 {
13388 }
13389
13390 }
13391 else
13392 {
13393 if (quantity >= 0)
13394 {
13395 item.SetQuantityNormalized(quantity, false);
13396 }
13397 else
13398 {
13400 }
13401
13402 }
13403 }
13404}
13405
13406#ifdef DEVELOPER
13408#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.