Set 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.
8235{
8237 {
8238 return true;
8239 }
8240};
8241
8243{
8244
8245};
8246
8247
8248
8250{
8254
8256
8259
8260
8261
8262
8263
8272
8278
8283
8288
8309 protected bool m_IsResultOfSplit
8310
8312
8317
8318
8319
8321
8325
8326
8327
8329
8332
8333
8334
8340
8341
8349
8352
8353
8355
8356
8358
8359
8364
8365
8370
8372
8373
8375
8376
8378 {
8383
8384 if (!
g_Game.IsDedicatedServer())
8385 {
8387 {
8389
8391 {
8393 }
8394 }
8395
8398 }
8399
8400 m_OldLocation = null;
8401
8403 {
8405 }
8406
8407 if (ConfigIsExisting("headSelectionsToHide"))
8408 {
8411 }
8412
8414 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8415 {
8417 }
8418
8420
8421 m_IsResultOfSplit = false;
8422
8424 }
8425
8427 {
8428 super.InitItemVariables();
8429
8435 m_Count = ConfigGetInt(
"count");
8436
8439
8444
8447
8452
8464
8468
8469
8472 if (ConfigIsExisting("canBeSplit"))
8473 {
8476 }
8477
8479 if (ConfigIsExisting("itemBehaviour"))
8481
8482
8485 RegisterNetSyncVariableInt("m_VarLiquidType");
8486 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8487
8488 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8489 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8490 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8491
8492 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8493 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8494 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8495 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8496
8497 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8498 RegisterNetSyncVariableBool("m_IsTakeable");
8499 RegisterNetSyncVariableBool("m_IsHologram");
8500
8503 {
8506 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8507 }
8508
8510
8512 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8514
8516 }
8517
8519 {
8521 }
8522
8524 {
8527 {
8532 }
8533 }
8534
8535 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8536 {
8538 {
8541 }
8542
8544 }
8545
8547 {
8553 }
8554
8556
8558 {
8560
8561 if (!action)
8562 {
8563 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8564 return;
8565 }
8566
8568 if (!ai)
8569 {
8571 return;
8572 }
8573
8575 if (!action_array)
8576 {
8577 action_array = new array<ActionBase_Basic>;
8579 }
8580 if (LogManager.IsActionLogEnable())
8581 {
8582 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8583 }
8584
8585 if (action_array.Find(action) != -1)
8586 {
8587 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8588 }
8589 else
8590 {
8591 action_array.Insert(action);
8592 }
8593 }
8594
8596 {
8597 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8598 ActionBase action = player.GetActionManager().GetAction(actionName);
8601
8602 if (action_array)
8603 {
8604 action_array.RemoveItem(action);
8605 }
8606 }
8607
8608
8609
8611 {
8612 ActionOverrideData overrideData = new ActionOverrideData();
8616
8618 if (!actionMap)
8619 {
8622 }
8623
8624 actionMap.Insert(this.
Type(), overrideData);
8625
8626 }
8627
8629
8631
8632
8634 {
8637
8640
8641 string config_to_search = "CfgVehicles";
8642 string muzzle_owner_config;
8643
8645 {
8646 if (IsInherited(Weapon))
8647 config_to_search = "CfgWeapons";
8648
8649 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8650
8651 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8652
8653 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8654
8655 if (config_OnFire_subclass_count > 0)
8656 {
8657 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8658
8659 for (int i = 0; i < config_OnFire_subclass_count; i++)
8660 {
8661 string particle_class = "";
8662 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8663 string config_OnFire_entry = config_OnFire_class + particle_class;
8664 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8665 WPOF_array.Insert(WPOF);
8666 }
8667
8668
8670 }
8671 }
8672
8674 {
8675 config_to_search = "CfgWeapons";
8676 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8677
8678 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8679
8680 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8681
8682 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8683 {
8684 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8685
8686 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8687 {
8688 string particle_class2 = "";
8689 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8690 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8691 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8692 WPOBE_array.Insert(WPOBE);
8693 }
8694
8695
8697 }
8698 }
8699 }
8700
8701
8703 {
8706
8708 {
8709 string config_to_search = "CfgVehicles";
8710
8711 if (IsInherited(Weapon))
8712 config_to_search = "CfgWeapons";
8713
8714 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8715 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8716
8717 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8718 {
8719
8721
8723 {
8725 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8727 return;
8728 }
8729
8732
8733
8734
8735 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8736 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8737
8738 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8739 {
8740 string particle_class = "";
8741 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8742 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8743 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8744
8745 if (entry_type == CT_CLASS)
8746 {
8747 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8748 WPOOH_array.Insert(WPOF);
8749 }
8750 }
8751
8752
8754 }
8755 }
8756 }
8757
8759 {
8761 }
8762
8764 {
8766 {
8768
8771
8774
8775 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8776 }
8777 }
8778
8780 {
8782 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8783
8785 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8786
8788 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8789
8791 {
8793 }
8794 }
8795
8797 {
8799 }
8800
8802 {
8805 else
8807
8809 {
8812 }
8813 else
8814 {
8817
8820 }
8821
8823 }
8824
8826 {
8828 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8829 }
8830
8832 {
8834 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8836 }
8837
8839 {
8841 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8842 }
8843
8845 {
8848
8849 OverheatingParticle OP = new OverheatingParticle();
8854
8856 }
8857
8859 {
8862
8863 return -1;
8864 }
8865
8867 {
8869 {
8872
8873 for (int i = count; i > 0; --i)
8874 {
8875 int id = i - 1;
8878
8881
8882 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8883 {
8884 if (p)
8885 {
8888 }
8889 }
8890 }
8891 }
8892 }
8893
8895 {
8897 {
8899 {
8900 int id = i - 1;
8902
8903 if (OP)
8904 {
8906
8907 if (p)
8908 {
8910 }
8911
8912 delete OP;
8913 }
8914 }
8915
8918 }
8919 }
8920
8923 {
8924 return 0.0;
8925 }
8926
8927
8929 {
8930 return 250;
8931 }
8932
8934 {
8935 return 0;
8936 }
8937
8940 {
8942 return true;
8943
8944 return false;
8945 }
8946
8949 {
8952
8954 {
8956 }
8957 else
8958 {
8959
8961 }
8962
8964 }
8965
8972 {
8973 return -1;
8974 }
8975
8976
8977
8978
8980 {
8982 {
8983 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8984 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8985
8986 if (r_index >= 0)
8987 {
8988 InventoryLocation r_il = new InventoryLocation;
8989 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8990
8991 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8994 {
8995 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8996 }
8998 {
8999 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9000 }
9001
9002 }
9003
9004 player.GetHumanInventory().ClearUserReservedLocation(this);
9005 }
9006
9009 }
9010
9011
9012
9013
9015 {
9016 return ItemBase.m_DebugActionsMask;
9017 }
9018
9020 {
9021 return ItemBase.m_DebugActionsMask & mask;
9022 }
9023
9025 {
9026 ItemBase.m_DebugActionsMask = mask;
9027 }
9028
9030 {
9031 ItemBase.m_DebugActionsMask |= mask;
9032 }
9033
9035 {
9036 ItemBase.m_DebugActionsMask &= ~mask;
9037 }
9038
9040 {
9042 {
9044 }
9045 else
9046 {
9048 }
9049 }
9050
9051
9053 {
9054 if (GetEconomyProfile())
9055 {
9056 float q_max = GetEconomyProfile().GetQuantityMax();
9057 if (q_max > 0)
9058 {
9059 float q_min = GetEconomyProfile().GetQuantityMin();
9060 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9061
9063 {
9064 ComponentEnergyManager comp = GetCompEM();
9066 {
9068 }
9069 }
9071 {
9073
9074 }
9075
9076 }
9077 }
9078 }
9079
9082 {
9083 EntityAI parent = GetHierarchyParent();
9084
9085 if (parent)
9086 {
9087 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9088 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9089 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9090 }
9091 }
9092
9095 {
9096 EntityAI parent = GetHierarchyParent();
9097
9098 if (parent)
9099 {
9100 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9101 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9102 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9103 }
9104 }
9105
9107 {
9108
9109
9110
9111
9113
9115 {
9116 if (ScriptInputUserData.CanStoreInputUserData())
9117 {
9118 ScriptInputUserData ctx = new ScriptInputUserData;
9124 ctx.
Write(use_stack_max);
9127
9129 {
9130 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9131 }
9132 }
9133 }
9134 else if (!
g_Game.IsMultiplayer())
9135 {
9137 }
9138 }
9139
9141 {
9143 }
9144
9146 {
9148 }
9149
9151 {
9153 }
9154
9156 {
9157
9158 return false;
9159 }
9160
9162 {
9163 return false;
9164 }
9165
9169 {
9170 return false;
9171 }
9172
9174 {
9175 return "";
9176 }
9177
9179
9181 {
9182 return false;
9183 }
9184
9186 {
9187 return true;
9188 }
9189
9190
9191
9193 {
9194 return true;
9195 }
9196
9198 {
9199 return true;
9200 }
9201
9203 {
9204 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9206 }
9207
9209 {
9211 }
9212
9214 {
9216 if (!is_being_placed)
9218 SetSynchDirty();
9219 }
9220
9221
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9235 {
9236 return 1;
9237 }
9238
9240 {
9241 return false;
9242 }
9243
9245 {
9247 SetSynchDirty();
9248 }
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9285 {
9286 super.OnMovedInsideCargo(container);
9287
9288 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9289 }
9290
9291 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9292 {
9293 super.EEItemLocationChanged(oldLoc, newLoc);
9294
9295 PlayerBase newPlayer = null;
9296 PlayerBase oldPlayer = null;
9297
9298 if (newLoc.GetParent())
9299 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9300
9301 if (oldLoc.GetParent())
9302 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9303
9305 {
9306 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9307
9308 if (rIndex >= 0)
9309 {
9310 InventoryLocation rIl = new InventoryLocation;
9311 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9312
9313 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9316 {
9317 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9318 }
9320 {
9322 }
9323
9324 }
9325 }
9326
9328 {
9329 if (newPlayer)
9330 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9331
9332 if (newPlayer == oldPlayer)
9333 {
9334 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9335 {
9337 {
9338 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9339 {
9340 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9341 }
9342 }
9343 else
9344 {
9345 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9346 }
9347 }
9348
9349 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9350 {
9351 int type = oldLoc.GetType();
9353 {
9354 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9355 }
9357 {
9358 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9359 }
9360 }
9361 if (!m_OldLocation)
9362 {
9363 m_OldLocation = new InventoryLocation;
9364 }
9365 m_OldLocation.Copy(oldLoc);
9366 }
9367 else
9368 {
9369 if (m_OldLocation)
9370 {
9371 m_OldLocation.Reset();
9372 }
9373 }
9374
9375 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9376 }
9377 else
9378 {
9379 if (newPlayer)
9380 {
9381 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9382 if (resIndex >= 0)
9383 {
9384 InventoryLocation il = new InventoryLocation;
9385 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9387 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9390 {
9391 il.
GetParent().GetOnReleaseLock().Invoke(it);
9392 }
9394 {
9396 }
9397
9398 }
9399 }
9401 {
9402
9404 }
9405
9406 if (m_OldLocation)
9407 {
9408 m_OldLocation.Reset();
9409 }
9410 }
9411
9413 {
9414 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9415 }
9416
9418 {
9419 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9420 }
9421 }
9422
9423 override void EOnContact(IEntity other, Contact extra)
9424 {
9426 {
9427 int liquidType = -1;
9429 if (impactSpeed > 0.0)
9430 {
9432 #ifndef SERVER
9434 #else
9436 SetSynchDirty();
9437 #endif
9439 }
9440 }
9441
9442 #ifdef SERVER
9443 if (GetCompEM() && GetCompEM().IsPlugged())
9444 {
9445 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9446 GetCompEM().UnplugThis();
9447 }
9448 #endif
9449 }
9450
9452
9454 {
9456 }
9457
9459 {
9460
9461 }
9462
9464 {
9465 super.OnItemLocationChanged(old_owner, new_owner);
9466
9467 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9468 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9469
9470 if (!relatedPlayer && playerNew)
9471 relatedPlayer = playerNew;
9472
9473 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9474 {
9476 if (actionMgr)
9477 {
9478 ActionBase currentAction = actionMgr.GetRunningAction();
9479 if (currentAction)
9481 }
9482 }
9483
9484 Man ownerPlayerOld = null;
9485 Man ownerPlayerNew = null;
9486
9487 if (old_owner)
9488 {
9489 if (old_owner.
IsMan())
9490 {
9491 ownerPlayerOld = Man.Cast(old_owner);
9492 }
9493 else
9494 {
9495 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9496 }
9497 }
9498 else
9499 {
9501 {
9503
9504 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9505 {
9506 GetCompEM().UnplugThis();
9507 }
9508 }
9509 }
9510
9511 if (new_owner)
9512 {
9513 if (new_owner.
IsMan())
9514 {
9515 ownerPlayerNew = Man.Cast(new_owner);
9516 }
9517 else
9518 {
9519 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9520 }
9521 }
9522
9523 if (ownerPlayerOld != ownerPlayerNew)
9524 {
9525 if (ownerPlayerOld)
9526 {
9527 array<EntityAI> subItemsExit = new array<EntityAI>;
9529 for (int i = 0; i < subItemsExit.Count(); i++)
9530 {
9533 }
9534 }
9535
9536 if (ownerPlayerNew)
9537 {
9538 array<EntityAI> subItemsEnter = new array<EntityAI>;
9540 for (int j = 0; j < subItemsEnter.Count(); j++)
9541 {
9544 }
9545 }
9546 }
9547 else if (ownerPlayerNew != null)
9548 {
9549 PlayerBase nplayer;
9550 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9551 {
9552 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9554 for (int k = 0; k < subItemsUpdate.Count(); k++)
9555 {
9557 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9558 }
9559 }
9560 }
9561
9562 if (old_owner)
9563 old_owner.OnChildItemRemoved(this);
9564 if (new_owner)
9565 new_owner.OnChildItemReceived(this);
9566 }
9567
9568
9570 {
9571 super.EEDelete(parent);
9572 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9573 if (player)
9574 {
9576
9577 if (player.IsAlive())
9578 {
9579 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9580 if (r_index >= 0)
9581 {
9582 InventoryLocation r_il = new InventoryLocation;
9583 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9584
9585 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9588 {
9589 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9590 }
9592 {
9593 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9594 }
9595
9596 }
9597
9598 player.RemoveQuickBarEntityShortcut(this);
9599 }
9600 }
9601 }
9602
9604 {
9605 super.EEKilled(killer);
9606
9609 {
9610 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9611 {
9612 if (IsMagazine())
9613 {
9614 if (Magazine.Cast(this).GetAmmoCount() > 0)
9615 {
9617 }
9618 }
9619 else
9620 {
9622 }
9623 }
9624 }
9625 }
9626
9628 {
9629 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9630
9631 super.OnWasAttached(parent, slot_id);
9632
9635
9638 }
9639
9641 {
9642 super.OnWasDetached(parent, slot_id);
9643
9646
9649 }
9650
9652 {
9653 int idx;
9656
9657 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9658 if (inventory_slots.Count() < 1)
9659 {
9660 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9661 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9662 }
9663 else
9664 {
9665 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9666 }
9667
9668 idx = inventory_slots.Find(slot);
9669 if (idx < 0)
9670 return "";
9671
9672 return attach_types.Get(idx);
9673 }
9674
9676 {
9677 int idx = -1;
9678 string slot;
9679
9682
9683 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9684 if (inventory_slots.Count() < 1)
9685 {
9686 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9687 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9688 }
9689 else
9690 {
9691 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9692 if (detach_types.Count() < 1)
9693 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9694 }
9695
9696 for (int i = 0; i < inventory_slots.Count(); i++)
9697 {
9698 slot = inventory_slots.Get(i);
9699 }
9700
9701 if (slot != "")
9702 {
9703 if (detach_types.Count() == 1)
9704 idx = 0;
9705 else
9706 idx = inventory_slots.Find(slot);
9707 }
9708 if (idx < 0)
9709 return "";
9710
9711 return detach_types.Get(idx);
9712 }
9713
9715 {
9716
9718
9719
9720 float min_time = 1;
9721 float max_time = 3;
9722 float delay = Math.RandomFloat(min_time, max_time);
9723
9724 explode_timer.Run(delay, this, "DoAmmoExplosion");
9725 }
9726
9728 {
9729 Magazine magazine = Magazine.Cast(this);
9730 int pop_sounds_count = 6;
9731 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9732
9733
9734 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9735 string sound_name = pop_sounds[ sound_idx ];
9736 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9737
9738
9739 magazine.ServerAddAmmoCount(-1);
9740
9741
9742 float min_temp_to_explode = 100;
9743
9744 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9745 {
9747 }
9748 }
9749
9750
9751 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9752 {
9753 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9754
9755 const int CHANCE_DAMAGE_CARGO = 4;
9756 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9757 const int CHANCE_DAMAGE_NOTHING = 2;
9758
9760 {
9761 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9762 int chances;
9763 int rnd;
9764
9765 if (GetInventory().GetCargo())
9766 {
9767 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9768 rnd = Math.RandomInt(0,chances);
9769
9770 if (rnd < CHANCE_DAMAGE_CARGO)
9771 {
9773 }
9774 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9775 {
9777 }
9778 }
9779 else
9780 {
9781 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9782 rnd = Math.RandomInt(0,chances);
9783
9784 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9785 {
9787 }
9788 }
9789 }
9790 }
9791
9793 {
9794 CargoBase cargo = GetInventory().GetCargo();
9795 if (cargo)
9796 {
9798 if (item_count > 0)
9799 {
9800 int random_pick = Math.RandomInt(0, item_count);
9802 if (!item.IsExplosive())
9803 {
9804 item.AddHealth("","",damage);
9805 return true;
9806 }
9807 }
9808 }
9809 return false;
9810 }
9811
9813 {
9814 GameInventory inventory = GetInventory();
9816 if (attachment_count > 0)
9817 {
9818 int random_pick = Math.RandomInt(0, attachment_count);
9820 if (!attachment.IsExplosive())
9821 {
9822 attachment.AddHealth("","",damage);
9823 return true;
9824 }
9825 }
9826 return false;
9827 }
9828
9830 {
9832 }
9833
9835 {
9837 return GetInventory().CanRemoveEntity();
9838
9839 return false;
9840 }
9841
9843 {
9844
9846 return false;
9847
9848
9850 return false;
9851
9852
9853
9855 if (delta == 0)
9856 return false;
9857
9858
9859 return true;
9860 }
9861
9863 {
9865 {
9866 if (ScriptInputUserData.CanStoreInputUserData())
9867 {
9868 ScriptInputUserData ctx = new ScriptInputUserData;
9873 ctx.
Write(destination_entity);
9877 }
9878 }
9879 else if (!
g_Game.IsMultiplayer())
9880 {
9882 }
9883 }
9884
9886 {
9887 float split_quantity_new;
9891 InventoryLocation loc = new InventoryLocation;
9892
9893 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9894 {
9896 split_quantity_new = stack_max;
9897 else
9899
9901 {
9902 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9903 if (new_item)
9904 {
9905 new_item.SetResultOfSplit(true);
9906 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9908 new_item.
SetQuantity(split_quantity_new,
false,
true);
9909 }
9910 }
9911 }
9912 else if (destination_entity && slot_id == -1)
9913 {
9914 if (quantity > stack_max)
9915 split_quantity_new = stack_max;
9916 else
9917 split_quantity_new = quantity;
9918
9920 {
9921 GameInventory destinationInventory = destination_entity.GetInventory();
9923 {
9926 }
9927
9928 if (new_item)
9929 {
9930 new_item.SetResultOfSplit(true);
9931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9933 new_item.
SetQuantity(split_quantity_new,
false,
true);
9934 }
9935 }
9936 }
9937 else
9938 {
9939 if (stack_max != 0)
9940 {
9942 {
9944 }
9945
9946 if (split_quantity_new == 0)
9947 {
9948 if (!
g_Game.IsMultiplayer())
9949 player.PhysicalPredictiveDropItem(this);
9950 else
9951 player.ServerDropEntity(this);
9952 return;
9953 }
9954
9956 {
9958
9959 if (new_item)
9960 {
9961 new_item.SetResultOfSplit(true);
9962 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9965 new_item.PlaceOnSurface();
9966 }
9967 }
9968 }
9969 }
9970 }
9971
9973 {
9974 float split_quantity_new;
9978 InventoryLocation loc = new InventoryLocation;
9979
9980 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9981 {
9983 split_quantity_new = stack_max;
9984 else
9986
9988 {
9989 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9990 if (new_item)
9991 {
9992 new_item.SetResultOfSplit(true);
9993 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9995 new_item.
SetQuantity(split_quantity_new,
false,
true);
9996 }
9997 }
9998 }
9999 else if (destination_entity && slot_id == -1)
10000 {
10001 if (quantity > stack_max)
10002 split_quantity_new = stack_max;
10003 else
10004 split_quantity_new = quantity;
10005
10007 {
10008 GameInventory destinationInventory = destination_entity.GetInventory();
10010 {
10013 }
10014
10015 if (new_item)
10016 {
10017 new_item.SetResultOfSplit(true);
10018 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10020 new_item.
SetQuantity(split_quantity_new,
false,
true);
10021 }
10022 }
10023 }
10024 else
10025 {
10026 if (stack_max != 0)
10027 {
10029 {
10031 }
10032
10034 {
10036
10037 if (new_item)
10038 {
10039 new_item.SetResultOfSplit(true);
10040 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10043 new_item.PlaceOnSurface();
10044 }
10045 }
10046 }
10047 }
10048 }
10049
10051 {
10053 {
10054 if (ScriptInputUserData.CanStoreInputUserData())
10055 {
10056 ScriptInputUserData ctx = new ScriptInputUserData;
10061 dst.WriteToContext(ctx);
10063 }
10064 }
10065 else if (!
g_Game.IsMultiplayer())
10066 {
10068 }
10069 }
10070
10072 {
10074 {
10075 if (ScriptInputUserData.CanStoreInputUserData())
10076 {
10077 ScriptInputUserData ctx = new ScriptInputUserData;
10082 ctx.
Write(destination_entity);
10088 }
10089 }
10090 else if (!
g_Game.IsMultiplayer())
10091 {
10093 }
10094 }
10095
10097 {
10099 }
10100
10102 {
10104 float split_quantity_new;
10106 if (dst.IsValid())
10107 {
10108 int slot_id = dst.GetSlot();
10110
10111 if (quantity > stack_max)
10112 split_quantity_new = stack_max;
10113 else
10114 split_quantity_new = quantity;
10115
10117 {
10119
10120 if (new_item)
10121 {
10122 new_item.SetResultOfSplit(true);
10123 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10125 new_item.
SetQuantity(split_quantity_new,
false,
true);
10126 }
10127
10128 return new_item;
10129 }
10130 }
10131
10132 return null;
10133 }
10134
10136 {
10138 float split_quantity_new;
10140 if (destination_entity)
10141 {
10143 if (quantity > stackable)
10144 split_quantity_new = stackable;
10145 else
10146 split_quantity_new = quantity;
10147
10149 {
10150 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10151 if (new_item)
10152 {
10153 new_item.SetResultOfSplit(true);
10154 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10156 new_item.
SetQuantity(split_quantity_new,
false,
true);
10157 }
10158 }
10159 }
10160 }
10161
10163 {
10165 {
10166 if (ScriptInputUserData.CanStoreInputUserData())
10167 {
10168 ScriptInputUserData ctx = new ScriptInputUserData;
10173 ItemBase destination_entity =
this;
10174 ctx.
Write(destination_entity);
10178 }
10179 }
10180 else if (!
g_Game.IsMultiplayer())
10181 {
10183 }
10184 }
10185
10187 {
10189 float split_quantity_new;
10191 if (player)
10192 {
10194 if (quantity > stackable)
10195 split_quantity_new = stackable;
10196 else
10197 split_quantity_new = quantity;
10198
10200 {
10201 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10202 new_item =
ItemBase.Cast(in_hands);
10203 if (new_item)
10204 {
10205 new_item.SetResultOfSplit(true);
10206 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10208 new_item.SetQuantity(split_quantity_new, false, true);
10209 }
10210 }
10211 }
10212 }
10213
10215 {
10217 float split_quantity_new = Math.Floor(quantity * 0.5);
10218
10220 return;
10221
10223
10224 if (new_item)
10225 {
10226 if (new_item.GetQuantityMax() < split_quantity_new)
10227 {
10228 split_quantity_new = new_item.GetQuantityMax();
10229 }
10230
10231 new_item.SetResultOfSplit(true);
10232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10233
10235 {
10238 }
10239 else
10240 {
10242 new_item.
SetQuantity(split_quantity_new,
false,
true);
10243 }
10244 }
10245 }
10246
10248 {
10250 float split_quantity_new = Math.Floor(quantity / 2);
10251
10253 return;
10254
10255 InventoryLocation invloc = new InventoryLocation;
10257
10259 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10260
10261 if (new_item)
10262 {
10263 if (new_item.GetQuantityMax() < split_quantity_new)
10264 {
10265 split_quantity_new = new_item.GetQuantityMax();
10266 }
10268 {
10271 }
10272 else if (split_quantity_new > 1)
10273 {
10275 new_item.
SetQuantity(split_quantity_new,
false,
true);
10276 }
10277 }
10278 }
10279
10282 {
10283 SetWeightDirty();
10285
10286 if (parent)
10287 parent.OnAttachmentQuantityChangedEx(this, delta);
10288
10290 {
10292 {
10294 }
10296 {
10297 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10299 }
10300 }
10301 }
10302
10305 {
10306
10307 }
10308
10311 {
10313 }
10314
10316 {
10317 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10318
10320 {
10321 if (newLevel == GameConstants.STATE_RUINED)
10322 {
10324 EntityAI parent = GetHierarchyParent();
10325 if (parent && parent.IsFireplace())
10326 {
10327 CargoBase cargo = GetInventory().GetCargo();
10328 if (cargo)
10329 {
10331 {
10333 }
10334 }
10335 }
10336 }
10337
10339 {
10340
10342 return;
10343 }
10344
10345 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10346 {
10348 }
10349 }
10350 }
10351
10352
10354 {
10355 super.OnRightClick();
10356
10358 {
10360 {
10361 if (ScriptInputUserData.CanStoreInputUserData())
10362 {
10363 EntityAI root = GetHierarchyRoot();
10364 Man playerOwner = GetHierarchyRootPlayer();
10365 InventoryLocation dst = new InventoryLocation;
10366
10367
10368 if (!playerOwner && root && root == this)
10369 {
10371 }
10372 else
10373 {
10374
10375 GetInventory().GetCurrentInventoryLocation(dst);
10377 {
10378 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10380 {
10382 }
10383 else
10384 {
10386
10387
10388 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10389 {
10391 }
10392 else
10393 {
10394 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10395 }
10396 }
10397 }
10398 }
10399
10400 ScriptInputUserData ctx = new ScriptInputUserData;
10408 }
10409 }
10410 else if (!
g_Game.IsMultiplayer())
10411 {
10413 }
10414 }
10415 }
10416
10418 {
10419 if (root)
10420 {
10421 vector m4[4];
10422 root.GetTransform(m4);
10423 dst.SetGround(this, m4);
10424 }
10425 else
10426 {
10427 GetInventory().GetCurrentInventoryLocation(dst);
10428 }
10429 }
10430
10431 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10432 {
10433
10434 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10435 return false;
10436
10437 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10438 return false;
10439
10440
10442 return false;
10443
10444
10445 Magazine mag = Magazine.Cast(this);
10446 if (mag)
10447 {
10448 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10449 return false;
10450
10451 if (stack_max_limit)
10452 {
10453 Magazine other_mag = Magazine.Cast(other_item);
10454 if (other_item)
10455 {
10456 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10457 return false;
10458 }
10459
10460 }
10461 }
10462 else
10463 {
10464
10466 return false;
10467
10469 return false;
10470 }
10471
10472 PlayerBase player = null;
10473 if (CastTo(player, GetHierarchyRootPlayer()))
10474 {
10475 if (player.GetInventory().HasAttachment(this))
10476 return false;
10477
10478 if (player.IsItemsToDelete())
10479 return false;
10480 }
10481
10482 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10483 return false;
10484
10485 int slotID;
10487 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10488 return false;
10489
10490 return true;
10491 }
10492
10494 {
10496 }
10497
10499 {
10500 return m_IsResultOfSplit;
10501 }
10502
10504 {
10505 m_IsResultOfSplit = value;
10506 }
10507
10509 {
10511 }
10512
10514 {
10515 float other_item_quantity = other_item.GetQuantity();
10516 float this_free_space;
10517
10519
10521
10522 if (other_item_quantity > this_free_space)
10523 {
10524 return this_free_space;
10525 }
10526 else
10527 {
10528 return other_item_quantity;
10529 }
10530 }
10531
10533 {
10535 }
10536
10538 {
10540 return;
10541
10542 if (!IsMagazine() && other_item)
10543 {
10545 if (quantity_used != 0)
10546 {
10547 float hp1 = GetHealth01("","");
10548 float hp2 = other_item.GetHealth01("","");
10549 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10550 hpResult = hpResult / (
GetQuantity() + quantity_used);
10551
10552 hpResult *= GetMaxHealth();
10553 Math.Round(hpResult);
10554 SetHealth("", "Health", hpResult);
10555
10557 other_item.AddQuantity(-quantity_used);
10558 }
10559 }
10561 }
10562
10564 {
10565 #ifdef SERVER
10566 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10567 GetHierarchyParent().IncreaseLifetimeUp();
10568 #endif
10569 };
10570
10572 {
10573 PlayerBase p = PlayerBase.Cast(player);
10574
10575 array<int> recipesIds = p.m_Recipes;
10576 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10577 if (moduleRecipesManager)
10578 {
10579 EntityAI itemInHands = player.GetEntityInHands();
10580 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10581 }
10582
10583 for (int i = 0;i < recipesIds.Count(); i++)
10584 {
10585 int key = recipesIds.Get(i);
10586 string recipeName = moduleRecipesManager.GetRecipeName(key);
10588 }
10589 }
10590
10591
10592 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10593 {
10594 super.GetDebugActions(outputList);
10595
10596
10602
10603
10608
10613
10614
10618
10619
10621 {
10625 }
10626
10629
10630
10634
10636
10637 InventoryLocation loc = new InventoryLocation();
10638 GetInventory().GetCurrentInventoryLocation(loc);
10640 {
10641 if (Gizmo_IsSupported())
10644 }
10645
10647 }
10648
10649
10650
10651
10653 {
10654 super.OnAction(action_id, player, ctx);
10655
10657 {
10658 switch (action_id)
10659 {
10663 return true;
10667 return true;
10668 }
10669 }
10670
10672 {
10673 switch (action_id)
10674 {
10676 Delete();
10677 return true;
10678 }
10679 }
10680
10681 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10682 {
10683 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10684 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10685 PlayerBase p = PlayerBase.Cast(player);
10686 if (
EActions.RECIPES_RANGE_START < 1000)
10687 {
10688 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10689 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10690 }
10691 }
10692 #ifndef SERVER
10693 else if (action_id ==
EActions.WATCH_PLAYER)
10694 {
10695 PluginDeveloper.SetDeveloperItemClientEx(player);
10696 }
10697 #endif
10699 {
10700 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10701 {
10702 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10703 OnDebugButtonPressServer(id + 1);
10704 }
10705
10706 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10707 {
10708 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10710 }
10711
10712 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10713 {
10714 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10716 }
10717
10718 else if (action_id ==
EActions.ADD_QUANTITY)
10719 {
10720 if (IsMagazine())
10721 {
10722 Magazine mag = Magazine.Cast(this);
10723 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10724 }
10725 else
10726 {
10728 }
10729
10730 if (m_EM)
10731 {
10732 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10733 }
10734
10735 }
10736
10737 else if (action_id ==
EActions.REMOVE_QUANTITY)
10738 {
10739 if (IsMagazine())
10740 {
10741 Magazine mag2 = Magazine.Cast(this);
10742 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10743 }
10744 else
10745 {
10747 }
10748 if (m_EM)
10749 {
10750 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10751 }
10752
10753 }
10754
10755 else if (action_id ==
EActions.SET_QUANTITY_0)
10756 {
10758
10759 if (m_EM)
10760 {
10761 m_EM.SetEnergy(0);
10762 }
10763 }
10764
10765 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10766 {
10768
10769 if (m_EM)
10770 {
10771 m_EM.SetEnergy(m_EM.GetEnergyMax());
10772 }
10773 }
10774
10775 else if (action_id ==
EActions.ADD_HEALTH)
10776 {
10777 AddHealth("","",GetMaxHealth("","Health")/5);
10778 }
10779 else if (action_id ==
EActions.REMOVE_HEALTH)
10780 {
10781 AddHealth("","",-GetMaxHealth("","Health")/5);
10782 }
10783 else if (action_id ==
EActions.DESTROY_HEALTH)
10784 {
10785 SetHealth01("","",0);
10786 }
10787 else if (action_id ==
EActions.WATCH_ITEM)
10788 {
10790 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10791 #ifdef DEVELOPER
10792 SetDebugDeveloper_item(this);
10793 #endif
10794 }
10795
10796 else if (action_id ==
EActions.ADD_TEMPERATURE)
10797 {
10798 AddTemperature(20);
10799
10800 }
10801
10802 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10803 {
10804 AddTemperature(-20);
10805
10806 }
10807
10808 else if (action_id ==
EActions.FLIP_FROZEN)
10809 {
10810 SetFrozen(!GetIsFrozen());
10811
10812 }
10813
10814 else if (action_id ==
EActions.ADD_WETNESS)
10815 {
10817
10818 }
10819
10820 else if (action_id ==
EActions.REMOVE_WETNESS)
10821 {
10823
10824 }
10825
10826 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10827 {
10830
10831
10832 }
10833
10834 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10835 {
10838 }
10839
10840 else if (action_id ==
EActions.MAKE_SPECIAL)
10841 {
10842 auto debugParams = DebugSpawnParams.WithPlayer(player);
10843 OnDebugSpawnEx(debugParams);
10844 }
10845
10846 }
10847
10848
10849 return false;
10850 }
10851
10852
10853
10854
10858
10861
10862
10863
10865 {
10866 return false;
10867 }
10868
10869
10871 {
10872 return true;
10873 }
10874
10875
10877 {
10878 return true;
10879 }
10880
10881
10882
10884 {
10885 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10886 return g_Game.ConfigIsExisting(config_path);
10887 }
10888
10891 {
10892 return null;
10893 }
10894
10896 {
10897 return false;
10898 }
10899
10901 {
10902 return false;
10903 }
10904
10908
10909
10911 {
10912 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10913 return module_repairing.CanRepair(this, item_repair_kit);
10914 }
10915
10916
10917 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10918 {
10919 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10920 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10921 }
10922
10923
10925 {
10926
10927
10928
10929
10930
10931
10932
10933
10934 return 1;
10935 }
10936
10937
10938
10940 {
10942 }
10943
10944
10945
10947 {
10949 }
10950
10951
10960 {
10961 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10962
10963 if (player)
10964 {
10965 player.MessageStatus(text);
10966 }
10967 }
10968
10969
10978 {
10979 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10980
10981 if (player)
10982 {
10983 player.MessageAction(text);
10984 }
10985 }
10986
10987
10996 {
10997 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10998
10999 if (player)
11000 {
11001 player.MessageFriendly(text);
11002 }
11003 }
11004
11005
11014 {
11015 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11016
11017 if (player)
11018 {
11019 player.MessageImportant(text);
11020 }
11021 }
11022
11024 {
11025 return true;
11026 }
11027
11028
11029 override bool KindOf(
string tag)
11030 {
11031 bool found = false;
11032 string item_name = this.
GetType();
11034 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11035
11036 int array_size = item_tag_array.Count();
11037 for (int i = 0; i < array_size; i++)
11038 {
11039 if (item_tag_array.Get(i) == tag)
11040 {
11041 found = true;
11042 break;
11043 }
11044 }
11045 return found;
11046 }
11047
11048
11050 {
11051
11052 super.OnRPC(sender, rpc_type,ctx);
11053
11054
11055 switch (rpc_type)
11056 {
11057 #ifndef SERVER
11058 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11059 Param2<bool, string> p = new Param2<bool, string>(false, "");
11060
11062 return;
11063
11064 bool play = p.param1;
11065 string soundSet = p.param2;
11066
11067 if (play)
11068 {
11070 {
11072 {
11074 }
11075 }
11076 else
11077 {
11079 }
11080 }
11081 else
11082 {
11084 }
11085
11086 break;
11087 #endif
11088
11089 }
11090
11092 {
11094 }
11095 }
11096
11097
11098
11099
11101 {
11102 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11103 return plugin.GetID(
name);
11104 }
11105
11107 {
11108 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11109 return plugin.GetName(id);
11110 }
11111
11114 {
11115
11116
11117 int varFlags;
11118 if (!ctx.
Read(varFlags))
11119 return;
11120
11121 if (varFlags & ItemVariableFlags.FLOAT)
11122 {
11124 }
11125 }
11126
11128 {
11129
11130 super.SerializeNumericalVars(floats_out);
11131
11132
11133
11135 {
11137 }
11138
11140 {
11142 }
11143
11145 {
11147 }
11148
11150 {
11155 }
11156
11158 {
11160 }
11161 }
11162
11164 {
11165
11166 super.DeSerializeNumericalVars(floats);
11167
11168
11169 int index = 0;
11170 int mask = Math.Round(floats.Get(index));
11171
11172 index++;
11173
11175 {
11177 {
11179 }
11180 else
11181 {
11182 float quantity = floats.Get(index);
11183 SetQuantity(quantity,
true,
false,
false,
false);
11184 }
11185 index++;
11186 }
11187
11189 {
11190 float wet = floats.Get(index);
11192 index++;
11193 }
11194
11196 {
11197 int liquidtype = Math.Round(floats.Get(index));
11199 index++;
11200 }
11201
11203 {
11205 index++;
11207 index++;
11209 index++;
11211 index++;
11212 }
11213
11215 {
11216 int cleanness = Math.Round(floats.Get(index));
11218 index++;
11219 }
11220 }
11221
11223 {
11224 super.WriteVarsToCTX(ctx);
11225
11226
11228 {
11230 }
11231
11233 {
11235 }
11236
11238 {
11240 }
11241
11243 {
11244 int r,g,b,a;
11250 }
11251
11253 {
11255 }
11256 }
11257
11259 {
11260 if (!super.ReadVarsFromCTX(ctx,version))
11261 return false;
11262
11263 int intValue;
11264 float value;
11265
11266 if (version < 140)
11267 {
11268 if (!ctx.
Read(intValue))
11269 return false;
11270
11271 m_VariablesMask = intValue;
11272 }
11273
11275 {
11276 if (!ctx.
Read(value))
11277 return false;
11278
11280 {
11282 }
11283 else
11284 {
11286 }
11287 }
11288
11289 if (version < 140)
11290 {
11292 {
11293 if (!ctx.
Read(value))
11294 return false;
11295 SetTemperatureDirect(value);
11296 }
11297 }
11298
11300 {
11301 if (!ctx.
Read(value))
11302 return false;
11304 }
11305
11307 {
11308 if (!ctx.
Read(intValue))
11309 return false;
11311 }
11312
11314 {
11315 int r,g,b,a;
11317 return false;
11319 return false;
11321 return false;
11323 return false;
11324
11326 }
11327
11329 {
11330 if (!ctx.
Read(intValue))
11331 return false;
11333 }
11334
11335 if (version >= 138 && version < 140)
11336 {
11338 {
11339 if (!ctx.
Read(intValue))
11340 return false;
11341 SetFrozen(intValue);
11342 }
11343 }
11344
11345 return true;
11346 }
11347
11348
11350 {
11353 {
11355 }
11356
11357 if (!super.OnStoreLoad(ctx, version))
11358 {
11360 return false;
11361 }
11362
11363 if (version >= 114)
11364 {
11365 bool hasQuickBarIndexSaved;
11366
11367 if (!ctx.
Read(hasQuickBarIndexSaved))
11368 {
11370 return false;
11371 }
11372
11373 if (hasQuickBarIndexSaved)
11374 {
11375 int itmQBIndex;
11376
11377
11378 if (!ctx.
Read(itmQBIndex))
11379 {
11381 return false;
11382 }
11383
11384 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11385 if (itmQBIndex != -1 && parentPlayer)
11386 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11387 }
11388 }
11389 else
11390 {
11391
11392 PlayerBase player;
11393 int itemQBIndex;
11394 if (version ==
int.
MAX)
11395 {
11396 if (!ctx.
Read(itemQBIndex))
11397 {
11399 return false;
11400 }
11401 }
11402 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11403 {
11404
11405 if (!ctx.
Read(itemQBIndex))
11406 {
11408 return false;
11409 }
11410 if (itemQBIndex != -1 && player)
11411 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11412 }
11413 }
11414
11415 if (version < 140)
11416 {
11417
11418 if (!LoadVariables(ctx, version))
11419 {
11421 return false;
11422 }
11423 }
11424
11425
11427 {
11429 return false;
11430 }
11431 if (version >= 132)
11432 {
11434 if (raib)
11435 {
11437 {
11439 return false;
11440 }
11441 }
11442 }
11443
11445 return true;
11446 }
11447
11448
11449
11451 {
11452 super.OnStoreSave(ctx);
11453
11454 PlayerBase player;
11455 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11456 {
11458
11459 int itemQBIndex = -1;
11460 itemQBIndex = player.FindQuickBarEntityIndex(this);
11461 ctx.
Write(itemQBIndex);
11462 }
11463 else
11464 {
11466 }
11467
11469
11471 if (raib)
11472 {
11474 }
11475 }
11476
11477
11479 {
11480 super.AfterStoreLoad();
11481
11483 {
11485 }
11486
11488 {
11491 }
11492 }
11493
11495 {
11496 super.EEOnAfterLoad();
11497
11499 {
11501 }
11502
11505 }
11506
11508 {
11509 return false;
11510 }
11511
11512
11513
11515 {
11517 {
11518 #ifdef PLATFORM_CONSOLE
11519
11521 {
11523 if (menu)
11524 {
11526 }
11527 }
11528 #endif
11529 }
11530
11532 {
11535 }
11536
11538 {
11539 SetWeightDirty();
11541 }
11543 {
11546 }
11547
11549 {
11552
11555 }
11557 {
11561 }
11562
11563 super.OnVariablesSynchronized();
11564 }
11565
11566
11567
11569 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11570 {
11571 if (!IsServerCheck(allow_client))
11572 return false;
11573
11575 return false;
11576
11579
11580 if (value <= (min + 0.001))
11581 value = min;
11582
11583 if (value == min)
11584 {
11585 if (destroy_config)
11586 {
11587 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11588 if (dstr)
11589 {
11591 this.Delete();
11592 return true;
11593 }
11594 }
11595 else if (destroy_forced)
11596 {
11598 this.Delete();
11599 return true;
11600 }
11601
11603 }
11604
11607
11609 {
11610 EntityAI parent = GetHierarchyRoot();
11611 InventoryLocation iLoc = new InventoryLocation();
11612 GetInventory().GetCurrentInventoryLocation(iLoc);
11614 {
11615 int iLocSlot = iLoc.
GetSlot();
11617 {
11619 }
11621 {
11623 }
11624 }
11625 }
11626
11628 {
11630
11631 if (delta)
11633 }
11634
11636
11637 return false;
11638 }
11639
11640
11642 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11643 {
11645 }
11646
11648 {
11651 }
11652
11654 {
11657 }
11658
11660 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11661 {
11662 float value_clamped = Math.Clamp(value, 0, 1);
11664 SetQuantity(result, destroy_config, destroy_forced);
11665 }
11666
11667
11670 {
11672 }
11673
11675 {
11677 }
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11689 {
11690 int slot = -1;
11691 GameInventory inventory = GetInventory();
11692 if (inventory)
11693 {
11694 InventoryLocation il = new InventoryLocation;
11697 }
11698
11700 }
11701
11703 {
11704 float quantity_max = 0;
11705
11707 {
11708 if (attSlotID != -1)
11709 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11710
11711 if (quantity_max <= 0)
11713 }
11714
11715 if (quantity_max <= 0)
11717
11718 return quantity_max;
11719 }
11720
11722 {
11724 }
11725
11727 {
11729 }
11730
11731
11733 {
11735 }
11736
11738 {
11740 }
11741
11743 {
11745 }
11746
11747
11749 {
11750
11751 float weightEx = GetWeightEx();
11752 float special = GetInventoryAndCargoWeight();
11753 return weightEx - special;
11754 }
11755
11756
11758 {
11760 }
11761
11763 {
11765 {
11766 #ifdef DEVELOPER
11767 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11768 {
11769 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11771 }
11772 #endif
11773
11774 return GetQuantity() * GetConfigWeightModified();
11775 }
11776 else if (HasEnergyManager())
11777 {
11778 #ifdef DEVELOPER
11779 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11780 {
11781 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11782 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11783 }
11784 #endif
11785 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11786 }
11787 else
11788 {
11789 #ifdef DEVELOPER
11790 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11791 {
11792 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11793 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11794 }
11795 #endif
11796 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11797 }
11798 }
11799
11802 {
11803 int item_count = 0;
11805
11806 GameInventory inventory = GetInventory();
11807 CargoBase cargo = inventory.
GetCargo();
11808 if (cargo != NULL)
11809 {
11811 }
11812
11814 for (int i = 0; i < nAttachments; ++i)
11815 {
11817 if (item)
11818 item_count += item.GetNumberOfItems();
11819 }
11820 return item_count;
11821 }
11822
11825 {
11826 float weight = 0;
11827 float wetness = 1;
11828 if (include_wetness)
11831 {
11832 weight = wetness * m_ConfigWeight;
11833 }
11835 {
11836 weight = 1;
11837 }
11838 return weight;
11839 }
11840
11841
11842
11844 {
11845 GameInventory inventory = GetInventory();
11846 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11847 {
11848 array<EntityAI> items = new array<EntityAI>;
11850 for (int i = 0; i < items.Count(); ++i)
11851 {
11853 if (item)
11854 {
11855 g_Game.ObjectDelete(item);
11856 }
11857 }
11858 }
11859 }
11860
11861
11862
11863
11865 {
11866 float energy = 0;
11867 if (HasEnergyManager())
11868 {
11869 energy = GetCompEM().GetEnergy();
11870 }
11871 return energy;
11872 }
11873
11874
11876 {
11877 super.OnEnergyConsumed();
11878
11880 }
11881
11883 {
11884 super.OnEnergyAdded();
11885
11887 }
11888
11889
11891 {
11892 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11893 {
11895 {
11896 float energy_0to1 = GetCompEM().GetEnergy0To1();
11898 }
11899 }
11900 }
11901
11902
11904 {
11905 return ConfigGetFloat("heatIsolation");
11906 }
11907
11909 {
11911 }
11912
11914 {
11915 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11916 if (
g_Game.ConfigIsExisting(paramPath))
11917 return g_Game.ConfigGetFloat(paramPath);
11918
11919 return 0.0;
11920 }
11921
11923 {
11924 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11925 if (
g_Game.ConfigIsExisting(paramPath))
11926 return g_Game.ConfigGetFloat(paramPath);
11927
11928 return 0.0;
11929 }
11930
11931 override void SetWet(
float value,
bool allow_client =
false)
11932 {
11933 if (!IsServerCheck(allow_client))
11934 return;
11935
11938
11940
11941 m_VarWet = Math.Clamp(value, min, max);
11942
11944 {
11947 }
11948 }
11949
11950 override void AddWet(
float value)
11951 {
11953 }
11954
11956 {
11958 }
11959
11961 {
11963 }
11964
11966 {
11968 }
11969
11971 {
11973 }
11974
11976 {
11978 }
11979
11980 override void OnWetChanged(
float newVal,
float oldVal)
11981 {
11984 if (newLevel != oldLevel)
11985 {
11987 }
11988 }
11989
11991 {
11992 SetWeightDirty();
11993 }
11994
11996 {
11997 return GetWetLevelInternal(
m_VarWet);
11998 }
11999
12000
12001
12003 {
12005 }
12006
12008 {
12010 }
12011
12013 {
12015 }
12016
12018 {
12020 }
12021
12022
12023
12025 {
12026 if (ConfigIsExisting("itemModelLength"))
12027 {
12028 return ConfigGetFloat("itemModelLength");
12029 }
12030 return 0;
12031 }
12032
12034 {
12035 if (ConfigIsExisting("itemAttachOffset"))
12036 {
12037 return ConfigGetFloat("itemAttachOffset");
12038 }
12039 return 0;
12040 }
12041
12042 override void SetCleanness(
int value,
bool allow_client =
false)
12043 {
12044 if (!IsServerCheck(allow_client))
12045 return;
12046
12048
12050
12053 }
12054
12056 {
12058 }
12059
12061 {
12062 return true;
12063 }
12064
12065
12066
12067
12069 {
12071 }
12072
12074 {
12076 }
12077
12078
12079
12080
12081 override void SetColor(
int r,
int g,
int b,
int a)
12082 {
12088 }
12090 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12091 {
12096 }
12097
12099 {
12101 }
12102
12105 {
12106 int r,g,b,a;
12108 r = r/255;
12109 g = g/255;
12110 b = b/255;
12111 a = a/255;
12112 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12113 }
12114
12115
12116
12117 override void SetLiquidType(
int value,
bool allow_client =
false)
12118 {
12119 if (!IsServerCheck(allow_client))
12120 return;
12121
12126 }
12127
12129 {
12130 return ConfigGetInt("varLiquidTypeInit");
12131 }
12132
12134 {
12136 }
12137
12139 {
12141 SetFrozen(false);
12142 }
12143
12146 {
12147 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12148 }
12149
12150
12153 {
12154 PlayerBase nplayer;
12155 if (PlayerBase.CastTo(nplayer, player))
12156 {
12158 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12159 }
12160 }
12161
12162
12165 {
12166 PlayerBase nplayer;
12167 if (PlayerBase.CastTo(nplayer,player))
12168 {
12169 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12170 }
12171
12172 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12173
12174 if (HasEnergyManager())
12175 {
12176 GetCompEM().UpdatePlugState();
12177 }
12178 }
12179
12180
12182 {
12183 super.OnPlacementStarted(player);
12184
12186 }
12187
12188 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12189 {
12191 {
12192 m_AdminLog.OnPlacementComplete(player,
this);
12193 }
12194
12195 super.OnPlacementComplete(player, position, orientation);
12196 }
12197
12198
12199
12200
12201
12203 {
12205 {
12206 return true;
12207 }
12208 else
12209 {
12210 return false;
12211 }
12212 }
12213
12214
12216 {
12218 {
12220 }
12221 }
12222
12223
12225 {
12227 }
12228
12230 {
12232 }
12233
12234 override void InsertAgent(
int agent,
float count = 1)
12235 {
12236 if (count < 1)
12237 return;
12238
12240 }
12241
12244 {
12246 }
12247
12248
12250 {
12252 }
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12296 {
12298 return false;
12299 return true;
12300 }
12301
12303 {
12304
12306 }
12307
12308
12311 {
12312 super.CheckForRoofLimited(timeTresholdMS);
12313
12314 float time =
g_Game.GetTime();
12315 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12316 {
12317 m_PreviousRoofTestTime = time;
12318 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12319 }
12320 }
12321
12322
12324 {
12326 {
12327 return 0;
12328 }
12329
12330 if (GetInventory().GetAttachmentSlotsCount() != 0)
12331 {
12332 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12333 if (filter)
12334 return filter.GetProtectionLevel(type, false, system);
12335 else
12336 return 0;
12337 }
12338
12339 string subclassPath, entryName;
12340
12341 switch (type)
12342 {
12344 entryName = "biological";
12345 break;
12347 entryName = "chemical";
12348 break;
12349 default:
12350 entryName = "biological";
12351 break;
12352 }
12353
12354 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12355
12356 return g_Game.ConfigGetFloat(subclassPath + entryName);
12357 }
12358
12359
12360
12363 {
12364 if (!IsMagazine())
12366
12368 }
12369
12370
12371
12372
12373
12378 {
12379 return true;
12380 }
12381
12383 {
12385 }
12386
12387
12388
12389
12390
12392 {
12393 if (parent)
12394 {
12395 if (parent.IsInherited(DayZInfected))
12396 return true;
12397
12398 if (!parent.IsRuined())
12399 return true;
12400 }
12401
12402 return true;
12403 }
12404
12406 {
12407 if (!super.CanPutAsAttachment(parent))
12408 {
12409 return false;
12410 }
12411
12412 if (!IsRuined() && !parent.IsRuined())
12413 {
12414 return true;
12415 }
12416
12417 return false;
12418 }
12419
12421 {
12422
12423
12424
12425
12426 return super.CanReceiveItemIntoCargo(item);
12427 }
12428
12430 {
12431
12432
12433
12434
12435 GameInventory attachmentInv = attachment.GetInventory();
12437 {
12438 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12439 return false;
12440 }
12441
12442 InventoryLocation loc = new InventoryLocation();
12443 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12444 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12445 return false;
12446
12447 return super.CanReceiveAttachment(attachment, slotId);
12448 }
12449
12451 {
12452 if (!super.CanReleaseAttachment(attachment))
12453 return false;
12454
12455 return GetInventory().AreChildrenAccessible();
12456 }
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12479 {
12480 int id = muzzle_owner.GetMuzzleID();
12481 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12482
12483 if (WPOF_array)
12484 {
12485 for (int i = 0; i < WPOF_array.Count(); i++)
12486 {
12487 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12488
12489 if (WPOF)
12490 {
12491 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12492 }
12493 }
12494 }
12495 }
12496
12497
12499 {
12500 int id = muzzle_owner.GetMuzzleID();
12502
12503 if (WPOBE_array)
12504 {
12505 for (int i = 0; i < WPOBE_array.Count(); i++)
12506 {
12507 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12508
12509 if (WPOBE)
12510 {
12511 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12512 }
12513 }
12514 }
12515 }
12516
12517
12519 {
12520 int id = muzzle_owner.GetMuzzleID();
12521 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12522
12523 if (WPOOH_array)
12524 {
12525 for (int i = 0; i < WPOOH_array.Count(); i++)
12526 {
12527 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12528
12529 if (WPOOH)
12530 {
12531 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12532 }
12533 }
12534 }
12535 }
12536
12537
12539 {
12540 int id = muzzle_owner.GetMuzzleID();
12541 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12542
12543 if (WPOOH_array)
12544 {
12545 for (int i = 0; i < WPOOH_array.Count(); i++)
12546 {
12547 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12548
12549 if (WPOOH)
12550 {
12551 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12552 }
12553 }
12554 }
12555 }
12556
12557
12559 {
12560 int id = muzzle_owner.GetMuzzleID();
12561 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12562
12563 if (WPOOH_array)
12564 {
12565 for (int i = 0; i < WPOOH_array.Count(); i++)
12566 {
12567 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12568
12569 if (WPOOH)
12570 {
12571 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12572 }
12573 }
12574 }
12575 }
12576
12577
12578
12580 {
12582 {
12583 return true;
12584 }
12585
12586 return false;
12587 }
12588
12590 {
12592 {
12593 return true;
12594 }
12595
12596 return false;
12597 }
12598
12600 {
12602 {
12603 return true;
12604 }
12605
12606 return false;
12607 }
12608
12610 {
12611 return false;
12612 }
12613
12616 {
12617 return UATimeSpent.DEFAULT_DEPLOY;
12618 }
12619
12620
12621
12622
12624 {
12626 SetSynchDirty();
12627 }
12628
12630 {
12632 }
12633
12634
12636 {
12637 return false;
12638 }
12639
12642 {
12643 string att_type = "None";
12644
12645 if (ConfigIsExisting("soundAttType"))
12646 {
12647 att_type = ConfigGetString("soundAttType");
12648 }
12649
12651 }
12652
12654 {
12656 }
12657
12658
12659
12660
12661
12667
12669 {
12672
12674 }
12675
12676
12678 {
12680 return;
12681
12683
12686
12689
12690 SoundParameters params = new SoundParameters();
12694 }
12695
12696
12698 {
12700 {
12703
12704 SetSynchDirty();
12705
12708 }
12709 }
12710
12712 {
12714 }
12715
12716
12718 {
12720 return;
12721
12723 SetSynchDirty();
12724
12727 }
12728
12730 {
12733 }
12734
12736 {
12738 }
12739
12740 void OnApply(PlayerBase player);
12741
12743 {
12744 return 1.0;
12745 };
12746
12748 {
12750 }
12751
12753 {
12755 }
12756
12758
12760 {
12761 SetDynamicPhysicsLifeTime(0.01);
12763 }
12764
12766 {
12767 array<string> zone_names = new array<string>;
12768 GetDamageZones(zone_names);
12769 for (int i = 0; i < zone_names.Count(); i++)
12770 {
12771 SetHealthMax(zone_names.Get(i),"Health");
12772 }
12773 SetHealthMax("","Health");
12774 }
12775
12778 {
12779 float global_health = GetHealth01("","Health");
12780 array<string> zones = new array<string>;
12781 GetDamageZones(zones);
12782
12783 for (int i = 0; i < zones.Count(); i++)
12784 {
12785 SetHealth01(zones.Get(i),"Health",global_health);
12786 }
12787 }
12788
12791 {
12792 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12793 }
12794
12796 {
12797 if (!hasRootAsPlayer)
12798 {
12799 if (refParentIB)
12800 {
12801
12802 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12803 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12804
12805 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12806 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12807
12810 }
12811 else
12812 {
12813
12816 }
12817 }
12818 }
12819
12821 {
12823 {
12824 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12825 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12826 {
12827 float heatPermCoef = 1.0;
12829 while (ent)
12830 {
12831 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12832 ent = ent.GetHierarchyParent();
12833 }
12834
12835 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12836 }
12837 }
12838 }
12839
12841 {
12842
12843 EntityAI parent = GetHierarchyParent();
12844 if (!parent)
12845 {
12846 hasParent = false;
12847 hasRootAsPlayer = false;
12848 }
12849 else
12850 {
12851 hasParent = true;
12852 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12853 refParentIB =
ItemBase.Cast(parent);
12854 }
12855 }
12856
12857 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12858 {
12859
12860 }
12861
12863 {
12864
12865 return false;
12866 }
12867
12869 {
12870
12871
12872 return false;
12873 }
12874
12876 {
12877
12878 return false;
12879 }
12880
12883 {
12884 return !GetIsFrozen() &&
IsOpen();
12885 }
12886
12888 {
12889 bool hasParent = false, hasRootAsPlayer = false;
12891
12892 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12893 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12894
12895 if (wwtu || foodDecay)
12896 {
12900
12901 if (processWetness || processTemperature || processDecay)
12902 {
12904
12905 if (processWetness)
12906 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12907
12908 if (processTemperature)
12910
12911 if (processDecay)
12912 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12913 }
12914 }
12915 }
12916
12919 {
12921 }
12922
12924 {
12927
12928 return super.GetTemperatureFreezeThreshold();
12929 }
12930
12932 {
12935
12936 return super.GetTemperatureThawThreshold();
12937 }
12938
12940 {
12943
12944 return super.GetItemOverheatThreshold();
12945 }
12946
12948 {
12950 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12951
12952 return super.GetTemperatureFreezeTime();
12953 }
12954
12956 {
12958 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12959
12960 return super.GetTemperatureThawTime();
12961 }
12962
12967
12969 {
12970 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12971 }
12972
12974 {
12975 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12976 }
12977
12980 {
12982 }
12983
12985 {
12987 }
12988
12990 {
12992 }
12993
12996 {
12997 return null;
12998 }
12999
13002 {
13003 return false;
13004 }
13005
13007 {
13009 {
13012 if (!trg)
13013 {
13015 explosive = this;
13016 }
13017
13018 explosive.PairRemote(trg);
13020
13021 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13022 trg.SetPersistentPairID(persistentID);
13023 explosive.SetPersistentPairID(persistentID);
13024
13025 return true;
13026 }
13027 return false;
13028 }
13029
13032 {
13033 float ret = 1.0;
13036 ret *= GetHealth01();
13037
13038 return ret;
13039 }
13040
13041 #ifdef DEVELOPER
13042 override void SetDebugItem()
13043 {
13044 super.SetDebugItem();
13045 _itemBase = this;
13046 }
13047
13049 {
13050 string text = super.GetDebugText();
13051
13053 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13054
13055 return text;
13056 }
13057 #endif
13058
13060 {
13061 return true;
13062 }
13063
13065
13067
13069 {
13072 }
13073
13074
13082
13098
13099 [
Obsolete(
"Use ItemSoundHandler instead")]
13102 {
13103 if (!
g_Game.IsDedicatedServer())
13104 {
13105 if (ConfigIsExisting("attachSoundSet"))
13106 {
13107 string cfg_path = "";
13108 string soundset = "";
13109 string type_name =
GetType();
13110
13113 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13114 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13115
13116 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13117 {
13118 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13119 {
13120 if (cfg_slot_array[i] == slot_type)
13121 {
13122 soundset = cfg_soundset_array[i];
13123 break;
13124 }
13125 }
13126 }
13127
13128 if (soundset != "")
13129 {
13130 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13132 }
13133 }
13134 }
13135 }
13136
13138}
13139
13141{
13143 if (entity)
13144 {
13145 bool is_item = entity.IsInherited(
ItemBase);
13146 if (is_item && full_quantity)
13147 {
13150 }
13151 }
13152 else
13153 {
13155 return NULL;
13156 }
13157 return entity;
13158}
13159
13161{
13162 if (item)
13163 {
13164 if (health > 0)
13165 item.SetHealth("", "", health);
13166
13167 if (item.CanHaveTemperature())
13168 {
13170 if (item.CanFreeze())
13171 item.SetFrozen(false);
13172 }
13173
13174 if (item.HasEnergyManager())
13175 {
13176 if (quantity >= 0)
13177 {
13178 item.GetCompEM().SetEnergy0To1(quantity);
13179 }
13180 else
13181 {
13183 }
13184 }
13185 else if (item.IsMagazine())
13186 {
13187 Magazine mag = Magazine.Cast(item);
13188 if (quantity >= 0)
13189 {
13190 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13191 }
13192 else
13193 {
13195 }
13196
13197 }
13198 else
13199 {
13200 if (quantity >= 0)
13201 {
13202 item.SetQuantityNormalized(quantity, false);
13203 }
13204 else
13205 {
13207 }
13208
13209 }
13210 }
13211}
13212
13213#ifdef DEVELOPER
13215#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.