Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config(for Min 0 and Max 5000, value 2500 will result in 0.5)
8335{
8337 {
8338 return true;
8339 }
8340};
8341
8343{
8344
8345};
8346
8347
8348
8350{
8354
8356
8359
8360
8361
8362
8363
8372
8378
8383
8388
8409 protected bool m_IsResultOfSplit
8410
8412
8417
8418
8419
8421
8425
8426
8427
8429
8432
8433
8434
8440
8441
8449
8452
8453
8455
8456
8458
8459
8464
8465
8470
8472
8473
8475
8476
8478 {
8483
8484 if (!
g_Game.IsDedicatedServer())
8485 {
8487 {
8489
8491 {
8493 }
8494 }
8495
8498 }
8499
8500 m_OldLocation = null;
8501
8503 {
8505 }
8506
8507 if (ConfigIsExisting("headSelectionsToHide"))
8508 {
8511 }
8512
8514 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8515 {
8517 }
8518
8520
8521 m_IsResultOfSplit = false;
8522
8524 }
8525
8527 {
8528 super.InitItemVariables();
8529
8535 m_Count = ConfigGetInt(
"count");
8536
8539
8544
8547
8552
8564
8568
8569
8572 if (ConfigIsExisting("canBeSplit"))
8573 {
8576 }
8577
8579 if (ConfigIsExisting("itemBehaviour"))
8581
8582
8585 RegisterNetSyncVariableInt("m_VarLiquidType");
8586 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8587
8588 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8589 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8590 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8591
8592 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8593 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8594 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8595 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8596
8597 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8598 RegisterNetSyncVariableBool("m_IsTakeable");
8599 RegisterNetSyncVariableBool("m_IsHologram");
8600
8603 {
8606 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8607 }
8608
8610
8612 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8614
8616 }
8617
8619 {
8621 }
8622
8624 {
8627 {
8632 }
8633 }
8634
8635 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8636 {
8638 {
8641 }
8642
8644 }
8645
8647 {
8653 }
8654
8656
8658 {
8660
8661 if (!action)
8662 {
8663 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8664 return;
8665 }
8666
8668 if (!ai)
8669 {
8671 return;
8672 }
8673
8675 if (!action_array)
8676 {
8677 action_array = new array<ActionBase_Basic>;
8679 }
8680 if (LogManager.IsActionLogEnable())
8681 {
8682 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8683 }
8684
8685 if (action_array.Find(action) != -1)
8686 {
8687 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8688 }
8689 else
8690 {
8691 action_array.Insert(action);
8692 }
8693 }
8694
8696 {
8697 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8698 ActionBase action = player.GetActionManager().GetAction(actionName);
8701
8702 if (action_array)
8703 {
8704 action_array.RemoveItem(action);
8705 }
8706 }
8707
8708
8709
8711 {
8712 ActionOverrideData overrideData = new ActionOverrideData();
8716
8718 if (!actionMap)
8719 {
8722 }
8723
8724 actionMap.Insert(this.
Type(), overrideData);
8725
8726 }
8727
8729
8731
8732
8734 {
8737
8740
8741 string config_to_search = "CfgVehicles";
8742 string muzzle_owner_config;
8743
8745 {
8746 if (IsInherited(Weapon))
8747 config_to_search = "CfgWeapons";
8748
8749 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8750
8751 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8752
8753 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8754
8755 if (config_OnFire_subclass_count > 0)
8756 {
8757 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8758
8759 for (int i = 0; i < config_OnFire_subclass_count; i++)
8760 {
8761 string particle_class = "";
8762 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8763 string config_OnFire_entry = config_OnFire_class + particle_class;
8764 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8765 WPOF_array.Insert(WPOF);
8766 }
8767
8768
8770 }
8771 }
8772
8774 {
8775 config_to_search = "CfgWeapons";
8776 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8777
8778 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8779
8780 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8781
8782 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8783 {
8784 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8785
8786 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8787 {
8788 string particle_class2 = "";
8789 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8790 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8791 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8792 WPOBE_array.Insert(WPOBE);
8793 }
8794
8795
8797 }
8798 }
8799 }
8800
8801
8803 {
8806
8808 {
8809 string config_to_search = "CfgVehicles";
8810
8811 if (IsInherited(Weapon))
8812 config_to_search = "CfgWeapons";
8813
8814 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8815 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8816
8817 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8818 {
8819
8821
8823 {
8825 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8827 return;
8828 }
8829
8832
8833
8834
8835 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8836 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8837
8838 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8839 {
8840 string particle_class = "";
8841 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8842 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8843 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8844
8845 if (entry_type == CT_CLASS)
8846 {
8847 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8848 WPOOH_array.Insert(WPOF);
8849 }
8850 }
8851
8852
8854 }
8855 }
8856 }
8857
8859 {
8861 }
8862
8864 {
8866 {
8868
8871
8874
8875 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8876 }
8877 }
8878
8880 {
8882 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8883
8885 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8886
8888 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8889
8891 {
8893 }
8894 }
8895
8897 {
8899 }
8900
8902 {
8905 else
8907
8909 {
8912 }
8913 else
8914 {
8917
8920 }
8921
8923 }
8924
8926 {
8928 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8929 }
8930
8932 {
8934 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8936 }
8937
8939 {
8941 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8942 }
8943
8945 {
8948
8949 OverheatingParticle OP = new OverheatingParticle();
8954
8956 }
8957
8959 {
8962
8963 return -1;
8964 }
8965
8967 {
8969 {
8972
8973 for (int i = count; i > 0; --i)
8974 {
8975 int id = i - 1;
8978
8981
8982 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8983 {
8984 if (p)
8985 {
8988 }
8989 }
8990 }
8991 }
8992 }
8993
8995 {
8997 {
8999 {
9000 int id = i - 1;
9002
9003 if (OP)
9004 {
9006
9007 if (p)
9008 {
9010 }
9011
9012 delete OP;
9013 }
9014 }
9015
9018 }
9019 }
9020
9023 {
9024 return 0.0;
9025 }
9026
9027
9029 {
9030 return 250;
9031 }
9032
9034 {
9035 return 0;
9036 }
9037
9040 {
9042 return true;
9043
9044 return false;
9045 }
9046
9049 {
9052
9054 {
9056 }
9057 else
9058 {
9059
9061 }
9062
9064 }
9065
9072 {
9073 return -1;
9074 }
9075
9076
9077
9078
9080 {
9082 {
9083 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9084 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9085
9086 if (r_index >= 0)
9087 {
9088 InventoryLocation r_il = new InventoryLocation;
9089 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9090
9091 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9094 {
9095 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9096 }
9098 {
9099 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9100 }
9101
9102 }
9103
9104 player.GetHumanInventory().ClearUserReservedLocation(this);
9105 }
9106
9109 }
9110
9111
9112
9113
9115 {
9116 return ItemBase.m_DebugActionsMask;
9117 }
9118
9120 {
9121 return ItemBase.m_DebugActionsMask & mask;
9122 }
9123
9125 {
9126 ItemBase.m_DebugActionsMask = mask;
9127 }
9128
9130 {
9131 ItemBase.m_DebugActionsMask |= mask;
9132 }
9133
9135 {
9136 ItemBase.m_DebugActionsMask &= ~mask;
9137 }
9138
9140 {
9142 {
9144 }
9145 else
9146 {
9148 }
9149 }
9150
9151
9153 {
9154 if (GetEconomyProfile())
9155 {
9156 float q_max = GetEconomyProfile().GetQuantityMax();
9157 if (q_max > 0)
9158 {
9159 float q_min = GetEconomyProfile().GetQuantityMin();
9160 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9161
9163 {
9164 ComponentEnergyManager comp = GetCompEM();
9166 {
9168 }
9169 }
9171 {
9173
9174 }
9175
9176 }
9177 }
9178 }
9179
9182 {
9183 EntityAI parent = GetHierarchyParent();
9184
9185 if (parent)
9186 {
9187 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9188 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9189 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9190 }
9191 }
9192
9195 {
9196 EntityAI parent = GetHierarchyParent();
9197
9198 if (parent)
9199 {
9200 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9201 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9202 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9203 }
9204 }
9205
9207 {
9208
9209
9210
9211
9213
9215 {
9216 if (ScriptInputUserData.CanStoreInputUserData())
9217 {
9218 ScriptInputUserData ctx = new ScriptInputUserData;
9224 ctx.
Write(use_stack_max);
9227
9229 {
9230 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9231 }
9232 }
9233 }
9234 else if (!
g_Game.IsMultiplayer())
9235 {
9237 }
9238 }
9239
9241 {
9243 }
9244
9246 {
9248 }
9249
9251 {
9253 }
9254
9256 {
9257
9258 return false;
9259 }
9260
9262 {
9263 return false;
9264 }
9265
9269 {
9270 return false;
9271 }
9272
9274 {
9275 return "";
9276 }
9277
9279
9281 {
9282 return false;
9283 }
9284
9286 {
9287 return true;
9288 }
9289
9290
9291
9293 {
9294 return true;
9295 }
9296
9298 {
9299 return true;
9300 }
9301
9303 {
9304 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9306 }
9307
9309 {
9311 }
9312
9314 {
9316 if (!is_being_placed)
9318 SetSynchDirty();
9319 }
9320
9321
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9336 return 1;
9337 }
9338
9340 {
9341 return false;
9342 }
9343
9345 {
9347 SetSynchDirty();
9348 }
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9385 {
9386 super.OnMovedInsideCargo(container);
9387
9388 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9389 }
9390
9391 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9392 {
9393 super.EEItemLocationChanged(oldLoc, newLoc);
9394
9395 PlayerBase newPlayer = null;
9396 PlayerBase oldPlayer = null;
9397
9398 if (newLoc.GetParent())
9399 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9400
9401 if (oldLoc.GetParent())
9402 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9403
9405 {
9406 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9407
9408 if (rIndex >= 0)
9409 {
9410 InventoryLocation rIl = new InventoryLocation;
9411 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9412
9413 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9416 {
9417 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9418 }
9420 {
9422 }
9423
9424 }
9425 }
9426
9428 {
9429 if (newPlayer)
9430 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9431
9432 if (newPlayer == oldPlayer)
9433 {
9434 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9435 {
9437 {
9438 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9439 {
9440 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9441 }
9442 }
9443 else
9444 {
9445 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9446 }
9447 }
9448
9449 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9450 {
9451 int type = oldLoc.GetType();
9453 {
9454 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9455 }
9457 {
9458 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9459 }
9460 }
9461 if (!m_OldLocation)
9462 {
9463 m_OldLocation = new InventoryLocation;
9464 }
9465 m_OldLocation.Copy(oldLoc);
9466 }
9467 else
9468 {
9469 if (m_OldLocation)
9470 {
9471 m_OldLocation.Reset();
9472 }
9473 }
9474
9475 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9476 }
9477 else
9478 {
9479 if (newPlayer)
9480 {
9481 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9482 if (resIndex >= 0)
9483 {
9484 InventoryLocation il = new InventoryLocation;
9485 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9487 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9490 {
9491 il.
GetParent().GetOnReleaseLock().Invoke(it);
9492 }
9494 {
9496 }
9497
9498 }
9499 }
9501 {
9502
9504 }
9505
9506 if (m_OldLocation)
9507 {
9508 m_OldLocation.Reset();
9509 }
9510 }
9511
9513 {
9514 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9515 }
9516
9518 {
9519 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9520 }
9521 }
9522
9523 override void EOnContact(IEntity other, Contact extra)
9524 {
9526 {
9527 int liquidType = -1;
9529 if (impactSpeed > 0.0)
9530 {
9532 #ifndef SERVER
9534 #else
9536 SetSynchDirty();
9537 #endif
9539 }
9540 }
9541
9542 #ifdef SERVER
9543 if (GetCompEM() && GetCompEM().IsPlugged())
9544 {
9545 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9546 GetCompEM().UnplugThis();
9547 }
9548 #endif
9549 }
9550
9552
9554 {
9556 }
9557
9559 {
9560
9561 }
9562
9564 {
9565 super.OnItemLocationChanged(old_owner, new_owner);
9566
9567 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9568 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9569
9570 if (!relatedPlayer && playerNew)
9571 relatedPlayer = playerNew;
9572
9573 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9574 {
9576 if (actionMgr)
9577 {
9578 ActionBase currentAction = actionMgr.GetRunningAction();
9579 if (currentAction)
9581 }
9582 }
9583
9584 Man ownerPlayerOld = null;
9585 Man ownerPlayerNew = null;
9586
9587 if (old_owner)
9588 {
9589 if (old_owner.
IsMan())
9590 {
9591 ownerPlayerOld = Man.Cast(old_owner);
9592 }
9593 else
9594 {
9595 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9596 }
9597 }
9598 else
9599 {
9601 {
9603
9604 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9605 {
9606 GetCompEM().UnplugThis();
9607 }
9608 }
9609 }
9610
9611 if (new_owner)
9612 {
9613 if (new_owner.
IsMan())
9614 {
9615 ownerPlayerNew = Man.Cast(new_owner);
9616 }
9617 else
9618 {
9619 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9620 }
9621 }
9622
9623 if (ownerPlayerOld != ownerPlayerNew)
9624 {
9625 if (ownerPlayerOld)
9626 {
9627 array<EntityAI> subItemsExit = new array<EntityAI>;
9629 for (int i = 0; i < subItemsExit.Count(); i++)
9630 {
9633 }
9634 }
9635
9636 if (ownerPlayerNew)
9637 {
9638 array<EntityAI> subItemsEnter = new array<EntityAI>;
9640 for (int j = 0; j < subItemsEnter.Count(); j++)
9641 {
9644 }
9645 }
9646 }
9647 else if (ownerPlayerNew != null)
9648 {
9649 PlayerBase nplayer;
9650 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9651 {
9652 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9654 for (int k = 0; k < subItemsUpdate.Count(); k++)
9655 {
9657 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9658 }
9659 }
9660 }
9661
9662 if (old_owner)
9663 old_owner.OnChildItemRemoved(this);
9664 if (new_owner)
9665 new_owner.OnChildItemReceived(this);
9666 }
9667
9668
9670 {
9671 super.EEDelete(parent);
9672 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9673 if (player)
9674 {
9676
9677 if (player.IsAlive())
9678 {
9679 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9680 if (r_index >= 0)
9681 {
9682 InventoryLocation r_il = new InventoryLocation;
9683 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9684
9685 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9688 {
9689 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9690 }
9692 {
9693 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9694 }
9695
9696 }
9697
9698 player.RemoveQuickBarEntityShortcut(this);
9699 }
9700 }
9701 }
9702
9704 {
9705 super.EEKilled(killer);
9706
9709 {
9710 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9711 {
9712 if (IsMagazine())
9713 {
9714 if (Magazine.Cast(this).GetAmmoCount() > 0)
9715 {
9717 }
9718 }
9719 else
9720 {
9722 }
9723 }
9724 }
9725 }
9726
9728 {
9729 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9730
9731 super.OnWasAttached(parent, slot_id);
9732
9735
9738 }
9739
9741 {
9742 super.OnWasDetached(parent, slot_id);
9743
9746
9749 }
9750
9752 {
9753 int idx;
9756
9757 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9758 if (inventory_slots.Count() < 1)
9759 {
9760 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9761 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9762 }
9763 else
9764 {
9765 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9766 }
9767
9768 idx = inventory_slots.Find(slot);
9769 if (idx < 0)
9770 return "";
9771
9772 return attach_types.Get(idx);
9773 }
9774
9776 {
9777 int idx = -1;
9778 string slot;
9779
9782
9783 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9784 if (inventory_slots.Count() < 1)
9785 {
9786 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9787 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9788 }
9789 else
9790 {
9791 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9792 if (detach_types.Count() < 1)
9793 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9794 }
9795
9796 for (int i = 0; i < inventory_slots.Count(); i++)
9797 {
9798 slot = inventory_slots.Get(i);
9799 }
9800
9801 if (slot != "")
9802 {
9803 if (detach_types.Count() == 1)
9804 idx = 0;
9805 else
9806 idx = inventory_slots.Find(slot);
9807 }
9808 if (idx < 0)
9809 return "";
9810
9811 return detach_types.Get(idx);
9812 }
9813
9815 {
9816
9818
9819
9820 float min_time = 1;
9821 float max_time = 3;
9822 float delay = Math.RandomFloat(min_time, max_time);
9823
9824 explode_timer.Run(delay, this, "DoAmmoExplosion");
9825 }
9826
9828 {
9829 Magazine magazine = Magazine.Cast(this);
9830 int pop_sounds_count = 6;
9831 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9832
9833
9834 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9835 string sound_name = pop_sounds[ sound_idx ];
9836 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9837
9838
9839 magazine.ServerAddAmmoCount(-1);
9840
9841
9842 float min_temp_to_explode = 100;
9843
9844 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9845 {
9847 }
9848 }
9849
9850
9851 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9852 {
9853 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9854
9855 const int CHANCE_DAMAGE_CARGO = 4;
9856 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9857 const int CHANCE_DAMAGE_NOTHING = 2;
9858
9860 {
9861 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9862 int chances;
9863 int rnd;
9864
9865 if (GetInventory().GetCargo())
9866 {
9867 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9868 rnd = Math.RandomInt(0,chances);
9869
9870 if (rnd < CHANCE_DAMAGE_CARGO)
9871 {
9873 }
9874 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9875 {
9877 }
9878 }
9879 else
9880 {
9881 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9882 rnd = Math.RandomInt(0,chances);
9883
9884 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9885 {
9887 }
9888 }
9889 }
9890 }
9891
9893 {
9894 CargoBase cargo = GetInventory().GetCargo();
9895 if (cargo)
9896 {
9898 if (item_count > 0)
9899 {
9900 int random_pick = Math.RandomInt(0, item_count);
9902 if (!item.IsExplosive())
9903 {
9904 item.AddHealth("","",damage);
9905 return true;
9906 }
9907 }
9908 }
9909 return false;
9910 }
9911
9913 {
9914 GameInventory inventory = GetInventory();
9916 if (attachment_count > 0)
9917 {
9918 int random_pick = Math.RandomInt(0, attachment_count);
9920 if (!attachment.IsExplosive())
9921 {
9922 attachment.AddHealth("","",damage);
9923 return true;
9924 }
9925 }
9926 return false;
9927 }
9928
9930 {
9932 }
9933
9935 {
9937 return GetInventory().CanRemoveEntity();
9938
9939 return false;
9940 }
9941
9943 {
9944
9946 return false;
9947
9948
9950 return false;
9951
9952
9953
9955 if (delta == 0)
9956 return false;
9957
9958
9959 return true;
9960 }
9961
9963 {
9965 {
9966 if (ScriptInputUserData.CanStoreInputUserData())
9967 {
9968 ScriptInputUserData ctx = new ScriptInputUserData;
9973 ctx.
Write(destination_entity);
9977 }
9978 }
9979 else if (!
g_Game.IsMultiplayer())
9980 {
9982 }
9983 }
9984
9986 {
9987 float split_quantity_new;
9991 InventoryLocation loc = new InventoryLocation;
9992
9993 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9994 {
9996 split_quantity_new = stack_max;
9997 else
9999
10001 {
10002 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10003 if (new_item)
10004 {
10005 new_item.SetResultOfSplit(true);
10006 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10008 new_item.
SetQuantity(split_quantity_new,
false,
true);
10009 }
10010 }
10011 }
10012 else if (destination_entity && slot_id == -1)
10013 {
10014 if (quantity > stack_max)
10015 split_quantity_new = stack_max;
10016 else
10017 split_quantity_new = quantity;
10018
10020 {
10021 GameInventory destinationInventory = destination_entity.GetInventory();
10023 {
10026 }
10027
10028 if (new_item)
10029 {
10030 new_item.SetResultOfSplit(true);
10031 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10033 new_item.
SetQuantity(split_quantity_new,
false,
true);
10034 }
10035 }
10036 }
10037 else
10038 {
10039 if (stack_max != 0)
10040 {
10042 {
10044 }
10045
10046 if (split_quantity_new == 0)
10047 {
10048 if (!
g_Game.IsMultiplayer())
10049 player.PhysicalPredictiveDropItem(this);
10050 else
10051 player.ServerDropEntity(this);
10052 return;
10053 }
10054
10056 {
10058
10059 if (new_item)
10060 {
10061 new_item.SetResultOfSplit(true);
10062 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10065 new_item.PlaceOnSurface();
10066 }
10067 }
10068 }
10069 }
10070 }
10071
10073 {
10074 float split_quantity_new;
10078 InventoryLocation loc = new InventoryLocation;
10079
10080 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10081 {
10083 split_quantity_new = stack_max;
10084 else
10086
10088 {
10089 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10090 if (new_item)
10091 {
10092 new_item.SetResultOfSplit(true);
10093 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10095 new_item.
SetQuantity(split_quantity_new,
false,
true);
10096 }
10097 }
10098 }
10099 else if (destination_entity && slot_id == -1)
10100 {
10101 if (quantity > stack_max)
10102 split_quantity_new = stack_max;
10103 else
10104 split_quantity_new = quantity;
10105
10107 {
10108 GameInventory destinationInventory = destination_entity.GetInventory();
10110 {
10113 }
10114
10115 if (new_item)
10116 {
10117 new_item.SetResultOfSplit(true);
10118 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10120 new_item.
SetQuantity(split_quantity_new,
false,
true);
10121 }
10122 }
10123 }
10124 else
10125 {
10126 if (stack_max != 0)
10127 {
10129 {
10131 }
10132
10134 {
10136
10137 if (new_item)
10138 {
10139 new_item.SetResultOfSplit(true);
10140 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10143 new_item.PlaceOnSurface();
10144 }
10145 }
10146 }
10147 }
10148 }
10149
10151 {
10153 {
10154 if (ScriptInputUserData.CanStoreInputUserData())
10155 {
10156 ScriptInputUserData ctx = new ScriptInputUserData;
10161 dst.WriteToContext(ctx);
10163 }
10164 }
10165 else if (!
g_Game.IsMultiplayer())
10166 {
10168 }
10169 }
10170
10172 {
10174 {
10175 if (ScriptInputUserData.CanStoreInputUserData())
10176 {
10177 ScriptInputUserData ctx = new ScriptInputUserData;
10182 ctx.
Write(destination_entity);
10188 }
10189 }
10190 else if (!
g_Game.IsMultiplayer())
10191 {
10193 }
10194 }
10195
10197 {
10199 }
10200
10202 {
10204 float split_quantity_new;
10206 if (dst.IsValid())
10207 {
10208 int slot_id = dst.GetSlot();
10210
10211 if (quantity > stack_max)
10212 split_quantity_new = stack_max;
10213 else
10214 split_quantity_new = quantity;
10215
10217 {
10219
10220 if (new_item)
10221 {
10222 new_item.SetResultOfSplit(true);
10223 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10225 new_item.
SetQuantity(split_quantity_new,
false,
true);
10226 }
10227
10228 return new_item;
10229 }
10230 }
10231
10232 return null;
10233 }
10234
10236 {
10238 float split_quantity_new;
10240 if (destination_entity)
10241 {
10243 if (quantity > stackable)
10244 split_quantity_new = stackable;
10245 else
10246 split_quantity_new = quantity;
10247
10249 {
10250 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10251 if (new_item)
10252 {
10253 new_item.SetResultOfSplit(true);
10254 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10256 new_item.
SetQuantity(split_quantity_new,
false,
true);
10257 }
10258 }
10259 }
10260 }
10261
10263 {
10265 {
10266 if (ScriptInputUserData.CanStoreInputUserData())
10267 {
10268 ScriptInputUserData ctx = new ScriptInputUserData;
10273 ItemBase destination_entity =
this;
10274 ctx.
Write(destination_entity);
10278 }
10279 }
10280 else if (!
g_Game.IsMultiplayer())
10281 {
10283 }
10284 }
10285
10287 {
10289 float split_quantity_new;
10291 if (player)
10292 {
10294 if (quantity > stackable)
10295 split_quantity_new = stackable;
10296 else
10297 split_quantity_new = quantity;
10298
10300 {
10301 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10302 new_item =
ItemBase.Cast(in_hands);
10303 if (new_item)
10304 {
10305 new_item.SetResultOfSplit(true);
10306 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10308 new_item.SetQuantity(split_quantity_new, false, true);
10309 }
10310 }
10311 }
10312 }
10313
10315 {
10317 float split_quantity_new = Math.Floor(quantity * 0.5);
10318
10320 return;
10321
10323
10324 if (new_item)
10325 {
10326 if (new_item.GetQuantityMax() < split_quantity_new)
10327 {
10328 split_quantity_new = new_item.GetQuantityMax();
10329 }
10330
10331 new_item.SetResultOfSplit(true);
10332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10333
10335 {
10338 }
10339 else
10340 {
10342 new_item.
SetQuantity(split_quantity_new,
false,
true);
10343 }
10344 }
10345 }
10346
10348 {
10350 float split_quantity_new = Math.Floor(quantity / 2);
10351
10353 return;
10354
10355 InventoryLocation invloc = new InventoryLocation;
10357
10359 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10360
10361 if (new_item)
10362 {
10363 if (new_item.GetQuantityMax() < split_quantity_new)
10364 {
10365 split_quantity_new = new_item.GetQuantityMax();
10366 }
10368 {
10371 }
10372 else if (split_quantity_new > 1)
10373 {
10375 new_item.
SetQuantity(split_quantity_new,
false,
true);
10376 }
10377 }
10378 }
10379
10382 {
10383 SetWeightDirty();
10385
10386 if (parent)
10387 parent.OnAttachmentQuantityChangedEx(this, delta);
10388
10390 {
10392 {
10394 }
10396 {
10397 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10399 }
10400 }
10401 }
10402
10405 {
10406
10407 }
10408
10411 {
10413 }
10414
10416 {
10417 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10418
10420 {
10421 if (newLevel == GameConstants.STATE_RUINED)
10422 {
10424 EntityAI parent = GetHierarchyParent();
10425 if (parent && parent.IsFireplace())
10426 {
10427 CargoBase cargo = GetInventory().GetCargo();
10428 if (cargo)
10429 {
10431 {
10433 }
10434 }
10435 }
10436 }
10437
10439 {
10440
10442 return;
10443 }
10444
10445 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10446 {
10448 }
10449 }
10450 }
10451
10452
10454 {
10455 super.OnRightClick();
10456
10458 {
10460 {
10461 if (ScriptInputUserData.CanStoreInputUserData())
10462 {
10463 EntityAI root = GetHierarchyRoot();
10464 Man playerOwner = GetHierarchyRootPlayer();
10465 InventoryLocation dst = new InventoryLocation;
10466
10467
10468 if (!playerOwner && root && root == this)
10469 {
10471 }
10472 else
10473 {
10474
10475 GetInventory().GetCurrentInventoryLocation(dst);
10477 {
10478 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10480 {
10482 }
10483 else
10484 {
10486
10487
10488 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10489 {
10491 }
10492 else
10493 {
10494 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10495 }
10496 }
10497 }
10498 }
10499
10500 ScriptInputUserData ctx = new ScriptInputUserData;
10508 }
10509 }
10510 else if (!
g_Game.IsMultiplayer())
10511 {
10513 }
10514 }
10515 }
10516
10518 {
10519 if (root)
10520 {
10521 vector m4[4];
10522 root.GetTransform(m4);
10523 dst.SetGround(this, m4);
10524 }
10525 else
10526 {
10527 GetInventory().GetCurrentInventoryLocation(dst);
10528 }
10529 }
10530
10531 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10532 {
10533
10534 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10535 return false;
10536
10537 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10538 return false;
10539
10540
10542 return false;
10543
10544
10545 Magazine mag = Magazine.Cast(this);
10546 if (mag)
10547 {
10548 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10549 return false;
10550
10551 if (stack_max_limit)
10552 {
10553 Magazine other_mag = Magazine.Cast(other_item);
10554 if (other_item)
10555 {
10556 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10557 return false;
10558 }
10559
10560 }
10561 }
10562 else
10563 {
10564
10566 return false;
10567
10569 return false;
10570 }
10571
10572 PlayerBase player = null;
10573 if (CastTo(player, GetHierarchyRootPlayer()))
10574 {
10575 if (player.GetInventory().HasAttachment(this))
10576 return false;
10577
10578 if (player.IsItemsToDelete())
10579 return false;
10580 }
10581
10582 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10583 return false;
10584
10585 int slotID;
10587 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10588 return false;
10589
10590 return true;
10591 }
10592
10594 {
10596 }
10597
10599 {
10600 return m_IsResultOfSplit;
10601 }
10602
10604 {
10605 m_IsResultOfSplit = value;
10606 }
10607
10609 {
10611 }
10612
10614 {
10615 float other_item_quantity = other_item.GetQuantity();
10616 float this_free_space;
10617
10619
10621
10622 if (other_item_quantity > this_free_space)
10623 {
10624 return this_free_space;
10625 }
10626 else
10627 {
10628 return other_item_quantity;
10629 }
10630 }
10631
10633 {
10635 }
10636
10638 {
10640 return;
10641
10642 if (!IsMagazine() && other_item)
10643 {
10645 if (quantity_used != 0)
10646 {
10647 float hp1 = GetHealth01("","");
10648 float hp2 = other_item.GetHealth01("","");
10649 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10650 hpResult = hpResult / (
GetQuantity() + quantity_used);
10651
10652 hpResult *= GetMaxHealth();
10653 Math.Round(hpResult);
10654 SetHealth("", "Health", hpResult);
10655
10657 other_item.AddQuantity(-quantity_used);
10658 }
10659 }
10661 }
10662
10664 {
10665 #ifdef SERVER
10666 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10667 GetHierarchyParent().IncreaseLifetimeUp();
10668 #endif
10669 };
10670
10672 {
10673 PlayerBase p = PlayerBase.Cast(player);
10674
10675 array<int> recipesIds = p.m_Recipes;
10676 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10677 if (moduleRecipesManager)
10678 {
10679 EntityAI itemInHands = player.GetEntityInHands();
10680 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10681 }
10682
10683 for (int i = 0;i < recipesIds.Count(); i++)
10684 {
10685 int key = recipesIds.Get(i);
10686 string recipeName = moduleRecipesManager.GetRecipeName(key);
10688 }
10689 }
10690
10691
10692 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10693 {
10694 super.GetDebugActions(outputList);
10695
10696
10702
10703
10708
10713
10714
10718
10719
10721 {
10725 }
10726
10729
10730
10734
10736
10737 InventoryLocation loc = new InventoryLocation();
10738 GetInventory().GetCurrentInventoryLocation(loc);
10740 {
10741 if (Gizmo_IsSupported())
10744 }
10745
10747 }
10748
10749
10750
10751
10753 {
10754 super.OnAction(action_id, player, ctx);
10755
10757 {
10758 switch (action_id)
10759 {
10763 return true;
10767 return true;
10768 }
10769 }
10770
10772 {
10773 switch (action_id)
10774 {
10776 Delete();
10777 return true;
10778 }
10779 }
10780
10781 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10782 {
10783 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10784 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10785 PlayerBase p = PlayerBase.Cast(player);
10786 if (
EActions.RECIPES_RANGE_START < 1000)
10787 {
10788 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10789 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10790 }
10791 }
10792 #ifndef SERVER
10793 else if (action_id ==
EActions.WATCH_PLAYER)
10794 {
10795 PluginDeveloper.SetDeveloperItemClientEx(player);
10796 }
10797 #endif
10799 {
10800 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10801 {
10802 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10803 OnDebugButtonPressServer(id + 1);
10804 }
10805
10806 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10807 {
10808 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10810 }
10811
10812 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10813 {
10814 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10816 }
10817
10818 else if (action_id ==
EActions.ADD_QUANTITY)
10819 {
10820 if (IsMagazine())
10821 {
10822 Magazine mag = Magazine.Cast(this);
10823 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10824 }
10825 else
10826 {
10828 }
10829
10830 if (m_EM)
10831 {
10832 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10833 }
10834
10835 }
10836
10837 else if (action_id ==
EActions.REMOVE_QUANTITY)
10838 {
10839 if (IsMagazine())
10840 {
10841 Magazine mag2 = Magazine.Cast(this);
10842 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10843 }
10844 else
10845 {
10847 }
10848 if (m_EM)
10849 {
10850 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10851 }
10852
10853 }
10854
10855 else if (action_id ==
EActions.SET_QUANTITY_0)
10856 {
10858
10859 if (m_EM)
10860 {
10861 m_EM.SetEnergy(0);
10862 }
10863 }
10864
10865 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10866 {
10868
10869 if (m_EM)
10870 {
10871 m_EM.SetEnergy(m_EM.GetEnergyMax());
10872 }
10873 }
10874
10875 else if (action_id ==
EActions.ADD_HEALTH)
10876 {
10877 AddHealth("","",GetMaxHealth("","Health")/5);
10878 }
10879 else if (action_id ==
EActions.REMOVE_HEALTH)
10880 {
10881 AddHealth("","",-GetMaxHealth("","Health")/5);
10882 }
10883 else if (action_id ==
EActions.DESTROY_HEALTH)
10884 {
10885 SetHealth01("","",0);
10886 }
10887 else if (action_id ==
EActions.WATCH_ITEM)
10888 {
10890 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10891 #ifdef DEVELOPER
10892 SetDebugDeveloper_item(this);
10893 #endif
10894 }
10895
10896 else if (action_id ==
EActions.ADD_TEMPERATURE)
10897 {
10898 AddTemperature(20);
10899
10900 }
10901
10902 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10903 {
10904 AddTemperature(-20);
10905
10906 }
10907
10908 else if (action_id ==
EActions.FLIP_FROZEN)
10909 {
10910 SetFrozen(!GetIsFrozen());
10911
10912 }
10913
10914 else if (action_id ==
EActions.ADD_WETNESS)
10915 {
10917
10918 }
10919
10920 else if (action_id ==
EActions.REMOVE_WETNESS)
10921 {
10923
10924 }
10925
10926 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10927 {
10930
10931
10932 }
10933
10934 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10935 {
10938 }
10939
10940 else if (action_id ==
EActions.MAKE_SPECIAL)
10941 {
10942 auto debugParams = DebugSpawnParams.WithPlayer(player);
10943 OnDebugSpawnEx(debugParams);
10944 }
10945
10946 }
10947
10948
10949 return false;
10950 }
10951
10952
10953
10954
10958
10961
10962
10963
10965 {
10966 return false;
10967 }
10968
10969
10971 {
10972 return true;
10973 }
10974
10975
10977 {
10978 return true;
10979 }
10980
10981
10982
10984 {
10985 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10986 return g_Game.ConfigIsExisting(config_path);
10987 }
10988
10991 {
10992 return null;
10993 }
10994
10996 {
10997 return false;
10998 }
10999
11001 {
11002 return false;
11003 }
11004
11008
11009
11011 {
11012 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11013 return module_repairing.CanRepair(this, item_repair_kit);
11014 }
11015
11016
11017 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11018 {
11019 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11020 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11021 }
11022
11023
11025 {
11026
11027
11028
11029
11030
11031
11032
11033
11034 return 1;
11035 }
11036
11037
11038
11040 {
11042 }
11043
11044
11045
11047 {
11049 }
11050
11051
11060 {
11061 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11062
11063 if (player)
11064 {
11065 player.MessageStatus(text);
11066 }
11067 }
11068
11069
11078 {
11079 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11080
11081 if (player)
11082 {
11083 player.MessageAction(text);
11084 }
11085 }
11086
11087
11096 {
11097 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11098
11099 if (player)
11100 {
11101 player.MessageFriendly(text);
11102 }
11103 }
11104
11105
11114 {
11115 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11116
11117 if (player)
11118 {
11119 player.MessageImportant(text);
11120 }
11121 }
11122
11124 {
11125 return true;
11126 }
11127
11128
11129 override bool KindOf(
string tag)
11130 {
11131 bool found = false;
11132 string item_name = this.
GetType();
11134 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11135
11136 int array_size = item_tag_array.Count();
11137 for (int i = 0; i < array_size; i++)
11138 {
11139 if (item_tag_array.Get(i) == tag)
11140 {
11141 found = true;
11142 break;
11143 }
11144 }
11145 return found;
11146 }
11147
11148
11150 {
11151
11152 super.OnRPC(sender, rpc_type,ctx);
11153
11154
11155 switch (rpc_type)
11156 {
11157 #ifndef SERVER
11158 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11159 Param2<bool, string> p = new Param2<bool, string>(false, "");
11160
11162 return;
11163
11164 bool play = p.param1;
11165 string soundSet = p.param2;
11166
11167 if (play)
11168 {
11170 {
11172 {
11174 }
11175 }
11176 else
11177 {
11179 }
11180 }
11181 else
11182 {
11184 }
11185
11186 break;
11187 #endif
11188
11189 }
11190
11192 {
11194 }
11195 }
11196
11197
11198
11199
11201 {
11202 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11203 return plugin.GetID(
name);
11204 }
11205
11207 {
11208 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11209 return plugin.GetName(id);
11210 }
11211
11214 {
11215
11216
11217 int varFlags;
11218 if (!ctx.
Read(varFlags))
11219 return;
11220
11221 if (varFlags & ItemVariableFlags.FLOAT)
11222 {
11224 }
11225 }
11226
11228 {
11229
11230 super.SerializeNumericalVars(floats_out);
11231
11232
11233
11235 {
11237 }
11238
11240 {
11242 }
11243
11245 {
11247 }
11248
11250 {
11255 }
11256
11258 {
11260 }
11261 }
11262
11264 {
11265
11266 super.DeSerializeNumericalVars(floats);
11267
11268
11269 int index = 0;
11270 int mask = Math.Round(floats.Get(index));
11271
11272 index++;
11273
11275 {
11277 {
11279 }
11280 else
11281 {
11282 float quantity = floats.Get(index);
11283 SetQuantity(quantity,
true,
false,
false,
false);
11284 }
11285 index++;
11286 }
11287
11289 {
11290 float wet = floats.Get(index);
11292 index++;
11293 }
11294
11296 {
11297 int liquidtype = Math.Round(floats.Get(index));
11299 index++;
11300 }
11301
11303 {
11305 index++;
11307 index++;
11309 index++;
11311 index++;
11312 }
11313
11315 {
11316 int cleanness = Math.Round(floats.Get(index));
11318 index++;
11319 }
11320 }
11321
11323 {
11324 super.WriteVarsToCTX(ctx);
11325
11326
11328 {
11330 }
11331
11333 {
11335 }
11336
11338 {
11340 }
11341
11343 {
11344 int r,g,b,a;
11350 }
11351
11353 {
11355 }
11356 }
11357
11359 {
11360 if (!super.ReadVarsFromCTX(ctx,version))
11361 return false;
11362
11363 int intValue;
11364 float value;
11365
11366 if (version < 140)
11367 {
11368 if (!ctx.
Read(intValue))
11369 return false;
11370
11371 m_VariablesMask = intValue;
11372 }
11373
11375 {
11376 if (!ctx.
Read(value))
11377 return false;
11378
11380 {
11382 }
11383 else
11384 {
11386 }
11387 }
11388
11389 if (version < 140)
11390 {
11392 {
11393 if (!ctx.
Read(value))
11394 return false;
11395 SetTemperatureDirect(value);
11396 }
11397 }
11398
11400 {
11401 if (!ctx.
Read(value))
11402 return false;
11404 }
11405
11407 {
11408 if (!ctx.
Read(intValue))
11409 return false;
11411 }
11412
11414 {
11415 int r,g,b,a;
11417 return false;
11419 return false;
11421 return false;
11423 return false;
11424
11426 }
11427
11429 {
11430 if (!ctx.
Read(intValue))
11431 return false;
11433 }
11434
11435 if (version >= 138 && version < 140)
11436 {
11438 {
11439 if (!ctx.
Read(intValue))
11440 return false;
11441 SetFrozen(intValue);
11442 }
11443 }
11444
11445 return true;
11446 }
11447
11448
11450 {
11453 {
11455 }
11456
11457 if (!super.OnStoreLoad(ctx, version))
11458 {
11460 return false;
11461 }
11462
11463 if (version >= 114)
11464 {
11465 bool hasQuickBarIndexSaved;
11466
11467 if (!ctx.
Read(hasQuickBarIndexSaved))
11468 {
11470 return false;
11471 }
11472
11473 if (hasQuickBarIndexSaved)
11474 {
11475 int itmQBIndex;
11476
11477
11478 if (!ctx.
Read(itmQBIndex))
11479 {
11481 return false;
11482 }
11483
11484 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11485 if (itmQBIndex != -1 && parentPlayer)
11486 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11487 }
11488 }
11489 else
11490 {
11491
11492 PlayerBase player;
11493 int itemQBIndex;
11494 if (version ==
int.
MAX)
11495 {
11496 if (!ctx.
Read(itemQBIndex))
11497 {
11499 return false;
11500 }
11501 }
11502 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11503 {
11504
11505 if (!ctx.
Read(itemQBIndex))
11506 {
11508 return false;
11509 }
11510 if (itemQBIndex != -1 && player)
11511 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11512 }
11513 }
11514
11515 if (version < 140)
11516 {
11517
11518 if (!LoadVariables(ctx, version))
11519 {
11521 return false;
11522 }
11523 }
11524
11525
11527 {
11529 return false;
11530 }
11531 if (version >= 132)
11532 {
11534 if (raib)
11535 {
11537 {
11539 return false;
11540 }
11541 }
11542 }
11543
11545 return true;
11546 }
11547
11548
11549
11551 {
11552 super.OnStoreSave(ctx);
11553
11554 PlayerBase player;
11555 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11556 {
11558
11559 int itemQBIndex = -1;
11560 itemQBIndex = player.FindQuickBarEntityIndex(this);
11561 ctx.
Write(itemQBIndex);
11562 }
11563 else
11564 {
11566 }
11567
11569
11571 if (raib)
11572 {
11574 }
11575 }
11576
11577
11579 {
11580 super.AfterStoreLoad();
11581
11583 {
11585 }
11586
11588 {
11591 }
11592 }
11593
11595 {
11596 super.EEOnAfterLoad();
11597
11599 {
11601 }
11602
11605 }
11606
11608 {
11609 return false;
11610 }
11611
11612
11613
11615 {
11617 {
11618 #ifdef PLATFORM_CONSOLE
11619
11621 {
11623 if (menu)
11624 {
11626 }
11627 }
11628 #endif
11629 }
11630
11632 {
11635 }
11636
11638 {
11639 SetWeightDirty();
11641 }
11643 {
11646 }
11647
11649 {
11652
11655 }
11657 {
11661 }
11662
11663 super.OnVariablesSynchronized();
11664 }
11665
11666
11667
11669 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11670 {
11671 if (!IsServerCheck(allow_client))
11672 return false;
11673
11675 return false;
11676
11679
11680 if (value <= (min + 0.001))
11681 value = min;
11682
11683 if (value == min)
11684 {
11685 if (destroy_config)
11686 {
11687 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11688 if (dstr)
11689 {
11691 this.Delete();
11692 return true;
11693 }
11694 }
11695 else if (destroy_forced)
11696 {
11698 this.Delete();
11699 return true;
11700 }
11701
11703 }
11704
11707
11709 {
11710 EntityAI parent = GetHierarchyRoot();
11711 InventoryLocation iLoc = new InventoryLocation();
11712 GetInventory().GetCurrentInventoryLocation(iLoc);
11714 {
11715 int iLocSlot = iLoc.
GetSlot();
11717 {
11719 }
11721 {
11723 }
11724 }
11725 }
11726
11728 {
11730
11731 if (delta)
11733 }
11734
11736
11737 return false;
11738 }
11739
11740
11742 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11743 {
11745 }
11746
11748 {
11751 }
11752
11754 {
11757 }
11758
11760 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11761 {
11762 float value_clamped = Math.Clamp(value, 0, 1);
11764 SetQuantity(result, destroy_config, destroy_forced);
11765 }
11766
11767
11770 {
11772 }
11773
11775 {
11777 }
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11789 {
11790 int slot = -1;
11791 GameInventory inventory = GetInventory();
11792 if (inventory)
11793 {
11794 InventoryLocation il = new InventoryLocation;
11797 }
11798
11800 }
11801
11803 {
11804 float quantity_max = 0;
11805
11807 {
11808 if (attSlotID != -1)
11809 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11810
11811 if (quantity_max <= 0)
11813 }
11814
11815 if (quantity_max <= 0)
11817
11818 return quantity_max;
11819 }
11820
11822 {
11824 }
11825
11827 {
11829 }
11830
11831
11833 {
11835 }
11836
11838 {
11840 }
11841
11843 {
11845 }
11846
11847
11849 {
11850
11851 float weightEx = GetWeightEx();
11852 float special = GetInventoryAndCargoWeight();
11853 return weightEx - special;
11854 }
11855
11856
11858 {
11860 }
11861
11863 {
11865 {
11866 #ifdef DEVELOPER
11867 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11868 {
11869 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11871 }
11872 #endif
11873
11874 return GetQuantity() * GetConfigWeightModified();
11875 }
11876 else if (HasEnergyManager())
11877 {
11878 #ifdef DEVELOPER
11879 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11880 {
11881 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11882 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11883 }
11884 #endif
11885 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11886 }
11887 else
11888 {
11889 #ifdef DEVELOPER
11890 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11891 {
11892 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11893 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11894 }
11895 #endif
11896 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11897 }
11898 }
11899
11902 {
11903 int item_count = 0;
11905
11906 GameInventory inventory = GetInventory();
11907 CargoBase cargo = inventory.
GetCargo();
11908 if (cargo != NULL)
11909 {
11911 }
11912
11914 for (int i = 0; i < nAttachments; ++i)
11915 {
11917 if (item)
11918 item_count += item.GetNumberOfItems();
11919 }
11920 return item_count;
11921 }
11922
11925 {
11926 float weight = 0;
11927 float wetness = 1;
11928 if (include_wetness)
11931 {
11932 weight = wetness * m_ConfigWeight;
11933 }
11935 {
11936 weight = 1;
11937 }
11938 return weight;
11939 }
11940
11941
11942
11944 {
11945 GameInventory inventory = GetInventory();
11946 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11947 {
11948 array<EntityAI> items = new array<EntityAI>;
11950 for (int i = 0; i < items.Count(); ++i)
11951 {
11953 if (item)
11954 {
11955 g_Game.ObjectDelete(item);
11956 }
11957 }
11958 }
11959 }
11960
11961
11962
11963
11965 {
11966 float energy = 0;
11967 if (HasEnergyManager())
11968 {
11969 energy = GetCompEM().GetEnergy();
11970 }
11971 return energy;
11972 }
11973
11974
11976 {
11977 super.OnEnergyConsumed();
11978
11980 }
11981
11983 {
11984 super.OnEnergyAdded();
11985
11987 }
11988
11989
11991 {
11992 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11993 {
11995 {
11996 float energy_0to1 = GetCompEM().GetEnergy0To1();
11998 }
11999 }
12000 }
12001
12002
12004 {
12005 return ConfigGetFloat("heatIsolation");
12006 }
12007
12009 {
12011 }
12012
12014 {
12015 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12016 if (
g_Game.ConfigIsExisting(paramPath))
12017 return g_Game.ConfigGetFloat(paramPath);
12018
12019 return 0.0;
12020 }
12021
12023 {
12024 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12025 if (
g_Game.ConfigIsExisting(paramPath))
12026 return g_Game.ConfigGetFloat(paramPath);
12027
12028 return 0.0;
12029 }
12030
12031 override void SetWet(
float value,
bool allow_client =
false)
12032 {
12033 if (!IsServerCheck(allow_client))
12034 return;
12035
12038
12040
12041 m_VarWet = Math.Clamp(value, min, max);
12042
12044 {
12047 }
12048 }
12049
12050 override void AddWet(
float value)
12051 {
12053 }
12054
12056 {
12058 }
12059
12061 {
12063 }
12064
12066 {
12068 }
12069
12071 {
12073 }
12074
12076 {
12078 }
12079
12080 override void OnWetChanged(
float newVal,
float oldVal)
12081 {
12084 if (newLevel != oldLevel)
12085 {
12087 }
12088 }
12089
12091 {
12092 SetWeightDirty();
12093 }
12094
12096 {
12097 return GetWetLevelInternal(
m_VarWet);
12098 }
12099
12100
12101
12103 {
12105 }
12106
12108 {
12110 }
12111
12113 {
12115 }
12116
12118 {
12120 }
12121
12122
12123
12125 {
12126 if (ConfigIsExisting("itemModelLength"))
12127 {
12128 return ConfigGetFloat("itemModelLength");
12129 }
12130 return 0;
12131 }
12132
12134 {
12135 if (ConfigIsExisting("itemAttachOffset"))
12136 {
12137 return ConfigGetFloat("itemAttachOffset");
12138 }
12139 return 0;
12140 }
12141
12142 override void SetCleanness(
int value,
bool allow_client =
false)
12143 {
12144 if (!IsServerCheck(allow_client))
12145 return;
12146
12148
12150
12153 }
12154
12156 {
12158 }
12159
12161 {
12162 return true;
12163 }
12164
12165
12166
12167
12169 {
12171 }
12172
12174 {
12176 }
12177
12178
12179
12180
12181 override void SetColor(
int r,
int g,
int b,
int a)
12182 {
12188 }
12190 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12191 {
12196 }
12197
12199 {
12201 }
12202
12205 {
12206 int r,g,b,a;
12208 r = r/255;
12209 g = g/255;
12210 b = b/255;
12211 a = a/255;
12212 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12213 }
12214
12215
12216
12217 override void SetLiquidType(
int value,
bool allow_client =
false)
12218 {
12219 if (!IsServerCheck(allow_client))
12220 return;
12221
12226 }
12227
12229 {
12230 return ConfigGetInt("varLiquidTypeInit");
12231 }
12232
12234 {
12236 }
12237
12239 {
12241 SetFrozen(false);
12242 }
12243
12246 {
12247 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12248 }
12249
12250
12253 {
12254 PlayerBase nplayer;
12255 if (PlayerBase.CastTo(nplayer, player))
12256 {
12258 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12259 }
12260 }
12261
12262
12265 {
12266 PlayerBase nplayer;
12267 if (PlayerBase.CastTo(nplayer,player))
12268 {
12269 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12270 }
12271
12272 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12273
12274 if (HasEnergyManager())
12275 {
12276 GetCompEM().UpdatePlugState();
12277 }
12278 }
12279
12280
12282 {
12283 super.OnPlacementStarted(player);
12284
12286 }
12287
12288 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12289 {
12291 {
12292 m_AdminLog.OnPlacementComplete(player,
this);
12293 }
12294
12295 super.OnPlacementComplete(player, position, orientation);
12296 }
12297
12298
12299
12300
12301
12303 {
12305 {
12306 return true;
12307 }
12308 else
12309 {
12310 return false;
12311 }
12312 }
12313
12314
12316 {
12318 {
12320 }
12321 }
12322
12323
12325 {
12327 }
12328
12330 {
12332 }
12333
12334 override void InsertAgent(
int agent,
float count = 1)
12335 {
12336 if (count < 1)
12337 return;
12338
12340 }
12341
12344 {
12346 }
12347
12348
12350 {
12352 }
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12396 {
12398 return false;
12399 return true;
12400 }
12401
12403 {
12404
12406 }
12407
12408
12411 {
12412 super.CheckForRoofLimited(timeTresholdMS);
12413
12414 float time =
g_Game.GetTime();
12415 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12416 {
12417 m_PreviousRoofTestTime = time;
12418 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12419 }
12420 }
12421
12422
12424 {
12426 {
12427 return 0;
12428 }
12429
12430 if (GetInventory().GetAttachmentSlotsCount() != 0)
12431 {
12432 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12433 if (filter)
12434 return filter.GetProtectionLevel(type, false, system);
12435 else
12436 return 0;
12437 }
12438
12439 string subclassPath, entryName;
12440
12441 switch (type)
12442 {
12444 entryName = "biological";
12445 break;
12447 entryName = "chemical";
12448 break;
12449 default:
12450 entryName = "biological";
12451 break;
12452 }
12453
12454 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12455
12456 return g_Game.ConfigGetFloat(subclassPath + entryName);
12457 }
12458
12459
12460
12463 {
12464 if (!IsMagazine())
12466
12468 }
12469
12470
12471
12472
12473
12478 {
12479 return true;
12480 }
12481
12483 {
12485 }
12486
12487
12488
12489
12490
12492 {
12493 if (parent)
12494 {
12495 if (parent.IsInherited(DayZInfected))
12496 return true;
12497
12498 if (!parent.IsRuined())
12499 return true;
12500 }
12501
12502 return true;
12503 }
12504
12506 {
12507 if (!super.CanPutAsAttachment(parent))
12508 {
12509 return false;
12510 }
12511
12512 if (!IsRuined() && !parent.IsRuined())
12513 {
12514 return true;
12515 }
12516
12517 return false;
12518 }
12519
12521 {
12522
12523
12524
12525
12526 return super.CanReceiveItemIntoCargo(item);
12527 }
12528
12530 {
12531
12532
12533
12534
12535 GameInventory attachmentInv = attachment.GetInventory();
12537 {
12538 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12539 return false;
12540 }
12541
12542 InventoryLocation loc = new InventoryLocation();
12543 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12544 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12545 return false;
12546
12547 return super.CanReceiveAttachment(attachment, slotId);
12548 }
12549
12551 {
12552 if (!super.CanReleaseAttachment(attachment))
12553 return false;
12554
12555 return GetInventory().AreChildrenAccessible();
12556 }
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12579 {
12580 int id = muzzle_owner.GetMuzzleID();
12581 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12582
12583 if (WPOF_array)
12584 {
12585 for (int i = 0; i < WPOF_array.Count(); i++)
12586 {
12587 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12588
12589 if (WPOF)
12590 {
12591 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12592 }
12593 }
12594 }
12595 }
12596
12597
12599 {
12600 int id = muzzle_owner.GetMuzzleID();
12602
12603 if (WPOBE_array)
12604 {
12605 for (int i = 0; i < WPOBE_array.Count(); i++)
12606 {
12607 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12608
12609 if (WPOBE)
12610 {
12611 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12612 }
12613 }
12614 }
12615 }
12616
12617
12619 {
12620 int id = muzzle_owner.GetMuzzleID();
12621 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12622
12623 if (WPOOH_array)
12624 {
12625 for (int i = 0; i < WPOOH_array.Count(); i++)
12626 {
12627 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12628
12629 if (WPOOH)
12630 {
12631 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12632 }
12633 }
12634 }
12635 }
12636
12637
12639 {
12640 int id = muzzle_owner.GetMuzzleID();
12641 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12642
12643 if (WPOOH_array)
12644 {
12645 for (int i = 0; i < WPOOH_array.Count(); i++)
12646 {
12647 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12648
12649 if (WPOOH)
12650 {
12651 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12652 }
12653 }
12654 }
12655 }
12656
12657
12659 {
12660 int id = muzzle_owner.GetMuzzleID();
12661 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12662
12663 if (WPOOH_array)
12664 {
12665 for (int i = 0; i < WPOOH_array.Count(); i++)
12666 {
12667 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12668
12669 if (WPOOH)
12670 {
12671 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12672 }
12673 }
12674 }
12675 }
12676
12677
12678
12680 {
12682 {
12683 return true;
12684 }
12685
12686 return false;
12687 }
12688
12690 {
12692 {
12693 return true;
12694 }
12695
12696 return false;
12697 }
12698
12700 {
12702 {
12703 return true;
12704 }
12705
12706 return false;
12707 }
12708
12710 {
12711 return false;
12712 }
12713
12716 {
12717 return UATimeSpent.DEFAULT_DEPLOY;
12718 }
12719
12720
12721
12722
12724 {
12726 SetSynchDirty();
12727 }
12728
12730 {
12732 }
12733
12734
12736 {
12737 return false;
12738 }
12739
12742 {
12743 string att_type = "None";
12744
12745 if (ConfigIsExisting("soundAttType"))
12746 {
12747 att_type = ConfigGetString("soundAttType");
12748 }
12749
12751 }
12752
12754 {
12756 }
12757
12758
12759
12760
12761
12767
12769 {
12772
12774 }
12775
12776
12778 {
12780 return;
12781
12783
12786
12789
12790 SoundParameters params = new SoundParameters();
12794 }
12795
12796
12798 {
12800 {
12803
12804 SetSynchDirty();
12805
12808 }
12809 }
12810
12812 {
12814 }
12815
12816
12818 {
12820 return;
12821
12823 SetSynchDirty();
12824
12827 }
12828
12830 {
12833 }
12834
12836 {
12838 }
12839
12840 void OnApply(PlayerBase player);
12841
12843 {
12844 return 1.0;
12845 };
12846
12848 {
12850 }
12851
12853 {
12855 }
12856
12858
12860 {
12861 SetDynamicPhysicsLifeTime(0.01);
12863 }
12864
12866 {
12867 array<string> zone_names = new array<string>;
12868 GetDamageZones(zone_names);
12869 for (int i = 0; i < zone_names.Count(); i++)
12870 {
12871 SetHealthMax(zone_names.Get(i),"Health");
12872 }
12873 SetHealthMax("","Health");
12874 }
12875
12878 {
12879 float global_health = GetHealth01("","Health");
12880 array<string> zones = new array<string>;
12881 GetDamageZones(zones);
12882
12883 for (int i = 0; i < zones.Count(); i++)
12884 {
12885 SetHealth01(zones.Get(i),"Health",global_health);
12886 }
12887 }
12888
12891 {
12892 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12893 }
12894
12896 {
12897 if (!hasRootAsPlayer)
12898 {
12899 if (refParentIB)
12900 {
12901
12902 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12903 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12904
12905 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12906 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12907
12910 }
12911 else
12912 {
12913
12916 }
12917 }
12918 }
12919
12921 {
12923 {
12924 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12925 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12926 {
12927 float heatPermCoef = 1.0;
12929 while (ent)
12930 {
12931 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12932 ent = ent.GetHierarchyParent();
12933 }
12934
12935 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12936 }
12937 }
12938 }
12939
12941 {
12942
12943 EntityAI parent = GetHierarchyParent();
12944 if (!parent)
12945 {
12946 hasParent = false;
12947 hasRootAsPlayer = false;
12948 }
12949 else
12950 {
12951 hasParent = true;
12952 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12953 refParentIB =
ItemBase.Cast(parent);
12954 }
12955 }
12956
12957 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12958 {
12959
12960 }
12961
12963 {
12964
12965 return false;
12966 }
12967
12969 {
12970
12971
12972 return false;
12973 }
12974
12976 {
12977
12978 return false;
12979 }
12980
12983 {
12984 return !GetIsFrozen() &&
IsOpen();
12985 }
12986
12988 {
12989 bool hasParent = false, hasRootAsPlayer = false;
12991
12992 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12993 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12994
12995 if (wwtu || foodDecay)
12996 {
13000
13001 if (processWetness || processTemperature || processDecay)
13002 {
13004
13005 if (processWetness)
13006 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13007
13008 if (processTemperature)
13010
13011 if (processDecay)
13012 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13013 }
13014 }
13015 }
13016
13019 {
13021 }
13022
13024 {
13027
13028 return super.GetTemperatureFreezeThreshold();
13029 }
13030
13032 {
13035
13036 return super.GetTemperatureThawThreshold();
13037 }
13038
13040 {
13043
13044 return super.GetItemOverheatThreshold();
13045 }
13046
13048 {
13050 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13051
13052 return super.GetTemperatureFreezeTime();
13053 }
13054
13056 {
13058 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13059
13060 return super.GetTemperatureThawTime();
13061 }
13062
13067
13069 {
13070 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13071 }
13072
13074 {
13075 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13076 }
13077
13080 {
13082 }
13083
13085 {
13087 }
13088
13090 {
13092 }
13093
13096 {
13097 return null;
13098 }
13099
13102 {
13103 return false;
13104 }
13105
13107 {
13109 {
13112 if (!trg)
13113 {
13115 explosive = this;
13116 }
13117
13118 explosive.PairRemote(trg);
13120
13121 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13122 trg.SetPersistentPairID(persistentID);
13123 explosive.SetPersistentPairID(persistentID);
13124
13125 return true;
13126 }
13127 return false;
13128 }
13129
13132 {
13133 float ret = 1.0;
13136 ret *= GetHealth01();
13137
13138 return ret;
13139 }
13140
13141 #ifdef DEVELOPER
13142 override void SetDebugItem()
13143 {
13144 super.SetDebugItem();
13145 _itemBase = this;
13146 }
13147
13149 {
13150 string text = super.GetDebugText();
13151
13153 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13154
13155 return text;
13156 }
13157 #endif
13158
13160 {
13161 return true;
13162 }
13163
13165
13167
13169 {
13172 }
13173
13174
13182
13198
13199 [
Obsolete(
"Use ItemSoundHandler instead")]
13202 {
13203 if (!
g_Game.IsDedicatedServer())
13204 {
13205 if (ConfigIsExisting("attachSoundSet"))
13206 {
13207 string cfg_path = "";
13208 string soundset = "";
13209 string type_name =
GetType();
13210
13213 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13214 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13215
13216 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13217 {
13218 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13219 {
13220 if (cfg_slot_array[i] == slot_type)
13221 {
13222 soundset = cfg_soundset_array[i];
13223 break;
13224 }
13225 }
13226 }
13227
13228 if (soundset != "")
13229 {
13230 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13232 }
13233 }
13234 }
13235 }
13236
13238}
13239
13241{
13243 if (entity)
13244 {
13245 bool is_item = entity.IsInherited(
ItemBase);
13246 if (is_item && full_quantity)
13247 {
13250 }
13251 }
13252 else
13253 {
13255 return NULL;
13256 }
13257 return entity;
13258}
13259
13261{
13262 if (item)
13263 {
13264 if (health > 0)
13265 item.SetHealth("", "", health);
13266
13267 if (item.CanHaveTemperature())
13268 {
13270 if (item.CanFreeze())
13271 item.SetFrozen(false);
13272 }
13273
13274 if (item.HasEnergyManager())
13275 {
13276 if (quantity >= 0)
13277 {
13278 item.GetCompEM().SetEnergy0To1(quantity);
13279 }
13280 else
13281 {
13283 }
13284 }
13285 else if (item.IsMagazine())
13286 {
13287 Magazine mag = Magazine.Cast(item);
13288 if (quantity >= 0)
13289 {
13290 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13291 }
13292 else
13293 {
13295 }
13296
13297 }
13298 else
13299 {
13300 if (quantity >= 0)
13301 {
13302 item.SetQuantityNormalized(quantity, false);
13303 }
13304 else
13305 {
13307 }
13308
13309 }
13310 }
13311}
13312
13313#ifdef DEVELOPER
13315#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.