8414{
8416 {
8417 return true;
8418 }
8419};
8420
8422{
8423
8424};
8425
8426
8427
8429{
8433
8435
8438
8439
8440
8441
8442
8451
8457
8462
8467
8488 protected bool m_IsResultOfSplit
8489
8491
8496
8497
8498
8500
8504
8505
8506
8508
8511
8512
8513
8519
8520
8528
8531
8532
8534
8535
8537
8538
8543
8544
8549
8551
8552
8554
8555
8557 {
8562
8563 if (!
g_Game.IsDedicatedServer())
8564 {
8566 {
8568
8570 {
8572 }
8573 }
8574
8577 }
8578
8579 m_OldLocation = null;
8580
8582 {
8584 }
8585
8586 if (ConfigIsExisting("headSelectionsToHide"))
8587 {
8590 }
8591
8593 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8594 {
8596 }
8597
8599
8600 m_IsResultOfSplit = false;
8601
8603 }
8604
8606 {
8607 super.InitItemVariables();
8608
8614 m_Count = ConfigGetInt(
"count");
8615
8618
8623
8626
8631
8643
8647
8648
8651 if (ConfigIsExisting("canBeSplit"))
8652 {
8655 }
8656
8658 if (ConfigIsExisting("itemBehaviour"))
8660
8661
8664 RegisterNetSyncVariableInt("m_VarLiquidType");
8665 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8666
8667 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8668 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8669 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8670
8671 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8672 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8673 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8674 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8675
8676 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8677 RegisterNetSyncVariableBool("m_IsTakeable");
8678 RegisterNetSyncVariableBool("m_IsHologram");
8679
8682 {
8685 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8686 }
8687
8689
8691 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8693
8695 }
8696
8698 {
8700 }
8701
8703 {
8706 {
8711 }
8712 }
8713
8714 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8715 {
8717 {
8720 }
8721
8723 }
8724
8726 {
8732 }
8733
8735
8737 {
8739
8740 if (!action)
8741 {
8742 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8743 return;
8744 }
8745
8747 if (!ai)
8748 {
8750 return;
8751 }
8752
8754 if (!action_array)
8755 {
8756 action_array = new array<ActionBase_Basic>;
8758 }
8759 if (LogManager.IsActionLogEnable())
8760 {
8761 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8762 }
8763
8764 if (action_array.Find(action) != -1)
8765 {
8766 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8767 }
8768 else
8769 {
8770 action_array.Insert(action);
8771 }
8772 }
8773
8775 {
8776 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8777 ActionBase action = player.GetActionManager().GetAction(actionName);
8780
8781 if (action_array)
8782 {
8783 action_array.RemoveItem(action);
8784 }
8785 }
8786
8787
8788
8790 {
8791 ActionOverrideData overrideData = new ActionOverrideData();
8795
8797 if (!actionMap)
8798 {
8801 }
8802
8803 actionMap.Insert(this.
Type(), overrideData);
8804
8805 }
8806
8808
8810
8811
8813 {
8816
8819
8820 string config_to_search = "CfgVehicles";
8821 string muzzle_owner_config;
8822
8824 {
8825 if (IsInherited(Weapon))
8826 config_to_search = "CfgWeapons";
8827
8828 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8829
8830 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8831
8832 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8833
8834 if (config_OnFire_subclass_count > 0)
8835 {
8836 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8837
8838 for (int i = 0; i < config_OnFire_subclass_count; i++)
8839 {
8840 string particle_class = "";
8841 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8842 string config_OnFire_entry = config_OnFire_class + particle_class;
8843 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8844 WPOF_array.Insert(WPOF);
8845 }
8846
8847
8849 }
8850 }
8851
8853 {
8854 config_to_search = "CfgWeapons";
8855 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8856
8857 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8858
8859 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8860
8861 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8862 {
8863 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8864
8865 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8866 {
8867 string particle_class2 = "";
8868 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8869 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8870 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8871 WPOBE_array.Insert(WPOBE);
8872 }
8873
8874
8876 }
8877 }
8878 }
8879
8880
8882 {
8885
8887 {
8888 string config_to_search = "CfgVehicles";
8889
8890 if (IsInherited(Weapon))
8891 config_to_search = "CfgWeapons";
8892
8893 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8894 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8895
8896 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8897 {
8898
8900
8902 {
8904 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8906 return;
8907 }
8908
8911
8912
8913
8914 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8915 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8916
8917 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8918 {
8919 string particle_class = "";
8920 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8921 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8922 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8923
8924 if (entry_type == CT_CLASS)
8925 {
8926 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8927 WPOOH_array.Insert(WPOF);
8928 }
8929 }
8930
8931
8933 }
8934 }
8935 }
8936
8938 {
8940 }
8941
8943 {
8945 {
8947
8950
8953
8954 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8955 }
8956 }
8957
8959 {
8961 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8962
8964 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8965
8967 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8968
8970 {
8972 }
8973 }
8974
8976 {
8978 }
8979
8981 {
8984 else
8986
8988 {
8991 }
8992 else
8993 {
8996
8999 }
9000
9002 }
9003
9005 {
9007 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9008 }
9009
9011 {
9013 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9015 }
9016
9018 {
9020 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9021 }
9022
9024 {
9027
9028 OverheatingParticle OP = new OverheatingParticle();
9033
9035 }
9036
9038 {
9041
9042 return -1;
9043 }
9044
9046 {
9048 {
9051
9052 for (int i = count; i > 0; --i)
9053 {
9054 int id = i - 1;
9057
9060
9061 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9062 {
9063 if (p)
9064 {
9067 }
9068 }
9069 }
9070 }
9071 }
9072
9074 {
9076 {
9078 {
9079 int id = i - 1;
9081
9082 if (OP)
9083 {
9085
9086 if (p)
9087 {
9089 }
9090
9091 delete OP;
9092 }
9093 }
9094
9097 }
9098 }
9099
9102 {
9103 return 0.0;
9104 }
9105
9106
9108 {
9109 return 250;
9110 }
9111
9113 {
9114 return 0;
9115 }
9116
9119 {
9121 return true;
9122
9123 return false;
9124 }
9125
9128 {
9131
9133 {
9135 }
9136 else
9137 {
9138
9140 }
9141
9143 }
9144
9151 {
9152 return -1;
9153 }
9154
9155
9156
9157
9159 {
9161 {
9162 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9163 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9164
9165 if (r_index >= 0)
9166 {
9167 InventoryLocation r_il = new InventoryLocation;
9168 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9169
9170 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9173 {
9174 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9175 }
9177 {
9178 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9179 }
9180
9181 }
9182
9183 player.GetHumanInventory().ClearUserReservedLocation(this);
9184 }
9185
9188 }
9189
9190
9191
9192
9194 {
9195 return ItemBase.m_DebugActionsMask;
9196 }
9197
9199 {
9200 return ItemBase.m_DebugActionsMask & mask;
9201 }
9202
9204 {
9205 ItemBase.m_DebugActionsMask = mask;
9206 }
9207
9209 {
9210 ItemBase.m_DebugActionsMask |= mask;
9211 }
9212
9214 {
9215 ItemBase.m_DebugActionsMask &= ~mask;
9216 }
9217
9219 {
9221 {
9223 }
9224 else
9225 {
9227 }
9228 }
9229
9230
9232 {
9233 if (GetEconomyProfile())
9234 {
9235 float q_max = GetEconomyProfile().GetQuantityMax();
9236 if (q_max > 0)
9237 {
9238 float q_min = GetEconomyProfile().GetQuantityMin();
9239 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9240
9242 {
9243 ComponentEnergyManager comp = GetCompEM();
9245 {
9247 }
9248 }
9250 {
9252
9253 }
9254
9255 }
9256 }
9257 }
9258
9261 {
9262 EntityAI parent = GetHierarchyParent();
9263
9264 if (parent)
9265 {
9266 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9267 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9268 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9269 }
9270 }
9271
9274 {
9275 EntityAI parent = GetHierarchyParent();
9276
9277 if (parent)
9278 {
9279 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9280 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9281 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9282 }
9283 }
9284
9286 {
9287
9288
9289
9290
9292
9294 {
9295 if (ScriptInputUserData.CanStoreInputUserData())
9296 {
9297 ScriptInputUserData ctx = new ScriptInputUserData;
9303 ctx.
Write(use_stack_max);
9306
9308 {
9309 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9310 }
9311 }
9312 }
9313 else if (!
g_Game.IsMultiplayer())
9314 {
9316 }
9317 }
9318
9320 {
9322 }
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9336
9337 return false;
9338 }
9339
9341 {
9342 return false;
9343 }
9344
9348 {
9349 return false;
9350 }
9351
9353 {
9354 return "";
9355 }
9356
9358
9360 {
9361 return false;
9362 }
9363
9365 {
9366 return true;
9367 }
9368
9369
9370
9372 {
9373 return true;
9374 }
9375
9377 {
9378 return true;
9379 }
9380
9382 {
9383 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9385 }
9386
9388 {
9390 }
9391
9393 {
9395 if (!is_being_placed)
9397 SetSynchDirty();
9398 }
9399
9400
9402
9404 {
9406 }
9407
9409 {
9411 }
9412
9414 {
9415 return 1;
9416 }
9417
9419 {
9420 return false;
9421 }
9422
9424 {
9426 SetSynchDirty();
9427 }
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9464 {
9465 super.OnMovedInsideCargo(container);
9466
9467 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9468 }
9469
9470 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9471 {
9472 super.EEItemLocationChanged(oldLoc, newLoc);
9473
9474 PlayerBase newPlayer = null;
9475 PlayerBase oldPlayer = null;
9476
9477 if (newLoc.GetParent())
9478 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9479
9480 if (oldLoc.GetParent())
9481 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9482
9484 {
9485 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9486
9487 if (rIndex >= 0)
9488 {
9489 InventoryLocation rIl = new InventoryLocation;
9490 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9491
9492 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9495 {
9496 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9497 }
9499 {
9501 }
9502
9503 }
9504 }
9505
9507 {
9508 if (newPlayer)
9509 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9510
9511 if (newPlayer == oldPlayer)
9512 {
9513 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9514 {
9516 {
9517 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9518 {
9519 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9520 }
9521 }
9522 else
9523 {
9524 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9525 }
9526 }
9527
9528 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9529 {
9530 int type = oldLoc.GetType();
9532 {
9533 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9534 }
9536 {
9537 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9538 }
9539 }
9540 if (!m_OldLocation)
9541 {
9542 m_OldLocation = new InventoryLocation;
9543 }
9544 m_OldLocation.Copy(oldLoc);
9545 }
9546 else
9547 {
9548 if (m_OldLocation)
9549 {
9550 m_OldLocation.Reset();
9551 }
9552 }
9553
9554 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9555 }
9556 else
9557 {
9558 if (newPlayer)
9559 {
9560 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9561 if (resIndex >= 0)
9562 {
9563 InventoryLocation il = new InventoryLocation;
9564 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9566 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9569 {
9570 il.
GetParent().GetOnReleaseLock().Invoke(it);
9571 }
9573 {
9575 }
9576
9577 }
9578 }
9580 {
9581
9583 }
9584
9585 if (m_OldLocation)
9586 {
9587 m_OldLocation.Reset();
9588 }
9589 }
9590
9592 {
9593 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9594 }
9595
9597 {
9598 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9599 }
9600 }
9601
9602 override void EOnContact(IEntity other, Contact extra)
9603 {
9605 {
9606 int liquidType = -1;
9608 if (impactSpeed > 0.0)
9609 {
9611 #ifndef SERVER
9613 #else
9615 SetSynchDirty();
9616 #endif
9618 }
9619 }
9620
9621 #ifdef SERVER
9622 if (GetCompEM() && GetCompEM().IsPlugged())
9623 {
9624 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9625 GetCompEM().UnplugThis();
9626 }
9627 #endif
9628 }
9629
9631
9633 {
9635 }
9636
9638 {
9639
9640 }
9641
9643 {
9644 super.OnItemLocationChanged(old_owner, new_owner);
9645
9646 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9647 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9648
9649 if (!relatedPlayer && playerNew)
9650 relatedPlayer = playerNew;
9651
9652 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9653 {
9655 if (actionMgr)
9656 {
9657 ActionBase currentAction = actionMgr.GetRunningAction();
9658 if (currentAction)
9660 }
9661 }
9662
9663 Man ownerPlayerOld = null;
9664 Man ownerPlayerNew = null;
9665
9666 if (old_owner)
9667 {
9668 if (old_owner.
IsMan())
9669 {
9670 ownerPlayerOld = Man.Cast(old_owner);
9671 }
9672 else
9673 {
9674 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9675 }
9676 }
9677 else
9678 {
9680 {
9682
9683 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9684 {
9685 GetCompEM().UnplugThis();
9686 }
9687 }
9688 }
9689
9690 if (new_owner)
9691 {
9692 if (new_owner.
IsMan())
9693 {
9694 ownerPlayerNew = Man.Cast(new_owner);
9695 }
9696 else
9697 {
9698 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9699 }
9700 }
9701
9702 if (ownerPlayerOld != ownerPlayerNew)
9703 {
9704 if (ownerPlayerOld)
9705 {
9706 array<EntityAI> subItemsExit = new array<EntityAI>;
9708 for (int i = 0; i < subItemsExit.Count(); i++)
9709 {
9712 }
9713 }
9714
9715 if (ownerPlayerNew)
9716 {
9717 array<EntityAI> subItemsEnter = new array<EntityAI>;
9719 for (int j = 0; j < subItemsEnter.Count(); j++)
9720 {
9723 }
9724 }
9725 }
9726 else if (ownerPlayerNew != null)
9727 {
9728 PlayerBase nplayer;
9729 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9730 {
9731 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9733 for (int k = 0; k < subItemsUpdate.Count(); k++)
9734 {
9736 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9737 }
9738 }
9739 }
9740
9741 if (old_owner)
9742 old_owner.OnChildItemRemoved(this);
9743 if (new_owner)
9744 new_owner.OnChildItemReceived(this);
9745 }
9746
9747
9749 {
9750 super.EEDelete(parent);
9751 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9752 if (player)
9753 {
9755
9756 if (player.IsAlive())
9757 {
9758 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9759 if (r_index >= 0)
9760 {
9761 InventoryLocation r_il = new InventoryLocation;
9762 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9763
9764 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9767 {
9768 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9769 }
9771 {
9772 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9773 }
9774
9775 }
9776
9777 player.RemoveQuickBarEntityShortcut(this);
9778 }
9779 }
9780 }
9781
9783 {
9784 super.EEKilled(killer);
9785
9788 {
9789 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9790 {
9791 if (IsMagazine())
9792 {
9793 if (Magazine.Cast(this).GetAmmoCount() > 0)
9794 {
9796 }
9797 }
9798 else
9799 {
9801 }
9802 }
9803 }
9804 }
9805
9807 {
9808 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9809
9810 super.OnWasAttached(parent, slot_id);
9811
9814
9817 }
9818
9820 {
9821 super.OnWasDetached(parent, slot_id);
9822
9825
9828 }
9829
9831 {
9832 int idx;
9835
9836 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9837 if (inventory_slots.Count() < 1)
9838 {
9839 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9840 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9841 }
9842 else
9843 {
9844 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9845 }
9846
9847 idx = inventory_slots.Find(slot);
9848 if (idx < 0)
9849 return "";
9850
9851 return attach_types.Get(idx);
9852 }
9853
9855 {
9856 int idx = -1;
9857 string slot;
9858
9861
9862 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9863 if (inventory_slots.Count() < 1)
9864 {
9865 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9866 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9867 }
9868 else
9869 {
9870 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9871 if (detach_types.Count() < 1)
9872 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9873 }
9874
9875 for (int i = 0; i < inventory_slots.Count(); i++)
9876 {
9877 slot = inventory_slots.Get(i);
9878 }
9879
9880 if (slot != "")
9881 {
9882 if (detach_types.Count() == 1)
9883 idx = 0;
9884 else
9885 idx = inventory_slots.Find(slot);
9886 }
9887 if (idx < 0)
9888 return "";
9889
9890 return detach_types.Get(idx);
9891 }
9892
9894 {
9895
9897
9898
9899 float min_time = 1;
9900 float max_time = 3;
9901 float delay = Math.RandomFloat(min_time, max_time);
9902
9903 explode_timer.Run(delay, this, "DoAmmoExplosion");
9904 }
9905
9907 {
9908 Magazine magazine = Magazine.Cast(this);
9909 int pop_sounds_count = 6;
9910 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9911
9912
9913 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9914 string sound_name = pop_sounds[ sound_idx ];
9915 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9916
9917
9918 magazine.ServerAddAmmoCount(-1);
9919
9920
9921 float min_temp_to_explode = 100;
9922
9923 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9924 {
9926 }
9927 }
9928
9929
9930 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9931 {
9932 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9933
9934 const int CHANCE_DAMAGE_CARGO = 4;
9935 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9936 const int CHANCE_DAMAGE_NOTHING = 2;
9937
9939 {
9940 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9941 int chances;
9942 int rnd;
9943
9944 if (GetInventory().GetCargo())
9945 {
9946 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9947 rnd = Math.RandomInt(0,chances);
9948
9949 if (rnd < CHANCE_DAMAGE_CARGO)
9950 {
9952 }
9953 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9954 {
9956 }
9957 }
9958 else
9959 {
9960 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9961 rnd = Math.RandomInt(0,chances);
9962
9963 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9964 {
9966 }
9967 }
9968 }
9969 }
9970
9972 {
9973 CargoBase cargo = GetInventory().GetCargo();
9974 if (cargo)
9975 {
9977 if (item_count > 0)
9978 {
9979 int random_pick = Math.RandomInt(0, item_count);
9981 if (!item.IsExplosive())
9982 {
9983 item.AddHealth("","",damage);
9984 return true;
9985 }
9986 }
9987 }
9988 return false;
9989 }
9990
9992 {
9993 GameInventory inventory = GetInventory();
9995 if (attachment_count > 0)
9996 {
9997 int random_pick = Math.RandomInt(0, attachment_count);
9999 if (!attachment.IsExplosive())
10000 {
10001 attachment.AddHealth("","",damage);
10002 return true;
10003 }
10004 }
10005 return false;
10006 }
10007
10009 {
10011 }
10012
10014 {
10016 return GetInventory().CanRemoveEntity();
10017
10018 return false;
10019 }
10020
10022 {
10023
10025 return false;
10026
10027
10029 return false;
10030
10031
10032
10034 if (delta == 0)
10035 return false;
10036
10037
10038 return true;
10039 }
10040
10042 {
10044 {
10045 if (ScriptInputUserData.CanStoreInputUserData())
10046 {
10047 ScriptInputUserData ctx = new ScriptInputUserData;
10052 ctx.
Write(destination_entity);
10054 ctx.
Write(slot_id);
10056 }
10057 }
10058 else if (!
g_Game.IsMultiplayer())
10059 {
10061 }
10062 }
10063
10065 {
10066 float split_quantity_new;
10070 InventoryLocation loc = new InventoryLocation;
10071
10072 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10073 {
10075 split_quantity_new = stack_max;
10076 else
10078
10080 {
10081 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10082 if (new_item)
10083 {
10084 new_item.SetResultOfSplit(true);
10085 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10087 new_item.
SetQuantity(split_quantity_new,
false,
true);
10088 }
10089 }
10090 }
10091 else if (destination_entity && slot_id == -1)
10092 {
10093 if (quantity > stack_max)
10094 split_quantity_new = stack_max;
10095 else
10096 split_quantity_new = quantity;
10097
10099 {
10100 GameInventory destinationInventory = destination_entity.GetInventory();
10102 {
10105 }
10106
10107 if (new_item)
10108 {
10109 new_item.SetResultOfSplit(true);
10110 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10112 new_item.
SetQuantity(split_quantity_new,
false,
true);
10113 }
10114 }
10115 }
10116 else
10117 {
10118 if (stack_max != 0)
10119 {
10121 {
10123 }
10124
10125 if (split_quantity_new == 0)
10126 {
10127 if (!
g_Game.IsMultiplayer())
10128 player.PhysicalPredictiveDropItem(this);
10129 else
10130 player.ServerDropEntity(this);
10131 return;
10132 }
10133
10135 {
10137
10138 if (new_item)
10139 {
10140 new_item.SetResultOfSplit(true);
10141 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10144 new_item.PlaceOnSurface();
10145 }
10146 }
10147 }
10148 }
10149 }
10150
10152 {
10153 float split_quantity_new;
10157 InventoryLocation loc = new InventoryLocation;
10158
10159 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10160 {
10162 split_quantity_new = stack_max;
10163 else
10165
10167 {
10168 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10169 if (new_item)
10170 {
10171 new_item.SetResultOfSplit(true);
10172 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10174 new_item.
SetQuantity(split_quantity_new,
false,
true);
10175 }
10176 }
10177 }
10178 else if (destination_entity && slot_id == -1)
10179 {
10180 if (quantity > stack_max)
10181 split_quantity_new = stack_max;
10182 else
10183 split_quantity_new = quantity;
10184
10186 {
10187 GameInventory destinationInventory = destination_entity.GetInventory();
10189 {
10192 }
10193
10194 if (new_item)
10195 {
10196 new_item.SetResultOfSplit(true);
10197 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10199 new_item.
SetQuantity(split_quantity_new,
false,
true);
10200 }
10201 }
10202 }
10203 else
10204 {
10205 if (stack_max != 0)
10206 {
10208 {
10210 }
10211
10213 {
10215
10216 if (new_item)
10217 {
10218 new_item.SetResultOfSplit(true);
10219 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10222 new_item.PlaceOnSurface();
10223 }
10224 }
10225 }
10226 }
10227 }
10228
10230 {
10232 {
10233 if (ScriptInputUserData.CanStoreInputUserData())
10234 {
10235 ScriptInputUserData ctx = new ScriptInputUserData;
10240 dst.WriteToContext(ctx);
10242 }
10243 }
10244 else if (!
g_Game.IsMultiplayer())
10245 {
10247 }
10248 }
10249
10251 {
10253 {
10254 if (ScriptInputUserData.CanStoreInputUserData())
10255 {
10256 ScriptInputUserData ctx = new ScriptInputUserData;
10261 ctx.
Write(destination_entity);
10267 }
10268 }
10269 else if (!
g_Game.IsMultiplayer())
10270 {
10272 }
10273 }
10274
10276 {
10278 }
10279
10281 {
10283 float split_quantity_new;
10285 if (dst.IsValid())
10286 {
10287 int slot_id = dst.GetSlot();
10289
10290 if (quantity > stack_max)
10291 split_quantity_new = stack_max;
10292 else
10293 split_quantity_new = quantity;
10294
10296 {
10298
10299 if (new_item)
10300 {
10301 new_item.SetResultOfSplit(true);
10302 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10304 new_item.
SetQuantity(split_quantity_new,
false,
true);
10305 }
10306
10307 return new_item;
10308 }
10309 }
10310
10311 return null;
10312 }
10313
10315 {
10317 float split_quantity_new;
10319 if (destination_entity)
10320 {
10322 if (quantity > stackable)
10323 split_quantity_new = stackable;
10324 else
10325 split_quantity_new = quantity;
10326
10328 {
10329 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10330 if (new_item)
10331 {
10332 new_item.SetResultOfSplit(true);
10333 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10335 new_item.
SetQuantity(split_quantity_new,
false,
true);
10336 }
10337 }
10338 }
10339 }
10340
10342 {
10344 {
10345 if (ScriptInputUserData.CanStoreInputUserData())
10346 {
10347 ScriptInputUserData ctx = new ScriptInputUserData;
10352 ItemBase destination_entity =
this;
10353 ctx.
Write(destination_entity);
10357 }
10358 }
10359 else if (!
g_Game.IsMultiplayer())
10360 {
10362 }
10363 }
10364
10366 {
10368 float split_quantity_new;
10370 if (player)
10371 {
10373 if (quantity > stackable)
10374 split_quantity_new = stackable;
10375 else
10376 split_quantity_new = quantity;
10377
10379 {
10380 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10381 new_item =
ItemBase.Cast(in_hands);
10382 if (new_item)
10383 {
10384 new_item.SetResultOfSplit(true);
10385 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10387 new_item.SetQuantity(split_quantity_new, false, true);
10388 }
10389 }
10390 }
10391 }
10392
10394 {
10396 float split_quantity_new = Math.Floor(quantity * 0.5);
10397
10399 return;
10400
10402
10403 if (new_item)
10404 {
10405 if (new_item.GetQuantityMax() < split_quantity_new)
10406 {
10407 split_quantity_new = new_item.GetQuantityMax();
10408 }
10409
10410 new_item.SetResultOfSplit(true);
10411 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10412
10414 {
10417 }
10418 else
10419 {
10421 new_item.
SetQuantity(split_quantity_new,
false,
true);
10422 }
10423 }
10424 }
10425
10427 {
10429 float split_quantity_new = Math.Floor(quantity / 2);
10430
10432 return;
10433
10434 InventoryLocation invloc = new InventoryLocation;
10436
10438 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10439
10440 if (new_item)
10441 {
10442 if (new_item.GetQuantityMax() < split_quantity_new)
10443 {
10444 split_quantity_new = new_item.GetQuantityMax();
10445 }
10447 {
10450 }
10451 else if (split_quantity_new > 1)
10452 {
10454 new_item.
SetQuantity(split_quantity_new,
false,
true);
10455 }
10456 }
10457 }
10458
10461 {
10462 SetWeightDirty();
10464
10465 if (parent)
10466 parent.OnAttachmentQuantityChangedEx(this, delta);
10467
10469 {
10471 {
10473 }
10475 {
10476 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10478 }
10479 }
10480 }
10481
10484 {
10485
10486 }
10487
10490 {
10492 }
10493
10495 {
10496 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10497
10499 {
10500 if (newLevel == GameConstants.STATE_RUINED)
10501 {
10503 EntityAI parent = GetHierarchyParent();
10504 if (parent && parent.IsFireplace())
10505 {
10506 CargoBase cargo = GetInventory().GetCargo();
10507 if (cargo)
10508 {
10510 {
10512 }
10513 }
10514 }
10515 }
10516
10518 {
10519
10521 return;
10522 }
10523
10524 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10525 {
10527 }
10528 }
10529 }
10530
10531
10533 {
10534 super.OnRightClick();
10535
10537 {
10539 {
10540 if (ScriptInputUserData.CanStoreInputUserData())
10541 {
10542 EntityAI root = GetHierarchyRoot();
10543 Man playerOwner = GetHierarchyRootPlayer();
10544 InventoryLocation dst = new InventoryLocation;
10545
10546
10547 if (!playerOwner && root && root == this)
10548 {
10550 }
10551 else
10552 {
10553
10554 GetInventory().GetCurrentInventoryLocation(dst);
10556 {
10557 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10559 {
10561 }
10562 else
10563 {
10565
10566
10567 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10568 {
10570 }
10571 else
10572 {
10573 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10574 }
10575 }
10576 }
10577 }
10578
10579 ScriptInputUserData ctx = new ScriptInputUserData;
10587 }
10588 }
10589 else if (!
g_Game.IsMultiplayer())
10590 {
10592 }
10593 }
10594 }
10595
10597 {
10598 if (root)
10599 {
10600 vector m4[4];
10601 root.GetTransform(m4);
10602 dst.SetGround(this, m4);
10603 }
10604 else
10605 {
10606 GetInventory().GetCurrentInventoryLocation(dst);
10607 }
10608 }
10609
10610 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10611 {
10612
10613 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10614 return false;
10615
10616 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10617 return false;
10618
10619
10621 return false;
10622
10623
10624 Magazine mag = Magazine.Cast(this);
10625 if (mag)
10626 {
10627 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10628 return false;
10629
10630 if (stack_max_limit)
10631 {
10632 Magazine other_mag = Magazine.Cast(other_item);
10633 if (other_item)
10634 {
10635 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10636 return false;
10637 }
10638
10639 }
10640 }
10641 else
10642 {
10643
10645 return false;
10646
10648 return false;
10649 }
10650
10651 PlayerBase player = null;
10652 if (CastTo(player, GetHierarchyRootPlayer()))
10653 {
10654 if (player.GetInventory().HasAttachment(this))
10655 return false;
10656
10657 if (player.IsItemsToDelete())
10658 return false;
10659 }
10660
10661 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10662 return false;
10663
10664 int slotID;
10666 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10667 return false;
10668
10669 return true;
10670 }
10671
10673 {
10675 }
10676
10678 {
10679 return m_IsResultOfSplit;
10680 }
10681
10683 {
10684 m_IsResultOfSplit = value;
10685 }
10686
10688 {
10690 }
10691
10693 {
10694 float other_item_quantity = other_item.GetQuantity();
10695 float this_free_space;
10696
10698
10700
10701 if (other_item_quantity > this_free_space)
10702 {
10703 return this_free_space;
10704 }
10705 else
10706 {
10707 return other_item_quantity;
10708 }
10709 }
10710
10712 {
10714 }
10715
10717 {
10719 return;
10720
10721 if (!IsMagazine() && other_item)
10722 {
10724 if (quantity_used != 0)
10725 {
10726 float hp1 = GetHealth01("","");
10727 float hp2 = other_item.GetHealth01("","");
10728 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10729 hpResult = hpResult / (
GetQuantity() + quantity_used);
10730
10731 hpResult *= GetMaxHealth();
10732 Math.Round(hpResult);
10733 SetHealth("", "Health", hpResult);
10734
10736 other_item.AddQuantity(-quantity_used);
10737 }
10738 }
10740 }
10741
10743 {
10744 #ifdef SERVER
10745 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10746 GetHierarchyParent().IncreaseLifetimeUp();
10747 #endif
10748 };
10749
10751 {
10752 PlayerBase p = PlayerBase.Cast(player);
10753
10754 array<int> recipesIds = p.m_Recipes;
10755 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10756 if (moduleRecipesManager)
10757 {
10758 EntityAI itemInHands = player.GetEntityInHands();
10759 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10760 }
10761
10762 for (int i = 0;i < recipesIds.Count(); i++)
10763 {
10764 int key = recipesIds.Get(i);
10765 string recipeName = moduleRecipesManager.GetRecipeName(key);
10767 }
10768 }
10769
10770
10771 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10772 {
10773 super.GetDebugActions(outputList);
10774
10775
10781
10782
10787
10792
10793
10797
10798
10800 {
10804 }
10805
10808
10809
10813
10815
10816 InventoryLocation loc = new InventoryLocation();
10817 GetInventory().GetCurrentInventoryLocation(loc);
10819 {
10820 if (Gizmo_IsSupported())
10823 }
10824
10826 }
10827
10828
10829
10830
10832 {
10833 super.OnAction(action_id, player, ctx);
10834
10836 {
10837 switch (action_id)
10838 {
10842 return true;
10846 return true;
10847 }
10848 }
10849
10851 {
10852 switch (action_id)
10853 {
10855 Delete();
10856 return true;
10857 }
10858 }
10859
10860 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10861 {
10862 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10863 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10864 PlayerBase p = PlayerBase.Cast(player);
10865 if (
EActions.RECIPES_RANGE_START < 1000)
10866 {
10867 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10868 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10869 }
10870 }
10871 #ifndef SERVER
10872 else if (action_id ==
EActions.WATCH_PLAYER)
10873 {
10874 PluginDeveloper.SetDeveloperItemClientEx(player);
10875 }
10876 #endif
10878 {
10879 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10880 {
10881 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10882 OnDebugButtonPressServer(id + 1);
10883 }
10884
10885 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10886 {
10887 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10889 }
10890
10891 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10892 {
10893 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10895 }
10896
10897 else if (action_id ==
EActions.ADD_QUANTITY)
10898 {
10899 if (IsMagazine())
10900 {
10901 Magazine mag = Magazine.Cast(this);
10902 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10903 }
10904 else
10905 {
10907 }
10908
10909 if (m_EM)
10910 {
10911 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10912 }
10913
10914 }
10915
10916 else if (action_id ==
EActions.REMOVE_QUANTITY)
10917 {
10918 if (IsMagazine())
10919 {
10920 Magazine mag2 = Magazine.Cast(this);
10921 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10922 }
10923 else
10924 {
10926 }
10927 if (m_EM)
10928 {
10929 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10930 }
10931
10932 }
10933
10934 else if (action_id ==
EActions.SET_QUANTITY_0)
10935 {
10937
10938 if (m_EM)
10939 {
10940 m_EM.SetEnergy(0);
10941 }
10942 }
10943
10944 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10945 {
10947
10948 if (m_EM)
10949 {
10950 m_EM.SetEnergy(m_EM.GetEnergyMax());
10951 }
10952 }
10953
10954 else if (action_id ==
EActions.ADD_HEALTH)
10955 {
10956 AddHealth("","",GetMaxHealth("","Health")/5);
10957 }
10958 else if (action_id ==
EActions.REMOVE_HEALTH)
10959 {
10960 AddHealth("","",-GetMaxHealth("","Health")/5);
10961 }
10962 else if (action_id ==
EActions.DESTROY_HEALTH)
10963 {
10964 SetHealth01("","",0);
10965 }
10966 else if (action_id ==
EActions.WATCH_ITEM)
10967 {
10969 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10970 #ifdef DEVELOPER
10971 SetDebugDeveloper_item(this);
10972 #endif
10973 }
10974
10975 else if (action_id ==
EActions.ADD_TEMPERATURE)
10976 {
10977 AddTemperature(20);
10978
10979 }
10980
10981 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10982 {
10983 AddTemperature(-20);
10984
10985 }
10986
10987 else if (action_id ==
EActions.FLIP_FROZEN)
10988 {
10989 SetFrozen(!GetIsFrozen());
10990
10991 }
10992
10993 else if (action_id ==
EActions.ADD_WETNESS)
10994 {
10996
10997 }
10998
10999 else if (action_id ==
EActions.REMOVE_WETNESS)
11000 {
11002
11003 }
11004
11005 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11006 {
11009
11010
11011 }
11012
11013 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11014 {
11017 }
11018
11019 else if (action_id ==
EActions.MAKE_SPECIAL)
11020 {
11021 auto debugParams = DebugSpawnParams.WithPlayer(player);
11022 OnDebugSpawnEx(debugParams);
11023 }
11024
11025 }
11026
11027
11028 return false;
11029 }
11030
11031
11032
11033
11037
11040
11041
11042
11044 {
11045 return false;
11046 }
11047
11048
11050 {
11051 return true;
11052 }
11053
11054
11056 {
11057 return true;
11058 }
11059
11060
11061
11063 {
11064 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11065 return g_Game.ConfigIsExisting(config_path);
11066 }
11067
11070 {
11071 return null;
11072 }
11073
11075 {
11076 return false;
11077 }
11078
11080 {
11081 return false;
11082 }
11083
11087
11088
11090 {
11091 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11092 return module_repairing.CanRepair(this, item_repair_kit);
11093 }
11094
11095
11096 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11097 {
11098 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11099 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11100 }
11101
11102
11104 {
11105
11106
11107
11108
11109
11110
11111
11112
11113 return 1;
11114 }
11115
11116
11117
11119 {
11121 }
11122
11123
11124
11126 {
11128 }
11129
11130
11139 {
11140 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11141
11142 if (player)
11143 {
11144 player.MessageStatus(text);
11145 }
11146 }
11147
11148
11157 {
11158 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11159
11160 if (player)
11161 {
11162 player.MessageAction(text);
11163 }
11164 }
11165
11166
11175 {
11176 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11177
11178 if (player)
11179 {
11180 player.MessageFriendly(text);
11181 }
11182 }
11183
11184
11193 {
11194 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11195
11196 if (player)
11197 {
11198 player.MessageImportant(text);
11199 }
11200 }
11201
11203 {
11204 return true;
11205 }
11206
11207
11208 override bool KindOf(
string tag)
11209 {
11210 bool found = false;
11211 string item_name = this.
GetType();
11213 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11214
11215 int array_size = item_tag_array.Count();
11216 for (int i = 0; i < array_size; i++)
11217 {
11218 if (item_tag_array.Get(i) == tag)
11219 {
11220 found = true;
11221 break;
11222 }
11223 }
11224 return found;
11225 }
11226
11227
11229 {
11230
11231 super.OnRPC(sender, rpc_type,ctx);
11232
11233
11234 switch (rpc_type)
11235 {
11236 #ifndef SERVER
11237 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11238 Param2<bool, string> p = new Param2<bool, string>(false, "");
11239
11241 return;
11242
11243 bool play = p.param1;
11244 string soundSet = p.param2;
11245
11246 if (play)
11247 {
11249 {
11251 {
11253 }
11254 }
11255 else
11256 {
11258 }
11259 }
11260 else
11261 {
11263 }
11264
11265 break;
11266 #endif
11267
11268 }
11269
11271 {
11273 }
11274 }
11275
11276
11277
11278
11280 {
11281 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11282 return plugin.GetID(
name);
11283 }
11284
11286 {
11287 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11288 return plugin.GetName(id);
11289 }
11290
11293 {
11294
11295
11296 int varFlags;
11297 if (!ctx.
Read(varFlags))
11298 return;
11299
11300 if (varFlags & ItemVariableFlags.FLOAT)
11301 {
11303 }
11304 }
11305
11307 {
11308
11309 super.SerializeNumericalVars(floats_out);
11310
11311
11312
11314 {
11316 }
11317
11319 {
11321 }
11322
11324 {
11326 }
11327
11329 {
11334 }
11335
11337 {
11339 }
11340 }
11341
11343 {
11344
11345 super.DeSerializeNumericalVars(floats);
11346
11347
11348 int index = 0;
11349 int mask = Math.Round(floats.Get(index));
11350
11351 index++;
11352
11354 {
11356 {
11358 }
11359 else
11360 {
11361 float quantity = floats.Get(index);
11362 SetQuantity(quantity,
true,
false,
false,
false);
11363 }
11364 index++;
11365 }
11366
11368 {
11369 float wet = floats.Get(index);
11371 index++;
11372 }
11373
11375 {
11376 int liquidtype = Math.Round(floats.Get(index));
11378 index++;
11379 }
11380
11382 {
11384 index++;
11386 index++;
11388 index++;
11390 index++;
11391 }
11392
11394 {
11395 int cleanness = Math.Round(floats.Get(index));
11397 index++;
11398 }
11399 }
11400
11402 {
11403 super.WriteVarsToCTX(ctx);
11404
11405
11407 {
11409 }
11410
11412 {
11414 }
11415
11417 {
11419 }
11420
11422 {
11423 int r,g,b,a;
11429 }
11430
11432 {
11434 }
11435 }
11436
11438 {
11439 if (!super.ReadVarsFromCTX(ctx,version))
11440 return false;
11441
11442 int intValue;
11443 float value;
11444
11445 if (version < 140)
11446 {
11447 if (!ctx.
Read(intValue))
11448 return false;
11449
11450 m_VariablesMask = intValue;
11451 }
11452
11454 {
11455 if (!ctx.
Read(value))
11456 return false;
11457
11459 {
11461 }
11462 else
11463 {
11465 }
11466 }
11467
11468 if (version < 140)
11469 {
11471 {
11472 if (!ctx.
Read(value))
11473 return false;
11474 SetTemperatureDirect(value);
11475 }
11476 }
11477
11479 {
11480 if (!ctx.
Read(value))
11481 return false;
11483 }
11484
11486 {
11487 if (!ctx.
Read(intValue))
11488 return false;
11490 }
11491
11493 {
11494 int r,g,b,a;
11496 return false;
11498 return false;
11500 return false;
11502 return false;
11503
11505 }
11506
11508 {
11509 if (!ctx.
Read(intValue))
11510 return false;
11512 }
11513
11514 if (version >= 138 && version < 140)
11515 {
11517 {
11518 if (!ctx.
Read(intValue))
11519 return false;
11520 SetFrozen(intValue);
11521 }
11522 }
11523
11524 return true;
11525 }
11526
11527
11529 {
11532 {
11534 }
11535
11536 if (!super.OnStoreLoad(ctx, version))
11537 {
11539 return false;
11540 }
11541
11542 if (version >= 114)
11543 {
11544 bool hasQuickBarIndexSaved;
11545
11546 if (!ctx.
Read(hasQuickBarIndexSaved))
11547 {
11549 return false;
11550 }
11551
11552 if (hasQuickBarIndexSaved)
11553 {
11554 int itmQBIndex;
11555
11556
11557 if (!ctx.
Read(itmQBIndex))
11558 {
11560 return false;
11561 }
11562
11563 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11564 if (itmQBIndex != -1 && parentPlayer)
11565 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11566 }
11567 }
11568 else
11569 {
11570
11571 PlayerBase player;
11572 int itemQBIndex;
11573 if (version ==
int.
MAX)
11574 {
11575 if (!ctx.
Read(itemQBIndex))
11576 {
11578 return false;
11579 }
11580 }
11581 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11582 {
11583
11584 if (!ctx.
Read(itemQBIndex))
11585 {
11587 return false;
11588 }
11589 if (itemQBIndex != -1 && player)
11590 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11591 }
11592 }
11593
11594 if (version < 140)
11595 {
11596
11597 if (!LoadVariables(ctx, version))
11598 {
11600 return false;
11601 }
11602 }
11603
11604
11606 {
11608 return false;
11609 }
11610 if (version >= 132)
11611 {
11613 if (raib)
11614 {
11616 {
11618 return false;
11619 }
11620 }
11621 }
11622
11624 return true;
11625 }
11626
11627
11628
11630 {
11631 super.OnStoreSave(ctx);
11632
11633 PlayerBase player;
11634 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11635 {
11637
11638 int itemQBIndex = -1;
11639 itemQBIndex = player.FindQuickBarEntityIndex(this);
11640 ctx.
Write(itemQBIndex);
11641 }
11642 else
11643 {
11645 }
11646
11648
11650 if (raib)
11651 {
11653 }
11654 }
11655
11656
11658 {
11659 super.AfterStoreLoad();
11660
11662 {
11664 }
11665
11667 {
11670 }
11671 }
11672
11674 {
11675 super.EEOnAfterLoad();
11676
11678 {
11680 }
11681
11684 }
11685
11687 {
11688 return false;
11689 }
11690
11691
11692
11694 {
11696 {
11697 #ifdef PLATFORM_CONSOLE
11698
11700 {
11702 if (menu)
11703 {
11705 }
11706 }
11707 #endif
11708 }
11709
11711 {
11714 }
11715
11717 {
11718 SetWeightDirty();
11720 }
11722 {
11725 }
11726
11728 {
11731
11734 }
11736 {
11740 }
11741
11742 super.OnVariablesSynchronized();
11743 }
11744
11745
11746
11748 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11749 {
11750 if (!IsServerCheck(allow_client))
11751 return false;
11752
11754 return false;
11755
11758
11759 if (value <= (min + 0.001))
11760 value = min;
11761
11762 if (value == min)
11763 {
11764 if (destroy_config)
11765 {
11766 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11767 if (dstr)
11768 {
11770 this.Delete();
11771 return true;
11772 }
11773 }
11774 else if (destroy_forced)
11775 {
11777 this.Delete();
11778 return true;
11779 }
11780
11782 }
11783
11786
11788 {
11789 EntityAI parent = GetHierarchyRoot();
11790 InventoryLocation iLoc = new InventoryLocation();
11791 GetInventory().GetCurrentInventoryLocation(iLoc);
11793 {
11794 int iLocSlot = iLoc.
GetSlot();
11796 {
11798 }
11800 {
11802 }
11803 }
11804 }
11805
11807 {
11809
11810 if (delta)
11812 }
11813
11815
11816 return false;
11817 }
11818
11819
11821 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11822 {
11824 }
11825
11827 {
11830 }
11831
11833 {
11836 }
11837
11839 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11840 {
11841 float value_clamped = Math.Clamp(value, 0, 1);
11843 SetQuantity(result, destroy_config, destroy_forced);
11844 }
11845
11846
11849 {
11851 }
11852
11854 {
11856 }
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11868 {
11869 int slot = -1;
11870 GameInventory inventory = GetInventory();
11871 if (inventory)
11872 {
11873 InventoryLocation il = new InventoryLocation;
11876 }
11877
11879 }
11880
11882 {
11883 float quantity_max = 0;
11884
11886 {
11887 if (attSlotID != -1)
11888 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11889
11890 if (quantity_max <= 0)
11892 }
11893
11894 if (quantity_max <= 0)
11896
11897 return quantity_max;
11898 }
11899
11901 {
11903 }
11904
11906 {
11908 }
11909
11910
11912 {
11914 }
11915
11917 {
11919 }
11920
11922 {
11924 }
11925
11926
11928 {
11929
11930 float weightEx = GetWeightEx();
11931 float special = GetInventoryAndCargoWeight();
11932 return weightEx - special;
11933 }
11934
11935
11937 {
11939 }
11940
11942 {
11944 {
11945 #ifdef DEVELOPER
11946 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11947 {
11948 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11950 }
11951 #endif
11952
11953 return GetQuantity() * GetConfigWeightModified();
11954 }
11955 else if (HasEnergyManager())
11956 {
11957 #ifdef DEVELOPER
11958 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11959 {
11960 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11961 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11962 }
11963 #endif
11964 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11965 }
11966 else
11967 {
11968 #ifdef DEVELOPER
11969 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11970 {
11971 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11972 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11973 }
11974 #endif
11975 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11976 }
11977 }
11978
11981 {
11982 int item_count = 0;
11984
11985 GameInventory inventory = GetInventory();
11986 CargoBase cargo = inventory.
GetCargo();
11987 if (cargo != NULL)
11988 {
11990 }
11991
11993 for (int i = 0; i < nAttachments; ++i)
11994 {
11996 if (item)
11997 item_count += item.GetNumberOfItems();
11998 }
11999 return item_count;
12000 }
12001
12004 {
12005 float weight = 0;
12006 float wetness = 1;
12007 if (include_wetness)
12010 {
12011 weight = wetness * m_ConfigWeight;
12012 }
12014 {
12015 weight = 1;
12016 }
12017 return weight;
12018 }
12019
12020
12021
12023 {
12024 GameInventory inventory = GetInventory();
12025 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12026 {
12027 array<EntityAI> items = new array<EntityAI>;
12029 for (int i = 0; i < items.Count(); ++i)
12030 {
12032 if (item)
12033 {
12034 g_Game.ObjectDelete(item);
12035 }
12036 }
12037 }
12038 }
12039
12040
12041
12042
12044 {
12045 float energy = 0;
12046 if (HasEnergyManager())
12047 {
12048 energy = GetCompEM().GetEnergy();
12049 }
12050 return energy;
12051 }
12052
12053
12055 {
12056 super.OnEnergyConsumed();
12057
12059 }
12060
12062 {
12063 super.OnEnergyAdded();
12064
12066 }
12067
12068
12070 {
12071 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12072 {
12074 {
12075 float energy_0to1 = GetCompEM().GetEnergy0To1();
12077 }
12078 }
12079 }
12080
12081
12083 {
12084 return ConfigGetFloat("heatIsolation");
12085 }
12086
12088 {
12090 }
12091
12093 {
12094 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12095 if (
g_Game.ConfigIsExisting(paramPath))
12096 return g_Game.ConfigGetFloat(paramPath);
12097
12098 return 0.0;
12099 }
12100
12102 {
12103 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12104 if (
g_Game.ConfigIsExisting(paramPath))
12105 return g_Game.ConfigGetFloat(paramPath);
12106
12107 return 0.0;
12108 }
12109
12110 override void SetWet(
float value,
bool allow_client =
false)
12111 {
12112 if (!IsServerCheck(allow_client))
12113 return;
12114
12117
12119
12120 m_VarWet = Math.Clamp(value, min, max);
12121
12123 {
12126 }
12127 }
12128
12129 override void AddWet(
float value)
12130 {
12132 }
12133
12135 {
12137 }
12138
12140 {
12142 }
12143
12145 {
12147 }
12148
12150 {
12152 }
12153
12155 {
12157 }
12158
12159 override void OnWetChanged(
float newVal,
float oldVal)
12160 {
12163 if (newLevel != oldLevel)
12164 {
12166 }
12167 }
12168
12170 {
12171 SetWeightDirty();
12172 }
12173
12175 {
12176 return GetWetLevelInternal(
m_VarWet);
12177 }
12178
12179
12180
12182 {
12184 }
12185
12187 {
12189 }
12190
12192 {
12194 }
12195
12197 {
12199 }
12200
12201
12202
12204 {
12205 if (ConfigIsExisting("itemModelLength"))
12206 {
12207 return ConfigGetFloat("itemModelLength");
12208 }
12209 return 0;
12210 }
12211
12213 {
12214 if (ConfigIsExisting("itemAttachOffset"))
12215 {
12216 return ConfigGetFloat("itemAttachOffset");
12217 }
12218 return 0;
12219 }
12220
12221 override void SetCleanness(
int value,
bool allow_client =
false)
12222 {
12223 if (!IsServerCheck(allow_client))
12224 return;
12225
12227
12229
12232 }
12233
12235 {
12237 }
12238
12240 {
12241 return true;
12242 }
12243
12244
12245
12246
12248 {
12250 }
12251
12253 {
12255 }
12256
12257
12258
12259
12260 override void SetColor(
int r,
int g,
int b,
int a)
12261 {
12267 }
12269 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12270 {
12275 }
12276
12278 {
12280 }
12281
12284 {
12285 int r,g,b,a;
12287 r = r/255;
12288 g = g/255;
12289 b = b/255;
12290 a = a/255;
12291 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12292 }
12293
12294
12295
12296 override void SetLiquidType(
int value,
bool allow_client =
false)
12297 {
12298 if (!IsServerCheck(allow_client))
12299 return;
12300
12305 }
12306
12308 {
12309 return ConfigGetInt("varLiquidTypeInit");
12310 }
12311
12313 {
12315 }
12316
12318 {
12320 SetFrozen(false);
12321 }
12322
12325 {
12326 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12327 }
12328
12329
12332 {
12333 PlayerBase nplayer;
12334 if (PlayerBase.CastTo(nplayer, player))
12335 {
12337 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12338 }
12339 }
12340
12341
12344 {
12345 PlayerBase nplayer;
12346 if (PlayerBase.CastTo(nplayer,player))
12347 {
12348 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12349 }
12350
12351 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12352
12353 if (HasEnergyManager())
12354 {
12355 GetCompEM().UpdatePlugState();
12356 }
12357 }
12358
12359
12361 {
12362 super.OnPlacementStarted(player);
12363
12365 }
12366
12367 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12368 {
12370 {
12371 m_AdminLog.OnPlacementComplete(player,
this);
12372 }
12373
12374 super.OnPlacementComplete(player, position, orientation);
12375 }
12376
12377
12378
12379
12380
12382 {
12384 {
12385 return true;
12386 }
12387 else
12388 {
12389 return false;
12390 }
12391 }
12392
12393
12395 {
12397 {
12399 }
12400 }
12401
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12413 override void InsertAgent(
int agent,
float count = 1)
12414 {
12415 if (count < 1)
12416 return;
12417
12419 }
12420
12423 {
12425 }
12426
12427
12429 {
12431 }
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12475 {
12477 return false;
12478 return true;
12479 }
12480
12482 {
12483
12485 }
12486
12487
12490 {
12491 super.CheckForRoofLimited(timeTresholdMS);
12492
12493 float time =
g_Game.GetTime();
12494 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12495 {
12496 m_PreviousRoofTestTime = time;
12497 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12498 }
12499 }
12500
12501
12503 {
12505 {
12506 return 0;
12507 }
12508
12509 if (GetInventory().GetAttachmentSlotsCount() != 0)
12510 {
12511 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12512 if (filter)
12513 return filter.GetProtectionLevel(type, false, system);
12514 else
12515 return 0;
12516 }
12517
12518 string subclassPath, entryName;
12519
12520 switch (type)
12521 {
12523 entryName = "biological";
12524 break;
12526 entryName = "chemical";
12527 break;
12528 default:
12529 entryName = "biological";
12530 break;
12531 }
12532
12533 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12534
12535 return g_Game.ConfigGetFloat(subclassPath + entryName);
12536 }
12537
12538
12539
12542 {
12543 if (!IsMagazine())
12545
12547 }
12548
12549
12550
12551
12552
12557 {
12558 return true;
12559 }
12560
12562 {
12564 }
12565
12566
12567
12568
12569
12571 {
12572 if (parent)
12573 {
12574 if (parent.IsInherited(DayZInfected))
12575 return true;
12576
12577 if (!parent.IsRuined())
12578 return true;
12579 }
12580
12581 return true;
12582 }
12583
12585 {
12586 if (!super.CanPutAsAttachment(parent))
12587 {
12588 return false;
12589 }
12590
12591 if (!IsRuined() && !parent.IsRuined())
12592 {
12593 return true;
12594 }
12595
12596 return false;
12597 }
12598
12600 {
12601
12602
12603
12604
12605 return super.CanReceiveItemIntoCargo(item);
12606 }
12607
12609 {
12610
12611
12612
12613
12614 GameInventory attachmentInv = attachment.GetInventory();
12616 {
12617 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12618 return false;
12619 }
12620
12621 InventoryLocation loc = new InventoryLocation();
12622 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12623 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12624 return false;
12625
12626 return super.CanReceiveAttachment(attachment, slotId);
12627 }
12628
12630 {
12631 if (!super.CanReleaseAttachment(attachment))
12632 return false;
12633
12634 return GetInventory().AreChildrenAccessible();
12635 }
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12658 {
12659 int id = muzzle_owner.GetMuzzleID();
12660 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12661
12662 if (WPOF_array)
12663 {
12664 for (int i = 0; i < WPOF_array.Count(); i++)
12665 {
12666 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12667
12668 if (WPOF)
12669 {
12670 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12671 }
12672 }
12673 }
12674 }
12675
12676
12678 {
12679 int id = muzzle_owner.GetMuzzleID();
12681
12682 if (WPOBE_array)
12683 {
12684 for (int i = 0; i < WPOBE_array.Count(); i++)
12685 {
12686 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12687
12688 if (WPOBE)
12689 {
12690 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12691 }
12692 }
12693 }
12694 }
12695
12696
12698 {
12699 int id = muzzle_owner.GetMuzzleID();
12700 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12701
12702 if (WPOOH_array)
12703 {
12704 for (int i = 0; i < WPOOH_array.Count(); i++)
12705 {
12706 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12707
12708 if (WPOOH)
12709 {
12710 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12711 }
12712 }
12713 }
12714 }
12715
12716
12718 {
12719 int id = muzzle_owner.GetMuzzleID();
12720 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12721
12722 if (WPOOH_array)
12723 {
12724 for (int i = 0; i < WPOOH_array.Count(); i++)
12725 {
12726 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12727
12728 if (WPOOH)
12729 {
12730 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12731 }
12732 }
12733 }
12734 }
12735
12736
12738 {
12739 int id = muzzle_owner.GetMuzzleID();
12740 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12741
12742 if (WPOOH_array)
12743 {
12744 for (int i = 0; i < WPOOH_array.Count(); i++)
12745 {
12746 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12747
12748 if (WPOOH)
12749 {
12750 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12751 }
12752 }
12753 }
12754 }
12755
12756
12757
12759 {
12761 {
12762 return true;
12763 }
12764
12765 return false;
12766 }
12767
12769 {
12771 {
12772 return true;
12773 }
12774
12775 return false;
12776 }
12777
12779 {
12781 {
12782 return true;
12783 }
12784
12785 return false;
12786 }
12787
12789 {
12790 return false;
12791 }
12792
12795 {
12796 return UATimeSpent.DEFAULT_DEPLOY;
12797 }
12798
12799
12800
12801
12803 {
12805 SetSynchDirty();
12806 }
12807
12809 {
12811 }
12812
12813
12815 {
12816 return false;
12817 }
12818
12821 {
12822 string att_type = "None";
12823
12824 if (ConfigIsExisting("soundAttType"))
12825 {
12826 att_type = ConfigGetString("soundAttType");
12827 }
12828
12830 }
12831
12833 {
12835 }
12836
12837
12838
12839
12840
12846
12848 {
12851
12853 }
12854
12855
12857 {
12859 return;
12860
12862
12865
12868
12869 SoundParameters params = new SoundParameters();
12873 }
12874
12875
12877 {
12879 {
12882
12883 SetSynchDirty();
12884
12887 }
12888 }
12889
12891 {
12893 }
12894
12895
12897 {
12899 return;
12900
12902 SetSynchDirty();
12903
12906 }
12907
12909 {
12912 }
12913
12915 {
12917 }
12918
12919 void OnApply(PlayerBase player);
12920
12922 {
12923 return 1.0;
12924 };
12925
12927 {
12929 }
12930
12932 {
12934 }
12935
12937
12939 {
12940 SetDynamicPhysicsLifeTime(0.01);
12942 }
12943
12945 {
12946 array<string> zone_names = new array<string>;
12947 GetDamageZones(zone_names);
12948 for (int i = 0; i < zone_names.Count(); i++)
12949 {
12950 SetHealthMax(zone_names.Get(i),"Health");
12951 }
12952 SetHealthMax("","Health");
12953 }
12954
12957 {
12958 float global_health = GetHealth01("","Health");
12959 array<string> zones = new array<string>;
12960 GetDamageZones(zones);
12961
12962 for (int i = 0; i < zones.Count(); i++)
12963 {
12964 SetHealth01(zones.Get(i),"Health",global_health);
12965 }
12966 }
12967
12970 {
12971 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12972 }
12973
12975 {
12976 if (!hasRootAsPlayer)
12977 {
12978 if (refParentIB)
12979 {
12980
12981 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12982 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12983
12984 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12985 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12986
12989 }
12990 else
12991 {
12992
12995 }
12996 }
12997 }
12998
13000 {
13002 {
13003 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13004 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13005 {
13006 float heatPermCoef = 1.0;
13008 while (ent)
13009 {
13010 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13011 ent = ent.GetHierarchyParent();
13012 }
13013
13014 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13015 }
13016 }
13017 }
13018
13020 {
13021
13022 EntityAI parent = GetHierarchyParent();
13023 if (!parent)
13024 {
13025 hasParent = false;
13026 hasRootAsPlayer = false;
13027 }
13028 else
13029 {
13030 hasParent = true;
13031 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13032 refParentIB =
ItemBase.Cast(parent);
13033 }
13034 }
13035
13036 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13037 {
13038
13039 }
13040
13042 {
13043
13044 return false;
13045 }
13046
13048 {
13049
13050
13051 return false;
13052 }
13053
13055 {
13056
13057 return false;
13058 }
13059
13062 {
13063 return !GetIsFrozen() &&
IsOpen();
13064 }
13065
13067 {
13068 bool hasParent = false, hasRootAsPlayer = false;
13070
13071 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13072 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13073
13074 if (wwtu || foodDecay)
13075 {
13079
13080 if (processWetness || processTemperature || processDecay)
13081 {
13083
13084 if (processWetness)
13085 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13086
13087 if (processTemperature)
13089
13090 if (processDecay)
13091 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13092 }
13093 }
13094 }
13095
13098 {
13100 }
13101
13103 {
13106
13107 return super.GetTemperatureFreezeThreshold();
13108 }
13109
13111 {
13114
13115 return super.GetTemperatureThawThreshold();
13116 }
13117
13119 {
13122
13123 return super.GetItemOverheatThreshold();
13124 }
13125
13127 {
13129 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13130
13131 return super.GetTemperatureFreezeTime();
13132 }
13133
13135 {
13137 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13138
13139 return super.GetTemperatureThawTime();
13140 }
13141
13146
13148 {
13149 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13150 }
13151
13153 {
13154 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13155 }
13156
13159 {
13161 }
13162
13164 {
13166 }
13167
13169 {
13171 }
13172
13175 {
13176 return null;
13177 }
13178
13181 {
13182 return false;
13183 }
13184
13186 {
13188 {
13191 if (!trg)
13192 {
13194 explosive = this;
13195 }
13196
13197 explosive.PairRemote(trg);
13199
13200 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13201 trg.SetPersistentPairID(persistentID);
13202 explosive.SetPersistentPairID(persistentID);
13203
13204 return true;
13205 }
13206 return false;
13207 }
13208
13211 {
13212 float ret = 1.0;
13215 ret *= GetHealth01();
13216
13217 return ret;
13218 }
13219
13220 #ifdef DEVELOPER
13221 override void SetDebugItem()
13222 {
13223 super.SetDebugItem();
13224 _itemBase = this;
13225 }
13226
13228 {
13229 string text = super.GetDebugText();
13230
13232 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13233
13234 return text;
13235 }
13236 #endif
13237
13239 {
13240 return true;
13241 }
13242
13244
13246
13248 {
13251 }
13252
13253
13261
13277
13278 [
Obsolete(
"Use ItemSoundHandler instead")]
13281 {
13282 if (!
g_Game.IsDedicatedServer())
13283 {
13284 if (ConfigIsExisting("attachSoundSet"))
13285 {
13286 string cfg_path = "";
13287 string soundset = "";
13288 string type_name =
GetType();
13289
13292 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13293 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13294
13295 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13296 {
13297 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13298 {
13299 if (cfg_slot_array[i] == slot_type)
13300 {
13301 soundset = cfg_soundset_array[i];
13302 break;
13303 }
13304 }
13305 }
13306
13307 if (soundset != "")
13308 {
13309 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13311 }
13312 }
13313 }
13314 }
13315
13317}
13318
13320{
13322 if (entity)
13323 {
13324 bool is_item = entity.IsInherited(
ItemBase);
13325 if (is_item && full_quantity)
13326 {
13329 }
13330 }
13331 else
13332 {
13334 return NULL;
13335 }
13336 return entity;
13337}
13338
13340{
13341 if (item)
13342 {
13343 if (health > 0)
13344 item.SetHealth("", "", health);
13345
13346 if (item.CanHaveTemperature())
13347 {
13349 if (item.CanFreeze())
13350 item.SetFrozen(false);
13351 }
13352
13353 if (item.HasEnergyManager())
13354 {
13355 if (quantity >= 0)
13356 {
13357 item.GetCompEM().SetEnergy0To1(quantity);
13358 }
13359 else
13360 {
13362 }
13363 }
13364 else if (item.IsMagazine())
13365 {
13366 Magazine mag = Magazine.Cast(item);
13367 if (quantity >= 0)
13368 {
13369 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13370 }
13371 else
13372 {
13374 }
13375
13376 }
13377 else
13378 {
13379 if (quantity >= 0)
13380 {
13381 item.SetQuantityNormalized(quantity, false);
13382 }
13383 else
13384 {
13386 }
13387
13388 }
13389 }
13390}
13391
13392#ifdef DEVELOPER
13394#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.