add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity reaches varQuantityMin or lower and the item config contains the varQuantityDestroyOnMin = true entry, the item gets destroyed. destroy_forced = true means item gets destroyed when quantity reaches varQuantityMin or lower regardless of config setting, returns true if the item gets deleted
8308{
8310 {
8311 return true;
8312 }
8313};
8314
8316{
8317
8318};
8319
8320
8321
8323{
8327
8329
8332
8333
8334
8335
8336
8345
8351
8356
8361
8382 protected bool m_IsResultOfSplit
8383
8385
8390
8391
8392
8394
8398
8399
8400
8402
8405
8406
8407
8413
8414
8422
8425
8426
8428
8429
8431
8432
8437
8438
8443
8445
8446
8448
8449
8451 {
8456
8457 if (!
g_Game.IsDedicatedServer())
8458 {
8460 {
8462
8464 {
8466 }
8467 }
8468
8471 }
8472
8473 m_OldLocation = null;
8474
8476 {
8478 }
8479
8480 if (ConfigIsExisting("headSelectionsToHide"))
8481 {
8484 }
8485
8487 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8488 {
8490 }
8491
8493
8494 m_IsResultOfSplit = false;
8495
8497 }
8498
8500 {
8501 super.InitItemVariables();
8502
8508 m_Count = ConfigGetInt(
"count");
8509
8512
8517
8520
8525
8537
8541
8542
8545 if (ConfigIsExisting("canBeSplit"))
8546 {
8549 }
8550
8552 if (ConfigIsExisting("itemBehaviour"))
8554
8555
8558 RegisterNetSyncVariableInt("m_VarLiquidType");
8559 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8560
8561 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8562 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8563 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8564
8565 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8566 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8567 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8568 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8569
8570 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8571 RegisterNetSyncVariableBool("m_IsTakeable");
8572 RegisterNetSyncVariableBool("m_IsHologram");
8573
8576 {
8579 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8580 }
8581
8583
8585 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8587
8589 }
8590
8592 {
8594 }
8595
8597 {
8600 {
8605 }
8606 }
8607
8608 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8609 {
8611 {
8614 }
8615
8617 }
8618
8620 {
8626 }
8627
8629
8631 {
8633
8634 if (!action)
8635 {
8636 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8637 return;
8638 }
8639
8641 if (!ai)
8642 {
8644 return;
8645 }
8646
8648 if (!action_array)
8649 {
8650 action_array = new array<ActionBase_Basic>;
8652 }
8653 if (LogManager.IsActionLogEnable())
8654 {
8655 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8656 }
8657
8658 if (action_array.Find(action) != -1)
8659 {
8660 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8661 }
8662 else
8663 {
8664 action_array.Insert(action);
8665 }
8666 }
8667
8669 {
8670 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8671 ActionBase action = player.GetActionManager().GetAction(actionName);
8674
8675 if (action_array)
8676 {
8677 action_array.RemoveItem(action);
8678 }
8679 }
8680
8681
8682
8684 {
8685 ActionOverrideData overrideData = new ActionOverrideData();
8689
8691 if (!actionMap)
8692 {
8695 }
8696
8697 actionMap.Insert(this.
Type(), overrideData);
8698
8699 }
8700
8702
8704
8705
8707 {
8710
8713
8714 string config_to_search = "CfgVehicles";
8715 string muzzle_owner_config;
8716
8718 {
8719 if (IsInherited(Weapon))
8720 config_to_search = "CfgWeapons";
8721
8722 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8723
8724 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8725
8726 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8727
8728 if (config_OnFire_subclass_count > 0)
8729 {
8730 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8731
8732 for (int i = 0; i < config_OnFire_subclass_count; i++)
8733 {
8734 string particle_class = "";
8735 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8736 string config_OnFire_entry = config_OnFire_class + particle_class;
8737 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8738 WPOF_array.Insert(WPOF);
8739 }
8740
8741
8743 }
8744 }
8745
8747 {
8748 config_to_search = "CfgWeapons";
8749 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8750
8751 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8752
8753 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8754
8755 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8756 {
8757 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8758
8759 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8760 {
8761 string particle_class2 = "";
8762 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8763 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8764 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8765 WPOBE_array.Insert(WPOBE);
8766 }
8767
8768
8770 }
8771 }
8772 }
8773
8774
8776 {
8779
8781 {
8782 string config_to_search = "CfgVehicles";
8783
8784 if (IsInherited(Weapon))
8785 config_to_search = "CfgWeapons";
8786
8787 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8788 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8789
8790 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8791 {
8792
8794
8796 {
8798 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8800 return;
8801 }
8802
8805
8806
8807
8808 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8809 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8810
8811 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8812 {
8813 string particle_class = "";
8814 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8815 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8816 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8817
8818 if (entry_type == CT_CLASS)
8819 {
8820 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8821 WPOOH_array.Insert(WPOF);
8822 }
8823 }
8824
8825
8827 }
8828 }
8829 }
8830
8832 {
8834 }
8835
8837 {
8839 {
8841
8844
8847
8848 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8849 }
8850 }
8851
8853 {
8855 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8856
8858 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8859
8861 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8862
8864 {
8866 }
8867 }
8868
8870 {
8872 }
8873
8875 {
8878 else
8880
8882 {
8885 }
8886 else
8887 {
8890
8893 }
8894
8896 }
8897
8899 {
8901 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8902 }
8903
8905 {
8907 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8909 }
8910
8912 {
8914 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8915 }
8916
8918 {
8921
8922 OverheatingParticle OP = new OverheatingParticle();
8927
8929 }
8930
8932 {
8935
8936 return -1;
8937 }
8938
8940 {
8942 {
8945
8946 for (int i = count; i > 0; --i)
8947 {
8948 int id = i - 1;
8951
8954
8955 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8956 {
8957 if (p)
8958 {
8961 }
8962 }
8963 }
8964 }
8965 }
8966
8968 {
8970 {
8972 {
8973 int id = i - 1;
8975
8976 if (OP)
8977 {
8979
8980 if (p)
8981 {
8983 }
8984
8985 delete OP;
8986 }
8987 }
8988
8991 }
8992 }
8993
8996 {
8997 return 0.0;
8998 }
8999
9000
9002 {
9003 return 250;
9004 }
9005
9007 {
9008 return 0;
9009 }
9010
9013 {
9015 return true;
9016
9017 return false;
9018 }
9019
9022 {
9025
9027 {
9029 }
9030 else
9031 {
9032
9034 }
9035
9037 }
9038
9045 {
9046 return -1;
9047 }
9048
9049
9050
9051
9053 {
9055 {
9056 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9057 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9058
9059 if (r_index >= 0)
9060 {
9061 InventoryLocation r_il = new InventoryLocation;
9062 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9063
9064 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9067 {
9068 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9069 }
9071 {
9072 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9073 }
9074
9075 }
9076
9077 player.GetHumanInventory().ClearUserReservedLocation(this);
9078 }
9079
9082 }
9083
9084
9085
9086
9088 {
9089 return ItemBase.m_DebugActionsMask;
9090 }
9091
9093 {
9094 return ItemBase.m_DebugActionsMask & mask;
9095 }
9096
9098 {
9099 ItemBase.m_DebugActionsMask = mask;
9100 }
9101
9103 {
9104 ItemBase.m_DebugActionsMask |= mask;
9105 }
9106
9108 {
9109 ItemBase.m_DebugActionsMask &= ~mask;
9110 }
9111
9113 {
9115 {
9117 }
9118 else
9119 {
9121 }
9122 }
9123
9124
9126 {
9127 if (GetEconomyProfile())
9128 {
9129 float q_max = GetEconomyProfile().GetQuantityMax();
9130 if (q_max > 0)
9131 {
9132 float q_min = GetEconomyProfile().GetQuantityMin();
9133 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9134
9136 {
9137 ComponentEnergyManager comp = GetCompEM();
9139 {
9141 }
9142 }
9144 {
9146
9147 }
9148
9149 }
9150 }
9151 }
9152
9155 {
9156 EntityAI parent = GetHierarchyParent();
9157
9158 if (parent)
9159 {
9160 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9161 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9162 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9163 }
9164 }
9165
9168 {
9169 EntityAI parent = GetHierarchyParent();
9170
9171 if (parent)
9172 {
9173 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9174 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9175 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9176 }
9177 }
9178
9180 {
9181
9182
9183
9184
9186
9188 {
9189 if (ScriptInputUserData.CanStoreInputUserData())
9190 {
9191 ScriptInputUserData ctx = new ScriptInputUserData;
9197 ctx.
Write(use_stack_max);
9200
9202 {
9203 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9204 }
9205 }
9206 }
9207 else if (!
g_Game.IsMultiplayer())
9208 {
9210 }
9211 }
9212
9214 {
9216 }
9217
9219 {
9221 }
9222
9224 {
9226 }
9227
9229 {
9230
9231 return false;
9232 }
9233
9235 {
9236 return false;
9237 }
9238
9242 {
9243 return false;
9244 }
9245
9247 {
9248 return "";
9249 }
9250
9252
9254 {
9255 return false;
9256 }
9257
9259 {
9260 return true;
9261 }
9262
9263
9264
9266 {
9267 return true;
9268 }
9269
9271 {
9272 return true;
9273 }
9274
9276 {
9277 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9279 }
9280
9282 {
9284 }
9285
9287 {
9289 if (!is_being_placed)
9291 SetSynchDirty();
9292 }
9293
9294
9296
9298 {
9300 }
9301
9303 {
9305 }
9306
9308 {
9309 return 1;
9310 }
9311
9313 {
9314 return false;
9315 }
9316
9318 {
9320 SetSynchDirty();
9321 }
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9358 {
9359 super.OnMovedInsideCargo(container);
9360
9361 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9362 }
9363
9364 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9365 {
9366 super.EEItemLocationChanged(oldLoc, newLoc);
9367
9368 PlayerBase newPlayer = null;
9369 PlayerBase oldPlayer = null;
9370
9371 if (newLoc.GetParent())
9372 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9373
9374 if (oldLoc.GetParent())
9375 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9376
9378 {
9379 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9380
9381 if (rIndex >= 0)
9382 {
9383 InventoryLocation rIl = new InventoryLocation;
9384 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9385
9386 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9389 {
9390 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9391 }
9393 {
9395 }
9396
9397 }
9398 }
9399
9401 {
9402 if (newPlayer)
9403 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9404
9405 if (newPlayer == oldPlayer)
9406 {
9407 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9408 {
9410 {
9411 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9412 {
9413 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9414 }
9415 }
9416 else
9417 {
9418 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9419 }
9420 }
9421
9422 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9423 {
9424 int type = oldLoc.GetType();
9426 {
9427 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9428 }
9430 {
9431 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9432 }
9433 }
9434 if (!m_OldLocation)
9435 {
9436 m_OldLocation = new InventoryLocation;
9437 }
9438 m_OldLocation.Copy(oldLoc);
9439 }
9440 else
9441 {
9442 if (m_OldLocation)
9443 {
9444 m_OldLocation.Reset();
9445 }
9446 }
9447
9448 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9449 }
9450 else
9451 {
9452 if (newPlayer)
9453 {
9454 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9455 if (resIndex >= 0)
9456 {
9457 InventoryLocation il = new InventoryLocation;
9458 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9460 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9463 {
9464 il.
GetParent().GetOnReleaseLock().Invoke(it);
9465 }
9467 {
9469 }
9470
9471 }
9472 }
9474 {
9475
9477 }
9478
9479 if (m_OldLocation)
9480 {
9481 m_OldLocation.Reset();
9482 }
9483 }
9484
9486 {
9487 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9488 }
9489
9491 {
9492 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9493 }
9494 }
9495
9496 override void EOnContact(IEntity other, Contact extra)
9497 {
9499 {
9500 int liquidType = -1;
9502 if (impactSpeed > 0.0)
9503 {
9505 #ifndef SERVER
9507 #else
9509 SetSynchDirty();
9510 #endif
9512 }
9513 }
9514
9515 #ifdef SERVER
9516 if (GetCompEM() && GetCompEM().IsPlugged())
9517 {
9518 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9519 GetCompEM().UnplugThis();
9520 }
9521 #endif
9522 }
9523
9525
9527 {
9529 }
9530
9532 {
9533
9534 }
9535
9537 {
9538 super.OnItemLocationChanged(old_owner, new_owner);
9539
9540 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9541 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9542
9543 if (!relatedPlayer && playerNew)
9544 relatedPlayer = playerNew;
9545
9546 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9547 {
9549 if (actionMgr)
9550 {
9551 ActionBase currentAction = actionMgr.GetRunningAction();
9552 if (currentAction)
9554 }
9555 }
9556
9557 Man ownerPlayerOld = null;
9558 Man ownerPlayerNew = null;
9559
9560 if (old_owner)
9561 {
9562 if (old_owner.
IsMan())
9563 {
9564 ownerPlayerOld = Man.Cast(old_owner);
9565 }
9566 else
9567 {
9568 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9569 }
9570 }
9571 else
9572 {
9574 {
9576
9577 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9578 {
9579 GetCompEM().UnplugThis();
9580 }
9581 }
9582 }
9583
9584 if (new_owner)
9585 {
9586 if (new_owner.
IsMan())
9587 {
9588 ownerPlayerNew = Man.Cast(new_owner);
9589 }
9590 else
9591 {
9592 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9593 }
9594 }
9595
9596 if (ownerPlayerOld != ownerPlayerNew)
9597 {
9598 if (ownerPlayerOld)
9599 {
9600 array<EntityAI> subItemsExit = new array<EntityAI>;
9602 for (int i = 0; i < subItemsExit.Count(); i++)
9603 {
9606 }
9607 }
9608
9609 if (ownerPlayerNew)
9610 {
9611 array<EntityAI> subItemsEnter = new array<EntityAI>;
9613 for (int j = 0; j < subItemsEnter.Count(); j++)
9614 {
9617 }
9618 }
9619 }
9620 else if (ownerPlayerNew != null)
9621 {
9622 PlayerBase nplayer;
9623 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9624 {
9625 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9627 for (int k = 0; k < subItemsUpdate.Count(); k++)
9628 {
9630 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9631 }
9632 }
9633 }
9634
9635 if (old_owner)
9636 old_owner.OnChildItemRemoved(this);
9637 if (new_owner)
9638 new_owner.OnChildItemReceived(this);
9639 }
9640
9641
9643 {
9644 super.EEDelete(parent);
9645 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9646 if (player)
9647 {
9649
9650 if (player.IsAlive())
9651 {
9652 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9653 if (r_index >= 0)
9654 {
9655 InventoryLocation r_il = new InventoryLocation;
9656 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9657
9658 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9661 {
9662 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9663 }
9665 {
9666 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9667 }
9668
9669 }
9670
9671 player.RemoveQuickBarEntityShortcut(this);
9672 }
9673 }
9674 }
9675
9677 {
9678 super.EEKilled(killer);
9679
9682 {
9683 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9684 {
9685 if (IsMagazine())
9686 {
9687 if (Magazine.Cast(this).GetAmmoCount() > 0)
9688 {
9690 }
9691 }
9692 else
9693 {
9695 }
9696 }
9697 }
9698 }
9699
9701 {
9702 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9703
9704 super.OnWasAttached(parent, slot_id);
9705
9708
9711 }
9712
9714 {
9715 super.OnWasDetached(parent, slot_id);
9716
9719
9722 }
9723
9725 {
9726 int idx;
9729
9730 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9731 if (inventory_slots.Count() < 1)
9732 {
9733 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9734 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9735 }
9736 else
9737 {
9738 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9739 }
9740
9741 idx = inventory_slots.Find(slot);
9742 if (idx < 0)
9743 return "";
9744
9745 return attach_types.Get(idx);
9746 }
9747
9749 {
9750 int idx = -1;
9751 string slot;
9752
9755
9756 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9757 if (inventory_slots.Count() < 1)
9758 {
9759 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9760 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9761 }
9762 else
9763 {
9764 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9765 if (detach_types.Count() < 1)
9766 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9767 }
9768
9769 for (int i = 0; i < inventory_slots.Count(); i++)
9770 {
9771 slot = inventory_slots.Get(i);
9772 }
9773
9774 if (slot != "")
9775 {
9776 if (detach_types.Count() == 1)
9777 idx = 0;
9778 else
9779 idx = inventory_slots.Find(slot);
9780 }
9781 if (idx < 0)
9782 return "";
9783
9784 return detach_types.Get(idx);
9785 }
9786
9788 {
9789
9791
9792
9793 float min_time = 1;
9794 float max_time = 3;
9795 float delay = Math.RandomFloat(min_time, max_time);
9796
9797 explode_timer.Run(delay, this, "DoAmmoExplosion");
9798 }
9799
9801 {
9802 Magazine magazine = Magazine.Cast(this);
9803 int pop_sounds_count = 6;
9804 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9805
9806
9807 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9808 string sound_name = pop_sounds[ sound_idx ];
9809 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9810
9811
9812 magazine.ServerAddAmmoCount(-1);
9813
9814
9815 float min_temp_to_explode = 100;
9816
9817 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9818 {
9820 }
9821 }
9822
9823
9824 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9825 {
9826 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9827
9828 const int CHANCE_DAMAGE_CARGO = 4;
9829 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9830 const int CHANCE_DAMAGE_NOTHING = 2;
9831
9833 {
9834 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9835 int chances;
9836 int rnd;
9837
9838 if (GetInventory().GetCargo())
9839 {
9840 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9841 rnd = Math.RandomInt(0,chances);
9842
9843 if (rnd < CHANCE_DAMAGE_CARGO)
9844 {
9846 }
9847 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9848 {
9850 }
9851 }
9852 else
9853 {
9854 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9855 rnd = Math.RandomInt(0,chances);
9856
9857 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9858 {
9860 }
9861 }
9862 }
9863 }
9864
9866 {
9867 CargoBase cargo = GetInventory().GetCargo();
9868 if (cargo)
9869 {
9871 if (item_count > 0)
9872 {
9873 int random_pick = Math.RandomInt(0, item_count);
9875 if (!item.IsExplosive())
9876 {
9877 item.AddHealth("","",damage);
9878 return true;
9879 }
9880 }
9881 }
9882 return false;
9883 }
9884
9886 {
9887 GameInventory inventory = GetInventory();
9889 if (attachment_count > 0)
9890 {
9891 int random_pick = Math.RandomInt(0, attachment_count);
9893 if (!attachment.IsExplosive())
9894 {
9895 attachment.AddHealth("","",damage);
9896 return true;
9897 }
9898 }
9899 return false;
9900 }
9901
9903 {
9905 }
9906
9908 {
9910 return GetInventory().CanRemoveEntity();
9911
9912 return false;
9913 }
9914
9916 {
9917
9919 return false;
9920
9921
9923 return false;
9924
9925
9926
9928 if (delta == 0)
9929 return false;
9930
9931
9932 return true;
9933 }
9934
9936 {
9938 {
9939 if (ScriptInputUserData.CanStoreInputUserData())
9940 {
9941 ScriptInputUserData ctx = new ScriptInputUserData;
9946 ctx.
Write(destination_entity);
9950 }
9951 }
9952 else if (!
g_Game.IsMultiplayer())
9953 {
9955 }
9956 }
9957
9959 {
9960 float split_quantity_new;
9964 InventoryLocation loc = new InventoryLocation;
9965
9966 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9967 {
9969 split_quantity_new = stack_max;
9970 else
9972
9974 {
9975 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9976 if (new_item)
9977 {
9978 new_item.SetResultOfSplit(true);
9979 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9981 new_item.
SetQuantity(split_quantity_new,
false,
true);
9982 }
9983 }
9984 }
9985 else if (destination_entity && slot_id == -1)
9986 {
9987 if (quantity > stack_max)
9988 split_quantity_new = stack_max;
9989 else
9990 split_quantity_new = quantity;
9991
9993 {
9994 GameInventory destinationInventory = destination_entity.GetInventory();
9996 {
9999 }
10000
10001 if (new_item)
10002 {
10003 new_item.SetResultOfSplit(true);
10004 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10006 new_item.
SetQuantity(split_quantity_new,
false,
true);
10007 }
10008 }
10009 }
10010 else
10011 {
10012 if (stack_max != 0)
10013 {
10015 {
10017 }
10018
10019 if (split_quantity_new == 0)
10020 {
10021 if (!
g_Game.IsMultiplayer())
10022 player.PhysicalPredictiveDropItem(this);
10023 else
10024 player.ServerDropEntity(this);
10025 return;
10026 }
10027
10029 {
10031
10032 if (new_item)
10033 {
10034 new_item.SetResultOfSplit(true);
10035 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10038 new_item.PlaceOnSurface();
10039 }
10040 }
10041 }
10042 }
10043 }
10044
10046 {
10047 float split_quantity_new;
10051 InventoryLocation loc = new InventoryLocation;
10052
10053 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10054 {
10056 split_quantity_new = stack_max;
10057 else
10059
10061 {
10062 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10063 if (new_item)
10064 {
10065 new_item.SetResultOfSplit(true);
10066 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10068 new_item.
SetQuantity(split_quantity_new,
false,
true);
10069 }
10070 }
10071 }
10072 else if (destination_entity && slot_id == -1)
10073 {
10074 if (quantity > stack_max)
10075 split_quantity_new = stack_max;
10076 else
10077 split_quantity_new = quantity;
10078
10080 {
10081 GameInventory destinationInventory = destination_entity.GetInventory();
10083 {
10086 }
10087
10088 if (new_item)
10089 {
10090 new_item.SetResultOfSplit(true);
10091 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10093 new_item.
SetQuantity(split_quantity_new,
false,
true);
10094 }
10095 }
10096 }
10097 else
10098 {
10099 if (stack_max != 0)
10100 {
10102 {
10104 }
10105
10107 {
10109
10110 if (new_item)
10111 {
10112 new_item.SetResultOfSplit(true);
10113 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10116 new_item.PlaceOnSurface();
10117 }
10118 }
10119 }
10120 }
10121 }
10122
10124 {
10126 {
10127 if (ScriptInputUserData.CanStoreInputUserData())
10128 {
10129 ScriptInputUserData ctx = new ScriptInputUserData;
10134 dst.WriteToContext(ctx);
10136 }
10137 }
10138 else if (!
g_Game.IsMultiplayer())
10139 {
10141 }
10142 }
10143
10145 {
10147 {
10148 if (ScriptInputUserData.CanStoreInputUserData())
10149 {
10150 ScriptInputUserData ctx = new ScriptInputUserData;
10155 ctx.
Write(destination_entity);
10161 }
10162 }
10163 else if (!
g_Game.IsMultiplayer())
10164 {
10166 }
10167 }
10168
10170 {
10172 }
10173
10175 {
10177 float split_quantity_new;
10179 if (dst.IsValid())
10180 {
10181 int slot_id = dst.GetSlot();
10183
10184 if (quantity > stack_max)
10185 split_quantity_new = stack_max;
10186 else
10187 split_quantity_new = quantity;
10188
10190 {
10192
10193 if (new_item)
10194 {
10195 new_item.SetResultOfSplit(true);
10196 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10198 new_item.
SetQuantity(split_quantity_new,
false,
true);
10199 }
10200
10201 return new_item;
10202 }
10203 }
10204
10205 return null;
10206 }
10207
10209 {
10211 float split_quantity_new;
10213 if (destination_entity)
10214 {
10216 if (quantity > stackable)
10217 split_quantity_new = stackable;
10218 else
10219 split_quantity_new = quantity;
10220
10222 {
10223 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10224 if (new_item)
10225 {
10226 new_item.SetResultOfSplit(true);
10227 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10229 new_item.
SetQuantity(split_quantity_new,
false,
true);
10230 }
10231 }
10232 }
10233 }
10234
10236 {
10238 {
10239 if (ScriptInputUserData.CanStoreInputUserData())
10240 {
10241 ScriptInputUserData ctx = new ScriptInputUserData;
10246 ItemBase destination_entity =
this;
10247 ctx.
Write(destination_entity);
10251 }
10252 }
10253 else if (!
g_Game.IsMultiplayer())
10254 {
10256 }
10257 }
10258
10260 {
10262 float split_quantity_new;
10264 if (player)
10265 {
10267 if (quantity > stackable)
10268 split_quantity_new = stackable;
10269 else
10270 split_quantity_new = quantity;
10271
10273 {
10274 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10275 new_item =
ItemBase.Cast(in_hands);
10276 if (new_item)
10277 {
10278 new_item.SetResultOfSplit(true);
10279 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10281 new_item.SetQuantity(split_quantity_new, false, true);
10282 }
10283 }
10284 }
10285 }
10286
10288 {
10290 float split_quantity_new = Math.Floor(quantity * 0.5);
10291
10293 return;
10294
10296
10297 if (new_item)
10298 {
10299 if (new_item.GetQuantityMax() < split_quantity_new)
10300 {
10301 split_quantity_new = new_item.GetQuantityMax();
10302 }
10303
10304 new_item.SetResultOfSplit(true);
10305 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10306
10308 {
10311 }
10312 else
10313 {
10315 new_item.
SetQuantity(split_quantity_new,
false,
true);
10316 }
10317 }
10318 }
10319
10321 {
10323 float split_quantity_new = Math.Floor(quantity / 2);
10324
10326 return;
10327
10328 InventoryLocation invloc = new InventoryLocation;
10330
10332 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10333
10334 if (new_item)
10335 {
10336 if (new_item.GetQuantityMax() < split_quantity_new)
10337 {
10338 split_quantity_new = new_item.GetQuantityMax();
10339 }
10341 {
10344 }
10345 else if (split_quantity_new > 1)
10346 {
10348 new_item.
SetQuantity(split_quantity_new,
false,
true);
10349 }
10350 }
10351 }
10352
10355 {
10356 SetWeightDirty();
10358
10359 if (parent)
10360 parent.OnAttachmentQuantityChangedEx(this, delta);
10361
10363 {
10365 {
10367 }
10369 {
10370 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10372 }
10373 }
10374 }
10375
10378 {
10379
10380 }
10381
10384 {
10386 }
10387
10389 {
10390 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10391
10393 {
10394 if (newLevel == GameConstants.STATE_RUINED)
10395 {
10397 EntityAI parent = GetHierarchyParent();
10398 if (parent && parent.IsFireplace())
10399 {
10400 CargoBase cargo = GetInventory().GetCargo();
10401 if (cargo)
10402 {
10404 {
10406 }
10407 }
10408 }
10409 }
10410
10412 {
10413
10415 return;
10416 }
10417
10418 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10419 {
10421 }
10422 }
10423 }
10424
10425
10427 {
10428 super.OnRightClick();
10429
10431 {
10433 {
10434 if (ScriptInputUserData.CanStoreInputUserData())
10435 {
10436 EntityAI root = GetHierarchyRoot();
10437 Man playerOwner = GetHierarchyRootPlayer();
10438 InventoryLocation dst = new InventoryLocation;
10439
10440
10441 if (!playerOwner && root && root == this)
10442 {
10444 }
10445 else
10446 {
10447
10448 GetInventory().GetCurrentInventoryLocation(dst);
10450 {
10451 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10453 {
10455 }
10456 else
10457 {
10459
10460
10461 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10462 {
10464 }
10465 else
10466 {
10467 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10468 }
10469 }
10470 }
10471 }
10472
10473 ScriptInputUserData ctx = new ScriptInputUserData;
10481 }
10482 }
10483 else if (!
g_Game.IsMultiplayer())
10484 {
10486 }
10487 }
10488 }
10489
10491 {
10492 if (root)
10493 {
10494 vector m4[4];
10495 root.GetTransform(m4);
10496 dst.SetGround(this, m4);
10497 }
10498 else
10499 {
10500 GetInventory().GetCurrentInventoryLocation(dst);
10501 }
10502 }
10503
10504 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10505 {
10506
10507 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10508 return false;
10509
10510 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10511 return false;
10512
10513
10515 return false;
10516
10517
10518 Magazine mag = Magazine.Cast(this);
10519 if (mag)
10520 {
10521 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10522 return false;
10523
10524 if (stack_max_limit)
10525 {
10526 Magazine other_mag = Magazine.Cast(other_item);
10527 if (other_item)
10528 {
10529 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10530 return false;
10531 }
10532
10533 }
10534 }
10535 else
10536 {
10537
10539 return false;
10540
10542 return false;
10543 }
10544
10545 PlayerBase player = null;
10546 if (CastTo(player, GetHierarchyRootPlayer()))
10547 {
10548 if (player.GetInventory().HasAttachment(this))
10549 return false;
10550
10551 if (player.IsItemsToDelete())
10552 return false;
10553 }
10554
10555 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10556 return false;
10557
10558 int slotID;
10560 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10561 return false;
10562
10563 return true;
10564 }
10565
10567 {
10569 }
10570
10572 {
10573 return m_IsResultOfSplit;
10574 }
10575
10577 {
10578 m_IsResultOfSplit = value;
10579 }
10580
10582 {
10584 }
10585
10587 {
10588 float other_item_quantity = other_item.GetQuantity();
10589 float this_free_space;
10590
10592
10594
10595 if (other_item_quantity > this_free_space)
10596 {
10597 return this_free_space;
10598 }
10599 else
10600 {
10601 return other_item_quantity;
10602 }
10603 }
10604
10606 {
10608 }
10609
10611 {
10613 return;
10614
10615 if (!IsMagazine() && other_item)
10616 {
10618 if (quantity_used != 0)
10619 {
10620 float hp1 = GetHealth01("","");
10621 float hp2 = other_item.GetHealth01("","");
10622 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10623 hpResult = hpResult / (
GetQuantity() + quantity_used);
10624
10625 hpResult *= GetMaxHealth();
10626 Math.Round(hpResult);
10627 SetHealth("", "Health", hpResult);
10628
10630 other_item.AddQuantity(-quantity_used);
10631 }
10632 }
10634 }
10635
10637 {
10638 #ifdef SERVER
10639 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10640 GetHierarchyParent().IncreaseLifetimeUp();
10641 #endif
10642 };
10643
10645 {
10646 PlayerBase p = PlayerBase.Cast(player);
10647
10648 array<int> recipesIds = p.m_Recipes;
10649 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10650 if (moduleRecipesManager)
10651 {
10652 EntityAI itemInHands = player.GetEntityInHands();
10653 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10654 }
10655
10656 for (int i = 0;i < recipesIds.Count(); i++)
10657 {
10658 int key = recipesIds.Get(i);
10659 string recipeName = moduleRecipesManager.GetRecipeName(key);
10661 }
10662 }
10663
10664
10665 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10666 {
10667 super.GetDebugActions(outputList);
10668
10669
10675
10676
10681
10686
10687
10691
10692
10694 {
10698 }
10699
10702
10703
10707
10709
10710 InventoryLocation loc = new InventoryLocation();
10711 GetInventory().GetCurrentInventoryLocation(loc);
10713 {
10714 if (Gizmo_IsSupported())
10717 }
10718
10720 }
10721
10722
10723
10724
10726 {
10727 super.OnAction(action_id, player, ctx);
10728
10730 {
10731 switch (action_id)
10732 {
10736 return true;
10740 return true;
10741 }
10742 }
10743
10745 {
10746 switch (action_id)
10747 {
10749 Delete();
10750 return true;
10751 }
10752 }
10753
10754 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10755 {
10756 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10757 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10758 PlayerBase p = PlayerBase.Cast(player);
10759 if (
EActions.RECIPES_RANGE_START < 1000)
10760 {
10761 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10762 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10763 }
10764 }
10765 #ifndef SERVER
10766 else if (action_id ==
EActions.WATCH_PLAYER)
10767 {
10768 PluginDeveloper.SetDeveloperItemClientEx(player);
10769 }
10770 #endif
10772 {
10773 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10774 {
10775 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10776 OnDebugButtonPressServer(id + 1);
10777 }
10778
10779 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10780 {
10781 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10783 }
10784
10785 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10786 {
10787 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10789 }
10790
10791 else if (action_id ==
EActions.ADD_QUANTITY)
10792 {
10793 if (IsMagazine())
10794 {
10795 Magazine mag = Magazine.Cast(this);
10796 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10797 }
10798 else
10799 {
10801 }
10802
10803 if (m_EM)
10804 {
10805 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10806 }
10807
10808 }
10809
10810 else if (action_id ==
EActions.REMOVE_QUANTITY)
10811 {
10812 if (IsMagazine())
10813 {
10814 Magazine mag2 = Magazine.Cast(this);
10815 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10816 }
10817 else
10818 {
10820 }
10821 if (m_EM)
10822 {
10823 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10824 }
10825
10826 }
10827
10828 else if (action_id ==
EActions.SET_QUANTITY_0)
10829 {
10831
10832 if (m_EM)
10833 {
10834 m_EM.SetEnergy(0);
10835 }
10836 }
10837
10838 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10839 {
10841
10842 if (m_EM)
10843 {
10844 m_EM.SetEnergy(m_EM.GetEnergyMax());
10845 }
10846 }
10847
10848 else if (action_id ==
EActions.ADD_HEALTH)
10849 {
10850 AddHealth("","",GetMaxHealth("","Health")/5);
10851 }
10852 else if (action_id ==
EActions.REMOVE_HEALTH)
10853 {
10854 AddHealth("","",-GetMaxHealth("","Health")/5);
10855 }
10856 else if (action_id ==
EActions.DESTROY_HEALTH)
10857 {
10858 SetHealth01("","",0);
10859 }
10860 else if (action_id ==
EActions.WATCH_ITEM)
10861 {
10863 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10864 #ifdef DEVELOPER
10865 SetDebugDeveloper_item(this);
10866 #endif
10867 }
10868
10869 else if (action_id ==
EActions.ADD_TEMPERATURE)
10870 {
10871 AddTemperature(20);
10872
10873 }
10874
10875 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10876 {
10877 AddTemperature(-20);
10878
10879 }
10880
10881 else if (action_id ==
EActions.FLIP_FROZEN)
10882 {
10883 SetFrozen(!GetIsFrozen());
10884
10885 }
10886
10887 else if (action_id ==
EActions.ADD_WETNESS)
10888 {
10890
10891 }
10892
10893 else if (action_id ==
EActions.REMOVE_WETNESS)
10894 {
10896
10897 }
10898
10899 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10900 {
10903
10904
10905 }
10906
10907 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10908 {
10911 }
10912
10913 else if (action_id ==
EActions.MAKE_SPECIAL)
10914 {
10915 auto debugParams = DebugSpawnParams.WithPlayer(player);
10916 OnDebugSpawnEx(debugParams);
10917 }
10918
10919 }
10920
10921
10922 return false;
10923 }
10924
10925
10926
10927
10931
10934
10935
10936
10938 {
10939 return false;
10940 }
10941
10942
10944 {
10945 return true;
10946 }
10947
10948
10950 {
10951 return true;
10952 }
10953
10954
10955
10957 {
10958 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10959 return g_Game.ConfigIsExisting(config_path);
10960 }
10961
10964 {
10965 return null;
10966 }
10967
10969 {
10970 return false;
10971 }
10972
10974 {
10975 return false;
10976 }
10977
10981
10982
10984 {
10985 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10986 return module_repairing.CanRepair(this, item_repair_kit);
10987 }
10988
10989
10990 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10991 {
10992 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10993 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10994 }
10995
10996
10998 {
10999
11000
11001
11002
11003
11004
11005
11006
11007 return 1;
11008 }
11009
11010
11011
11013 {
11015 }
11016
11017
11018
11020 {
11022 }
11023
11024
11033 {
11034 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11035
11036 if (player)
11037 {
11038 player.MessageStatus(text);
11039 }
11040 }
11041
11042
11051 {
11052 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11053
11054 if (player)
11055 {
11056 player.MessageAction(text);
11057 }
11058 }
11059
11060
11069 {
11070 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11071
11072 if (player)
11073 {
11074 player.MessageFriendly(text);
11075 }
11076 }
11077
11078
11087 {
11088 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11089
11090 if (player)
11091 {
11092 player.MessageImportant(text);
11093 }
11094 }
11095
11097 {
11098 return true;
11099 }
11100
11101
11102 override bool KindOf(
string tag)
11103 {
11104 bool found = false;
11105 string item_name = this.
GetType();
11107 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11108
11109 int array_size = item_tag_array.Count();
11110 for (int i = 0; i < array_size; i++)
11111 {
11112 if (item_tag_array.Get(i) == tag)
11113 {
11114 found = true;
11115 break;
11116 }
11117 }
11118 return found;
11119 }
11120
11121
11123 {
11124
11125 super.OnRPC(sender, rpc_type,ctx);
11126
11127
11128 switch (rpc_type)
11129 {
11130 #ifndef SERVER
11131 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11132 Param2<bool, string> p = new Param2<bool, string>(false, "");
11133
11135 return;
11136
11137 bool play = p.param1;
11138 string soundSet = p.param2;
11139
11140 if (play)
11141 {
11143 {
11145 {
11147 }
11148 }
11149 else
11150 {
11152 }
11153 }
11154 else
11155 {
11157 }
11158
11159 break;
11160 #endif
11161
11162 }
11163
11165 {
11167 }
11168 }
11169
11170
11171
11172
11174 {
11175 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11176 return plugin.GetID(
name);
11177 }
11178
11180 {
11181 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11182 return plugin.GetName(id);
11183 }
11184
11187 {
11188
11189
11190 int varFlags;
11191 if (!ctx.
Read(varFlags))
11192 return;
11193
11194 if (varFlags & ItemVariableFlags.FLOAT)
11195 {
11197 }
11198 }
11199
11201 {
11202
11203 super.SerializeNumericalVars(floats_out);
11204
11205
11206
11208 {
11210 }
11211
11213 {
11215 }
11216
11218 {
11220 }
11221
11223 {
11228 }
11229
11231 {
11233 }
11234 }
11235
11237 {
11238
11239 super.DeSerializeNumericalVars(floats);
11240
11241
11242 int index = 0;
11243 int mask = Math.Round(floats.Get(index));
11244
11245 index++;
11246
11248 {
11250 {
11252 }
11253 else
11254 {
11255 float quantity = floats.Get(index);
11256 SetQuantity(quantity,
true,
false,
false,
false);
11257 }
11258 index++;
11259 }
11260
11262 {
11263 float wet = floats.Get(index);
11265 index++;
11266 }
11267
11269 {
11270 int liquidtype = Math.Round(floats.Get(index));
11272 index++;
11273 }
11274
11276 {
11278 index++;
11280 index++;
11282 index++;
11284 index++;
11285 }
11286
11288 {
11289 int cleanness = Math.Round(floats.Get(index));
11291 index++;
11292 }
11293 }
11294
11296 {
11297 super.WriteVarsToCTX(ctx);
11298
11299
11301 {
11303 }
11304
11306 {
11308 }
11309
11311 {
11313 }
11314
11316 {
11317 int r,g,b,a;
11323 }
11324
11326 {
11328 }
11329 }
11330
11332 {
11333 if (!super.ReadVarsFromCTX(ctx,version))
11334 return false;
11335
11336 int intValue;
11337 float value;
11338
11339 if (version < 140)
11340 {
11341 if (!ctx.
Read(intValue))
11342 return false;
11343
11344 m_VariablesMask = intValue;
11345 }
11346
11348 {
11349 if (!ctx.
Read(value))
11350 return false;
11351
11353 {
11355 }
11356 else
11357 {
11359 }
11360 }
11361
11362 if (version < 140)
11363 {
11365 {
11366 if (!ctx.
Read(value))
11367 return false;
11368 SetTemperatureDirect(value);
11369 }
11370 }
11371
11373 {
11374 if (!ctx.
Read(value))
11375 return false;
11377 }
11378
11380 {
11381 if (!ctx.
Read(intValue))
11382 return false;
11384 }
11385
11387 {
11388 int r,g,b,a;
11390 return false;
11392 return false;
11394 return false;
11396 return false;
11397
11399 }
11400
11402 {
11403 if (!ctx.
Read(intValue))
11404 return false;
11406 }
11407
11408 if (version >= 138 && version < 140)
11409 {
11411 {
11412 if (!ctx.
Read(intValue))
11413 return false;
11414 SetFrozen(intValue);
11415 }
11416 }
11417
11418 return true;
11419 }
11420
11421
11423 {
11426 {
11428 }
11429
11430 if (!super.OnStoreLoad(ctx, version))
11431 {
11433 return false;
11434 }
11435
11436 if (version >= 114)
11437 {
11438 bool hasQuickBarIndexSaved;
11439
11440 if (!ctx.
Read(hasQuickBarIndexSaved))
11441 {
11443 return false;
11444 }
11445
11446 if (hasQuickBarIndexSaved)
11447 {
11448 int itmQBIndex;
11449
11450
11451 if (!ctx.
Read(itmQBIndex))
11452 {
11454 return false;
11455 }
11456
11457 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11458 if (itmQBIndex != -1 && parentPlayer)
11459 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11460 }
11461 }
11462 else
11463 {
11464
11465 PlayerBase player;
11466 int itemQBIndex;
11467 if (version ==
int.
MAX)
11468 {
11469 if (!ctx.
Read(itemQBIndex))
11470 {
11472 return false;
11473 }
11474 }
11475 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11476 {
11477
11478 if (!ctx.
Read(itemQBIndex))
11479 {
11481 return false;
11482 }
11483 if (itemQBIndex != -1 && player)
11484 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11485 }
11486 }
11487
11488 if (version < 140)
11489 {
11490
11491 if (!LoadVariables(ctx, version))
11492 {
11494 return false;
11495 }
11496 }
11497
11498
11500 {
11502 return false;
11503 }
11504 if (version >= 132)
11505 {
11507 if (raib)
11508 {
11510 {
11512 return false;
11513 }
11514 }
11515 }
11516
11518 return true;
11519 }
11520
11521
11522
11524 {
11525 super.OnStoreSave(ctx);
11526
11527 PlayerBase player;
11528 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11529 {
11531
11532 int itemQBIndex = -1;
11533 itemQBIndex = player.FindQuickBarEntityIndex(this);
11534 ctx.
Write(itemQBIndex);
11535 }
11536 else
11537 {
11539 }
11540
11542
11544 if (raib)
11545 {
11547 }
11548 }
11549
11550
11552 {
11553 super.AfterStoreLoad();
11554
11556 {
11558 }
11559
11561 {
11564 }
11565 }
11566
11568 {
11569 super.EEOnAfterLoad();
11570
11572 {
11574 }
11575
11578 }
11579
11581 {
11582 return false;
11583 }
11584
11585
11586
11588 {
11590 {
11591 #ifdef PLATFORM_CONSOLE
11592
11594 {
11596 if (menu)
11597 {
11599 }
11600 }
11601 #endif
11602 }
11603
11605 {
11608 }
11609
11611 {
11612 SetWeightDirty();
11614 }
11616 {
11619 }
11620
11622 {
11625
11628 }
11630 {
11634 }
11635
11636 super.OnVariablesSynchronized();
11637 }
11638
11639
11640
11642 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11643 {
11644 if (!IsServerCheck(allow_client))
11645 return false;
11646
11648 return false;
11649
11652
11653 if (value <= (min + 0.001))
11654 value = min;
11655
11656 if (value == min)
11657 {
11658 if (destroy_config)
11659 {
11660 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11661 if (dstr)
11662 {
11664 this.Delete();
11665 return true;
11666 }
11667 }
11668 else if (destroy_forced)
11669 {
11671 this.Delete();
11672 return true;
11673 }
11674
11676 }
11677
11680
11682 {
11683 EntityAI parent = GetHierarchyRoot();
11684 InventoryLocation iLoc = new InventoryLocation();
11685 GetInventory().GetCurrentInventoryLocation(iLoc);
11687 {
11688 int iLocSlot = iLoc.
GetSlot();
11690 {
11692 }
11694 {
11696 }
11697 }
11698 }
11699
11701 {
11703
11704 if (delta)
11706 }
11707
11709
11710 return false;
11711 }
11712
11713
11715 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11716 {
11718 }
11719
11721 {
11724 }
11725
11727 {
11730 }
11731
11733 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11734 {
11735 float value_clamped = Math.Clamp(value, 0, 1);
11737 SetQuantity(result, destroy_config, destroy_forced);
11738 }
11739
11740
11743 {
11745 }
11746
11748 {
11750 }
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11762 {
11763 int slot = -1;
11764 GameInventory inventory = GetInventory();
11765 if (inventory)
11766 {
11767 InventoryLocation il = new InventoryLocation;
11770 }
11771
11773 }
11774
11776 {
11777 float quantity_max = 0;
11778
11780 {
11781 if (attSlotID != -1)
11782 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11783
11784 if (quantity_max <= 0)
11786 }
11787
11788 if (quantity_max <= 0)
11790
11791 return quantity_max;
11792 }
11793
11795 {
11797 }
11798
11800 {
11802 }
11803
11804
11806 {
11808 }
11809
11811 {
11813 }
11814
11816 {
11818 }
11819
11820
11822 {
11823
11824 float weightEx = GetWeightEx();
11825 float special = GetInventoryAndCargoWeight();
11826 return weightEx - special;
11827 }
11828
11829
11831 {
11833 }
11834
11836 {
11838 {
11839 #ifdef DEVELOPER
11840 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11841 {
11842 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11844 }
11845 #endif
11846
11847 return GetQuantity() * GetConfigWeightModified();
11848 }
11849 else if (HasEnergyManager())
11850 {
11851 #ifdef DEVELOPER
11852 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11853 {
11854 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11855 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11856 }
11857 #endif
11858 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11859 }
11860 else
11861 {
11862 #ifdef DEVELOPER
11863 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11864 {
11865 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11866 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11867 }
11868 #endif
11869 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11870 }
11871 }
11872
11875 {
11876 int item_count = 0;
11878
11879 GameInventory inventory = GetInventory();
11880 CargoBase cargo = inventory.
GetCargo();
11881 if (cargo != NULL)
11882 {
11884 }
11885
11887 for (int i = 0; i < nAttachments; ++i)
11888 {
11890 if (item)
11891 item_count += item.GetNumberOfItems();
11892 }
11893 return item_count;
11894 }
11895
11898 {
11899 float weight = 0;
11900 float wetness = 1;
11901 if (include_wetness)
11904 {
11905 weight = wetness * m_ConfigWeight;
11906 }
11908 {
11909 weight = 1;
11910 }
11911 return weight;
11912 }
11913
11914
11915
11917 {
11918 GameInventory inventory = GetInventory();
11919 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11920 {
11921 array<EntityAI> items = new array<EntityAI>;
11923 for (int i = 0; i < items.Count(); ++i)
11924 {
11926 if (item)
11927 {
11928 g_Game.ObjectDelete(item);
11929 }
11930 }
11931 }
11932 }
11933
11934
11935
11936
11938 {
11939 float energy = 0;
11940 if (HasEnergyManager())
11941 {
11942 energy = GetCompEM().GetEnergy();
11943 }
11944 return energy;
11945 }
11946
11947
11949 {
11950 super.OnEnergyConsumed();
11951
11953 }
11954
11956 {
11957 super.OnEnergyAdded();
11958
11960 }
11961
11962
11964 {
11965 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11966 {
11968 {
11969 float energy_0to1 = GetCompEM().GetEnergy0To1();
11971 }
11972 }
11973 }
11974
11975
11977 {
11978 return ConfigGetFloat("heatIsolation");
11979 }
11980
11982 {
11984 }
11985
11987 {
11988 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11989 if (
g_Game.ConfigIsExisting(paramPath))
11990 return g_Game.ConfigGetFloat(paramPath);
11991
11992 return 0.0;
11993 }
11994
11996 {
11997 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11998 if (
g_Game.ConfigIsExisting(paramPath))
11999 return g_Game.ConfigGetFloat(paramPath);
12000
12001 return 0.0;
12002 }
12003
12004 override void SetWet(
float value,
bool allow_client =
false)
12005 {
12006 if (!IsServerCheck(allow_client))
12007 return;
12008
12011
12013
12014 m_VarWet = Math.Clamp(value, min, max);
12015
12017 {
12020 }
12021 }
12022
12023 override void AddWet(
float value)
12024 {
12026 }
12027
12029 {
12031 }
12032
12034 {
12036 }
12037
12039 {
12041 }
12042
12044 {
12046 }
12047
12049 {
12051 }
12052
12053 override void OnWetChanged(
float newVal,
float oldVal)
12054 {
12057 if (newLevel != oldLevel)
12058 {
12060 }
12061 }
12062
12064 {
12065 SetWeightDirty();
12066 }
12067
12069 {
12070 return GetWetLevelInternal(
m_VarWet);
12071 }
12072
12073
12074
12076 {
12078 }
12079
12081 {
12083 }
12084
12086 {
12088 }
12089
12091 {
12093 }
12094
12095
12096
12098 {
12099 if (ConfigIsExisting("itemModelLength"))
12100 {
12101 return ConfigGetFloat("itemModelLength");
12102 }
12103 return 0;
12104 }
12105
12107 {
12108 if (ConfigIsExisting("itemAttachOffset"))
12109 {
12110 return ConfigGetFloat("itemAttachOffset");
12111 }
12112 return 0;
12113 }
12114
12115 override void SetCleanness(
int value,
bool allow_client =
false)
12116 {
12117 if (!IsServerCheck(allow_client))
12118 return;
12119
12121
12123
12126 }
12127
12129 {
12131 }
12132
12134 {
12135 return true;
12136 }
12137
12138
12139
12140
12142 {
12144 }
12145
12147 {
12149 }
12150
12151
12152
12153
12154 override void SetColor(
int r,
int g,
int b,
int a)
12155 {
12161 }
12163 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12164 {
12169 }
12170
12172 {
12174 }
12175
12178 {
12179 int r,g,b,a;
12181 r = r/255;
12182 g = g/255;
12183 b = b/255;
12184 a = a/255;
12185 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12186 }
12187
12188
12189
12190 override void SetLiquidType(
int value,
bool allow_client =
false)
12191 {
12192 if (!IsServerCheck(allow_client))
12193 return;
12194
12199 }
12200
12202 {
12203 return ConfigGetInt("varLiquidTypeInit");
12204 }
12205
12207 {
12209 }
12210
12212 {
12214 SetFrozen(false);
12215 }
12216
12219 {
12220 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12221 }
12222
12223
12226 {
12227 PlayerBase nplayer;
12228 if (PlayerBase.CastTo(nplayer, player))
12229 {
12231 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12232 }
12233 }
12234
12235
12238 {
12239 PlayerBase nplayer;
12240 if (PlayerBase.CastTo(nplayer,player))
12241 {
12242 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12243 }
12244
12245 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12246
12247 if (HasEnergyManager())
12248 {
12249 GetCompEM().UpdatePlugState();
12250 }
12251 }
12252
12253
12255 {
12256 super.OnPlacementStarted(player);
12257
12259 }
12260
12261 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12262 {
12264 {
12265 m_AdminLog.OnPlacementComplete(player,
this);
12266 }
12267
12268 super.OnPlacementComplete(player, position, orientation);
12269 }
12270
12271
12272
12273
12274
12276 {
12278 {
12279 return true;
12280 }
12281 else
12282 {
12283 return false;
12284 }
12285 }
12286
12287
12289 {
12291 {
12293 }
12294 }
12295
12296
12298 {
12300 }
12301
12303 {
12305 }
12306
12307 override void InsertAgent(
int agent,
float count = 1)
12308 {
12309 if (count < 1)
12310 return;
12311
12313 }
12314
12317 {
12319 }
12320
12321
12323 {
12325 }
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12369 {
12371 return false;
12372 return true;
12373 }
12374
12376 {
12377
12379 }
12380
12381
12384 {
12385 super.CheckForRoofLimited(timeTresholdMS);
12386
12387 float time =
g_Game.GetTime();
12388 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12389 {
12390 m_PreviousRoofTestTime = time;
12391 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12392 }
12393 }
12394
12395
12397 {
12399 {
12400 return 0;
12401 }
12402
12403 if (GetInventory().GetAttachmentSlotsCount() != 0)
12404 {
12405 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12406 if (filter)
12407 return filter.GetProtectionLevel(type, false, system);
12408 else
12409 return 0;
12410 }
12411
12412 string subclassPath, entryName;
12413
12414 switch (type)
12415 {
12417 entryName = "biological";
12418 break;
12420 entryName = "chemical";
12421 break;
12422 default:
12423 entryName = "biological";
12424 break;
12425 }
12426
12427 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12428
12429 return g_Game.ConfigGetFloat(subclassPath + entryName);
12430 }
12431
12432
12433
12436 {
12437 if (!IsMagazine())
12439
12441 }
12442
12443
12444
12445
12446
12451 {
12452 return true;
12453 }
12454
12456 {
12458 }
12459
12460
12461
12462
12463
12465 {
12466 if (parent)
12467 {
12468 if (parent.IsInherited(DayZInfected))
12469 return true;
12470
12471 if (!parent.IsRuined())
12472 return true;
12473 }
12474
12475 return true;
12476 }
12477
12479 {
12480 if (!super.CanPutAsAttachment(parent))
12481 {
12482 return false;
12483 }
12484
12485 if (!IsRuined() && !parent.IsRuined())
12486 {
12487 return true;
12488 }
12489
12490 return false;
12491 }
12492
12494 {
12495
12496
12497
12498
12499 return super.CanReceiveItemIntoCargo(item);
12500 }
12501
12503 {
12504
12505
12506
12507
12508 GameInventory attachmentInv = attachment.GetInventory();
12510 {
12511 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12512 return false;
12513 }
12514
12515 InventoryLocation loc = new InventoryLocation();
12516 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12517 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12518 return false;
12519
12520 return super.CanReceiveAttachment(attachment, slotId);
12521 }
12522
12524 {
12525 if (!super.CanReleaseAttachment(attachment))
12526 return false;
12527
12528 return GetInventory().AreChildrenAccessible();
12529 }
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12552 {
12553 int id = muzzle_owner.GetMuzzleID();
12554 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12555
12556 if (WPOF_array)
12557 {
12558 for (int i = 0; i < WPOF_array.Count(); i++)
12559 {
12560 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12561
12562 if (WPOF)
12563 {
12564 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12565 }
12566 }
12567 }
12568 }
12569
12570
12572 {
12573 int id = muzzle_owner.GetMuzzleID();
12575
12576 if (WPOBE_array)
12577 {
12578 for (int i = 0; i < WPOBE_array.Count(); i++)
12579 {
12580 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12581
12582 if (WPOBE)
12583 {
12584 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12585 }
12586 }
12587 }
12588 }
12589
12590
12592 {
12593 int id = muzzle_owner.GetMuzzleID();
12594 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12595
12596 if (WPOOH_array)
12597 {
12598 for (int i = 0; i < WPOOH_array.Count(); i++)
12599 {
12600 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12601
12602 if (WPOOH)
12603 {
12604 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12605 }
12606 }
12607 }
12608 }
12609
12610
12612 {
12613 int id = muzzle_owner.GetMuzzleID();
12614 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12615
12616 if (WPOOH_array)
12617 {
12618 for (int i = 0; i < WPOOH_array.Count(); i++)
12619 {
12620 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12621
12622 if (WPOOH)
12623 {
12624 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12625 }
12626 }
12627 }
12628 }
12629
12630
12632 {
12633 int id = muzzle_owner.GetMuzzleID();
12634 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12635
12636 if (WPOOH_array)
12637 {
12638 for (int i = 0; i < WPOOH_array.Count(); i++)
12639 {
12640 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12641
12642 if (WPOOH)
12643 {
12644 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12645 }
12646 }
12647 }
12648 }
12649
12650
12651
12653 {
12655 {
12656 return true;
12657 }
12658
12659 return false;
12660 }
12661
12663 {
12665 {
12666 return true;
12667 }
12668
12669 return false;
12670 }
12671
12673 {
12675 {
12676 return true;
12677 }
12678
12679 return false;
12680 }
12681
12683 {
12684 return false;
12685 }
12686
12689 {
12690 return UATimeSpent.DEFAULT_DEPLOY;
12691 }
12692
12693
12694
12695
12697 {
12699 SetSynchDirty();
12700 }
12701
12703 {
12705 }
12706
12707
12709 {
12710 return false;
12711 }
12712
12715 {
12716 string att_type = "None";
12717
12718 if (ConfigIsExisting("soundAttType"))
12719 {
12720 att_type = ConfigGetString("soundAttType");
12721 }
12722
12724 }
12725
12727 {
12729 }
12730
12731
12732
12733
12734
12740
12742 {
12745
12747 }
12748
12749
12751 {
12753 return;
12754
12756
12759
12762
12763 SoundParameters params = new SoundParameters();
12767 }
12768
12769
12771 {
12773 {
12776
12777 SetSynchDirty();
12778
12781 }
12782 }
12783
12785 {
12787 }
12788
12789
12791 {
12793 return;
12794
12796 SetSynchDirty();
12797
12800 }
12801
12803 {
12806 }
12807
12809 {
12811 }
12812
12813 void OnApply(PlayerBase player);
12814
12816 {
12817 return 1.0;
12818 };
12819
12821 {
12823 }
12824
12826 {
12828 }
12829
12831
12833 {
12834 SetDynamicPhysicsLifeTime(0.01);
12836 }
12837
12839 {
12840 array<string> zone_names = new array<string>;
12841 GetDamageZones(zone_names);
12842 for (int i = 0; i < zone_names.Count(); i++)
12843 {
12844 SetHealthMax(zone_names.Get(i),"Health");
12845 }
12846 SetHealthMax("","Health");
12847 }
12848
12851 {
12852 float global_health = GetHealth01("","Health");
12853 array<string> zones = new array<string>;
12854 GetDamageZones(zones);
12855
12856 for (int i = 0; i < zones.Count(); i++)
12857 {
12858 SetHealth01(zones.Get(i),"Health",global_health);
12859 }
12860 }
12861
12864 {
12865 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12866 }
12867
12869 {
12870 if (!hasRootAsPlayer)
12871 {
12872 if (refParentIB)
12873 {
12874
12875 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12876 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12877
12878 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12879 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12880
12883 }
12884 else
12885 {
12886
12889 }
12890 }
12891 }
12892
12894 {
12896 {
12897 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12898 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12899 {
12900 float heatPermCoef = 1.0;
12902 while (ent)
12903 {
12904 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12905 ent = ent.GetHierarchyParent();
12906 }
12907
12908 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12909 }
12910 }
12911 }
12912
12914 {
12915
12916 EntityAI parent = GetHierarchyParent();
12917 if (!parent)
12918 {
12919 hasParent = false;
12920 hasRootAsPlayer = false;
12921 }
12922 else
12923 {
12924 hasParent = true;
12925 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12926 refParentIB =
ItemBase.Cast(parent);
12927 }
12928 }
12929
12930 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12931 {
12932
12933 }
12934
12936 {
12937
12938 return false;
12939 }
12940
12942 {
12943
12944
12945 return false;
12946 }
12947
12949 {
12950
12951 return false;
12952 }
12953
12956 {
12957 return !GetIsFrozen() &&
IsOpen();
12958 }
12959
12961 {
12962 bool hasParent = false, hasRootAsPlayer = false;
12964
12965 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12966 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12967
12968 if (wwtu || foodDecay)
12969 {
12973
12974 if (processWetness || processTemperature || processDecay)
12975 {
12977
12978 if (processWetness)
12979 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12980
12981 if (processTemperature)
12983
12984 if (processDecay)
12985 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12986 }
12987 }
12988 }
12989
12992 {
12994 }
12995
12997 {
13000
13001 return super.GetTemperatureFreezeThreshold();
13002 }
13003
13005 {
13008
13009 return super.GetTemperatureThawThreshold();
13010 }
13011
13013 {
13016
13017 return super.GetItemOverheatThreshold();
13018 }
13019
13021 {
13023 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13024
13025 return super.GetTemperatureFreezeTime();
13026 }
13027
13029 {
13031 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13032
13033 return super.GetTemperatureThawTime();
13034 }
13035
13040
13042 {
13043 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13044 }
13045
13047 {
13048 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13049 }
13050
13053 {
13055 }
13056
13058 {
13060 }
13061
13063 {
13065 }
13066
13069 {
13070 return null;
13071 }
13072
13075 {
13076 return false;
13077 }
13078
13080 {
13082 {
13085 if (!trg)
13086 {
13088 explosive = this;
13089 }
13090
13091 explosive.PairRemote(trg);
13093
13094 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13095 trg.SetPersistentPairID(persistentID);
13096 explosive.SetPersistentPairID(persistentID);
13097
13098 return true;
13099 }
13100 return false;
13101 }
13102
13105 {
13106 float ret = 1.0;
13109 ret *= GetHealth01();
13110
13111 return ret;
13112 }
13113
13114 #ifdef DEVELOPER
13115 override void SetDebugItem()
13116 {
13117 super.SetDebugItem();
13118 _itemBase = this;
13119 }
13120
13122 {
13123 string text = super.GetDebugText();
13124
13126 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13127
13128 return text;
13129 }
13130 #endif
13131
13133 {
13134 return true;
13135 }
13136
13138
13140
13142 {
13145 }
13146
13147
13155
13171
13172 [
Obsolete(
"Use ItemSoundHandler instead")]
13175 {
13176 if (!
g_Game.IsDedicatedServer())
13177 {
13178 if (ConfigIsExisting("attachSoundSet"))
13179 {
13180 string cfg_path = "";
13181 string soundset = "";
13182 string type_name =
GetType();
13183
13186 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13187 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13188
13189 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13190 {
13191 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13192 {
13193 if (cfg_slot_array[i] == slot_type)
13194 {
13195 soundset = cfg_soundset_array[i];
13196 break;
13197 }
13198 }
13199 }
13200
13201 if (soundset != "")
13202 {
13203 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13205 }
13206 }
13207 }
13208 }
13209
13211}
13212
13214{
13216 if (entity)
13217 {
13218 bool is_item = entity.IsInherited(
ItemBase);
13219 if (is_item && full_quantity)
13220 {
13223 }
13224 }
13225 else
13226 {
13228 return NULL;
13229 }
13230 return entity;
13231}
13232
13234{
13235 if (item)
13236 {
13237 if (health > 0)
13238 item.SetHealth("", "", health);
13239
13240 if (item.CanHaveTemperature())
13241 {
13243 if (item.CanFreeze())
13244 item.SetFrozen(false);
13245 }
13246
13247 if (item.HasEnergyManager())
13248 {
13249 if (quantity >= 0)
13250 {
13251 item.GetCompEM().SetEnergy0To1(quantity);
13252 }
13253 else
13254 {
13256 }
13257 }
13258 else if (item.IsMagazine())
13259 {
13260 Magazine mag = Magazine.Cast(item);
13261 if (quantity >= 0)
13262 {
13263 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13264 }
13265 else
13266 {
13268 }
13269
13270 }
13271 else
13272 {
13273 if (quantity >= 0)
13274 {
13275 item.SetQuantityNormalized(quantity, false);
13276 }
13277 else
13278 {
13280 }
13281
13282 }
13283 }
13284}
13285
13286#ifdef DEVELOPER
13288#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.