Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config(for Min 0 and Max 5000, value 2500 will result in 0.5)
8233{
8235 {
8236 return true;
8237 }
8238};
8239
8240
8241
8243{
8247
8249
8252
8253
8254
8255
8256
8265
8271
8276
8281
8302 protected bool m_IsResultOfSplit
8303
8305
8310
8311
8312
8314
8318
8319
8320
8322
8325
8326
8327
8333
8334
8342
8345
8346
8348
8349
8351
8352
8357
8358
8363
8364
8366
8367
8369 {
8374
8375 if (!
GetGame().IsDedicatedServer())
8376 {
8378 {
8380
8382 {
8384 }
8385 }
8386
8389 }
8390
8391 m_OldLocation = null;
8392
8394 {
8396 }
8397
8398 if (ConfigIsExisting("headSelectionsToHide"))
8399 {
8402 }
8403
8405 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8406 {
8408 }
8409
8411
8412 m_IsResultOfSplit = false;
8413
8415 }
8416
8418 {
8419 super.InitItemVariables();
8420
8426 m_Count = ConfigGetInt(
"count");
8427
8430
8435
8438
8443
8455
8459
8460
8463 if (ConfigIsExisting("canBeSplit"))
8464 {
8467 }
8468
8470 if (ConfigIsExisting("itemBehaviour"))
8472
8473
8476 RegisterNetSyncVariableInt("m_VarLiquidType");
8477 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8478
8479 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8480 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8481 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8482
8483 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8484 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8485 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8486 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8487
8488 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8489 RegisterNetSyncVariableBool("m_IsTakeable");
8490 RegisterNetSyncVariableBool("m_IsHologram");
8491
8494 {
8497 }
8498
8500
8502 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8504
8505 }
8506
8508 {
8510 }
8511
8513 {
8516 {
8521 }
8522 }
8523
8524 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8525 {
8527 {
8530 }
8531
8533 }
8534
8536 {
8542 }
8543
8545
8547 {
8549
8550 if (!action)
8551 {
8552 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8553 return;
8554 }
8555
8557 if (!ai)
8558 {
8560 return;
8561 }
8562
8564 if (!action_array)
8565 {
8566 action_array = new array<ActionBase_Basic>;
8568 }
8569 if (LogManager.IsActionLogEnable())
8570 {
8571 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8572 }
8573
8574 if (action_array.Find(action) != -1)
8575 {
8576 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8577 }
8578 else
8579 {
8580 action_array.Insert(action);
8581 }
8582 }
8583
8585 {
8587 ActionBase action = player.GetActionManager().GetAction(actionName);
8590
8591 if (action_array)
8592 {
8593 action_array.RemoveItem(action);
8594 }
8595 }
8596
8597
8598
8600 {
8601 ActionOverrideData overrideData = new ActionOverrideData();
8605
8607 if (!actionMap)
8608 {
8611 }
8612
8613 actionMap.Insert(this.
Type(), overrideData);
8614
8615 }
8616
8618
8620
8621
8623 {
8626
8629
8630 string config_to_search = "CfgVehicles";
8631 string muzzle_owner_config;
8632
8634 {
8635 if (IsInherited(Weapon))
8636 config_to_search = "CfgWeapons";
8637
8638 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8639
8640 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8641
8643
8644 if (config_OnFire_subclass_count > 0)
8645 {
8646 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8647
8648 for (int i = 0; i < config_OnFire_subclass_count; i++)
8649 {
8650 string particle_class = "";
8652 string config_OnFire_entry = config_OnFire_class + particle_class;
8653 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8654 WPOF_array.Insert(WPOF);
8655 }
8656
8657
8659 }
8660 }
8661
8663 {
8664 config_to_search = "CfgWeapons";
8665 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8666
8667 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8668
8670
8671 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8672 {
8673 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8674
8675 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8676 {
8677 string particle_class2 = "";
8679 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8680 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8681 WPOBE_array.Insert(WPOBE);
8682 }
8683
8684
8686 }
8687 }
8688 }
8689
8690
8692 {
8695
8697 {
8698 string config_to_search = "CfgVehicles";
8699
8700 if (IsInherited(Weapon))
8701 config_to_search = "CfgWeapons";
8702
8703 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8704 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8705
8706 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8707 {
8708
8710
8712 {
8714 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8716 return;
8717 }
8718
8721
8722
8723
8725 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8726
8727 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8728 {
8729 string particle_class = "";
8731 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8733
8734 if (entry_type == CT_CLASS)
8735 {
8736 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8737 WPOOH_array.Insert(WPOF);
8738 }
8739 }
8740
8741
8743 }
8744 }
8745 }
8746
8748 {
8750 }
8751
8753 {
8755 {
8757
8760
8763
8764 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8765 }
8766 }
8767
8769 {
8771 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8772
8774 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8775
8777 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8778
8780 {
8782 }
8783 }
8784
8786 {
8788 }
8789
8791 {
8794 else
8796
8798 {
8801 }
8802 else
8803 {
8806
8809 }
8810
8812 }
8813
8815 {
8817 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8818 }
8819
8821 {
8823 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8825 }
8826
8828 {
8830 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8831 }
8832
8834 {
8837
8838 OverheatingParticle OP = new OverheatingParticle();
8843
8845 }
8846
8848 {
8851
8852 return -1;
8853 }
8854
8856 {
8858 {
8861
8862 for (int i = count; i > 0; --i)
8863 {
8864 int id = i - 1;
8867
8870
8871 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8872 {
8873 if (p)
8874 {
8877 }
8878 }
8879 }
8880 }
8881 }
8882
8884 {
8886 {
8888 {
8889 int id = i - 1;
8891
8892 if (OP)
8893 {
8895
8896 if (p)
8897 {
8899 }
8900
8901 delete OP;
8902 }
8903 }
8904
8907 }
8908 }
8909
8912 {
8913 return 0.0;
8914 }
8915
8916
8918 {
8919 return 250;
8920 }
8921
8923 {
8924 return 0;
8925 }
8926
8929 {
8931 return true;
8932
8933 return false;
8934 }
8935
8938 {
8941
8943 {
8945 }
8946 else
8947 {
8948
8950 }
8951
8953 }
8954
8961 {
8962 return -1;
8963 }
8964
8965
8966
8967
8969 {
8971 {
8973 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8974
8975 if (r_index >= 0)
8976 {
8977 InventoryLocation r_il = new InventoryLocation;
8978 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8979
8980 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8983 {
8984 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8985 }
8987 {
8988 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8989 }
8990
8991 }
8992
8993 player.GetHumanInventory().ClearUserReservedLocation(this);
8994 }
8995
8998 }
8999
9000
9001
9002
9004 {
9005 return ItemBase.m_DebugActionsMask;
9006 }
9007
9009 {
9010 return ItemBase.m_DebugActionsMask & mask;
9011 }
9012
9014 {
9015 ItemBase.m_DebugActionsMask = mask;
9016 }
9017
9019 {
9020 ItemBase.m_DebugActionsMask |= mask;
9021 }
9022
9024 {
9025 ItemBase.m_DebugActionsMask &= ~mask;
9026 }
9027
9029 {
9031 {
9033 }
9034 else
9035 {
9037 }
9038 }
9039
9040
9042 {
9043 if (GetEconomyProfile())
9044 {
9045 float q_max = GetEconomyProfile().GetQuantityMax();
9046 if (q_max > 0)
9047 {
9048 float q_min = GetEconomyProfile().GetQuantityMin();
9049 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9050
9052 {
9053 ComponentEnergyManager comp = GetCompEM();
9055 {
9057 }
9058 }
9060 {
9062
9063 }
9064
9065 }
9066 }
9067 }
9068
9071 {
9072 EntityAI parent = GetHierarchyParent();
9073
9074 if (parent)
9075 {
9076 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9077 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9078 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9079 }
9080 }
9081
9084 {
9085 EntityAI parent = GetHierarchyParent();
9086
9087 if (parent)
9088 {
9089 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9090 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9091 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9092 }
9093 }
9094
9096 {
9097
9098
9099
9100
9102
9104 {
9105 if (ScriptInputUserData.CanStoreInputUserData())
9106 {
9107 ScriptInputUserData ctx = new ScriptInputUserData;
9113 ctx.
Write(use_stack_max);
9116
9118 {
9119 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9120 }
9121 }
9122 }
9123 else if (!
GetGame().IsMultiplayer())
9124 {
9126 }
9127 }
9128
9130 {
9132 }
9133
9135 {
9137 }
9138
9140 {
9142 }
9143
9145 {
9146
9147 return false;
9148 }
9149
9151 {
9152 return false;
9153 }
9154
9158 {
9159 return false;
9160 }
9161
9163 {
9164 return "";
9165 }
9166
9168
9170 {
9171 return false;
9172 }
9173
9175 {
9176 return true;
9177 }
9178
9179
9180
9182 {
9183 return true;
9184 }
9185
9187 {
9188 return true;
9189 }
9190
9192 {
9193 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 if (!is_being_placed)
9207 SetSynchDirty();
9208 }
9209
9210
9212
9214 {
9216 }
9217
9219 {
9221 }
9222
9224 {
9225 return 1;
9226 }
9227
9229 {
9230 return false;
9231 }
9232
9234 {
9236 SetSynchDirty();
9237 }
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
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
9274 {
9275 super.OnMovedInsideCargo(container);
9276
9277 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9278 }
9279
9280 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9281 {
9282 super.EEItemLocationChanged(oldLoc,newLoc);
9283
9284 PlayerBase new_player = null;
9285 PlayerBase old_player = null;
9286
9287 if (newLoc.GetParent())
9288 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9289
9290 if (oldLoc.GetParent())
9291 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9292
9294 {
9295 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9296
9297 if (r_index >= 0)
9298 {
9299 InventoryLocation r_il = new InventoryLocation;
9300 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9301
9302 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9305 {
9306 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9307 }
9309 {
9310 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9311 }
9312
9313 }
9314 }
9315
9317 {
9318 if (new_player)
9319 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9320
9321 if (new_player == old_player)
9322 {
9323
9324 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9325 {
9327 {
9328 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9329 {
9330 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9331 }
9332 }
9333 else
9334 {
9335 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9336 }
9337 }
9338
9339 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9340 {
9341 int type = oldLoc.GetType();
9343 {
9344 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9345 }
9347 {
9348 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9349 }
9350 }
9351 if (!m_OldLocation)
9352 {
9353 m_OldLocation = new InventoryLocation;
9354 }
9355 m_OldLocation.Copy(oldLoc);
9356 }
9357 else
9358 {
9359 if (m_OldLocation)
9360 {
9361 m_OldLocation.Reset();
9362 }
9363 }
9364
9366 }
9367 else
9368 {
9369 if (new_player)
9370 {
9371 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9372 if (res_index >= 0)
9373 {
9374 InventoryLocation il = new InventoryLocation;
9375 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9377 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9380 {
9381 il.
GetParent().GetOnReleaseLock().Invoke(it);
9382 }
9384 {
9386 }
9387
9388 }
9389 }
9391 {
9392
9394 }
9395
9396 if (m_OldLocation)
9397 {
9398 m_OldLocation.Reset();
9399 }
9400 }
9401 }
9402
9403 override void EOnContact(IEntity other, Contact extra)
9404 {
9406 {
9407 int liquidType = -1;
9409 if (impactSpeed > 0.0)
9410 {
9412 #ifndef SERVER
9414 #else
9416 SetSynchDirty();
9417 #endif
9419 }
9420 }
9421
9422 #ifdef SERVER
9423 if (GetCompEM() && GetCompEM().IsPlugged())
9424 {
9425 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9426 GetCompEM().UnplugThis();
9427 }
9428 #endif
9429 }
9430
9432
9434 {
9436 }
9437
9439 {
9440
9441 }
9442
9444 {
9445 super.OnItemLocationChanged(old_owner, new_owner);
9446
9447 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9448 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9449
9450 if (!relatedPlayer && playerNew)
9451 relatedPlayer = playerNew;
9452
9453 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9454 {
9456 if (actionMgr)
9457 {
9458 ActionBase currentAction = actionMgr.GetRunningAction();
9459 if (currentAction)
9461 }
9462 }
9463
9464 Man ownerPlayerOld = null;
9465 Man ownerPlayerNew = null;
9466
9467 if (old_owner)
9468 {
9469 if (old_owner.
IsMan())
9470 {
9471 ownerPlayerOld = Man.Cast(old_owner);
9472 }
9473 else
9474 {
9475 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9476 }
9477 }
9478 else
9479 {
9481 {
9483
9484 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9485 {
9486 GetCompEM().UnplugThis();
9487 }
9488 }
9489 }
9490
9491 if (new_owner)
9492 {
9493 if (new_owner.
IsMan())
9494 {
9495 ownerPlayerNew = Man.Cast(new_owner);
9496 }
9497 else
9498 {
9499 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9500 }
9501 }
9502
9503 if (ownerPlayerOld != ownerPlayerNew)
9504 {
9505 if (ownerPlayerOld)
9506 {
9507 array<EntityAI> subItemsExit = new array<EntityAI>;
9509 for (int i = 0; i < subItemsExit.Count(); i++)
9510 {
9513 }
9514 }
9515
9516 if (ownerPlayerNew)
9517 {
9518 array<EntityAI> subItemsEnter = new array<EntityAI>;
9520 for (int j = 0; j < subItemsEnter.Count(); j++)
9521 {
9524 }
9525 }
9526 }
9527 else if (ownerPlayerNew != null)
9528 {
9529 PlayerBase nplayer;
9530 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9531 {
9532 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9534 for (int k = 0; k < subItemsUpdate.Count(); k++)
9535 {
9537 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9538 }
9539 }
9540 }
9541
9542 if (old_owner)
9543 old_owner.OnChildItemRemoved(this);
9544 if (new_owner)
9545 new_owner.OnChildItemReceived(this);
9546 }
9547
9548
9550 {
9551 super.EEDelete(parent);
9552 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9553 if (player)
9554 {
9556
9557 if (player.IsAlive())
9558 {
9559 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9560 if (r_index >= 0)
9561 {
9562 InventoryLocation r_il = new InventoryLocation;
9563 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9564
9565 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9568 {
9569 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9570 }
9572 {
9573 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9574 }
9575
9576 }
9577
9578 player.RemoveQuickBarEntityShortcut(this);
9579 }
9580 }
9581 }
9582
9584 {
9585 super.EEKilled(killer);
9586
9589 {
9590 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9591 {
9592 if (IsMagazine())
9593 {
9594 if (Magazine.Cast(this).GetAmmoCount() > 0)
9595 {
9597 }
9598 }
9599 else
9600 {
9602 }
9603 }
9604 }
9605 }
9606
9608 {
9609 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9610
9611 super.OnWasAttached(parent, slot_id);
9612
9615
9617 }
9618
9620 {
9621 super.OnWasDetached(parent, slot_id);
9622
9625 }
9626
9628 {
9629 int idx;
9632
9633 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9634 if (inventory_slots.Count() < 1)
9635 {
9636 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9637 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9638 }
9639 else
9640 {
9641 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9642 }
9643
9644 idx = inventory_slots.Find(slot);
9645 if (idx < 0)
9646 return "";
9647
9648 return attach_types.Get(idx);
9649 }
9650
9652 {
9653 int idx = -1;
9654 string slot;
9655
9658
9659 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9660 if (inventory_slots.Count() < 1)
9661 {
9662 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9663 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9664 }
9665 else
9666 {
9667 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9668 if (detach_types.Count() < 1)
9669 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9670 }
9671
9672 for (int i = 0; i < inventory_slots.Count(); i++)
9673 {
9674 slot = inventory_slots.Get(i);
9675 }
9676
9677 if (slot != "")
9678 {
9679 if (detach_types.Count() == 1)
9680 idx = 0;
9681 else
9682 idx = inventory_slots.Find(slot);
9683 }
9684 if (idx < 0)
9685 return "";
9686
9687 return detach_types.Get(idx);
9688 }
9689
9691 {
9692
9694
9695
9696 float min_time = 1;
9697 float max_time = 3;
9698 float delay = Math.RandomFloat(min_time, max_time);
9699
9700 explode_timer.Run(delay, this, "DoAmmoExplosion");
9701 }
9702
9704 {
9705 Magazine magazine = Magazine.Cast(this);
9706 int pop_sounds_count = 6;
9707 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9708
9709
9710 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9711 string sound_name = pop_sounds[ sound_idx ];
9713
9714
9715 magazine.ServerAddAmmoCount(-1);
9716
9717
9718 float min_temp_to_explode = 100;
9719
9720 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9721 {
9723 }
9724 }
9725
9726
9727 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9728 {
9729 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9730
9731 const int CHANCE_DAMAGE_CARGO = 4;
9732 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9733 const int CHANCE_DAMAGE_NOTHING = 2;
9734
9736 {
9737 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9738 int chances;
9739 int rnd;
9740
9741 if (GetInventory().GetCargo())
9742 {
9743 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9744 rnd = Math.RandomInt(0,chances);
9745
9746 if (rnd < CHANCE_DAMAGE_CARGO)
9747 {
9749 }
9750 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9751 {
9753 }
9754 }
9755 else
9756 {
9757 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9758 rnd = Math.RandomInt(0,chances);
9759
9760 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9761 {
9763 }
9764 }
9765 }
9766 }
9767
9769 {
9770 if (GetInventory().GetCargo())
9771 {
9772 int item_count = GetInventory().GetCargo().GetItemCount();
9773 if (item_count > 0)
9774 {
9775 int random_pick = Math.RandomInt(0, item_count);
9777 if (!item.IsExplosive())
9778 {
9779 item.AddHealth("","",damage);
9780 return true;
9781 }
9782 }
9783 }
9784 return false;
9785 }
9786
9788 {
9789 int attachment_count = GetInventory().AttachmentCount();
9790 if (attachment_count > 0)
9791 {
9792 int random_pick = Math.RandomInt(0, attachment_count);
9793 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9794 if (!attachment.IsExplosive())
9795 {
9796 attachment.AddHealth("","",damage);
9797 return true;
9798 }
9799 }
9800 return false;
9801 }
9802
9804 {
9806 }
9807
9809 {
9811 return GetInventory().CanRemoveEntity();
9812
9813 return false;
9814 }
9815
9817 {
9818
9820 return false;
9821
9822
9824 return false;
9825
9826
9827
9829 if (delta == 0)
9830 return false;
9831
9832
9833 return true;
9834 }
9835
9837 {
9839 {
9840 if (ScriptInputUserData.CanStoreInputUserData())
9841 {
9842 ScriptInputUserData ctx = new ScriptInputUserData;
9847 ctx.
Write(destination_entity);
9851 }
9852 }
9853 else if (!
GetGame().IsMultiplayer())
9854 {
9856 }
9857 }
9858
9860 {
9861 float split_quantity_new;
9865 InventoryLocation loc = new InventoryLocation;
9866
9867 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9868 {
9870 split_quantity_new = stack_max;
9871 else
9873
9875 {
9876 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9877 if (new_item)
9878 {
9879 new_item.SetResultOfSplit(true);
9880 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9882 new_item.
SetQuantity(split_quantity_new,
false,
true);
9883 }
9884 }
9885 }
9886 else if (destination_entity && slot_id == -1)
9887 {
9888 if (quantity > stack_max)
9889 split_quantity_new = stack_max;
9890 else
9891 split_quantity_new = quantity;
9892
9894 {
9896 {
9899 }
9900
9901 if (new_item)
9902 {
9903 new_item.SetResultOfSplit(true);
9904 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9906 new_item.
SetQuantity(split_quantity_new,
false,
true);
9907 }
9908 }
9909 }
9910 else
9911 {
9912 if (stack_max != 0)
9913 {
9915 {
9917 }
9918
9919 if (split_quantity_new == 0)
9920 {
9921 if (!
GetGame().IsMultiplayer())
9922 player.PhysicalPredictiveDropItem(this);
9923 else
9924 player.ServerDropEntity(this);
9925 return;
9926 }
9927
9929 {
9931
9932 if (new_item)
9933 {
9934 new_item.SetResultOfSplit(true);
9935 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9938 new_item.PlaceOnSurface();
9939 }
9940 }
9941 }
9942 }
9943 }
9944
9946 {
9947 float split_quantity_new;
9951 InventoryLocation loc = new InventoryLocation;
9952
9953 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9954 {
9956 split_quantity_new = stack_max;
9957 else
9959
9961 {
9962 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9963 if (new_item)
9964 {
9965 new_item.SetResultOfSplit(true);
9966 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9968 new_item.
SetQuantity(split_quantity_new,
false,
true);
9969 }
9970 }
9971 }
9972 else if (destination_entity && slot_id == -1)
9973 {
9974 if (quantity > stack_max)
9975 split_quantity_new = stack_max;
9976 else
9977 split_quantity_new = quantity;
9978
9980 {
9982 {
9985 }
9986
9987 if (new_item)
9988 {
9989 new_item.SetResultOfSplit(true);
9990 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9992 new_item.
SetQuantity(split_quantity_new,
false,
true);
9993 }
9994 }
9995 }
9996 else
9997 {
9998 if (stack_max != 0)
9999 {
10001 {
10003 }
10004
10006 {
10008
10009 if (new_item)
10010 {
10011 new_item.SetResultOfSplit(true);
10012 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10015 new_item.PlaceOnSurface();
10016 }
10017 }
10018 }
10019 }
10020 }
10021
10023 {
10025 {
10026 if (ScriptInputUserData.CanStoreInputUserData())
10027 {
10028 ScriptInputUserData ctx = new ScriptInputUserData;
10033 dst.WriteToContext(ctx);
10035 }
10036 }
10037 else if (!
GetGame().IsMultiplayer())
10038 {
10040 }
10041 }
10042
10044 {
10046 {
10047 if (ScriptInputUserData.CanStoreInputUserData())
10048 {
10049 ScriptInputUserData ctx = new ScriptInputUserData;
10054 ctx.
Write(destination_entity);
10060 }
10061 }
10062 else if (!
GetGame().IsMultiplayer())
10063 {
10065 }
10066 }
10067
10069 {
10071 }
10072
10074 {
10076 float split_quantity_new;
10078 if (dst.IsValid())
10079 {
10080 int slot_id = dst.GetSlot();
10082
10083 if (quantity > stack_max)
10084 split_quantity_new = stack_max;
10085 else
10086 split_quantity_new = quantity;
10087
10089 {
10091
10092 if (new_item)
10093 {
10094 new_item.SetResultOfSplit(true);
10095 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10097 new_item.
SetQuantity(split_quantity_new,
false,
true);
10098 }
10099
10100 return new_item;
10101 }
10102 }
10103
10104 return null;
10105 }
10106
10108 {
10110 float split_quantity_new;
10112 if (destination_entity)
10113 {
10115 if (quantity > stackable)
10116 split_quantity_new = stackable;
10117 else
10118 split_quantity_new = quantity;
10119
10121 {
10122 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10123 if (new_item)
10124 {
10125 new_item.SetResultOfSplit(true);
10126 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10128 new_item.
SetQuantity(split_quantity_new,
false,
true);
10129 }
10130 }
10131 }
10132 }
10133
10135 {
10137 {
10138 if (ScriptInputUserData.CanStoreInputUserData())
10139 {
10140 ScriptInputUserData ctx = new ScriptInputUserData;
10145 ItemBase destination_entity =
this;
10146 ctx.
Write(destination_entity);
10150 }
10151 }
10152 else if (!
GetGame().IsMultiplayer())
10153 {
10155 }
10156 }
10157
10159 {
10161 float split_quantity_new;
10163 if (player)
10164 {
10166 if (quantity > stackable)
10167 split_quantity_new = stackable;
10168 else
10169 split_quantity_new = quantity;
10170
10172 {
10173 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10174 new_item =
ItemBase.Cast(in_hands);
10175 if (new_item)
10176 {
10177 new_item.SetResultOfSplit(true);
10178 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10180 new_item.SetQuantity(split_quantity_new, false, true);
10181 }
10182 }
10183 }
10184 }
10185
10187 {
10189 float split_quantity_new = Math.Floor(quantity * 0.5);
10190
10192 return;
10193
10195
10196 if (new_item)
10197 {
10198 if (new_item.GetQuantityMax() < split_quantity_new)
10199 {
10200 split_quantity_new = new_item.GetQuantityMax();
10201 }
10202
10203 new_item.SetResultOfSplit(true);
10204 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10205
10207 {
10210 }
10211 else
10212 {
10214 new_item.
SetQuantity(split_quantity_new,
false,
true);
10215 }
10216 }
10217 }
10218
10220 {
10222 float split_quantity_new = Math.Floor(quantity / 2);
10223
10225 return;
10226
10227 InventoryLocation invloc = new InventoryLocation;
10229
10231 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10232
10233 if (new_item)
10234 {
10235 if (new_item.GetQuantityMax() < split_quantity_new)
10236 {
10237 split_quantity_new = new_item.GetQuantityMax();
10238 }
10240 {
10243 }
10244 else if (split_quantity_new > 1)
10245 {
10247 new_item.
SetQuantity(split_quantity_new,
false,
true);
10248 }
10249 }
10250 }
10251
10254 {
10255 SetWeightDirty();
10257
10258 if (parent)
10259 parent.OnAttachmentQuantityChangedEx(this, delta);
10260
10262 {
10264 {
10266 }
10268 {
10269 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10271 }
10272 }
10273
10274 }
10275
10278 {
10279
10280 }
10281
10284 {
10286 }
10287
10289 {
10290 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10291
10293 {
10294 if (newLevel == GameConstants.STATE_RUINED)
10295 {
10297 EntityAI parent = GetHierarchyParent();
10298 if (parent && parent.IsFireplace())
10299 {
10300 CargoBase cargo = GetInventory().GetCargo();
10301 if (cargo)
10302 {
10304 {
10306 }
10307 }
10308 }
10309 }
10310
10312 {
10313
10315 return;
10316 }
10317
10318 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10319 {
10321 }
10322 }
10323 }
10324
10325
10327 {
10328 super.OnRightClick();
10329
10331 {
10333 {
10334 if (ScriptInputUserData.CanStoreInputUserData())
10335 {
10336 EntityAI root = GetHierarchyRoot();
10337 Man playerOwner = GetHierarchyRootPlayer();
10338 InventoryLocation dst = new InventoryLocation;
10339
10340
10341 if (!playerOwner && root && root == this)
10342 {
10344 }
10345 else
10346 {
10347
10348 GetInventory().GetCurrentInventoryLocation(dst);
10350 {
10353 {
10355 }
10356 else
10357 {
10359
10360
10361 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10362 {
10364 }
10365 else
10366 {
10367 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10368 }
10369 }
10370 }
10371 }
10372
10373 ScriptInputUserData ctx = new ScriptInputUserData;
10381 }
10382 }
10383 else if (!
GetGame().IsMultiplayer())
10384 {
10386 }
10387 }
10388 }
10389
10391 {
10392 if (root)
10393 {
10394 vector m4[4];
10395 root.GetTransform(m4);
10396 dst.SetGround(this, m4);
10397 }
10398 else
10399 {
10400 GetInventory().GetCurrentInventoryLocation(dst);
10401 }
10402 }
10403
10404 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10405 {
10406
10407 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10408 return false;
10409
10410 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10411 return false;
10412
10413
10415 return false;
10416
10417
10418 Magazine mag = Magazine.Cast(this);
10419 if (mag)
10420 {
10421 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10422 return false;
10423
10424 if (stack_max_limit)
10425 {
10426 Magazine other_mag = Magazine.Cast(other_item);
10427 if (other_item)
10428 {
10429 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10430 return false;
10431 }
10432
10433 }
10434 }
10435 else
10436 {
10437
10439 return false;
10440
10442 return false;
10443 }
10444
10445 PlayerBase player = null;
10446 if (CastTo(player, GetHierarchyRootPlayer()))
10447 {
10448 if (player.GetInventory().HasAttachment(this))
10449 return false;
10450
10451 if (player.IsItemsToDelete())
10452 return false;
10453 }
10454
10455 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10456 return false;
10457
10458 int slotID;
10460 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10461 return false;
10462
10463 return true;
10464 }
10465
10467 {
10469 }
10470
10472 {
10473 return m_IsResultOfSplit;
10474 }
10475
10477 {
10478 m_IsResultOfSplit = value;
10479 }
10480
10482 {
10484 }
10485
10487 {
10488 float other_item_quantity = other_item.GetQuantity();
10489 float this_free_space;
10490
10492
10494
10495 if (other_item_quantity > this_free_space)
10496 {
10497 return this_free_space;
10498 }
10499 else
10500 {
10501 return other_item_quantity;
10502 }
10503 }
10504
10506 {
10508 }
10509
10511 {
10513 return;
10514
10515 if (!IsMagazine() && other_item)
10516 {
10518 if (quantity_used != 0)
10519 {
10520 float hp1 = GetHealth01("","");
10521 float hp2 = other_item.GetHealth01("","");
10522 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10523 hpResult = hpResult / (
GetQuantity() + quantity_used);
10524
10525 hpResult *= GetMaxHealth();
10526 Math.Round(hpResult);
10527 SetHealth("", "Health", hpResult);
10528
10530 other_item.AddQuantity(-quantity_used);
10531 }
10532 }
10534 }
10535
10537 {
10538 #ifdef SERVER
10539 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10540 GetHierarchyParent().IncreaseLifetimeUp();
10541 #endif
10542 };
10543
10545 {
10546 PlayerBase p = PlayerBase.Cast(player);
10547
10548 array<int> recipesIds = p.m_Recipes;
10549 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10550 if (moduleRecipesManager)
10551 {
10552 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10553 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10554 }
10555
10556 for (int i = 0;i < recipesIds.Count(); i++)
10557 {
10558 int key = recipesIds.Get(i);
10559 string recipeName = moduleRecipesManager.GetRecipeName(key);
10561 }
10562 }
10563
10564
10565 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10566 {
10567 super.GetDebugActions(outputList);
10568
10569
10575
10576
10581
10586
10587
10591
10592
10594 {
10598 }
10599
10602
10603
10607
10609
10610 InventoryLocation loc = new InventoryLocation();
10611 GetInventory().GetCurrentInventoryLocation(loc);
10613 {
10614 if (Gizmo_IsSupported())
10617 }
10618
10620 }
10621
10622
10623
10624
10626 {
10627 super.OnAction(action_id, player, ctx);
10628
10630 {
10631 switch (action_id)
10632 {
10635 return true;
10638 return true;
10639 }
10640 }
10641
10643 {
10644 switch (action_id)
10645 {
10647 Delete();
10648 return true;
10649 }
10650 }
10651
10652 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10653 {
10654 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10655 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10656 PlayerBase p = PlayerBase.Cast(player);
10657 if (
EActions.RECIPES_RANGE_START < 1000)
10658 {
10659 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10660 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10661 }
10662 }
10663 #ifndef SERVER
10664 else if (action_id ==
EActions.WATCH_PLAYER)
10665 {
10666 PluginDeveloper.SetDeveloperItemClientEx(player);
10667 }
10668 #endif
10670 {
10671 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10672 {
10673 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10674 OnDebugButtonPressServer(id + 1);
10675 }
10676
10677 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10678 {
10679 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10681 }
10682
10683 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10684 {
10685 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10687 }
10688
10689 else if (action_id ==
EActions.ADD_QUANTITY)
10690 {
10691 if (IsMagazine())
10692 {
10693 Magazine mag = Magazine.Cast(this);
10694 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10695 }
10696 else
10697 {
10699 }
10700
10701 if (m_EM)
10702 {
10703 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10704 }
10705
10706 }
10707
10708 else if (action_id ==
EActions.REMOVE_QUANTITY)
10709 {
10710 if (IsMagazine())
10711 {
10712 Magazine mag2 = Magazine.Cast(this);
10713 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10714 }
10715 else
10716 {
10718 }
10719 if (m_EM)
10720 {
10721 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10722 }
10723
10724 }
10725
10726 else if (action_id ==
EActions.SET_QUANTITY_0)
10727 {
10729
10730 if (m_EM)
10731 {
10732 m_EM.SetEnergy(0);
10733 }
10734 }
10735
10736 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10737 {
10739
10740 if (m_EM)
10741 {
10742 m_EM.SetEnergy(m_EM.GetEnergyMax());
10743 }
10744 }
10745
10746 else if (action_id ==
EActions.ADD_HEALTH)
10747 {
10748 AddHealth("","",GetMaxHealth("","Health")/5);
10749 }
10750 else if (action_id ==
EActions.REMOVE_HEALTH)
10751 {
10752 AddHealth("","",-GetMaxHealth("","Health")/5);
10753 }
10754 else if (action_id ==
EActions.DESTROY_HEALTH)
10755 {
10756 SetHealth01("","",0);
10757 }
10758 else if (action_id ==
EActions.WATCH_ITEM)
10759 {
10761 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10762 #ifdef DEVELOPER
10763 SetDebugDeveloper_item(this);
10764 #endif
10765 }
10766
10767 else if (action_id ==
EActions.ADD_TEMPERATURE)
10768 {
10769 AddTemperature(20);
10770
10771 }
10772
10773 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10774 {
10775 AddTemperature(-20);
10776
10777 }
10778
10779 else if (action_id ==
EActions.FLIP_FROZEN)
10780 {
10781 SetFrozen(!GetIsFrozen());
10782
10783 }
10784
10785 else if (action_id ==
EActions.ADD_WETNESS)
10786 {
10788
10789 }
10790
10791 else if (action_id ==
EActions.REMOVE_WETNESS)
10792 {
10794
10795 }
10796
10797 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10798 {
10801
10802
10803 }
10804
10805 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10806 {
10809 }
10810
10811 else if (action_id ==
EActions.MAKE_SPECIAL)
10812 {
10813 auto debugParams = DebugSpawnParams.WithPlayer(player);
10814 OnDebugSpawnEx(debugParams);
10815 }
10816
10817 }
10818
10819
10820 return false;
10821 }
10822
10823
10824
10825
10829
10832
10833
10834
10836 {
10837 return false;
10838 }
10839
10840
10842 {
10843 return true;
10844 }
10845
10846
10848 {
10849 return true;
10850 }
10851
10852
10853
10855 {
10856 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10858 }
10859
10862 {
10863 return null;
10864 }
10865
10867 {
10868 return false;
10869 }
10870
10872 {
10873 return false;
10874 }
10875
10879
10880
10882 {
10883 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10884 return module_repairing.CanRepair(this, item_repair_kit);
10885 }
10886
10887
10888 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10889 {
10890 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10891 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10892 }
10893
10894
10896 {
10897
10898
10899
10900
10901
10902
10903
10904
10905 return 1;
10906 }
10907
10908
10909
10911 {
10913 }
10914
10915
10916
10918 {
10920 }
10921
10922
10931 {
10932 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10933
10934 if (player)
10935 {
10936 player.MessageStatus(text);
10937 }
10938 }
10939
10940
10949 {
10950 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10951
10952 if (player)
10953 {
10954 player.MessageAction(text);
10955 }
10956 }
10957
10958
10967 {
10968 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10969
10970 if (player)
10971 {
10972 player.MessageFriendly(text);
10973 }
10974 }
10975
10976
10985 {
10986 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10987
10988 if (player)
10989 {
10990 player.MessageImportant(text);
10991 }
10992 }
10993
10995 {
10996 return true;
10997 }
10998
10999
11000 override bool KindOf(
string tag)
11001 {
11002 bool found = false;
11003 string item_name = this.
GetType();
11006
11007 int array_size = item_tag_array.Count();
11008 for (int i = 0; i < array_size; i++)
11009 {
11010 if (item_tag_array.Get(i) == tag)
11011 {
11012 found = true;
11013 break;
11014 }
11015 }
11016 return found;
11017 }
11018
11019
11021 {
11022
11023 super.OnRPC(sender, rpc_type,ctx);
11024
11025
11026 switch (rpc_type)
11027 {
11028 #ifndef SERVER
11029 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11030 Param2<bool, string> p = new Param2<bool, string>(false, "");
11031
11033 return;
11034
11035 bool play = p.param1;
11036 string soundSet = p.param2;
11037
11038 if (play)
11039 {
11041 {
11043 {
11045 }
11046 }
11047 else
11048 {
11050 }
11051 }
11052 else
11053 {
11055 }
11056
11057 break;
11058 #endif
11059
11060 }
11061
11063 {
11065 }
11066 }
11067
11068
11069
11070
11072 {
11073 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11074 return plugin.GetID(
name);
11075 }
11076
11078 {
11079 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11080 return plugin.GetName(id);
11081 }
11082
11085 {
11086
11087
11088 int varFlags;
11089 if (!ctx.
Read(varFlags))
11090 return;
11091
11092 if (varFlags & ItemVariableFlags.FLOAT)
11093 {
11095 }
11096 }
11097
11099 {
11100
11101 super.SerializeNumericalVars(floats_out);
11102
11103
11104
11106 {
11108 }
11109
11111 {
11113 }
11114
11116 {
11118 }
11119
11121 {
11126 }
11127
11129 {
11131 }
11132 }
11133
11135 {
11136
11137 super.DeSerializeNumericalVars(floats);
11138
11139
11140 int index = 0;
11141 int mask = Math.Round(floats.Get(index));
11142
11143 index++;
11144
11146 {
11148 {
11150 }
11151 else
11152 {
11153 float quantity = floats.Get(index);
11154 SetQuantity(quantity,
true,
false,
false,
false);
11155 }
11156 index++;
11157 }
11158
11160 {
11161 float wet = floats.Get(index);
11163 index++;
11164 }
11165
11167 {
11168 int liquidtype = Math.Round(floats.Get(index));
11170 index++;
11171 }
11172
11174 {
11176 index++;
11178 index++;
11180 index++;
11182 index++;
11183 }
11184
11186 {
11187 int cleanness = Math.Round(floats.Get(index));
11189 index++;
11190 }
11191 }
11192
11194 {
11195 super.WriteVarsToCTX(ctx);
11196
11197
11199 {
11201 }
11202
11204 {
11206 }
11207
11209 {
11211 }
11212
11214 {
11215 int r,g,b,a;
11221 }
11222
11224 {
11226 }
11227 }
11228
11230 {
11231 if (!super.ReadVarsFromCTX(ctx,version))
11232 return false;
11233
11234 int intValue;
11235 float value;
11236
11237 if (version < 140)
11238 {
11239 if (!ctx.
Read(intValue))
11240 return false;
11241
11242 m_VariablesMask = intValue;
11243 }
11244
11246 {
11247 if (!ctx.
Read(value))
11248 return false;
11249
11251 {
11253 }
11254 else
11255 {
11257 }
11258 }
11259
11260 if (version < 140)
11261 {
11263 {
11264 if (!ctx.
Read(value))
11265 return false;
11266 SetTemperatureDirect(value);
11267 }
11268 }
11269
11271 {
11272 if (!ctx.
Read(value))
11273 return false;
11275 }
11276
11278 {
11279 if (!ctx.
Read(intValue))
11280 return false;
11282 }
11283
11285 {
11286 int r,g,b,a;
11288 return false;
11290 return false;
11292 return false;
11294 return false;
11295
11297 }
11298
11300 {
11301 if (!ctx.
Read(intValue))
11302 return false;
11304 }
11305
11306 if (version >= 138 && version < 140)
11307 {
11309 {
11310 if (!ctx.
Read(intValue))
11311 return false;
11312 SetFrozen(intValue);
11313 }
11314 }
11315
11316 return true;
11317 }
11318
11319
11321 {
11324 {
11326 }
11327
11328 if (!super.OnStoreLoad(ctx, version))
11329 {
11331 return false;
11332 }
11333
11334 if (version >= 114)
11335 {
11336 bool hasQuickBarIndexSaved;
11337
11338 if (!ctx.
Read(hasQuickBarIndexSaved))
11339 {
11341 return false;
11342 }
11343
11344 if (hasQuickBarIndexSaved)
11345 {
11346 int itmQBIndex;
11347
11348
11349 if (!ctx.
Read(itmQBIndex))
11350 {
11352 return false;
11353 }
11354
11355 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11356 if (itmQBIndex != -1 && parentPlayer)
11357 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11358 }
11359 }
11360 else
11361 {
11362
11363 PlayerBase player;
11364 int itemQBIndex;
11365 if (version ==
int.
MAX)
11366 {
11367 if (!ctx.
Read(itemQBIndex))
11368 {
11370 return false;
11371 }
11372 }
11373 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11374 {
11375
11376 if (!ctx.
Read(itemQBIndex))
11377 {
11379 return false;
11380 }
11381 if (itemQBIndex != -1 && player)
11382 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11383 }
11384 }
11385
11386 if (version < 140)
11387 {
11388
11389 if (!LoadVariables(ctx, version))
11390 {
11392 return false;
11393 }
11394 }
11395
11396
11398 {
11400 return false;
11401 }
11402 if (version >= 132)
11403 {
11405 if (raib)
11406 {
11408 {
11410 return false;
11411 }
11412 }
11413 }
11414
11416 return true;
11417 }
11418
11419
11420
11422 {
11423 super.OnStoreSave(ctx);
11424
11425 PlayerBase player;
11426 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11427 {
11429
11430 int itemQBIndex = -1;
11431 itemQBIndex = player.FindQuickBarEntityIndex(this);
11432 ctx.
Write(itemQBIndex);
11433 }
11434 else
11435 {
11437 }
11438
11440
11442 if (raib)
11443 {
11445 }
11446 }
11447
11448
11450 {
11451 super.AfterStoreLoad();
11452
11454 {
11456 }
11457
11459 {
11462 }
11463 }
11464
11466 {
11467 super.EEOnAfterLoad();
11468
11470 {
11472 }
11473
11476 }
11477
11479 {
11480 return false;
11481 }
11482
11483
11484
11486 {
11488 {
11489 #ifdef PLATFORM_CONSOLE
11490
11492 {
11494 if (menu)
11495 {
11497 }
11498 }
11499 #endif
11500 }
11501
11503 {
11506 }
11507
11509 {
11510 SetWeightDirty();
11512 }
11514 {
11517 }
11518
11520 {
11523 }
11525 {
11528 }
11529
11530 super.OnVariablesSynchronized();
11531 }
11532
11533
11534
11536 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11537 {
11538 if (!IsServerCheck(allow_client))
11539 return false;
11540
11542 return false;
11543
11546
11547 if (value <= (min + 0.001))
11548 value = min;
11549
11550 if (value == min)
11551 {
11552 if (destroy_config)
11553 {
11554 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11555 if (dstr)
11556 {
11558 this.Delete();
11559 return true;
11560 }
11561 }
11562 else if (destroy_forced)
11563 {
11565 this.Delete();
11566 return true;
11567 }
11568
11570 }
11571
11574
11576 {
11578
11579 if (delta)
11581 }
11582
11584
11585 return false;
11586 }
11587
11588
11590 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11591 {
11593 }
11594
11596 {
11599 }
11600
11602 {
11605 }
11606
11608 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11609 {
11610 float value_clamped = Math.Clamp(value, 0, 1);
11612 SetQuantity(result, destroy_config, destroy_forced);
11613 }
11614
11615
11618 {
11620 }
11621
11623 {
11625 }
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11637 {
11638 int slot = -1;
11639 if (GetInventory())
11640 {
11641 InventoryLocation il = new InventoryLocation;
11642 GetInventory().GetCurrentInventoryLocation(il);
11644 }
11645
11647 }
11648
11650 {
11651 float quantity_max = 0;
11652
11654 {
11655 if (attSlotID != -1)
11656 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11657
11658 if (quantity_max <= 0)
11660 }
11661
11662 if (quantity_max <= 0)
11664
11665 return quantity_max;
11666 }
11667
11669 {
11671 }
11672
11674 {
11676 }
11677
11678
11680 {
11682 }
11683
11685 {
11687 }
11688
11690 {
11692 }
11693
11694
11696 {
11697
11698 float weightEx = GetWeightEx();
11699 float special = GetInventoryAndCargoWeight();
11700 return weightEx - special;
11701 }
11702
11703
11705 {
11707 }
11708
11710 {
11712 {
11713 #ifdef DEVELOPER
11714 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11715 {
11716 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11718 }
11719 #endif
11720
11721 return GetQuantity() * GetConfigWeightModified();
11722 }
11723 else if (HasEnergyManager())
11724 {
11725 #ifdef DEVELOPER
11726 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11727 {
11728 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11729 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11730 }
11731 #endif
11732 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11733 }
11734 else
11735 {
11736 #ifdef DEVELOPER
11737 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11738 {
11739 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11740 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11741 }
11742 #endif
11743 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11744 }
11745 }
11746
11749 {
11750 int item_count = 0;
11752
11753 if (GetInventory().GetCargo() != NULL)
11754 {
11755 item_count = GetInventory().GetCargo().GetItemCount();
11756 }
11757
11758 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11759 {
11760 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11761 if (item)
11762 item_count += item.GetNumberOfItems();
11763 }
11764 return item_count;
11765 }
11766
11769 {
11770 float weight = 0;
11771 float wetness = 1;
11772 if (include_wetness)
11775 {
11776 weight = wetness * m_ConfigWeight;
11777 }
11779 {
11780 weight = 1;
11781 }
11782 return weight;
11783 }
11784
11785
11786
11788 {
11789 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11790 {
11791 GameInventory inv = GetInventory();
11792 array<EntityAI> items = new array<EntityAI>;
11794 for (int i = 0; i < items.Count(); i++)
11795 {
11797 if (item)
11798 {
11800 }
11801 }
11802 }
11803 }
11804
11805
11806
11807
11809 {
11810 float energy = 0;
11811 if (HasEnergyManager())
11812 {
11813 energy = GetCompEM().GetEnergy();
11814 }
11815 return energy;
11816 }
11817
11818
11820 {
11821 super.OnEnergyConsumed();
11822
11824 }
11825
11827 {
11828 super.OnEnergyAdded();
11829
11831 }
11832
11833
11835 {
11836 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11837 {
11839 {
11840 float energy_0to1 = GetCompEM().GetEnergy0To1();
11842 }
11843 }
11844 }
11845
11846
11848 {
11849 return ConfigGetFloat("heatIsolation");
11850 }
11851
11853 {
11855 }
11856
11858 {
11859 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11860 if (
GetGame().ConfigIsExisting(paramPath))
11862
11863 return 0.0;
11864 }
11865
11867 {
11868 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11869 if (
GetGame().ConfigIsExisting(paramPath))
11871
11872 return 0.0;
11873 }
11874
11875 override void SetWet(
float value,
bool allow_client =
false)
11876 {
11877 if (!IsServerCheck(allow_client))
11878 return;
11879
11882
11884
11885 m_VarWet = Math.Clamp(value, min, max);
11886
11888 {
11891 }
11892 }
11893
11894 override void AddWet(
float value)
11895 {
11897 }
11898
11900 {
11902 }
11903
11905 {
11907 }
11908
11910 {
11912 }
11913
11915 {
11917 }
11918
11920 {
11922 }
11923
11924 override void OnWetChanged(
float newVal,
float oldVal)
11925 {
11928 if (newLevel != oldLevel)
11929 {
11931 }
11932 }
11933
11935 {
11936 SetWeightDirty();
11937 }
11938
11940 {
11941 return GetWetLevelInternal(
m_VarWet);
11942 }
11943
11944
11945
11947 {
11949 }
11950
11952 {
11954 }
11955
11957 {
11959 }
11960
11962 {
11964 }
11965
11966
11967
11969 {
11970 if (ConfigIsExisting("itemModelLength"))
11971 {
11972 return ConfigGetFloat("itemModelLength");
11973 }
11974 return 0;
11975 }
11976
11978 {
11979 if (ConfigIsExisting("itemAttachOffset"))
11980 {
11981 return ConfigGetFloat("itemAttachOffset");
11982 }
11983 return 0;
11984 }
11985
11986 override void SetCleanness(
int value,
bool allow_client =
false)
11987 {
11988 if (!IsServerCheck(allow_client))
11989 return;
11990
11992
11994
11997 }
11998
12000 {
12002 }
12003
12005 {
12006 return true;
12007 }
12008
12009
12010
12011
12013 {
12015 }
12016
12018 {
12020 }
12021
12022
12023
12024
12025 override void SetColor(
int r,
int g,
int b,
int a)
12026 {
12032 }
12034 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12035 {
12040 }
12041
12043 {
12045 }
12046
12049 {
12050 int r,g,b,a;
12052 r = r/255;
12053 g = g/255;
12054 b = b/255;
12055 a = a/255;
12056 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12057 }
12058
12059
12060
12061 override void SetLiquidType(
int value,
bool allow_client =
false)
12062 {
12063 if (!IsServerCheck(allow_client))
12064 return;
12065
12070 }
12071
12073 {
12074 return ConfigGetInt("varLiquidTypeInit");
12075 }
12076
12078 {
12080 }
12081
12083 {
12085 SetFrozen(false);
12086 }
12087
12090 {
12091 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12092 }
12093
12094
12097 {
12098 PlayerBase nplayer;
12099 if (PlayerBase.CastTo(nplayer, player))
12100 {
12102
12103 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12104 }
12105 }
12106
12107
12110 {
12111 PlayerBase nplayer;
12112 if (PlayerBase.CastTo(nplayer,player))
12113 {
12114
12115 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12116
12117 }
12118
12119
12120 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12121
12122
12123 if (HasEnergyManager())
12124 {
12125 GetCompEM().UpdatePlugState();
12126 }
12127 }
12128
12129
12131 {
12132 super.OnPlacementStarted(player);
12133
12135 }
12136
12137 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12138 {
12140 {
12141 m_AdminLog.OnPlacementComplete(player,
this);
12142 }
12143
12144 super.OnPlacementComplete(player, position, orientation);
12145 }
12146
12147
12148
12149
12150
12152 {
12154 {
12155 return true;
12156 }
12157 else
12158 {
12159 return false;
12160 }
12161 }
12162
12163
12165 {
12167 {
12169 }
12170 }
12171
12172
12174 {
12176 }
12177
12179 {
12181 }
12182
12183 override void InsertAgent(
int agent,
float count = 1)
12184 {
12185 if (count < 1)
12186 return;
12187
12189 }
12190
12193 {
12195 }
12196
12197
12199 {
12201 }
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12245 {
12247 return false;
12248 return true;
12249 }
12250
12252 {
12253
12255 }
12256
12257
12260 {
12261 super.CheckForRoofLimited(timeTresholdMS);
12262
12264 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12265 {
12266 m_PreviousRoofTestTime = time;
12267 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12268 }
12269 }
12270
12271
12273 {
12275 {
12276 return 0;
12277 }
12278
12279 if (GetInventory().GetAttachmentSlotsCount() != 0)
12280 {
12281 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12282 if (filter)
12283 return filter.GetProtectionLevel(type, false, system);
12284 else
12285 return 0;
12286 }
12287
12288 string subclassPath, entryName;
12289
12290 switch (type)
12291 {
12293 entryName = "biological";
12294 break;
12296 entryName = "chemical";
12297 break;
12298 default:
12299 entryName = "biological";
12300 break;
12301 }
12302
12303 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12304
12306 }
12307
12308
12309
12312 {
12313 if (!IsMagazine())
12315
12317 }
12318
12319
12320
12321
12322
12327 {
12328 return true;
12329 }
12330
12332 {
12334 }
12335
12336
12337
12338
12339
12341 {
12342 if (parent)
12343 {
12344 if (parent.IsInherited(DayZInfected))
12345 return true;
12346
12347 if (!parent.IsRuined())
12348 return true;
12349 }
12350
12351 return true;
12352 }
12353
12355 {
12356 if (!super.CanPutAsAttachment(parent))
12357 {
12358 return false;
12359 }
12360
12361 if (!IsRuined() && !parent.IsRuined())
12362 {
12363 return true;
12364 }
12365
12366 return false;
12367 }
12368
12370 {
12371
12372
12373
12374
12375 return super.CanReceiveItemIntoCargo(item);
12376 }
12377
12379 {
12380
12381
12382
12383
12384 GameInventory attachmentInv = attachment.GetInventory();
12386 {
12387 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12388 return false;
12389 }
12390
12391 InventoryLocation loc = new InventoryLocation();
12392 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12393 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12394 return false;
12395
12396 return super.CanReceiveAttachment(attachment, slotId);
12397 }
12398
12400 {
12401 if (!super.CanReleaseAttachment(attachment))
12402 return false;
12403
12404 return GetInventory().AreChildrenAccessible();
12405 }
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12428 {
12429 int id = muzzle_owner.GetMuzzleID();
12430 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12431
12432 if (WPOF_array)
12433 {
12434 for (int i = 0; i < WPOF_array.Count(); i++)
12435 {
12436 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12437
12438 if (WPOF)
12439 {
12440 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12441 }
12442 }
12443 }
12444 }
12445
12446
12448 {
12449 int id = muzzle_owner.GetMuzzleID();
12451
12452 if (WPOBE_array)
12453 {
12454 for (int i = 0; i < WPOBE_array.Count(); i++)
12455 {
12456 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12457
12458 if (WPOBE)
12459 {
12460 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12461 }
12462 }
12463 }
12464 }
12465
12466
12468 {
12469 int id = muzzle_owner.GetMuzzleID();
12470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12471
12472 if (WPOOH_array)
12473 {
12474 for (int i = 0; i < WPOOH_array.Count(); i++)
12475 {
12476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12477
12478 if (WPOOH)
12479 {
12480 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12481 }
12482 }
12483 }
12484 }
12485
12486
12488 {
12489 int id = muzzle_owner.GetMuzzleID();
12490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12491
12492 if (WPOOH_array)
12493 {
12494 for (int i = 0; i < WPOOH_array.Count(); i++)
12495 {
12496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12497
12498 if (WPOOH)
12499 {
12500 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12501 }
12502 }
12503 }
12504 }
12505
12506
12508 {
12509 int id = muzzle_owner.GetMuzzleID();
12510 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12511
12512 if (WPOOH_array)
12513 {
12514 for (int i = 0; i < WPOOH_array.Count(); i++)
12515 {
12516 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12517
12518 if (WPOOH)
12519 {
12520 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12521 }
12522 }
12523 }
12524 }
12525
12526
12527
12529 {
12531 {
12532 return true;
12533 }
12534
12535 return false;
12536 }
12537
12539 {
12541 {
12542 return true;
12543 }
12544
12545 return false;
12546 }
12547
12549 {
12551 {
12552 return true;
12553 }
12554
12555 return false;
12556 }
12557
12559 {
12560 return false;
12561 }
12562
12565 {
12566 return UATimeSpent.DEFAULT_DEPLOY;
12567 }
12568
12569
12570
12571
12573 {
12575 SetSynchDirty();
12576 }
12577
12579 {
12581 }
12582
12583
12585 {
12586 return false;
12587 }
12588
12591 {
12592 string att_type = "None";
12593
12594 if (ConfigIsExisting("soundAttType"))
12595 {
12596 att_type = ConfigGetString("soundAttType");
12597 }
12598
12600 }
12601
12603 {
12605 }
12606
12607
12608
12609
12610
12616
12618 {
12621
12623 }
12624
12625
12627 {
12629 return;
12630
12632
12635
12638
12639 SoundParameters params = new SoundParameters();
12643 }
12644
12645
12647 {
12649 return;
12650
12652 SetSynchDirty();
12653
12656 }
12657
12658
12660 {
12662 return;
12663
12665 SetSynchDirty();
12666
12669 }
12670
12672 {
12674 }
12675
12677 {
12679 }
12680
12683 {
12684 if (!
GetGame().IsDedicatedServer())
12685 {
12686 if (ConfigIsExisting("attachSoundSet"))
12687 {
12688 string cfg_path = "";
12689 string soundset = "";
12690 string type_name =
GetType();
12691
12694 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12695 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12696
12697 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12698 {
12699 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12700 {
12701 if (cfg_slot_array[i] == slot_type)
12702 {
12703 soundset = cfg_soundset_array[i];
12704 break;
12705 }
12706 }
12707 }
12708
12709 if (soundset != "")
12710 {
12711 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12713 }
12714 }
12715 }
12716 }
12717
12719 {
12720
12721 }
12722
12723 void OnApply(PlayerBase player);
12724
12726 {
12727 return 1.0;
12728 };
12729
12731 {
12733 }
12734
12736 {
12738 }
12739
12741
12743 {
12744 SetDynamicPhysicsLifeTime(0.01);
12746 }
12747
12749 {
12750 array<string> zone_names = new array<string>;
12751 GetDamageZones(zone_names);
12752 for (int i = 0; i < zone_names.Count(); i++)
12753 {
12754 SetHealthMax(zone_names.Get(i),"Health");
12755 }
12756 SetHealthMax("","Health");
12757 }
12758
12761 {
12762 float global_health = GetHealth01("","Health");
12763 array<string> zones = new array<string>;
12764 GetDamageZones(zones);
12765
12766 for (int i = 0; i < zones.Count(); i++)
12767 {
12768 SetHealth01(zones.Get(i),"Health",global_health);
12769 }
12770 }
12771
12774 {
12775 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12776 }
12777
12779 {
12780 if (!hasRootAsPlayer)
12781 {
12782 if (refParentIB)
12783 {
12784
12785 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12786 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12787
12788 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12789 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12790
12793 }
12794 else
12795 {
12796
12799 }
12800 }
12801 }
12802
12804 {
12806 {
12807 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12808 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12809 {
12810 float heatPermCoef = 1.0;
12812 while (ent)
12813 {
12814 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12815 ent = ent.GetHierarchyParent();
12816 }
12817
12818 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12819 }
12820 }
12821 }
12822
12824 {
12825
12826 EntityAI parent = GetHierarchyParent();
12827 if (!parent)
12828 {
12829 hasParent = false;
12830 hasRootAsPlayer = false;
12831 }
12832 else
12833 {
12834 hasParent = true;
12835 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12836 refParentIB =
ItemBase.Cast(parent);
12837 }
12838 }
12839
12840 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12841 {
12842
12843 }
12844
12846 {
12847
12848 return false;
12849 }
12850
12852 {
12853
12854
12855 return false;
12856 }
12857
12859 {
12860
12861 return false;
12862 }
12863
12866 {
12867 return !GetIsFrozen() &&
IsOpen();
12868 }
12869
12871 {
12872 bool hasParent = false, hasRootAsPlayer = false;
12874
12875 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12876 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12877
12878 if (wwtu || foodDecay)
12879 {
12883
12884 if (processWetness || processTemperature || processDecay)
12885 {
12887
12888 if (processWetness)
12889 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12890
12891 if (processTemperature)
12893
12894 if (processDecay)
12895 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12896 }
12897 }
12898 }
12899
12902 {
12904 }
12905
12907 {
12910
12911 return super.GetTemperatureFreezeThreshold();
12912 }
12913
12915 {
12918
12919 return super.GetTemperatureThawThreshold();
12920 }
12921
12923 {
12926
12927 return super.GetItemOverheatThreshold();
12928 }
12929
12931 {
12933 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12934
12935 return super.GetTemperatureFreezeTime();
12936 }
12937
12939 {
12941 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12942
12943 return super.GetTemperatureThawTime();
12944 }
12945
12950
12952 {
12953 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12954 }
12955
12957 {
12958 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12959 }
12960
12963 {
12965 }
12966
12968 {
12970 }
12971
12973 {
12975 }
12976
12979 {
12980 return null;
12981 }
12982
12985 {
12986 return false;
12987 }
12988
12990 {
12992 {
12995 if (!trg)
12996 {
12998 explosive = this;
12999 }
13000
13001 explosive.PairRemote(trg);
13003
13004 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13005 trg.SetPersistentPairID(persistentID);
13006 explosive.SetPersistentPairID(persistentID);
13007
13008 return true;
13009 }
13010 return false;
13011 }
13012
13015 {
13016 float ret = 1.0;
13019 ret *= GetHealth01();
13020
13021 return ret;
13022 }
13023
13024 #ifdef DEVELOPER
13025 override void SetDebugItem()
13026 {
13027 super.SetDebugItem();
13028 _itemBase = this;
13029 }
13030
13032 {
13033 string text = super.GetDebugText();
13034
13036 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13037
13038 return text;
13039 }
13040 #endif
13041
13043 {
13044 return true;
13045 }
13046
13048
13050
13052 {
13055 }
13056
13057
13065
13081}
13082
13084{
13086 if (entity)
13087 {
13088 bool is_item = entity.IsInherited(
ItemBase);
13089 if (is_item && full_quantity)
13090 {
13093 }
13094 }
13095 else
13096 {
13098 return NULL;
13099 }
13100 return entity;
13101}
13102
13104{
13105 if (item)
13106 {
13107 if (health > 0)
13108 item.SetHealth("", "", health);
13109
13110 if (item.CanHaveTemperature())
13111 {
13113 if (item.CanFreeze())
13114 item.SetFrozen(false);
13115 }
13116
13117 if (item.HasEnergyManager())
13118 {
13119 if (quantity >= 0)
13120 {
13121 item.GetCompEM().SetEnergy0To1(quantity);
13122 }
13123 else
13124 {
13126 }
13127 }
13128 else if (item.IsMagazine())
13129 {
13130 Magazine mag = Magazine.Cast(item);
13131 if (quantity >= 0)
13132 {
13133 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13134 }
13135 else
13136 {
13138 }
13139
13140 }
13141 else
13142 {
13143 if (quantity >= 0)
13144 {
13145 item.SetQuantityNormalized(quantity, false);
13146 }
13147 else
13148 {
13150 }
13151
13152 }
13153 }
13154}
13155
13156#ifdef DEVELOPER
13158#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.