8354{
8356 {
8357 return true;
8358 }
8359};
8360
8362{
8363
8364};
8365
8366
8367
8369{
8373
8375
8378
8379
8380
8381
8382
8391
8397
8402
8407
8428 protected bool m_IsResultOfSplit
8429
8431
8436
8437
8438
8440
8444
8445
8446
8448
8451
8452
8453
8459
8460
8468
8471
8472
8474
8475
8477
8478
8483
8484
8489
8491
8492
8494
8495
8497 {
8502
8503 if (!
g_Game.IsDedicatedServer())
8504 {
8506 {
8508
8510 {
8512 }
8513 }
8514
8517 }
8518
8519 m_OldLocation = null;
8520
8522 {
8524 }
8525
8526 if (ConfigIsExisting("headSelectionsToHide"))
8527 {
8530 }
8531
8533 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8534 {
8536 }
8537
8539
8540 m_IsResultOfSplit = false;
8541
8543 }
8544
8546 {
8547 super.InitItemVariables();
8548
8554 m_Count = ConfigGetInt(
"count");
8555
8558
8563
8566
8571
8583
8587
8588
8591 if (ConfigIsExisting("canBeSplit"))
8592 {
8595 }
8596
8598 if (ConfigIsExisting("itemBehaviour"))
8600
8601
8604 RegisterNetSyncVariableInt("m_VarLiquidType");
8605 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8606
8607 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8608 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8609 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8610
8611 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8612 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8613 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8614 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8615
8616 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8617 RegisterNetSyncVariableBool("m_IsTakeable");
8618 RegisterNetSyncVariableBool("m_IsHologram");
8619
8622 {
8625 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8626 }
8627
8629
8631 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8633
8635 }
8636
8638 {
8640 }
8641
8643 {
8646 {
8651 }
8652 }
8653
8654 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8655 {
8657 {
8660 }
8661
8663 }
8664
8666 {
8672 }
8673
8675
8677 {
8679
8680 if (!action)
8681 {
8682 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8683 return;
8684 }
8685
8687 if (!ai)
8688 {
8690 return;
8691 }
8692
8694 if (!action_array)
8695 {
8696 action_array = new array<ActionBase_Basic>;
8698 }
8699 if (LogManager.IsActionLogEnable())
8700 {
8701 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8702 }
8703
8704 if (action_array.Find(action) != -1)
8705 {
8706 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8707 }
8708 else
8709 {
8710 action_array.Insert(action);
8711 }
8712 }
8713
8715 {
8716 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8717 ActionBase action = player.GetActionManager().GetAction(actionName);
8720
8721 if (action_array)
8722 {
8723 action_array.RemoveItem(action);
8724 }
8725 }
8726
8727
8728
8730 {
8731 ActionOverrideData overrideData = new ActionOverrideData();
8735
8737 if (!actionMap)
8738 {
8741 }
8742
8743 actionMap.Insert(this.
Type(), overrideData);
8744
8745 }
8746
8748
8750
8751
8753 {
8756
8759
8760 string config_to_search = "CfgVehicles";
8761 string muzzle_owner_config;
8762
8764 {
8765 if (IsInherited(Weapon))
8766 config_to_search = "CfgWeapons";
8767
8768 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8769
8770 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8771
8772 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8773
8774 if (config_OnFire_subclass_count > 0)
8775 {
8776 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8777
8778 for (int i = 0; i < config_OnFire_subclass_count; i++)
8779 {
8780 string particle_class = "";
8781 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8782 string config_OnFire_entry = config_OnFire_class + particle_class;
8783 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8784 WPOF_array.Insert(WPOF);
8785 }
8786
8787
8789 }
8790 }
8791
8793 {
8794 config_to_search = "CfgWeapons";
8795 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8796
8797 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8798
8799 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8800
8801 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8802 {
8803 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8804
8805 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8806 {
8807 string particle_class2 = "";
8808 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8809 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8810 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8811 WPOBE_array.Insert(WPOBE);
8812 }
8813
8814
8816 }
8817 }
8818 }
8819
8820
8822 {
8825
8827 {
8828 string config_to_search = "CfgVehicles";
8829
8830 if (IsInherited(Weapon))
8831 config_to_search = "CfgWeapons";
8832
8833 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8834 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8835
8836 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8837 {
8838
8840
8842 {
8844 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8846 return;
8847 }
8848
8851
8852
8853
8854 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8855 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8856
8857 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8858 {
8859 string particle_class = "";
8860 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8861 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8862 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8863
8864 if (entry_type == CT_CLASS)
8865 {
8866 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8867 WPOOH_array.Insert(WPOF);
8868 }
8869 }
8870
8871
8873 }
8874 }
8875 }
8876
8878 {
8880 }
8881
8883 {
8885 {
8887
8890
8893
8894 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8895 }
8896 }
8897
8899 {
8901 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8902
8904 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8905
8907 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8908
8910 {
8912 }
8913 }
8914
8916 {
8918 }
8919
8921 {
8924 else
8926
8928 {
8931 }
8932 else
8933 {
8936
8939 }
8940
8942 }
8943
8945 {
8947 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8948 }
8949
8951 {
8953 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8955 }
8956
8958 {
8960 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8961 }
8962
8964 {
8967
8968 OverheatingParticle OP = new OverheatingParticle();
8973
8975 }
8976
8978 {
8981
8982 return -1;
8983 }
8984
8986 {
8988 {
8991
8992 for (int i = count; i > 0; --i)
8993 {
8994 int id = i - 1;
8997
9000
9001 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9002 {
9003 if (p)
9004 {
9007 }
9008 }
9009 }
9010 }
9011 }
9012
9014 {
9016 {
9018 {
9019 int id = i - 1;
9021
9022 if (OP)
9023 {
9025
9026 if (p)
9027 {
9029 }
9030
9031 delete OP;
9032 }
9033 }
9034
9037 }
9038 }
9039
9042 {
9043 return 0.0;
9044 }
9045
9046
9048 {
9049 return 250;
9050 }
9051
9053 {
9054 return 0;
9055 }
9056
9059 {
9061 return true;
9062
9063 return false;
9064 }
9065
9068 {
9071
9073 {
9075 }
9076 else
9077 {
9078
9080 }
9081
9083 }
9084
9091 {
9092 return -1;
9093 }
9094
9095
9096
9097
9099 {
9101 {
9102 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9103 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9104
9105 if (r_index >= 0)
9106 {
9107 InventoryLocation r_il = new InventoryLocation;
9108 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9109
9110 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9113 {
9114 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9115 }
9117 {
9118 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9119 }
9120
9121 }
9122
9123 player.GetHumanInventory().ClearUserReservedLocation(this);
9124 }
9125
9128 }
9129
9130
9131
9132
9134 {
9135 return ItemBase.m_DebugActionsMask;
9136 }
9137
9139 {
9140 return ItemBase.m_DebugActionsMask & mask;
9141 }
9142
9144 {
9145 ItemBase.m_DebugActionsMask = mask;
9146 }
9147
9149 {
9150 ItemBase.m_DebugActionsMask |= mask;
9151 }
9152
9154 {
9155 ItemBase.m_DebugActionsMask &= ~mask;
9156 }
9157
9159 {
9161 {
9163 }
9164 else
9165 {
9167 }
9168 }
9169
9170
9172 {
9173 if (GetEconomyProfile())
9174 {
9175 float q_max = GetEconomyProfile().GetQuantityMax();
9176 if (q_max > 0)
9177 {
9178 float q_min = GetEconomyProfile().GetQuantityMin();
9179 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9180
9182 {
9183 ComponentEnergyManager comp = GetCompEM();
9185 {
9187 }
9188 }
9190 {
9192
9193 }
9194
9195 }
9196 }
9197 }
9198
9201 {
9202 EntityAI parent = GetHierarchyParent();
9203
9204 if (parent)
9205 {
9206 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9207 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9208 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9209 }
9210 }
9211
9214 {
9215 EntityAI parent = GetHierarchyParent();
9216
9217 if (parent)
9218 {
9219 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9220 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9221 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9222 }
9223 }
9224
9226 {
9227
9228
9229
9230
9232
9234 {
9235 if (ScriptInputUserData.CanStoreInputUserData())
9236 {
9237 ScriptInputUserData ctx = new ScriptInputUserData;
9243 ctx.
Write(use_stack_max);
9246
9248 {
9249 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9250 }
9251 }
9252 }
9253 else if (!
g_Game.IsMultiplayer())
9254 {
9256 }
9257 }
9258
9260 {
9262 }
9263
9265 {
9267 }
9268
9270 {
9272 }
9273
9275 {
9276
9277 return false;
9278 }
9279
9281 {
9282 return false;
9283 }
9284
9288 {
9289 return false;
9290 }
9291
9293 {
9294 return "";
9295 }
9296
9298
9300 {
9301 return false;
9302 }
9303
9305 {
9306 return true;
9307 }
9308
9309
9310
9312 {
9313 return true;
9314 }
9315
9317 {
9318 return true;
9319 }
9320
9322 {
9323 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9325 }
9326
9328 {
9330 }
9331
9333 {
9335 if (!is_being_placed)
9337 SetSynchDirty();
9338 }
9339
9340
9342
9344 {
9346 }
9347
9349 {
9351 }
9352
9354 {
9355 return 1;
9356 }
9357
9359 {
9360 return false;
9361 }
9362
9364 {
9366 SetSynchDirty();
9367 }
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9404 {
9405 super.OnMovedInsideCargo(container);
9406
9407 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9408 }
9409
9410 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9411 {
9412 super.EEItemLocationChanged(oldLoc, newLoc);
9413
9414 PlayerBase newPlayer = null;
9415 PlayerBase oldPlayer = null;
9416
9417 if (newLoc.GetParent())
9418 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9419
9420 if (oldLoc.GetParent())
9421 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9422
9424 {
9425 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9426
9427 if (rIndex >= 0)
9428 {
9429 InventoryLocation rIl = new InventoryLocation;
9430 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9431
9432 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9435 {
9436 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9437 }
9439 {
9441 }
9442
9443 }
9444 }
9445
9447 {
9448 if (newPlayer)
9449 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9450
9451 if (newPlayer == oldPlayer)
9452 {
9453 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9454 {
9456 {
9457 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9458 {
9459 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9460 }
9461 }
9462 else
9463 {
9464 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9465 }
9466 }
9467
9468 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9469 {
9470 int type = oldLoc.GetType();
9472 {
9473 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9474 }
9476 {
9477 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9478 }
9479 }
9480 if (!m_OldLocation)
9481 {
9482 m_OldLocation = new InventoryLocation;
9483 }
9484 m_OldLocation.Copy(oldLoc);
9485 }
9486 else
9487 {
9488 if (m_OldLocation)
9489 {
9490 m_OldLocation.Reset();
9491 }
9492 }
9493
9494 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9495 }
9496 else
9497 {
9498 if (newPlayer)
9499 {
9500 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9501 if (resIndex >= 0)
9502 {
9503 InventoryLocation il = new InventoryLocation;
9504 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9506 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9509 {
9510 il.
GetParent().GetOnReleaseLock().Invoke(it);
9511 }
9513 {
9515 }
9516
9517 }
9518 }
9520 {
9521
9523 }
9524
9525 if (m_OldLocation)
9526 {
9527 m_OldLocation.Reset();
9528 }
9529 }
9530
9532 {
9533 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9534 }
9535
9537 {
9538 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9539 }
9540 }
9541
9542 override void EOnContact(IEntity other, Contact extra)
9543 {
9545 {
9546 int liquidType = -1;
9548 if (impactSpeed > 0.0)
9549 {
9551 #ifndef SERVER
9553 #else
9555 SetSynchDirty();
9556 #endif
9558 }
9559 }
9560
9561 #ifdef SERVER
9562 if (GetCompEM() && GetCompEM().IsPlugged())
9563 {
9564 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9565 GetCompEM().UnplugThis();
9566 }
9567 #endif
9568 }
9569
9571
9573 {
9575 }
9576
9578 {
9579
9580 }
9581
9583 {
9584 super.OnItemLocationChanged(old_owner, new_owner);
9585
9586 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9587 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9588
9589 if (!relatedPlayer && playerNew)
9590 relatedPlayer = playerNew;
9591
9592 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9593 {
9595 if (actionMgr)
9596 {
9597 ActionBase currentAction = actionMgr.GetRunningAction();
9598 if (currentAction)
9600 }
9601 }
9602
9603 Man ownerPlayerOld = null;
9604 Man ownerPlayerNew = null;
9605
9606 if (old_owner)
9607 {
9608 if (old_owner.
IsMan())
9609 {
9610 ownerPlayerOld = Man.Cast(old_owner);
9611 }
9612 else
9613 {
9614 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9615 }
9616 }
9617 else
9618 {
9620 {
9622
9623 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9624 {
9625 GetCompEM().UnplugThis();
9626 }
9627 }
9628 }
9629
9630 if (new_owner)
9631 {
9632 if (new_owner.
IsMan())
9633 {
9634 ownerPlayerNew = Man.Cast(new_owner);
9635 }
9636 else
9637 {
9638 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9639 }
9640 }
9641
9642 if (ownerPlayerOld != ownerPlayerNew)
9643 {
9644 if (ownerPlayerOld)
9645 {
9646 array<EntityAI> subItemsExit = new array<EntityAI>;
9648 for (int i = 0; i < subItemsExit.Count(); i++)
9649 {
9652 }
9653 }
9654
9655 if (ownerPlayerNew)
9656 {
9657 array<EntityAI> subItemsEnter = new array<EntityAI>;
9659 for (int j = 0; j < subItemsEnter.Count(); j++)
9660 {
9663 }
9664 }
9665 }
9666 else if (ownerPlayerNew != null)
9667 {
9668 PlayerBase nplayer;
9669 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9670 {
9671 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9673 for (int k = 0; k < subItemsUpdate.Count(); k++)
9674 {
9676 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9677 }
9678 }
9679 }
9680
9681 if (old_owner)
9682 old_owner.OnChildItemRemoved(this);
9683 if (new_owner)
9684 new_owner.OnChildItemReceived(this);
9685 }
9686
9687
9689 {
9690 super.EEDelete(parent);
9691 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9692 if (player)
9693 {
9695
9696 if (player.IsAlive())
9697 {
9698 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9699 if (r_index >= 0)
9700 {
9701 InventoryLocation r_il = new InventoryLocation;
9702 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9703
9704 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9707 {
9708 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9709 }
9711 {
9712 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9713 }
9714
9715 }
9716
9717 player.RemoveQuickBarEntityShortcut(this);
9718 }
9719 }
9720 }
9721
9723 {
9724 super.EEKilled(killer);
9725
9728 {
9729 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9730 {
9731 if (IsMagazine())
9732 {
9733 if (Magazine.Cast(this).GetAmmoCount() > 0)
9734 {
9736 }
9737 }
9738 else
9739 {
9741 }
9742 }
9743 }
9744 }
9745
9747 {
9748 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9749
9750 super.OnWasAttached(parent, slot_id);
9751
9754
9757 }
9758
9760 {
9761 super.OnWasDetached(parent, slot_id);
9762
9765
9768 }
9769
9771 {
9772 int idx;
9775
9776 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9777 if (inventory_slots.Count() < 1)
9778 {
9779 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9780 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9781 }
9782 else
9783 {
9784 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9785 }
9786
9787 idx = inventory_slots.Find(slot);
9788 if (idx < 0)
9789 return "";
9790
9791 return attach_types.Get(idx);
9792 }
9793
9795 {
9796 int idx = -1;
9797 string slot;
9798
9801
9802 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9803 if (inventory_slots.Count() < 1)
9804 {
9805 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9806 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9807 }
9808 else
9809 {
9810 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9811 if (detach_types.Count() < 1)
9812 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9813 }
9814
9815 for (int i = 0; i < inventory_slots.Count(); i++)
9816 {
9817 slot = inventory_slots.Get(i);
9818 }
9819
9820 if (slot != "")
9821 {
9822 if (detach_types.Count() == 1)
9823 idx = 0;
9824 else
9825 idx = inventory_slots.Find(slot);
9826 }
9827 if (idx < 0)
9828 return "";
9829
9830 return detach_types.Get(idx);
9831 }
9832
9834 {
9835
9837
9838
9839 float min_time = 1;
9840 float max_time = 3;
9841 float delay = Math.RandomFloat(min_time, max_time);
9842
9843 explode_timer.Run(delay, this, "DoAmmoExplosion");
9844 }
9845
9847 {
9848 Magazine magazine = Magazine.Cast(this);
9849 int pop_sounds_count = 6;
9850 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9851
9852
9853 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9854 string sound_name = pop_sounds[ sound_idx ];
9855 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9856
9857
9858 magazine.ServerAddAmmoCount(-1);
9859
9860
9861 float min_temp_to_explode = 100;
9862
9863 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9864 {
9866 }
9867 }
9868
9869
9870 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9871 {
9872 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9873
9874 const int CHANCE_DAMAGE_CARGO = 4;
9875 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9876 const int CHANCE_DAMAGE_NOTHING = 2;
9877
9879 {
9880 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9881 int chances;
9882 int rnd;
9883
9884 if (GetInventory().GetCargo())
9885 {
9886 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9887 rnd = Math.RandomInt(0,chances);
9888
9889 if (rnd < CHANCE_DAMAGE_CARGO)
9890 {
9892 }
9893 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9894 {
9896 }
9897 }
9898 else
9899 {
9900 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9901 rnd = Math.RandomInt(0,chances);
9902
9903 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9904 {
9906 }
9907 }
9908 }
9909 }
9910
9912 {
9913 CargoBase cargo = GetInventory().GetCargo();
9914 if (cargo)
9915 {
9917 if (item_count > 0)
9918 {
9919 int random_pick = Math.RandomInt(0, item_count);
9921 if (!item.IsExplosive())
9922 {
9923 item.AddHealth("","",damage);
9924 return true;
9925 }
9926 }
9927 }
9928 return false;
9929 }
9930
9932 {
9933 GameInventory inventory = GetInventory();
9935 if (attachment_count > 0)
9936 {
9937 int random_pick = Math.RandomInt(0, attachment_count);
9939 if (!attachment.IsExplosive())
9940 {
9941 attachment.AddHealth("","",damage);
9942 return true;
9943 }
9944 }
9945 return false;
9946 }
9947
9949 {
9951 }
9952
9954 {
9956 return GetInventory().CanRemoveEntity();
9957
9958 return false;
9959 }
9960
9962 {
9963
9965 return false;
9966
9967
9969 return false;
9970
9971
9972
9974 if (delta == 0)
9975 return false;
9976
9977
9978 return true;
9979 }
9980
9982 {
9984 {
9985 if (ScriptInputUserData.CanStoreInputUserData())
9986 {
9987 ScriptInputUserData ctx = new ScriptInputUserData;
9992 ctx.
Write(destination_entity);
9996 }
9997 }
9998 else if (!
g_Game.IsMultiplayer())
9999 {
10001 }
10002 }
10003
10005 {
10006 float split_quantity_new;
10010 InventoryLocation loc = new InventoryLocation;
10011
10012 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10013 {
10015 split_quantity_new = stack_max;
10016 else
10018
10020 {
10021 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10022 if (new_item)
10023 {
10024 new_item.SetResultOfSplit(true);
10025 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10027 new_item.
SetQuantity(split_quantity_new,
false,
true);
10028 }
10029 }
10030 }
10031 else if (destination_entity && slot_id == -1)
10032 {
10033 if (quantity > stack_max)
10034 split_quantity_new = stack_max;
10035 else
10036 split_quantity_new = quantity;
10037
10039 {
10040 GameInventory destinationInventory = destination_entity.GetInventory();
10042 {
10045 }
10046
10047 if (new_item)
10048 {
10049 new_item.SetResultOfSplit(true);
10050 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10052 new_item.
SetQuantity(split_quantity_new,
false,
true);
10053 }
10054 }
10055 }
10056 else
10057 {
10058 if (stack_max != 0)
10059 {
10061 {
10063 }
10064
10065 if (split_quantity_new == 0)
10066 {
10067 if (!
g_Game.IsMultiplayer())
10068 player.PhysicalPredictiveDropItem(this);
10069 else
10070 player.ServerDropEntity(this);
10071 return;
10072 }
10073
10075 {
10077
10078 if (new_item)
10079 {
10080 new_item.SetResultOfSplit(true);
10081 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10084 new_item.PlaceOnSurface();
10085 }
10086 }
10087 }
10088 }
10089 }
10090
10092 {
10093 float split_quantity_new;
10097 InventoryLocation loc = new InventoryLocation;
10098
10099 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10100 {
10102 split_quantity_new = stack_max;
10103 else
10105
10107 {
10108 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10109 if (new_item)
10110 {
10111 new_item.SetResultOfSplit(true);
10112 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10114 new_item.
SetQuantity(split_quantity_new,
false,
true);
10115 }
10116 }
10117 }
10118 else if (destination_entity && slot_id == -1)
10119 {
10120 if (quantity > stack_max)
10121 split_quantity_new = stack_max;
10122 else
10123 split_quantity_new = quantity;
10124
10126 {
10127 GameInventory destinationInventory = destination_entity.GetInventory();
10129 {
10132 }
10133
10134 if (new_item)
10135 {
10136 new_item.SetResultOfSplit(true);
10137 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10139 new_item.
SetQuantity(split_quantity_new,
false,
true);
10140 }
10141 }
10142 }
10143 else
10144 {
10145 if (stack_max != 0)
10146 {
10148 {
10150 }
10151
10153 {
10155
10156 if (new_item)
10157 {
10158 new_item.SetResultOfSplit(true);
10159 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10162 new_item.PlaceOnSurface();
10163 }
10164 }
10165 }
10166 }
10167 }
10168
10170 {
10172 {
10173 if (ScriptInputUserData.CanStoreInputUserData())
10174 {
10175 ScriptInputUserData ctx = new ScriptInputUserData;
10180 dst.WriteToContext(ctx);
10182 }
10183 }
10184 else if (!
g_Game.IsMultiplayer())
10185 {
10187 }
10188 }
10189
10191 {
10193 {
10194 if (ScriptInputUserData.CanStoreInputUserData())
10195 {
10196 ScriptInputUserData ctx = new ScriptInputUserData;
10201 ctx.
Write(destination_entity);
10207 }
10208 }
10209 else if (!
g_Game.IsMultiplayer())
10210 {
10212 }
10213 }
10214
10216 {
10218 }
10219
10221 {
10223 float split_quantity_new;
10225 if (dst.IsValid())
10226 {
10227 int slot_id = dst.GetSlot();
10229
10230 if (quantity > stack_max)
10231 split_quantity_new = stack_max;
10232 else
10233 split_quantity_new = quantity;
10234
10236 {
10238
10239 if (new_item)
10240 {
10241 new_item.SetResultOfSplit(true);
10242 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10244 new_item.
SetQuantity(split_quantity_new,
false,
true);
10245 }
10246
10247 return new_item;
10248 }
10249 }
10250
10251 return null;
10252 }
10253
10255 {
10257 float split_quantity_new;
10259 if (destination_entity)
10260 {
10262 if (quantity > stackable)
10263 split_quantity_new = stackable;
10264 else
10265 split_quantity_new = quantity;
10266
10268 {
10269 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10270 if (new_item)
10271 {
10272 new_item.SetResultOfSplit(true);
10273 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10275 new_item.
SetQuantity(split_quantity_new,
false,
true);
10276 }
10277 }
10278 }
10279 }
10280
10282 {
10284 {
10285 if (ScriptInputUserData.CanStoreInputUserData())
10286 {
10287 ScriptInputUserData ctx = new ScriptInputUserData;
10292 ItemBase destination_entity =
this;
10293 ctx.
Write(destination_entity);
10297 }
10298 }
10299 else if (!
g_Game.IsMultiplayer())
10300 {
10302 }
10303 }
10304
10306 {
10308 float split_quantity_new;
10310 if (player)
10311 {
10313 if (quantity > stackable)
10314 split_quantity_new = stackable;
10315 else
10316 split_quantity_new = quantity;
10317
10319 {
10320 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10321 new_item =
ItemBase.Cast(in_hands);
10322 if (new_item)
10323 {
10324 new_item.SetResultOfSplit(true);
10325 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10327 new_item.SetQuantity(split_quantity_new, false, true);
10328 }
10329 }
10330 }
10331 }
10332
10334 {
10336 float split_quantity_new = Math.Floor(quantity * 0.5);
10337
10339 return;
10340
10342
10343 if (new_item)
10344 {
10345 if (new_item.GetQuantityMax() < split_quantity_new)
10346 {
10347 split_quantity_new = new_item.GetQuantityMax();
10348 }
10349
10350 new_item.SetResultOfSplit(true);
10351 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10352
10354 {
10357 }
10358 else
10359 {
10361 new_item.
SetQuantity(split_quantity_new,
false,
true);
10362 }
10363 }
10364 }
10365
10367 {
10369 float split_quantity_new = Math.Floor(quantity / 2);
10370
10372 return;
10373
10374 InventoryLocation invloc = new InventoryLocation;
10376
10378 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10379
10380 if (new_item)
10381 {
10382 if (new_item.GetQuantityMax() < split_quantity_new)
10383 {
10384 split_quantity_new = new_item.GetQuantityMax();
10385 }
10387 {
10390 }
10391 else if (split_quantity_new > 1)
10392 {
10394 new_item.
SetQuantity(split_quantity_new,
false,
true);
10395 }
10396 }
10397 }
10398
10401 {
10402 SetWeightDirty();
10404
10405 if (parent)
10406 parent.OnAttachmentQuantityChangedEx(this, delta);
10407
10409 {
10411 {
10413 }
10415 {
10416 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10418 }
10419 }
10420 }
10421
10424 {
10425
10426 }
10427
10430 {
10432 }
10433
10435 {
10436 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10437
10439 {
10440 if (newLevel == GameConstants.STATE_RUINED)
10441 {
10443 EntityAI parent = GetHierarchyParent();
10444 if (parent && parent.IsFireplace())
10445 {
10446 CargoBase cargo = GetInventory().GetCargo();
10447 if (cargo)
10448 {
10450 {
10452 }
10453 }
10454 }
10455 }
10456
10458 {
10459
10461 return;
10462 }
10463
10464 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10465 {
10467 }
10468 }
10469 }
10470
10471
10473 {
10474 super.OnRightClick();
10475
10477 {
10479 {
10480 if (ScriptInputUserData.CanStoreInputUserData())
10481 {
10482 EntityAI root = GetHierarchyRoot();
10483 Man playerOwner = GetHierarchyRootPlayer();
10484 InventoryLocation dst = new InventoryLocation;
10485
10486
10487 if (!playerOwner && root && root == this)
10488 {
10490 }
10491 else
10492 {
10493
10494 GetInventory().GetCurrentInventoryLocation(dst);
10496 {
10497 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10499 {
10501 }
10502 else
10503 {
10505
10506
10507 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10508 {
10510 }
10511 else
10512 {
10513 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10514 }
10515 }
10516 }
10517 }
10518
10519 ScriptInputUserData ctx = new ScriptInputUserData;
10527 }
10528 }
10529 else if (!
g_Game.IsMultiplayer())
10530 {
10532 }
10533 }
10534 }
10535
10537 {
10538 if (root)
10539 {
10540 vector m4[4];
10541 root.GetTransform(m4);
10542 dst.SetGround(this, m4);
10543 }
10544 else
10545 {
10546 GetInventory().GetCurrentInventoryLocation(dst);
10547 }
10548 }
10549
10550 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10551 {
10552
10553 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10554 return false;
10555
10556 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10557 return false;
10558
10559
10561 return false;
10562
10563
10564 Magazine mag = Magazine.Cast(this);
10565 if (mag)
10566 {
10567 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10568 return false;
10569
10570 if (stack_max_limit)
10571 {
10572 Magazine other_mag = Magazine.Cast(other_item);
10573 if (other_item)
10574 {
10575 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10576 return false;
10577 }
10578
10579 }
10580 }
10581 else
10582 {
10583
10585 return false;
10586
10588 return false;
10589 }
10590
10591 PlayerBase player = null;
10592 if (CastTo(player, GetHierarchyRootPlayer()))
10593 {
10594 if (player.GetInventory().HasAttachment(this))
10595 return false;
10596
10597 if (player.IsItemsToDelete())
10598 return false;
10599 }
10600
10601 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10602 return false;
10603
10604 int slotID;
10606 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10607 return false;
10608
10609 return true;
10610 }
10611
10613 {
10615 }
10616
10618 {
10619 return m_IsResultOfSplit;
10620 }
10621
10623 {
10624 m_IsResultOfSplit = value;
10625 }
10626
10628 {
10630 }
10631
10633 {
10634 float other_item_quantity = other_item.GetQuantity();
10635 float this_free_space;
10636
10638
10640
10641 if (other_item_quantity > this_free_space)
10642 {
10643 return this_free_space;
10644 }
10645 else
10646 {
10647 return other_item_quantity;
10648 }
10649 }
10650
10652 {
10654 }
10655
10657 {
10659 return;
10660
10661 if (!IsMagazine() && other_item)
10662 {
10664 if (quantity_used != 0)
10665 {
10666 float hp1 = GetHealth01("","");
10667 float hp2 = other_item.GetHealth01("","");
10668 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10669 hpResult = hpResult / (
GetQuantity() + quantity_used);
10670
10671 hpResult *= GetMaxHealth();
10672 Math.Round(hpResult);
10673 SetHealth("", "Health", hpResult);
10674
10676 other_item.AddQuantity(-quantity_used);
10677 }
10678 }
10680 }
10681
10683 {
10684 #ifdef SERVER
10685 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10686 GetHierarchyParent().IncreaseLifetimeUp();
10687 #endif
10688 };
10689
10691 {
10692 PlayerBase p = PlayerBase.Cast(player);
10693
10694 array<int> recipesIds = p.m_Recipes;
10695 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10696 if (moduleRecipesManager)
10697 {
10698 EntityAI itemInHands = player.GetEntityInHands();
10699 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10700 }
10701
10702 for (int i = 0;i < recipesIds.Count(); i++)
10703 {
10704 int key = recipesIds.Get(i);
10705 string recipeName = moduleRecipesManager.GetRecipeName(key);
10707 }
10708 }
10709
10710
10711 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10712 {
10713 super.GetDebugActions(outputList);
10714
10715
10721
10722
10727
10732
10733
10737
10738
10740 {
10744 }
10745
10748
10749
10753
10755
10756 InventoryLocation loc = new InventoryLocation();
10757 GetInventory().GetCurrentInventoryLocation(loc);
10759 {
10760 if (Gizmo_IsSupported())
10763 }
10764
10766 }
10767
10768
10769
10770
10772 {
10773 super.OnAction(action_id, player, ctx);
10774
10776 {
10777 switch (action_id)
10778 {
10782 return true;
10786 return true;
10787 }
10788 }
10789
10791 {
10792 switch (action_id)
10793 {
10795 Delete();
10796 return true;
10797 }
10798 }
10799
10800 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10801 {
10802 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10803 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10804 PlayerBase p = PlayerBase.Cast(player);
10805 if (
EActions.RECIPES_RANGE_START < 1000)
10806 {
10807 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10808 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10809 }
10810 }
10811 #ifndef SERVER
10812 else if (action_id ==
EActions.WATCH_PLAYER)
10813 {
10814 PluginDeveloper.SetDeveloperItemClientEx(player);
10815 }
10816 #endif
10818 {
10819 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10820 {
10821 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10822 OnDebugButtonPressServer(id + 1);
10823 }
10824
10825 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10826 {
10827 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10829 }
10830
10831 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10832 {
10833 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10835 }
10836
10837 else if (action_id ==
EActions.ADD_QUANTITY)
10838 {
10839 if (IsMagazine())
10840 {
10841 Magazine mag = Magazine.Cast(this);
10842 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10843 }
10844 else
10845 {
10847 }
10848
10849 if (m_EM)
10850 {
10851 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10852 }
10853
10854 }
10855
10856 else if (action_id ==
EActions.REMOVE_QUANTITY)
10857 {
10858 if (IsMagazine())
10859 {
10860 Magazine mag2 = Magazine.Cast(this);
10861 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10862 }
10863 else
10864 {
10866 }
10867 if (m_EM)
10868 {
10869 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10870 }
10871
10872 }
10873
10874 else if (action_id ==
EActions.SET_QUANTITY_0)
10875 {
10877
10878 if (m_EM)
10879 {
10880 m_EM.SetEnergy(0);
10881 }
10882 }
10883
10884 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10885 {
10887
10888 if (m_EM)
10889 {
10890 m_EM.SetEnergy(m_EM.GetEnergyMax());
10891 }
10892 }
10893
10894 else if (action_id ==
EActions.ADD_HEALTH)
10895 {
10896 AddHealth("","",GetMaxHealth("","Health")/5);
10897 }
10898 else if (action_id ==
EActions.REMOVE_HEALTH)
10899 {
10900 AddHealth("","",-GetMaxHealth("","Health")/5);
10901 }
10902 else if (action_id ==
EActions.DESTROY_HEALTH)
10903 {
10904 SetHealth01("","",0);
10905 }
10906 else if (action_id ==
EActions.WATCH_ITEM)
10907 {
10909 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10910 #ifdef DEVELOPER
10911 SetDebugDeveloper_item(this);
10912 #endif
10913 }
10914
10915 else if (action_id ==
EActions.ADD_TEMPERATURE)
10916 {
10917 AddTemperature(20);
10918
10919 }
10920
10921 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10922 {
10923 AddTemperature(-20);
10924
10925 }
10926
10927 else if (action_id ==
EActions.FLIP_FROZEN)
10928 {
10929 SetFrozen(!GetIsFrozen());
10930
10931 }
10932
10933 else if (action_id ==
EActions.ADD_WETNESS)
10934 {
10936
10937 }
10938
10939 else if (action_id ==
EActions.REMOVE_WETNESS)
10940 {
10942
10943 }
10944
10945 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10946 {
10949
10950
10951 }
10952
10953 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10954 {
10957 }
10958
10959 else if (action_id ==
EActions.MAKE_SPECIAL)
10960 {
10961 auto debugParams = DebugSpawnParams.WithPlayer(player);
10962 OnDebugSpawnEx(debugParams);
10963 }
10964
10965 }
10966
10967
10968 return false;
10969 }
10970
10971
10972
10973
10977
10980
10981
10982
10984 {
10985 return false;
10986 }
10987
10988
10990 {
10991 return true;
10992 }
10993
10994
10996 {
10997 return true;
10998 }
10999
11000
11001
11003 {
11004 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11005 return g_Game.ConfigIsExisting(config_path);
11006 }
11007
11010 {
11011 return null;
11012 }
11013
11015 {
11016 return false;
11017 }
11018
11020 {
11021 return false;
11022 }
11023
11027
11028
11030 {
11031 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11032 return module_repairing.CanRepair(this, item_repair_kit);
11033 }
11034
11035
11036 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11037 {
11038 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11039 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11040 }
11041
11042
11044 {
11045
11046
11047
11048
11049
11050
11051
11052
11053 return 1;
11054 }
11055
11056
11057
11059 {
11061 }
11062
11063
11064
11066 {
11068 }
11069
11070
11079 {
11080 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11081
11082 if (player)
11083 {
11084 player.MessageStatus(text);
11085 }
11086 }
11087
11088
11097 {
11098 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11099
11100 if (player)
11101 {
11102 player.MessageAction(text);
11103 }
11104 }
11105
11106
11115 {
11116 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11117
11118 if (player)
11119 {
11120 player.MessageFriendly(text);
11121 }
11122 }
11123
11124
11133 {
11134 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11135
11136 if (player)
11137 {
11138 player.MessageImportant(text);
11139 }
11140 }
11141
11143 {
11144 return true;
11145 }
11146
11147
11148 override bool KindOf(
string tag)
11149 {
11150 bool found = false;
11151 string item_name = this.
GetType();
11153 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11154
11155 int array_size = item_tag_array.Count();
11156 for (int i = 0; i < array_size; i++)
11157 {
11158 if (item_tag_array.Get(i) == tag)
11159 {
11160 found = true;
11161 break;
11162 }
11163 }
11164 return found;
11165 }
11166
11167
11169 {
11170
11171 super.OnRPC(sender, rpc_type,ctx);
11172
11173
11174 switch (rpc_type)
11175 {
11176 #ifndef SERVER
11177 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11178 Param2<bool, string> p = new Param2<bool, string>(false, "");
11179
11181 return;
11182
11183 bool play = p.param1;
11184 string soundSet = p.param2;
11185
11186 if (play)
11187 {
11189 {
11191 {
11193 }
11194 }
11195 else
11196 {
11198 }
11199 }
11200 else
11201 {
11203 }
11204
11205 break;
11206 #endif
11207
11208 }
11209
11211 {
11213 }
11214 }
11215
11216
11217
11218
11220 {
11221 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11222 return plugin.GetID(
name);
11223 }
11224
11226 {
11227 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11228 return plugin.GetName(id);
11229 }
11230
11233 {
11234
11235
11236 int varFlags;
11237 if (!ctx.
Read(varFlags))
11238 return;
11239
11240 if (varFlags & ItemVariableFlags.FLOAT)
11241 {
11243 }
11244 }
11245
11247 {
11248
11249 super.SerializeNumericalVars(floats_out);
11250
11251
11252
11254 {
11256 }
11257
11259 {
11261 }
11262
11264 {
11266 }
11267
11269 {
11274 }
11275
11277 {
11279 }
11280 }
11281
11283 {
11284
11285 super.DeSerializeNumericalVars(floats);
11286
11287
11288 int index = 0;
11289 int mask = Math.Round(floats.Get(index));
11290
11291 index++;
11292
11294 {
11296 {
11298 }
11299 else
11300 {
11301 float quantity = floats.Get(index);
11302 SetQuantity(quantity,
true,
false,
false,
false);
11303 }
11304 index++;
11305 }
11306
11308 {
11309 float wet = floats.Get(index);
11311 index++;
11312 }
11313
11315 {
11316 int liquidtype = Math.Round(floats.Get(index));
11318 index++;
11319 }
11320
11322 {
11324 index++;
11326 index++;
11328 index++;
11330 index++;
11331 }
11332
11334 {
11335 int cleanness = Math.Round(floats.Get(index));
11337 index++;
11338 }
11339 }
11340
11342 {
11343 super.WriteVarsToCTX(ctx);
11344
11345
11347 {
11349 }
11350
11352 {
11354 }
11355
11357 {
11359 }
11360
11362 {
11363 int r,g,b,a;
11369 }
11370
11372 {
11374 }
11375 }
11376
11378 {
11379 if (!super.ReadVarsFromCTX(ctx,version))
11380 return false;
11381
11382 int intValue;
11383 float value;
11384
11385 if (version < 140)
11386 {
11387 if (!ctx.
Read(intValue))
11388 return false;
11389
11390 m_VariablesMask = intValue;
11391 }
11392
11394 {
11395 if (!ctx.
Read(value))
11396 return false;
11397
11399 {
11401 }
11402 else
11403 {
11405 }
11406 }
11407
11408 if (version < 140)
11409 {
11411 {
11412 if (!ctx.
Read(value))
11413 return false;
11414 SetTemperatureDirect(value);
11415 }
11416 }
11417
11419 {
11420 if (!ctx.
Read(value))
11421 return false;
11423 }
11424
11426 {
11427 if (!ctx.
Read(intValue))
11428 return false;
11430 }
11431
11433 {
11434 int r,g,b,a;
11436 return false;
11438 return false;
11440 return false;
11442 return false;
11443
11445 }
11446
11448 {
11449 if (!ctx.
Read(intValue))
11450 return false;
11452 }
11453
11454 if (version >= 138 && version < 140)
11455 {
11457 {
11458 if (!ctx.
Read(intValue))
11459 return false;
11460 SetFrozen(intValue);
11461 }
11462 }
11463
11464 return true;
11465 }
11466
11467
11469 {
11472 {
11474 }
11475
11476 if (!super.OnStoreLoad(ctx, version))
11477 {
11479 return false;
11480 }
11481
11482 if (version >= 114)
11483 {
11484 bool hasQuickBarIndexSaved;
11485
11486 if (!ctx.
Read(hasQuickBarIndexSaved))
11487 {
11489 return false;
11490 }
11491
11492 if (hasQuickBarIndexSaved)
11493 {
11494 int itmQBIndex;
11495
11496
11497 if (!ctx.
Read(itmQBIndex))
11498 {
11500 return false;
11501 }
11502
11503 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11504 if (itmQBIndex != -1 && parentPlayer)
11505 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11506 }
11507 }
11508 else
11509 {
11510
11511 PlayerBase player;
11512 int itemQBIndex;
11513 if (version ==
int.
MAX)
11514 {
11515 if (!ctx.
Read(itemQBIndex))
11516 {
11518 return false;
11519 }
11520 }
11521 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11522 {
11523
11524 if (!ctx.
Read(itemQBIndex))
11525 {
11527 return false;
11528 }
11529 if (itemQBIndex != -1 && player)
11530 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11531 }
11532 }
11533
11534 if (version < 140)
11535 {
11536
11537 if (!LoadVariables(ctx, version))
11538 {
11540 return false;
11541 }
11542 }
11543
11544
11546 {
11548 return false;
11549 }
11550 if (version >= 132)
11551 {
11553 if (raib)
11554 {
11556 {
11558 return false;
11559 }
11560 }
11561 }
11562
11564 return true;
11565 }
11566
11567
11568
11570 {
11571 super.OnStoreSave(ctx);
11572
11573 PlayerBase player;
11574 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11575 {
11577
11578 int itemQBIndex = -1;
11579 itemQBIndex = player.FindQuickBarEntityIndex(this);
11580 ctx.
Write(itemQBIndex);
11581 }
11582 else
11583 {
11585 }
11586
11588
11590 if (raib)
11591 {
11593 }
11594 }
11595
11596
11598 {
11599 super.AfterStoreLoad();
11600
11602 {
11604 }
11605
11607 {
11610 }
11611 }
11612
11614 {
11615 super.EEOnAfterLoad();
11616
11618 {
11620 }
11621
11624 }
11625
11627 {
11628 return false;
11629 }
11630
11631
11632
11634 {
11636 {
11637 #ifdef PLATFORM_CONSOLE
11638
11640 {
11642 if (menu)
11643 {
11645 }
11646 }
11647 #endif
11648 }
11649
11651 {
11654 }
11655
11657 {
11658 SetWeightDirty();
11660 }
11662 {
11665 }
11666
11668 {
11671
11674 }
11676 {
11680 }
11681
11682 super.OnVariablesSynchronized();
11683 }
11684
11685
11686
11688 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11689 {
11690 if (!IsServerCheck(allow_client))
11691 return false;
11692
11694 return false;
11695
11698
11699 if (value <= (min + 0.001))
11700 value = min;
11701
11702 if (value == min)
11703 {
11704 if (destroy_config)
11705 {
11706 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11707 if (dstr)
11708 {
11710 this.Delete();
11711 return true;
11712 }
11713 }
11714 else if (destroy_forced)
11715 {
11717 this.Delete();
11718 return true;
11719 }
11720
11722 }
11723
11726
11728 {
11729 EntityAI parent = GetHierarchyRoot();
11730 InventoryLocation iLoc = new InventoryLocation();
11731 GetInventory().GetCurrentInventoryLocation(iLoc);
11733 {
11734 int iLocSlot = iLoc.
GetSlot();
11736 {
11738 }
11740 {
11742 }
11743 }
11744 }
11745
11747 {
11749
11750 if (delta)
11752 }
11753
11755
11756 return false;
11757 }
11758
11759
11761 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11762 {
11764 }
11765
11767 {
11770 }
11771
11773 {
11776 }
11777
11779 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11780 {
11781 float value_clamped = Math.Clamp(value, 0, 1);
11783 SetQuantity(result, destroy_config, destroy_forced);
11784 }
11785
11786
11789 {
11791 }
11792
11794 {
11796 }
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11808 {
11809 int slot = -1;
11810 GameInventory inventory = GetInventory();
11811 if (inventory)
11812 {
11813 InventoryLocation il = new InventoryLocation;
11816 }
11817
11819 }
11820
11822 {
11823 float quantity_max = 0;
11824
11826 {
11827 if (attSlotID != -1)
11828 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11829
11830 if (quantity_max <= 0)
11832 }
11833
11834 if (quantity_max <= 0)
11836
11837 return quantity_max;
11838 }
11839
11841 {
11843 }
11844
11846 {
11848 }
11849
11850
11852 {
11854 }
11855
11857 {
11859 }
11860
11862 {
11864 }
11865
11866
11868 {
11869
11870 float weightEx = GetWeightEx();
11871 float special = GetInventoryAndCargoWeight();
11872 return weightEx - special;
11873 }
11874
11875
11877 {
11879 }
11880
11882 {
11884 {
11885 #ifdef DEVELOPER
11886 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11887 {
11888 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11890 }
11891 #endif
11892
11893 return GetQuantity() * GetConfigWeightModified();
11894 }
11895 else if (HasEnergyManager())
11896 {
11897 #ifdef DEVELOPER
11898 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11899 {
11900 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11901 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11902 }
11903 #endif
11904 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11905 }
11906 else
11907 {
11908 #ifdef DEVELOPER
11909 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11910 {
11911 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11912 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11913 }
11914 #endif
11915 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11916 }
11917 }
11918
11921 {
11922 int item_count = 0;
11924
11925 GameInventory inventory = GetInventory();
11926 CargoBase cargo = inventory.
GetCargo();
11927 if (cargo != NULL)
11928 {
11930 }
11931
11933 for (int i = 0; i < nAttachments; ++i)
11934 {
11936 if (item)
11937 item_count += item.GetNumberOfItems();
11938 }
11939 return item_count;
11940 }
11941
11944 {
11945 float weight = 0;
11946 float wetness = 1;
11947 if (include_wetness)
11950 {
11951 weight = wetness * m_ConfigWeight;
11952 }
11954 {
11955 weight = 1;
11956 }
11957 return weight;
11958 }
11959
11960
11961
11963 {
11964 GameInventory inventory = GetInventory();
11965 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11966 {
11967 array<EntityAI> items = new array<EntityAI>;
11969 for (int i = 0; i < items.Count(); ++i)
11970 {
11972 if (item)
11973 {
11974 g_Game.ObjectDelete(item);
11975 }
11976 }
11977 }
11978 }
11979
11980
11981
11982
11984 {
11985 float energy = 0;
11986 if (HasEnergyManager())
11987 {
11988 energy = GetCompEM().GetEnergy();
11989 }
11990 return energy;
11991 }
11992
11993
11995 {
11996 super.OnEnergyConsumed();
11997
11999 }
12000
12002 {
12003 super.OnEnergyAdded();
12004
12006 }
12007
12008
12010 {
12011 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12012 {
12014 {
12015 float energy_0to1 = GetCompEM().GetEnergy0To1();
12017 }
12018 }
12019 }
12020
12021
12023 {
12024 return ConfigGetFloat("heatIsolation");
12025 }
12026
12028 {
12030 }
12031
12033 {
12034 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12035 if (
g_Game.ConfigIsExisting(paramPath))
12036 return g_Game.ConfigGetFloat(paramPath);
12037
12038 return 0.0;
12039 }
12040
12042 {
12043 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12044 if (
g_Game.ConfigIsExisting(paramPath))
12045 return g_Game.ConfigGetFloat(paramPath);
12046
12047 return 0.0;
12048 }
12049
12050 override void SetWet(
float value,
bool allow_client =
false)
12051 {
12052 if (!IsServerCheck(allow_client))
12053 return;
12054
12057
12059
12060 m_VarWet = Math.Clamp(value, min, max);
12061
12063 {
12066 }
12067 }
12068
12069 override void AddWet(
float value)
12070 {
12072 }
12073
12075 {
12077 }
12078
12080 {
12082 }
12083
12085 {
12087 }
12088
12090 {
12092 }
12093
12095 {
12097 }
12098
12099 override void OnWetChanged(
float newVal,
float oldVal)
12100 {
12103 if (newLevel != oldLevel)
12104 {
12106 }
12107 }
12108
12110 {
12111 SetWeightDirty();
12112 }
12113
12115 {
12116 return GetWetLevelInternal(
m_VarWet);
12117 }
12118
12119
12120
12122 {
12124 }
12125
12127 {
12129 }
12130
12132 {
12134 }
12135
12137 {
12139 }
12140
12141
12142
12144 {
12145 if (ConfigIsExisting("itemModelLength"))
12146 {
12147 return ConfigGetFloat("itemModelLength");
12148 }
12149 return 0;
12150 }
12151
12153 {
12154 if (ConfigIsExisting("itemAttachOffset"))
12155 {
12156 return ConfigGetFloat("itemAttachOffset");
12157 }
12158 return 0;
12159 }
12160
12161 override void SetCleanness(
int value,
bool allow_client =
false)
12162 {
12163 if (!IsServerCheck(allow_client))
12164 return;
12165
12167
12169
12172 }
12173
12175 {
12177 }
12178
12180 {
12181 return true;
12182 }
12183
12184
12185
12186
12188 {
12190 }
12191
12193 {
12195 }
12196
12197
12198
12199
12200 override void SetColor(
int r,
int g,
int b,
int a)
12201 {
12207 }
12209 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12210 {
12215 }
12216
12218 {
12220 }
12221
12224 {
12225 int r,g,b,a;
12227 r = r/255;
12228 g = g/255;
12229 b = b/255;
12230 a = a/255;
12231 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12232 }
12233
12234
12235
12236 override void SetLiquidType(
int value,
bool allow_client =
false)
12237 {
12238 if (!IsServerCheck(allow_client))
12239 return;
12240
12245 }
12246
12248 {
12249 return ConfigGetInt("varLiquidTypeInit");
12250 }
12251
12253 {
12255 }
12256
12258 {
12260 SetFrozen(false);
12261 }
12262
12265 {
12266 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12267 }
12268
12269
12272 {
12273 PlayerBase nplayer;
12274 if (PlayerBase.CastTo(nplayer, player))
12275 {
12277 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12278 }
12279 }
12280
12281
12284 {
12285 PlayerBase nplayer;
12286 if (PlayerBase.CastTo(nplayer,player))
12287 {
12288 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12289 }
12290
12291 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12292
12293 if (HasEnergyManager())
12294 {
12295 GetCompEM().UpdatePlugState();
12296 }
12297 }
12298
12299
12301 {
12302 super.OnPlacementStarted(player);
12303
12305 }
12306
12307 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12308 {
12310 {
12311 m_AdminLog.OnPlacementComplete(player,
this);
12312 }
12313
12314 super.OnPlacementComplete(player, position, orientation);
12315 }
12316
12317
12318
12319
12320
12322 {
12324 {
12325 return true;
12326 }
12327 else
12328 {
12329 return false;
12330 }
12331 }
12332
12333
12335 {
12337 {
12339 }
12340 }
12341
12342
12344 {
12346 }
12347
12349 {
12351 }
12352
12353 override void InsertAgent(
int agent,
float count = 1)
12354 {
12355 if (count < 1)
12356 return;
12357
12359 }
12360
12363 {
12365 }
12366
12367
12369 {
12371 }
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12415 {
12417 return false;
12418 return true;
12419 }
12420
12422 {
12423
12425 }
12426
12427
12430 {
12431 super.CheckForRoofLimited(timeTresholdMS);
12432
12433 float time =
g_Game.GetTime();
12434 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12435 {
12436 m_PreviousRoofTestTime = time;
12437 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12438 }
12439 }
12440
12441
12443 {
12445 {
12446 return 0;
12447 }
12448
12449 if (GetInventory().GetAttachmentSlotsCount() != 0)
12450 {
12451 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12452 if (filter)
12453 return filter.GetProtectionLevel(type, false, system);
12454 else
12455 return 0;
12456 }
12457
12458 string subclassPath, entryName;
12459
12460 switch (type)
12461 {
12463 entryName = "biological";
12464 break;
12466 entryName = "chemical";
12467 break;
12468 default:
12469 entryName = "biological";
12470 break;
12471 }
12472
12473 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12474
12475 return g_Game.ConfigGetFloat(subclassPath + entryName);
12476 }
12477
12478
12479
12482 {
12483 if (!IsMagazine())
12485
12487 }
12488
12489
12490
12491
12492
12497 {
12498 return true;
12499 }
12500
12502 {
12504 }
12505
12506
12507
12508
12509
12511 {
12512 if (parent)
12513 {
12514 if (parent.IsInherited(DayZInfected))
12515 return true;
12516
12517 if (!parent.IsRuined())
12518 return true;
12519 }
12520
12521 return true;
12522 }
12523
12525 {
12526 if (!super.CanPutAsAttachment(parent))
12527 {
12528 return false;
12529 }
12530
12531 if (!IsRuined() && !parent.IsRuined())
12532 {
12533 return true;
12534 }
12535
12536 return false;
12537 }
12538
12540 {
12541
12542
12543
12544
12545 return super.CanReceiveItemIntoCargo(item);
12546 }
12547
12549 {
12550
12551
12552
12553
12554 GameInventory attachmentInv = attachment.GetInventory();
12556 {
12557 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12558 return false;
12559 }
12560
12561 InventoryLocation loc = new InventoryLocation();
12562 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12563 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12564 return false;
12565
12566 return super.CanReceiveAttachment(attachment, slotId);
12567 }
12568
12570 {
12571 if (!super.CanReleaseAttachment(attachment))
12572 return false;
12573
12574 return GetInventory().AreChildrenAccessible();
12575 }
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12598 {
12599 int id = muzzle_owner.GetMuzzleID();
12600 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12601
12602 if (WPOF_array)
12603 {
12604 for (int i = 0; i < WPOF_array.Count(); i++)
12605 {
12606 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12607
12608 if (WPOF)
12609 {
12610 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12611 }
12612 }
12613 }
12614 }
12615
12616
12618 {
12619 int id = muzzle_owner.GetMuzzleID();
12621
12622 if (WPOBE_array)
12623 {
12624 for (int i = 0; i < WPOBE_array.Count(); i++)
12625 {
12626 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12627
12628 if (WPOBE)
12629 {
12630 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12631 }
12632 }
12633 }
12634 }
12635
12636
12638 {
12639 int id = muzzle_owner.GetMuzzleID();
12640 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12641
12642 if (WPOOH_array)
12643 {
12644 for (int i = 0; i < WPOOH_array.Count(); i++)
12645 {
12646 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12647
12648 if (WPOOH)
12649 {
12650 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12651 }
12652 }
12653 }
12654 }
12655
12656
12658 {
12659 int id = muzzle_owner.GetMuzzleID();
12660 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12661
12662 if (WPOOH_array)
12663 {
12664 for (int i = 0; i < WPOOH_array.Count(); i++)
12665 {
12666 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12667
12668 if (WPOOH)
12669 {
12670 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12671 }
12672 }
12673 }
12674 }
12675
12676
12678 {
12679 int id = muzzle_owner.GetMuzzleID();
12680 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12681
12682 if (WPOOH_array)
12683 {
12684 for (int i = 0; i < WPOOH_array.Count(); i++)
12685 {
12686 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12687
12688 if (WPOOH)
12689 {
12690 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12691 }
12692 }
12693 }
12694 }
12695
12696
12697
12699 {
12701 {
12702 return true;
12703 }
12704
12705 return false;
12706 }
12707
12709 {
12711 {
12712 return true;
12713 }
12714
12715 return false;
12716 }
12717
12719 {
12721 {
12722 return true;
12723 }
12724
12725 return false;
12726 }
12727
12729 {
12730 return false;
12731 }
12732
12735 {
12736 return UATimeSpent.DEFAULT_DEPLOY;
12737 }
12738
12739
12740
12741
12743 {
12745 SetSynchDirty();
12746 }
12747
12749 {
12751 }
12752
12753
12755 {
12756 return false;
12757 }
12758
12761 {
12762 string att_type = "None";
12763
12764 if (ConfigIsExisting("soundAttType"))
12765 {
12766 att_type = ConfigGetString("soundAttType");
12767 }
12768
12770 }
12771
12773 {
12775 }
12776
12777
12778
12779
12780
12786
12788 {
12791
12793 }
12794
12795
12797 {
12799 return;
12800
12802
12805
12808
12809 SoundParameters params = new SoundParameters();
12813 }
12814
12815
12817 {
12819 {
12822
12823 SetSynchDirty();
12824
12827 }
12828 }
12829
12831 {
12833 }
12834
12835
12837 {
12839 return;
12840
12842 SetSynchDirty();
12843
12846 }
12847
12849 {
12852 }
12853
12855 {
12857 }
12858
12859 void OnApply(PlayerBase player);
12860
12862 {
12863 return 1.0;
12864 };
12865
12867 {
12869 }
12870
12872 {
12874 }
12875
12877
12879 {
12880 SetDynamicPhysicsLifeTime(0.01);
12882 }
12883
12885 {
12886 array<string> zone_names = new array<string>;
12887 GetDamageZones(zone_names);
12888 for (int i = 0; i < zone_names.Count(); i++)
12889 {
12890 SetHealthMax(zone_names.Get(i),"Health");
12891 }
12892 SetHealthMax("","Health");
12893 }
12894
12897 {
12898 float global_health = GetHealth01("","Health");
12899 array<string> zones = new array<string>;
12900 GetDamageZones(zones);
12901
12902 for (int i = 0; i < zones.Count(); i++)
12903 {
12904 SetHealth01(zones.Get(i),"Health",global_health);
12905 }
12906 }
12907
12910 {
12911 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12912 }
12913
12915 {
12916 if (!hasRootAsPlayer)
12917 {
12918 if (refParentIB)
12919 {
12920
12921 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12922 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12923
12924 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12925 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12926
12929 }
12930 else
12931 {
12932
12935 }
12936 }
12937 }
12938
12940 {
12942 {
12943 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12944 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12945 {
12946 float heatPermCoef = 1.0;
12948 while (ent)
12949 {
12950 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12951 ent = ent.GetHierarchyParent();
12952 }
12953
12954 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12955 }
12956 }
12957 }
12958
12960 {
12961
12962 EntityAI parent = GetHierarchyParent();
12963 if (!parent)
12964 {
12965 hasParent = false;
12966 hasRootAsPlayer = false;
12967 }
12968 else
12969 {
12970 hasParent = true;
12971 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12972 refParentIB =
ItemBase.Cast(parent);
12973 }
12974 }
12975
12976 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12977 {
12978
12979 }
12980
12982 {
12983
12984 return false;
12985 }
12986
12988 {
12989
12990
12991 return false;
12992 }
12993
12995 {
12996
12997 return false;
12998 }
12999
13002 {
13003 return !GetIsFrozen() &&
IsOpen();
13004 }
13005
13007 {
13008 bool hasParent = false, hasRootAsPlayer = false;
13010
13011 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13012 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13013
13014 if (wwtu || foodDecay)
13015 {
13019
13020 if (processWetness || processTemperature || processDecay)
13021 {
13023
13024 if (processWetness)
13025 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13026
13027 if (processTemperature)
13029
13030 if (processDecay)
13031 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13032 }
13033 }
13034 }
13035
13038 {
13040 }
13041
13043 {
13046
13047 return super.GetTemperatureFreezeThreshold();
13048 }
13049
13051 {
13054
13055 return super.GetTemperatureThawThreshold();
13056 }
13057
13059 {
13062
13063 return super.GetItemOverheatThreshold();
13064 }
13065
13067 {
13069 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13070
13071 return super.GetTemperatureFreezeTime();
13072 }
13073
13075 {
13077 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13078
13079 return super.GetTemperatureThawTime();
13080 }
13081
13086
13088 {
13089 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13090 }
13091
13093 {
13094 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13095 }
13096
13099 {
13101 }
13102
13104 {
13106 }
13107
13109 {
13111 }
13112
13115 {
13116 return null;
13117 }
13118
13121 {
13122 return false;
13123 }
13124
13126 {
13128 {
13131 if (!trg)
13132 {
13134 explosive = this;
13135 }
13136
13137 explosive.PairRemote(trg);
13139
13140 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13141 trg.SetPersistentPairID(persistentID);
13142 explosive.SetPersistentPairID(persistentID);
13143
13144 return true;
13145 }
13146 return false;
13147 }
13148
13151 {
13152 float ret = 1.0;
13155 ret *= GetHealth01();
13156
13157 return ret;
13158 }
13159
13160 #ifdef DEVELOPER
13161 override void SetDebugItem()
13162 {
13163 super.SetDebugItem();
13164 _itemBase = this;
13165 }
13166
13168 {
13169 string text = super.GetDebugText();
13170
13172 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13173
13174 return text;
13175 }
13176 #endif
13177
13179 {
13180 return true;
13181 }
13182
13184
13186
13188 {
13191 }
13192
13193
13201
13217
13218 [
Obsolete(
"Use ItemSoundHandler instead")]
13221 {
13222 if (!
g_Game.IsDedicatedServer())
13223 {
13224 if (ConfigIsExisting("attachSoundSet"))
13225 {
13226 string cfg_path = "";
13227 string soundset = "";
13228 string type_name =
GetType();
13229
13232 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13233 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13234
13235 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13236 {
13237 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13238 {
13239 if (cfg_slot_array[i] == slot_type)
13240 {
13241 soundset = cfg_soundset_array[i];
13242 break;
13243 }
13244 }
13245 }
13246
13247 if (soundset != "")
13248 {
13249 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13251 }
13252 }
13253 }
13254 }
13255
13257}
13258
13260{
13262 if (entity)
13263 {
13264 bool is_item = entity.IsInherited(
ItemBase);
13265 if (is_item && full_quantity)
13266 {
13269 }
13270 }
13271 else
13272 {
13274 return NULL;
13275 }
13276 return entity;
13277}
13278
13280{
13281 if (item)
13282 {
13283 if (health > 0)
13284 item.SetHealth("", "", health);
13285
13286 if (item.CanHaveTemperature())
13287 {
13289 if (item.CanFreeze())
13290 item.SetFrozen(false);
13291 }
13292
13293 if (item.HasEnergyManager())
13294 {
13295 if (quantity >= 0)
13296 {
13297 item.GetCompEM().SetEnergy0To1(quantity);
13298 }
13299 else
13300 {
13302 }
13303 }
13304 else if (item.IsMagazine())
13305 {
13306 Magazine mag = Magazine.Cast(item);
13307 if (quantity >= 0)
13308 {
13309 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13310 }
13311 else
13312 {
13314 }
13315
13316 }
13317 else
13318 {
13319 if (quantity >= 0)
13320 {
13321 item.SetQuantityNormalized(quantity, false);
13322 }
13323 else
13324 {
13326 }
13327
13328 }
13329 }
13330}
13331
13332#ifdef DEVELOPER
13334#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.