Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
8364{
8366 {
8367 return true;
8368 }
8369};
8370
8371
8372
8374{
8378
8380
8383
8384
8385
8386
8387
8396
8402
8407
8412
8433 protected bool m_IsResultOfSplit
8434
8436
8441
8442
8443
8445
8449
8450
8451
8453
8456
8457
8458
8464
8465
8473
8476
8477
8479
8480
8482
8483
8488
8489
8494
8495
8497
8498
8500 {
8505
8506 if (!
GetGame().IsDedicatedServer())
8507 {
8509 {
8511
8513 {
8515 }
8516 }
8517
8520 }
8521
8522 m_OldLocation = null;
8523
8525 {
8527 }
8528
8529 if (ConfigIsExisting("headSelectionsToHide"))
8530 {
8533 }
8534
8536 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8537 {
8539 }
8540
8542
8543 m_IsResultOfSplit = false;
8544
8546 }
8547
8549 {
8550 super.InitItemVariables();
8551
8557 m_Count = ConfigGetInt(
"count");
8558
8561
8566
8569
8574
8586
8590
8591
8594 if (ConfigIsExisting("canBeSplit"))
8595 {
8598 }
8599
8601 if (ConfigIsExisting("itemBehaviour"))
8603
8604
8607 RegisterNetSyncVariableInt("m_VarLiquidType");
8608 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8609
8610 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8611 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8612 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8613
8614 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8615 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8616 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8617 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8618
8619 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8620 RegisterNetSyncVariableBool("m_IsTakeable");
8621 RegisterNetSyncVariableBool("m_IsHologram");
8622
8625 {
8628 }
8629
8631
8633 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8635
8636 }
8637
8639 {
8641 }
8642
8644 {
8647 {
8652 }
8653 }
8654
8655 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8656 {
8658 {
8661 }
8662
8664 }
8665
8667 {
8673 }
8674
8676
8678 {
8680
8681 if (!action)
8682 {
8683 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8684 return;
8685 }
8686
8688 if (!ai)
8689 {
8691 return;
8692 }
8693
8695 if (!action_array)
8696 {
8697 action_array = new array<ActionBase_Basic>;
8699 }
8700 if (LogManager.IsActionLogEnable())
8701 {
8702 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8703 }
8704
8705 if (action_array.Find(action) != -1)
8706 {
8707 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8708 }
8709 else
8710 {
8711 action_array.Insert(action);
8712 }
8713 }
8714
8716 {
8718 ActionBase action = player.GetActionManager().GetAction(actionName);
8721
8722 if (action_array)
8723 {
8724 action_array.RemoveItem(action);
8725 }
8726 }
8727
8728
8729
8731 {
8732 ActionOverrideData overrideData = new ActionOverrideData();
8736
8738 if (!actionMap)
8739 {
8742 }
8743
8744 actionMap.Insert(this.
Type(), overrideData);
8745
8746 }
8747
8749
8751
8752
8754 {
8757
8760
8761 string config_to_search = "CfgVehicles";
8762 string muzzle_owner_config;
8763
8765 {
8766 if (IsInherited(Weapon))
8767 config_to_search = "CfgWeapons";
8768
8769 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8770
8771 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8772
8774
8775 if (config_OnFire_subclass_count > 0)
8776 {
8777 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8778
8779 for (int i = 0; i < config_OnFire_subclass_count; i++)
8780 {
8781 string particle_class = "";
8783 string config_OnFire_entry = config_OnFire_class + particle_class;
8784 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8785 WPOF_array.Insert(WPOF);
8786 }
8787
8788
8790 }
8791 }
8792
8794 {
8795 config_to_search = "CfgWeapons";
8796 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8797
8798 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8799
8801
8802 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8803 {
8804 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8805
8806 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8807 {
8808 string particle_class2 = "";
8810 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8811 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8812 WPOBE_array.Insert(WPOBE);
8813 }
8814
8815
8817 }
8818 }
8819 }
8820
8821
8823 {
8826
8828 {
8829 string config_to_search = "CfgVehicles";
8830
8831 if (IsInherited(Weapon))
8832 config_to_search = "CfgWeapons";
8833
8834 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8835 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8836
8837 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8838 {
8839
8841
8843 {
8845 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8847 return;
8848 }
8849
8852
8853
8854
8856 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8857
8858 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8859 {
8860 string particle_class = "";
8862 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8864
8865 if (entry_type == CT_CLASS)
8866 {
8867 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8868 WPOOH_array.Insert(WPOF);
8869 }
8870 }
8871
8872
8874 }
8875 }
8876 }
8877
8879 {
8881 }
8882
8884 {
8886 {
8888
8891
8894
8895 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8896 }
8897 }
8898
8900 {
8902 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8903
8905 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8906
8908 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8909
8911 {
8913 }
8914 }
8915
8917 {
8919 }
8920
8922 {
8925 else
8927
8929 {
8932 }
8933 else
8934 {
8937
8940 }
8941
8943 }
8944
8946 {
8948 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8949 }
8950
8952 {
8954 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8956 }
8957
8959 {
8961 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8962 }
8963
8965 {
8968
8969 OverheatingParticle OP = new OverheatingParticle();
8974
8976 }
8977
8979 {
8982
8983 return -1;
8984 }
8985
8987 {
8989 {
8992
8993 for (int i = count; i > 0; --i)
8994 {
8995 int id = i - 1;
8998
9001
9002 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9003 {
9004 if (p)
9005 {
9008 }
9009 }
9010 }
9011 }
9012 }
9013
9015 {
9017 {
9019 {
9020 int id = i - 1;
9022
9023 if (OP)
9024 {
9026
9027 if (p)
9028 {
9030 }
9031
9032 delete OP;
9033 }
9034 }
9035
9038 }
9039 }
9040
9043 {
9044 return 0.0;
9045 }
9046
9047
9049 {
9050 return 250;
9051 }
9052
9054 {
9055 return 0;
9056 }
9057
9060 {
9062 return true;
9063
9064 return false;
9065 }
9066
9069 {
9072
9074 {
9076 }
9077 else
9078 {
9079
9081 }
9082
9084 }
9085
9092 {
9093 return -1;
9094 }
9095
9096
9097
9098
9100 {
9102 {
9104 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9105
9106 if (r_index >= 0)
9107 {
9108 InventoryLocation r_il = new InventoryLocation;
9109 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9110
9111 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9114 {
9115 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9116 }
9118 {
9119 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9120 }
9121
9122 }
9123
9124 player.GetHumanInventory().ClearUserReservedLocation(this);
9125 }
9126
9129 }
9130
9131
9132
9133
9135 {
9136 return ItemBase.m_DebugActionsMask;
9137 }
9138
9140 {
9141 return ItemBase.m_DebugActionsMask & mask;
9142 }
9143
9145 {
9146 ItemBase.m_DebugActionsMask = mask;
9147 }
9148
9150 {
9151 ItemBase.m_DebugActionsMask |= mask;
9152 }
9153
9155 {
9156 ItemBase.m_DebugActionsMask &= ~mask;
9157 }
9158
9160 {
9162 {
9164 }
9165 else
9166 {
9168 }
9169 }
9170
9171
9173 {
9174 if (GetEconomyProfile())
9175 {
9176 float q_max = GetEconomyProfile().GetQuantityMax();
9177 if (q_max > 0)
9178 {
9179 float q_min = GetEconomyProfile().GetQuantityMin();
9180 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9181
9183 {
9184 ComponentEnergyManager comp = GetCompEM();
9186 {
9188 }
9189 }
9191 {
9193
9194 }
9195
9196 }
9197 }
9198 }
9199
9202 {
9203 EntityAI parent = GetHierarchyParent();
9204
9205 if (parent)
9206 {
9207 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9208 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9209 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9210 }
9211 }
9212
9215 {
9216 EntityAI parent = GetHierarchyParent();
9217
9218 if (parent)
9219 {
9220 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9221 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9222 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9223 }
9224 }
9225
9227 {
9228
9229
9230
9231
9233
9235 {
9236 if (ScriptInputUserData.CanStoreInputUserData())
9237 {
9238 ScriptInputUserData ctx = new ScriptInputUserData;
9244 ctx.
Write(use_stack_max);
9247
9249 {
9250 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9251 }
9252 }
9253 }
9254 else if (!
GetGame().IsMultiplayer())
9255 {
9257 }
9258 }
9259
9261 {
9263 }
9264
9266 {
9268 }
9269
9271 {
9273 }
9274
9276 {
9277
9278 return false;
9279 }
9280
9282 {
9283 return false;
9284 }
9285
9289 {
9290 return false;
9291 }
9292
9294 {
9295 return "";
9296 }
9297
9299
9301 {
9302 return false;
9303 }
9304
9306 {
9307 return true;
9308 }
9309
9310
9311
9313 {
9314 return true;
9315 }
9316
9318 {
9319 return true;
9320 }
9321
9323 {
9324 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9326 }
9327
9329 {
9331 }
9332
9334 {
9336 if (!is_being_placed)
9338 SetSynchDirty();
9339 }
9340
9341
9343
9345 {
9347 }
9348
9350 {
9352 }
9353
9355 {
9356 return 1;
9357 }
9358
9360 {
9361 return false;
9362 }
9363
9365 {
9367 SetSynchDirty();
9368 }
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9405 {
9406 super.OnMovedInsideCargo(container);
9407
9408 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9409 }
9410
9411 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9412 {
9413 super.EEItemLocationChanged(oldLoc,newLoc);
9414
9415 PlayerBase new_player = null;
9416 PlayerBase old_player = null;
9417
9418 if (newLoc.GetParent())
9419 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9420
9421 if (oldLoc.GetParent())
9422 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9423
9425 {
9426 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9427
9428 if (r_index >= 0)
9429 {
9430 InventoryLocation r_il = new InventoryLocation;
9431 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9432
9433 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9436 {
9437 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9438 }
9440 {
9441 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9442 }
9443
9444 }
9445 }
9446
9448 {
9449 if (new_player)
9450 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9451
9452 if (new_player == old_player)
9453 {
9454
9455 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9456 {
9458 {
9459 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9460 {
9461 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9462 }
9463 }
9464 else
9465 {
9466 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9467 }
9468 }
9469
9470 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9471 {
9472 int type = oldLoc.GetType();
9474 {
9475 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9476 }
9478 {
9479 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9480 }
9481 }
9482 if (!m_OldLocation)
9483 {
9484 m_OldLocation = new InventoryLocation;
9485 }
9486 m_OldLocation.Copy(oldLoc);
9487 }
9488 else
9489 {
9490 if (m_OldLocation)
9491 {
9492 m_OldLocation.Reset();
9493 }
9494 }
9495
9497 }
9498 else
9499 {
9500 if (new_player)
9501 {
9502 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9503 if (res_index >= 0)
9504 {
9505 InventoryLocation il = new InventoryLocation;
9506 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9508 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9511 {
9512 il.
GetParent().GetOnReleaseLock().Invoke(it);
9513 }
9515 {
9517 }
9518
9519 }
9520 }
9522 {
9523
9525 }
9526
9527 if (m_OldLocation)
9528 {
9529 m_OldLocation.Reset();
9530 }
9531 }
9532 }
9533
9534 override void EOnContact(IEntity other, Contact extra)
9535 {
9537 {
9538 int liquidType = -1;
9540 if (impactSpeed > 0.0)
9541 {
9543 #ifndef SERVER
9545 #else
9547 SetSynchDirty();
9548 #endif
9550 }
9551 }
9552
9553 #ifdef SERVER
9554 if (GetCompEM() && GetCompEM().IsPlugged())
9555 {
9556 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9557 GetCompEM().UnplugThis();
9558 }
9559 #endif
9560 }
9561
9563
9565 {
9567 }
9568
9570 {
9571
9572 }
9573
9575 {
9576 super.OnItemLocationChanged(old_owner, new_owner);
9577
9578 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9579 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9580
9581 if (!relatedPlayer && playerNew)
9582 relatedPlayer = playerNew;
9583
9584 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9585 {
9587 if (actionMgr)
9588 {
9589 ActionBase currentAction = actionMgr.GetRunningAction();
9590 if (currentAction)
9592 }
9593 }
9594
9595 Man ownerPlayerOld = null;
9596 Man ownerPlayerNew = null;
9597
9598 if (old_owner)
9599 {
9600 if (old_owner.
IsMan())
9601 {
9602 ownerPlayerOld = Man.Cast(old_owner);
9603 }
9604 else
9605 {
9606 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9607 }
9608 }
9609 else
9610 {
9612 {
9614
9615 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9616 {
9617 GetCompEM().UnplugThis();
9618 }
9619 }
9620 }
9621
9622 if (new_owner)
9623 {
9624 if (new_owner.
IsMan())
9625 {
9626 ownerPlayerNew = Man.Cast(new_owner);
9627 }
9628 else
9629 {
9630 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9631 }
9632 }
9633
9634 if (ownerPlayerOld != ownerPlayerNew)
9635 {
9636 if (ownerPlayerOld)
9637 {
9638 array<EntityAI> subItemsExit = new array<EntityAI>;
9640 for (int i = 0; i < subItemsExit.Count(); i++)
9641 {
9644 }
9645 }
9646
9647 if (ownerPlayerNew)
9648 {
9649 array<EntityAI> subItemsEnter = new array<EntityAI>;
9651 for (int j = 0; j < subItemsEnter.Count(); j++)
9652 {
9655 }
9656 }
9657 }
9658 else if (ownerPlayerNew != null)
9659 {
9660 PlayerBase nplayer;
9661 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9662 {
9663 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9665 for (int k = 0; k < subItemsUpdate.Count(); k++)
9666 {
9668 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9669 }
9670 }
9671 }
9672
9673 if (old_owner)
9674 old_owner.OnChildItemRemoved(this);
9675 if (new_owner)
9676 new_owner.OnChildItemReceived(this);
9677 }
9678
9679
9681 {
9682 super.EEDelete(parent);
9683 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9684 if (player)
9685 {
9687
9688 if (player.IsAlive())
9689 {
9690 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9691 if (r_index >= 0)
9692 {
9693 InventoryLocation r_il = new InventoryLocation;
9694 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9695
9696 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9699 {
9700 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9701 }
9703 {
9704 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9705 }
9706
9707 }
9708
9709 player.RemoveQuickBarEntityShortcut(this);
9710 }
9711 }
9712 }
9713
9715 {
9716 super.EEKilled(killer);
9717
9720 {
9721 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9722 {
9723 if (IsMagazine())
9724 {
9725 if (Magazine.Cast(this).GetAmmoCount() > 0)
9726 {
9728 }
9729 }
9730 else
9731 {
9733 }
9734 }
9735 }
9736 }
9737
9739 {
9740 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9741
9742 super.OnWasAttached(parent, slot_id);
9743
9746
9748 }
9749
9751 {
9752 super.OnWasDetached(parent, slot_id);
9753
9756 }
9757
9759 {
9760 int idx;
9763
9764 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9765 if (inventory_slots.Count() < 1)
9766 {
9767 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9768 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9769 }
9770 else
9771 {
9772 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9773 }
9774
9775 idx = inventory_slots.Find(slot);
9776 if (idx < 0)
9777 return "";
9778
9779 return attach_types.Get(idx);
9780 }
9781
9783 {
9784 int idx = -1;
9785 string slot;
9786
9789
9790 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9791 if (inventory_slots.Count() < 1)
9792 {
9793 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9794 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9795 }
9796 else
9797 {
9798 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9799 if (detach_types.Count() < 1)
9800 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9801 }
9802
9803 for (int i = 0; i < inventory_slots.Count(); i++)
9804 {
9805 slot = inventory_slots.Get(i);
9806 }
9807
9808 if (slot != "")
9809 {
9810 if (detach_types.Count() == 1)
9811 idx = 0;
9812 else
9813 idx = inventory_slots.Find(slot);
9814 }
9815 if (idx < 0)
9816 return "";
9817
9818 return detach_types.Get(idx);
9819 }
9820
9822 {
9823
9825
9826
9827 float min_time = 1;
9828 float max_time = 3;
9829 float delay = Math.RandomFloat(min_time, max_time);
9830
9831 explode_timer.Run(delay, this, "DoAmmoExplosion");
9832 }
9833
9835 {
9836 Magazine magazine = Magazine.Cast(this);
9837 int pop_sounds_count = 6;
9838 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9839
9840
9841 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9842 string sound_name = pop_sounds[ sound_idx ];
9844
9845
9846 magazine.ServerAddAmmoCount(-1);
9847
9848
9849 float min_temp_to_explode = 100;
9850
9851 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9852 {
9854 }
9855 }
9856
9857
9858 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9859 {
9860 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9861
9862 const int CHANCE_DAMAGE_CARGO = 4;
9863 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9864 const int CHANCE_DAMAGE_NOTHING = 2;
9865
9867 {
9868 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9869 int chances;
9870 int rnd;
9871
9872 if (GetInventory().GetCargo())
9873 {
9874 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9875 rnd = Math.RandomInt(0,chances);
9876
9877 if (rnd < CHANCE_DAMAGE_CARGO)
9878 {
9880 }
9881 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9882 {
9884 }
9885 }
9886 else
9887 {
9888 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9889 rnd = Math.RandomInt(0,chances);
9890
9891 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9892 {
9894 }
9895 }
9896 }
9897 }
9898
9900 {
9901 if (GetInventory().GetCargo())
9902 {
9903 int item_count = GetInventory().GetCargo().GetItemCount();
9904 if (item_count > 0)
9905 {
9906 int random_pick = Math.RandomInt(0, item_count);
9908 if (!item.IsExplosive())
9909 {
9910 item.AddHealth("","",damage);
9911 return true;
9912 }
9913 }
9914 }
9915 return false;
9916 }
9917
9919 {
9920 int attachment_count = GetInventory().AttachmentCount();
9921 if (attachment_count > 0)
9922 {
9923 int random_pick = Math.RandomInt(0, attachment_count);
9924 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9925 if (!attachment.IsExplosive())
9926 {
9927 attachment.AddHealth("","",damage);
9928 return true;
9929 }
9930 }
9931 return false;
9932 }
9933
9935 {
9937 }
9938
9940 {
9942 return GetInventory().CanRemoveEntity();
9943
9944 return false;
9945 }
9946
9948 {
9949
9951 return false;
9952
9953
9955 return false;
9956
9957
9958
9960 if (delta == 0)
9961 return false;
9962
9963
9964 return true;
9965 }
9966
9968 {
9970 {
9971 if (ScriptInputUserData.CanStoreInputUserData())
9972 {
9973 ScriptInputUserData ctx = new ScriptInputUserData;
9978 ctx.
Write(destination_entity);
9982 }
9983 }
9984 else if (!
GetGame().IsMultiplayer())
9985 {
9987 }
9988 }
9989
9991 {
9992 float split_quantity_new;
9996 InventoryLocation loc = new InventoryLocation;
9997
9998 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9999 {
10001 split_quantity_new = stack_max;
10002 else
10004
10006 {
10007 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10008 if (new_item)
10009 {
10010 new_item.SetResultOfSplit(true);
10011 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10013 new_item.
SetQuantity(split_quantity_new,
false,
true);
10014 }
10015 }
10016 }
10017 else if (destination_entity && slot_id == -1)
10018 {
10019 if (quantity > stack_max)
10020 split_quantity_new = stack_max;
10021 else
10022 split_quantity_new = quantity;
10023
10025 {
10027 {
10030 }
10031
10032 if (new_item)
10033 {
10034 new_item.SetResultOfSplit(true);
10035 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10037 new_item.
SetQuantity(split_quantity_new,
false,
true);
10038 }
10039 }
10040 }
10041 else
10042 {
10043 if (stack_max != 0)
10044 {
10046 {
10048 }
10049
10050 if (split_quantity_new == 0)
10051 {
10052 if (!
GetGame().IsMultiplayer())
10053 player.PhysicalPredictiveDropItem(this);
10054 else
10055 player.ServerDropEntity(this);
10056 return;
10057 }
10058
10060 {
10062
10063 if (new_item)
10064 {
10065 new_item.SetResultOfSplit(true);
10066 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10069 new_item.PlaceOnSurface();
10070 }
10071 }
10072 }
10073 }
10074 }
10075
10077 {
10078 float split_quantity_new;
10082 InventoryLocation loc = new InventoryLocation;
10083
10084 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10085 {
10087 split_quantity_new = stack_max;
10088 else
10090
10092 {
10093 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10094 if (new_item)
10095 {
10096 new_item.SetResultOfSplit(true);
10097 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10099 new_item.
SetQuantity(split_quantity_new,
false,
true);
10100 }
10101 }
10102 }
10103 else if (destination_entity && slot_id == -1)
10104 {
10105 if (quantity > stack_max)
10106 split_quantity_new = stack_max;
10107 else
10108 split_quantity_new = quantity;
10109
10111 {
10113 {
10116 }
10117
10118 if (new_item)
10119 {
10120 new_item.SetResultOfSplit(true);
10121 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10123 new_item.
SetQuantity(split_quantity_new,
false,
true);
10124 }
10125 }
10126 }
10127 else
10128 {
10129 if (stack_max != 0)
10130 {
10132 {
10134 }
10135
10137 {
10139
10140 if (new_item)
10141 {
10142 new_item.SetResultOfSplit(true);
10143 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10146 new_item.PlaceOnSurface();
10147 }
10148 }
10149 }
10150 }
10151 }
10152
10154 {
10156 {
10157 if (ScriptInputUserData.CanStoreInputUserData())
10158 {
10159 ScriptInputUserData ctx = new ScriptInputUserData;
10164 dst.WriteToContext(ctx);
10166 }
10167 }
10168 else if (!
GetGame().IsMultiplayer())
10169 {
10171 }
10172 }
10173
10175 {
10177 {
10178 if (ScriptInputUserData.CanStoreInputUserData())
10179 {
10180 ScriptInputUserData ctx = new ScriptInputUserData;
10185 ctx.
Write(destination_entity);
10191 }
10192 }
10193 else if (!
GetGame().IsMultiplayer())
10194 {
10196 }
10197 }
10198
10200 {
10202 }
10203
10205 {
10207 float split_quantity_new;
10209 if (dst.IsValid())
10210 {
10211 int slot_id = dst.GetSlot();
10213
10214 if (quantity > stack_max)
10215 split_quantity_new = stack_max;
10216 else
10217 split_quantity_new = quantity;
10218
10220 {
10222
10223 if (new_item)
10224 {
10225 new_item.SetResultOfSplit(true);
10226 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10228 new_item.
SetQuantity(split_quantity_new,
false,
true);
10229 }
10230
10231 return new_item;
10232 }
10233 }
10234
10235 return null;
10236 }
10237
10239 {
10241 float split_quantity_new;
10243 if (destination_entity)
10244 {
10246 if (quantity > stackable)
10247 split_quantity_new = stackable;
10248 else
10249 split_quantity_new = quantity;
10250
10252 {
10253 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10254 if (new_item)
10255 {
10256 new_item.SetResultOfSplit(true);
10257 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10259 new_item.
SetQuantity(split_quantity_new,
false,
true);
10260 }
10261 }
10262 }
10263 }
10264
10266 {
10268 {
10269 if (ScriptInputUserData.CanStoreInputUserData())
10270 {
10271 ScriptInputUserData ctx = new ScriptInputUserData;
10276 ItemBase destination_entity =
this;
10277 ctx.
Write(destination_entity);
10281 }
10282 }
10283 else if (!
GetGame().IsMultiplayer())
10284 {
10286 }
10287 }
10288
10290 {
10292 float split_quantity_new;
10294 if (player)
10295 {
10297 if (quantity > stackable)
10298 split_quantity_new = stackable;
10299 else
10300 split_quantity_new = quantity;
10301
10303 {
10304 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10305 new_item =
ItemBase.Cast(in_hands);
10306 if (new_item)
10307 {
10308 new_item.SetResultOfSplit(true);
10309 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10311 new_item.SetQuantity(split_quantity_new, false, true);
10312 }
10313 }
10314 }
10315 }
10316
10318 {
10320 float split_quantity_new = Math.Floor(quantity * 0.5);
10321
10323 return;
10324
10326
10327 if (new_item)
10328 {
10329 if (new_item.GetQuantityMax() < split_quantity_new)
10330 {
10331 split_quantity_new = new_item.GetQuantityMax();
10332 }
10333
10334 new_item.SetResultOfSplit(true);
10335 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10336
10338 {
10341 }
10342 else
10343 {
10345 new_item.
SetQuantity(split_quantity_new,
false,
true);
10346 }
10347 }
10348 }
10349
10351 {
10353 float split_quantity_new = Math.Floor(quantity / 2);
10354
10356 return;
10357
10358 InventoryLocation invloc = new InventoryLocation;
10360
10362 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10363
10364 if (new_item)
10365 {
10366 if (new_item.GetQuantityMax() < split_quantity_new)
10367 {
10368 split_quantity_new = new_item.GetQuantityMax();
10369 }
10371 {
10374 }
10375 else if (split_quantity_new > 1)
10376 {
10378 new_item.
SetQuantity(split_quantity_new,
false,
true);
10379 }
10380 }
10381 }
10382
10385 {
10386 SetWeightDirty();
10388
10389 if (parent)
10390 parent.OnAttachmentQuantityChangedEx(this, delta);
10391
10393 {
10395 {
10397 }
10399 {
10400 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10402 }
10403 }
10404
10405 }
10406
10409 {
10410
10411 }
10412
10415 {
10417 }
10418
10420 {
10421 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10422
10424 {
10425 if (newLevel == GameConstants.STATE_RUINED)
10426 {
10428 EntityAI parent = GetHierarchyParent();
10429 if (parent && parent.IsFireplace())
10430 {
10431 CargoBase cargo = GetInventory().GetCargo();
10432 if (cargo)
10433 {
10435 {
10437 }
10438 }
10439 }
10440 }
10441
10443 {
10444
10446 return;
10447 }
10448
10449 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10450 {
10452 }
10453 }
10454 }
10455
10456
10458 {
10459 super.OnRightClick();
10460
10462 {
10464 {
10465 if (ScriptInputUserData.CanStoreInputUserData())
10466 {
10467 EntityAI root = GetHierarchyRoot();
10468 Man playerOwner = GetHierarchyRootPlayer();
10469 InventoryLocation dst = new InventoryLocation;
10470
10471
10472 if (!playerOwner && root && root == this)
10473 {
10475 }
10476 else
10477 {
10478
10479 GetInventory().GetCurrentInventoryLocation(dst);
10481 {
10484 {
10486 }
10487 else
10488 {
10490
10491
10492 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10493 {
10495 }
10496 else
10497 {
10498 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10499 }
10500 }
10501 }
10502 }
10503
10504 ScriptInputUserData ctx = new ScriptInputUserData;
10512 }
10513 }
10514 else if (!
GetGame().IsMultiplayer())
10515 {
10517 }
10518 }
10519 }
10520
10522 {
10523 if (root)
10524 {
10525 vector m4[4];
10526 root.GetTransform(m4);
10527 dst.SetGround(this, m4);
10528 }
10529 else
10530 {
10531 GetInventory().GetCurrentInventoryLocation(dst);
10532 }
10533 }
10534
10535 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10536 {
10537
10538 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10539 return false;
10540
10541 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10542 return false;
10543
10544
10546 return false;
10547
10548
10549 Magazine mag = Magazine.Cast(this);
10550 if (mag)
10551 {
10552 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10553 return false;
10554
10555 if (stack_max_limit)
10556 {
10557 Magazine other_mag = Magazine.Cast(other_item);
10558 if (other_item)
10559 {
10560 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10561 return false;
10562 }
10563
10564 }
10565 }
10566 else
10567 {
10568
10570 return false;
10571
10573 return false;
10574 }
10575
10576 PlayerBase player = null;
10577 if (CastTo(player, GetHierarchyRootPlayer()))
10578 {
10579 if (player.GetInventory().HasAttachment(this))
10580 return false;
10581
10582 if (player.IsItemsToDelete())
10583 return false;
10584 }
10585
10586 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10587 return false;
10588
10589 int slotID;
10591 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10592 return false;
10593
10594 return true;
10595 }
10596
10598 {
10600 }
10601
10603 {
10604 return m_IsResultOfSplit;
10605 }
10606
10608 {
10609 m_IsResultOfSplit = value;
10610 }
10611
10613 {
10615 }
10616
10618 {
10619 float other_item_quantity = other_item.GetQuantity();
10620 float this_free_space;
10621
10623
10625
10626 if (other_item_quantity > this_free_space)
10627 {
10628 return this_free_space;
10629 }
10630 else
10631 {
10632 return other_item_quantity;
10633 }
10634 }
10635
10637 {
10639 }
10640
10642 {
10644 return;
10645
10646 if (!IsMagazine() && other_item)
10647 {
10649 if (quantity_used != 0)
10650 {
10651 float hp1 = GetHealth01("","");
10652 float hp2 = other_item.GetHealth01("","");
10653 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10654 hpResult = hpResult / (
GetQuantity() + quantity_used);
10655
10656 hpResult *= GetMaxHealth();
10657 Math.Round(hpResult);
10658 SetHealth("", "Health", hpResult);
10659
10661 other_item.AddQuantity(-quantity_used);
10662 }
10663 }
10665 }
10666
10668 {
10669 #ifdef SERVER
10670 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10671 GetHierarchyParent().IncreaseLifetimeUp();
10672 #endif
10673 };
10674
10676 {
10677 PlayerBase p = PlayerBase.Cast(player);
10678
10679 array<int> recipesIds = p.m_Recipes;
10680 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10681 if (moduleRecipesManager)
10682 {
10683 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10684 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10685 }
10686
10687 for (int i = 0;i < recipesIds.Count(); i++)
10688 {
10689 int key = recipesIds.Get(i);
10690 string recipeName = moduleRecipesManager.GetRecipeName(key);
10692 }
10693 }
10694
10695
10696 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10697 {
10698 super.GetDebugActions(outputList);
10699
10700
10706
10707
10712
10717
10718
10722
10723
10725 {
10729 }
10730
10733
10734
10738
10740
10741 InventoryLocation loc = new InventoryLocation();
10742 GetInventory().GetCurrentInventoryLocation(loc);
10744 {
10745 if (Gizmo_IsSupported())
10748 }
10749
10751 }
10752
10753
10754
10755
10757 {
10758 super.OnAction(action_id, player, ctx);
10759
10761 {
10762 switch (action_id)
10763 {
10766 return true;
10769 return true;
10770 }
10771 }
10772
10774 {
10775 switch (action_id)
10776 {
10778 Delete();
10779 return true;
10780 }
10781 }
10782
10783 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10784 {
10785 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10786 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10787 PlayerBase p = PlayerBase.Cast(player);
10788 if (
EActions.RECIPES_RANGE_START < 1000)
10789 {
10790 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10791 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10792 }
10793 }
10794 #ifndef SERVER
10795 else if (action_id ==
EActions.WATCH_PLAYER)
10796 {
10797 PluginDeveloper.SetDeveloperItemClientEx(player);
10798 }
10799 #endif
10801 {
10802 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10803 {
10804 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10805 OnDebugButtonPressServer(id + 1);
10806 }
10807
10808 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10809 {
10810 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10812 }
10813
10814 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10815 {
10816 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10818 }
10819
10820 else if (action_id ==
EActions.ADD_QUANTITY)
10821 {
10822 if (IsMagazine())
10823 {
10824 Magazine mag = Magazine.Cast(this);
10825 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10826 }
10827 else
10828 {
10830 }
10831
10832 if (m_EM)
10833 {
10834 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10835 }
10836
10837 }
10838
10839 else if (action_id ==
EActions.REMOVE_QUANTITY)
10840 {
10841 if (IsMagazine())
10842 {
10843 Magazine mag2 = Magazine.Cast(this);
10844 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10845 }
10846 else
10847 {
10849 }
10850 if (m_EM)
10851 {
10852 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10853 }
10854
10855 }
10856
10857 else if (action_id ==
EActions.SET_QUANTITY_0)
10858 {
10860
10861 if (m_EM)
10862 {
10863 m_EM.SetEnergy(0);
10864 }
10865 }
10866
10867 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10868 {
10870
10871 if (m_EM)
10872 {
10873 m_EM.SetEnergy(m_EM.GetEnergyMax());
10874 }
10875 }
10876
10877 else if (action_id ==
EActions.ADD_HEALTH)
10878 {
10879 AddHealth("","",GetMaxHealth("","Health")/5);
10880 }
10881 else if (action_id ==
EActions.REMOVE_HEALTH)
10882 {
10883 AddHealth("","",-GetMaxHealth("","Health")/5);
10884 }
10885 else if (action_id ==
EActions.DESTROY_HEALTH)
10886 {
10887 SetHealth01("","",0);
10888 }
10889 else if (action_id ==
EActions.WATCH_ITEM)
10890 {
10892 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10893 #ifdef DEVELOPER
10894 SetDebugDeveloper_item(this);
10895 #endif
10896 }
10897
10898 else if (action_id ==
EActions.ADD_TEMPERATURE)
10899 {
10900 AddTemperature(20);
10901
10902 }
10903
10904 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10905 {
10906 AddTemperature(-20);
10907
10908 }
10909
10910 else if (action_id ==
EActions.FLIP_FROZEN)
10911 {
10912 SetFrozen(!GetIsFrozen());
10913
10914 }
10915
10916 else if (action_id ==
EActions.ADD_WETNESS)
10917 {
10919
10920 }
10921
10922 else if (action_id ==
EActions.REMOVE_WETNESS)
10923 {
10925
10926 }
10927
10928 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10929 {
10932
10933
10934 }
10935
10936 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10937 {
10940 }
10941
10942 else if (action_id ==
EActions.MAKE_SPECIAL)
10943 {
10944 auto debugParams = DebugSpawnParams.WithPlayer(player);
10945 OnDebugSpawnEx(debugParams);
10946 }
10947
10948 }
10949
10950
10951 return false;
10952 }
10953
10954
10955
10956
10960
10963
10964
10965
10967 {
10968 return false;
10969 }
10970
10971
10973 {
10974 return true;
10975 }
10976
10977
10979 {
10980 return true;
10981 }
10982
10983
10984
10986 {
10987 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10989 }
10990
10993 {
10994 return null;
10995 }
10996
10998 {
10999 return false;
11000 }
11001
11003 {
11004 return false;
11005 }
11006
11010
11011
11013 {
11014 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11015 return module_repairing.CanRepair(this, item_repair_kit);
11016 }
11017
11018
11019 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11020 {
11021 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11022 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11023 }
11024
11025
11027 {
11028
11029
11030
11031
11032
11033
11034
11035
11036 return 1;
11037 }
11038
11039
11040
11042 {
11044 }
11045
11046
11047
11049 {
11051 }
11052
11053
11062 {
11063 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11064
11065 if (player)
11066 {
11067 player.MessageStatus(text);
11068 }
11069 }
11070
11071
11080 {
11081 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11082
11083 if (player)
11084 {
11085 player.MessageAction(text);
11086 }
11087 }
11088
11089
11098 {
11099 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11100
11101 if (player)
11102 {
11103 player.MessageFriendly(text);
11104 }
11105 }
11106
11107
11116 {
11117 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11118
11119 if (player)
11120 {
11121 player.MessageImportant(text);
11122 }
11123 }
11124
11126 {
11127 return true;
11128 }
11129
11130
11131 override bool KindOf(
string tag)
11132 {
11133 bool found = false;
11134 string item_name = this.
GetType();
11137
11138 int array_size = item_tag_array.Count();
11139 for (int i = 0; i < array_size; i++)
11140 {
11141 if (item_tag_array.Get(i) == tag)
11142 {
11143 found = true;
11144 break;
11145 }
11146 }
11147 return found;
11148 }
11149
11150
11152 {
11153
11154 super.OnRPC(sender, rpc_type,ctx);
11155
11156
11157 switch (rpc_type)
11158 {
11159 #ifndef SERVER
11160 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11161 Param2<bool, string> p = new Param2<bool, string>(false, "");
11162
11164 return;
11165
11166 bool play = p.param1;
11167 string soundSet = p.param2;
11168
11169 if (play)
11170 {
11172 {
11174 {
11176 }
11177 }
11178 else
11179 {
11181 }
11182 }
11183 else
11184 {
11186 }
11187
11188 break;
11189 #endif
11190
11191 }
11192
11194 {
11196 }
11197 }
11198
11199
11200
11201
11203 {
11204 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11205 return plugin.GetID(
name);
11206 }
11207
11209 {
11210 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11211 return plugin.GetName(id);
11212 }
11213
11216 {
11217
11218
11219 int varFlags;
11220 if (!ctx.
Read(varFlags))
11221 return;
11222
11223 if (varFlags & ItemVariableFlags.FLOAT)
11224 {
11226 }
11227 }
11228
11230 {
11231
11232 super.SerializeNumericalVars(floats_out);
11233
11234
11235
11237 {
11239 }
11240
11242 {
11244 }
11245
11247 {
11249 }
11250
11252 {
11257 }
11258
11260 {
11262 }
11263 }
11264
11266 {
11267
11268 super.DeSerializeNumericalVars(floats);
11269
11270
11271 int index = 0;
11272 int mask = Math.Round(floats.Get(index));
11273
11274 index++;
11275
11277 {
11279 {
11281 }
11282 else
11283 {
11284 float quantity = floats.Get(index);
11285 SetQuantity(quantity,
true,
false,
false,
false);
11286 }
11287 index++;
11288 }
11289
11291 {
11292 float wet = floats.Get(index);
11294 index++;
11295 }
11296
11298 {
11299 int liquidtype = Math.Round(floats.Get(index));
11301 index++;
11302 }
11303
11305 {
11307 index++;
11309 index++;
11311 index++;
11313 index++;
11314 }
11315
11317 {
11318 int cleanness = Math.Round(floats.Get(index));
11320 index++;
11321 }
11322 }
11323
11325 {
11326 super.WriteVarsToCTX(ctx);
11327
11328
11330 {
11332 }
11333
11335 {
11337 }
11338
11340 {
11342 }
11343
11345 {
11346 int r,g,b,a;
11352 }
11353
11355 {
11357 }
11358 }
11359
11361 {
11362 if (!super.ReadVarsFromCTX(ctx,version))
11363 return false;
11364
11365 int intValue;
11366 float value;
11367
11368 if (version < 140)
11369 {
11370 if (!ctx.
Read(intValue))
11371 return false;
11372
11373 m_VariablesMask = intValue;
11374 }
11375
11377 {
11378 if (!ctx.
Read(value))
11379 return false;
11380
11382 {
11384 }
11385 else
11386 {
11388 }
11389 }
11390
11391 if (version < 140)
11392 {
11394 {
11395 if (!ctx.
Read(value))
11396 return false;
11397 SetTemperatureDirect(value);
11398 }
11399 }
11400
11402 {
11403 if (!ctx.
Read(value))
11404 return false;
11406 }
11407
11409 {
11410 if (!ctx.
Read(intValue))
11411 return false;
11413 }
11414
11416 {
11417 int r,g,b,a;
11419 return false;
11421 return false;
11423 return false;
11425 return false;
11426
11428 }
11429
11431 {
11432 if (!ctx.
Read(intValue))
11433 return false;
11435 }
11436
11437 if (version >= 138 && version < 140)
11438 {
11440 {
11441 if (!ctx.
Read(intValue))
11442 return false;
11443 SetFrozen(intValue);
11444 }
11445 }
11446
11447 return true;
11448 }
11449
11450
11452 {
11455 {
11457 }
11458
11459 if (!super.OnStoreLoad(ctx, version))
11460 {
11462 return false;
11463 }
11464
11465 if (version >= 114)
11466 {
11467 bool hasQuickBarIndexSaved;
11468
11469 if (!ctx.
Read(hasQuickBarIndexSaved))
11470 {
11472 return false;
11473 }
11474
11475 if (hasQuickBarIndexSaved)
11476 {
11477 int itmQBIndex;
11478
11479
11480 if (!ctx.
Read(itmQBIndex))
11481 {
11483 return false;
11484 }
11485
11486 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11487 if (itmQBIndex != -1 && parentPlayer)
11488 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11489 }
11490 }
11491 else
11492 {
11493
11494 PlayerBase player;
11495 int itemQBIndex;
11496 if (version ==
int.
MAX)
11497 {
11498 if (!ctx.
Read(itemQBIndex))
11499 {
11501 return false;
11502 }
11503 }
11504 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11505 {
11506
11507 if (!ctx.
Read(itemQBIndex))
11508 {
11510 return false;
11511 }
11512 if (itemQBIndex != -1 && player)
11513 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11514 }
11515 }
11516
11517 if (version < 140)
11518 {
11519
11520 if (!LoadVariables(ctx, version))
11521 {
11523 return false;
11524 }
11525 }
11526
11527
11529 {
11531 return false;
11532 }
11533 if (version >= 132)
11534 {
11536 if (raib)
11537 {
11539 {
11541 return false;
11542 }
11543 }
11544 }
11545
11547 return true;
11548 }
11549
11550
11551
11553 {
11554 super.OnStoreSave(ctx);
11555
11556 PlayerBase player;
11557 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11558 {
11560
11561 int itemQBIndex = -1;
11562 itemQBIndex = player.FindQuickBarEntityIndex(this);
11563 ctx.
Write(itemQBIndex);
11564 }
11565 else
11566 {
11568 }
11569
11571
11573 if (raib)
11574 {
11576 }
11577 }
11578
11579
11581 {
11582 super.AfterStoreLoad();
11583
11585 {
11587 }
11588
11590 {
11593 }
11594 }
11595
11597 {
11598 super.EEOnAfterLoad();
11599
11601 {
11603 }
11604
11607 }
11608
11610 {
11611 return false;
11612 }
11613
11614
11615
11617 {
11619 {
11620 #ifdef PLATFORM_CONSOLE
11621
11623 {
11625 if (menu)
11626 {
11628 }
11629 }
11630 #endif
11631 }
11632
11634 {
11637 }
11638
11640 {
11641 SetWeightDirty();
11643 }
11645 {
11648 }
11649
11651 {
11654 }
11656 {
11659 }
11660
11661 super.OnVariablesSynchronized();
11662 }
11663
11664
11665
11667 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11668 {
11669 if (!IsServerCheck(allow_client))
11670 return false;
11671
11673 return false;
11674
11677
11678 if (value <= (min + 0.001))
11679 value = min;
11680
11681 if (value == min)
11682 {
11683 if (destroy_config)
11684 {
11685 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11686 if (dstr)
11687 {
11689 this.Delete();
11690 return true;
11691 }
11692 }
11693 else if (destroy_forced)
11694 {
11696 this.Delete();
11697 return true;
11698 }
11699
11701 }
11702
11705
11707 {
11709
11710 if (delta)
11712 }
11713
11715
11716 return false;
11717 }
11718
11719
11721 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11722 {
11724 }
11725
11727 {
11730 }
11731
11733 {
11736 }
11737
11739 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11740 {
11741 float value_clamped = Math.Clamp(value, 0, 1);
11743 SetQuantity(result, destroy_config, destroy_forced);
11744 }
11745
11746
11749 {
11751 }
11752
11754 {
11756 }
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11768 {
11769 int slot = -1;
11770 if (GetInventory())
11771 {
11772 InventoryLocation il = new InventoryLocation;
11773 GetInventory().GetCurrentInventoryLocation(il);
11775 }
11776
11778 }
11779
11781 {
11782 float quantity_max = 0;
11783
11785 {
11786 if (attSlotID != -1)
11787 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11788
11789 if (quantity_max <= 0)
11791 }
11792
11793 if (quantity_max <= 0)
11795
11796 return quantity_max;
11797 }
11798
11800 {
11802 }
11803
11805 {
11807 }
11808
11809
11811 {
11813 }
11814
11816 {
11818 }
11819
11821 {
11823 }
11824
11825
11827 {
11828
11829 float weightEx = GetWeightEx();
11830 float special = GetInventoryAndCargoWeight();
11831 return weightEx - special;
11832 }
11833
11834
11836 {
11838 }
11839
11841 {
11843 {
11844 #ifdef DEVELOPER
11845 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11846 {
11847 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11849 }
11850 #endif
11851
11852 return GetQuantity() * GetConfigWeightModified();
11853 }
11854 else if (HasEnergyManager())
11855 {
11856 #ifdef DEVELOPER
11857 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11858 {
11859 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11860 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11861 }
11862 #endif
11863 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11864 }
11865 else
11866 {
11867 #ifdef DEVELOPER
11868 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11869 {
11870 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11871 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11872 }
11873 #endif
11874 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11875 }
11876 }
11877
11880 {
11881 int item_count = 0;
11883
11884 if (GetInventory().GetCargo() != NULL)
11885 {
11886 item_count = GetInventory().GetCargo().GetItemCount();
11887 }
11888
11889 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11890 {
11891 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11892 if (item)
11893 item_count += item.GetNumberOfItems();
11894 }
11895 return item_count;
11896 }
11897
11900 {
11901 float weight = 0;
11902 float wetness = 1;
11903 if (include_wetness)
11906 {
11907 weight = wetness * m_ConfigWeight;
11908 }
11910 {
11911 weight = 1;
11912 }
11913 return weight;
11914 }
11915
11916
11917
11919 {
11920 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11921 {
11922 GameInventory inv = GetInventory();
11923 array<EntityAI> items = new array<EntityAI>;
11925 for (int i = 0; i < items.Count(); i++)
11926 {
11928 if (item)
11929 {
11931 }
11932 }
11933 }
11934 }
11935
11936
11937
11938
11940 {
11941 float energy = 0;
11942 if (HasEnergyManager())
11943 {
11944 energy = GetCompEM().GetEnergy();
11945 }
11946 return energy;
11947 }
11948
11949
11951 {
11952 super.OnEnergyConsumed();
11953
11955 }
11956
11958 {
11959 super.OnEnergyAdded();
11960
11962 }
11963
11964
11966 {
11967 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11968 {
11970 {
11971 float energy_0to1 = GetCompEM().GetEnergy0To1();
11973 }
11974 }
11975 }
11976
11977
11979 {
11980 return ConfigGetFloat("heatIsolation");
11981 }
11982
11984 {
11986 }
11987
11989 {
11990 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11991 if (
GetGame().ConfigIsExisting(paramPath))
11993
11994 return 0.0;
11995 }
11996
11998 {
11999 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12000 if (
GetGame().ConfigIsExisting(paramPath))
12002
12003 return 0.0;
12004 }
12005
12006 override void SetWet(
float value,
bool allow_client =
false)
12007 {
12008 if (!IsServerCheck(allow_client))
12009 return;
12010
12013
12015
12016 m_VarWet = Math.Clamp(value, min, max);
12017
12019 {
12022 }
12023 }
12024
12025 override void AddWet(
float value)
12026 {
12028 }
12029
12031 {
12033 }
12034
12036 {
12038 }
12039
12041 {
12043 }
12044
12046 {
12048 }
12049
12051 {
12053 }
12054
12055 override void OnWetChanged(
float newVal,
float oldVal)
12056 {
12059 if (newLevel != oldLevel)
12060 {
12062 }
12063 }
12064
12066 {
12067 SetWeightDirty();
12068 }
12069
12071 {
12072 return GetWetLevelInternal(
m_VarWet);
12073 }
12074
12075
12076
12078 {
12080 }
12081
12083 {
12085 }
12086
12088 {
12090 }
12091
12093 {
12095 }
12096
12097
12098
12100 {
12101 if (ConfigIsExisting("itemModelLength"))
12102 {
12103 return ConfigGetFloat("itemModelLength");
12104 }
12105 return 0;
12106 }
12107
12109 {
12110 if (ConfigIsExisting("itemAttachOffset"))
12111 {
12112 return ConfigGetFloat("itemAttachOffset");
12113 }
12114 return 0;
12115 }
12116
12117 override void SetCleanness(
int value,
bool allow_client =
false)
12118 {
12119 if (!IsServerCheck(allow_client))
12120 return;
12121
12123
12125
12128 }
12129
12131 {
12133 }
12134
12136 {
12137 return true;
12138 }
12139
12140
12141
12142
12144 {
12146 }
12147
12149 {
12151 }
12152
12153
12154
12155
12156 override void SetColor(
int r,
int g,
int b,
int a)
12157 {
12163 }
12165 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12166 {
12171 }
12172
12174 {
12176 }
12177
12180 {
12181 int r,g,b,a;
12183 r = r/255;
12184 g = g/255;
12185 b = b/255;
12186 a = a/255;
12187 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12188 }
12189
12190
12191
12192 override void SetLiquidType(
int value,
bool allow_client =
false)
12193 {
12194 if (!IsServerCheck(allow_client))
12195 return;
12196
12201 }
12202
12204 {
12205 return ConfigGetInt("varLiquidTypeInit");
12206 }
12207
12209 {
12211 }
12212
12214 {
12216 SetFrozen(false);
12217 }
12218
12221 {
12222 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12223 }
12224
12225
12228 {
12229 PlayerBase nplayer;
12230 if (PlayerBase.CastTo(nplayer, player))
12231 {
12233
12234 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12235 }
12236 }
12237
12238
12241 {
12242 PlayerBase nplayer;
12243 if (PlayerBase.CastTo(nplayer,player))
12244 {
12245
12246 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12247
12248 }
12249
12250
12251 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12252
12253
12254 if (HasEnergyManager())
12255 {
12256 GetCompEM().UpdatePlugState();
12257 }
12258 }
12259
12260
12262 {
12263 super.OnPlacementStarted(player);
12264
12266 }
12267
12268 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12269 {
12271 {
12272 m_AdminLog.OnPlacementComplete(player,
this);
12273 }
12274
12275 super.OnPlacementComplete(player, position, orientation);
12276 }
12277
12278
12279
12280
12281
12283 {
12285 {
12286 return true;
12287 }
12288 else
12289 {
12290 return false;
12291 }
12292 }
12293
12294
12296 {
12298 {
12300 }
12301 }
12302
12303
12305 {
12307 }
12308
12310 {
12312 }
12313
12314 override void InsertAgent(
int agent,
float count = 1)
12315 {
12316 if (count < 1)
12317 return;
12318
12320 }
12321
12324 {
12326 }
12327
12328
12330 {
12332 }
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12376 {
12378 return false;
12379 return true;
12380 }
12381
12383 {
12384
12386 }
12387
12388
12391 {
12392 super.CheckForRoofLimited(timeTresholdMS);
12393
12395 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12396 {
12397 m_PreviousRoofTestTime = time;
12398 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12399 }
12400 }
12401
12402
12404 {
12406 {
12407 return 0;
12408 }
12409
12410 if (GetInventory().GetAttachmentSlotsCount() != 0)
12411 {
12412 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12413 if (filter)
12414 return filter.GetProtectionLevel(type, false, system);
12415 else
12416 return 0;
12417 }
12418
12419 string subclassPath, entryName;
12420
12421 switch (type)
12422 {
12424 entryName = "biological";
12425 break;
12427 entryName = "chemical";
12428 break;
12429 default:
12430 entryName = "biological";
12431 break;
12432 }
12433
12434 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12435
12437 }
12438
12439
12440
12443 {
12444 if (!IsMagazine())
12446
12448 }
12449
12450
12451
12452
12453
12458 {
12459 return true;
12460 }
12461
12463 {
12465 }
12466
12467
12468
12469
12470
12472 {
12473 if (parent)
12474 {
12475 if (parent.IsInherited(DayZInfected))
12476 return true;
12477
12478 if (!parent.IsRuined())
12479 return true;
12480 }
12481
12482 return true;
12483 }
12484
12486 {
12487 if (!super.CanPutAsAttachment(parent))
12488 {
12489 return false;
12490 }
12491
12492 if (!IsRuined() && !parent.IsRuined())
12493 {
12494 return true;
12495 }
12496
12497 return false;
12498 }
12499
12501 {
12502
12503
12504
12505
12506 return super.CanReceiveItemIntoCargo(item);
12507 }
12508
12510 {
12511
12512
12513
12514
12515 GameInventory attachmentInv = attachment.GetInventory();
12517 {
12518 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12519 return false;
12520 }
12521
12522 InventoryLocation loc = new InventoryLocation();
12523 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12524 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12525 return false;
12526
12527 return super.CanReceiveAttachment(attachment, slotId);
12528 }
12529
12531 {
12532 if (!super.CanReleaseAttachment(attachment))
12533 return false;
12534
12535 return GetInventory().AreChildrenAccessible();
12536 }
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12559 {
12560 int id = muzzle_owner.GetMuzzleID();
12561 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12562
12563 if (WPOF_array)
12564 {
12565 for (int i = 0; i < WPOF_array.Count(); i++)
12566 {
12567 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12568
12569 if (WPOF)
12570 {
12571 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12572 }
12573 }
12574 }
12575 }
12576
12577
12579 {
12580 int id = muzzle_owner.GetMuzzleID();
12582
12583 if (WPOBE_array)
12584 {
12585 for (int i = 0; i < WPOBE_array.Count(); i++)
12586 {
12587 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12588
12589 if (WPOBE)
12590 {
12591 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12592 }
12593 }
12594 }
12595 }
12596
12597
12599 {
12600 int id = muzzle_owner.GetMuzzleID();
12601 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12602
12603 if (WPOOH_array)
12604 {
12605 for (int i = 0; i < WPOOH_array.Count(); i++)
12606 {
12607 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12608
12609 if (WPOOH)
12610 {
12611 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12612 }
12613 }
12614 }
12615 }
12616
12617
12619 {
12620 int id = muzzle_owner.GetMuzzleID();
12621 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12622
12623 if (WPOOH_array)
12624 {
12625 for (int i = 0; i < WPOOH_array.Count(); i++)
12626 {
12627 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12628
12629 if (WPOOH)
12630 {
12631 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12632 }
12633 }
12634 }
12635 }
12636
12637
12639 {
12640 int id = muzzle_owner.GetMuzzleID();
12641 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12642
12643 if (WPOOH_array)
12644 {
12645 for (int i = 0; i < WPOOH_array.Count(); i++)
12646 {
12647 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12648
12649 if (WPOOH)
12650 {
12651 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12652 }
12653 }
12654 }
12655 }
12656
12657
12658
12660 {
12662 {
12663 return true;
12664 }
12665
12666 return false;
12667 }
12668
12670 {
12672 {
12673 return true;
12674 }
12675
12676 return false;
12677 }
12678
12680 {
12682 {
12683 return true;
12684 }
12685
12686 return false;
12687 }
12688
12690 {
12691 return false;
12692 }
12693
12696 {
12697 return UATimeSpent.DEFAULT_DEPLOY;
12698 }
12699
12700
12701
12702
12704 {
12706 SetSynchDirty();
12707 }
12708
12710 {
12712 }
12713
12714
12716 {
12717 return false;
12718 }
12719
12722 {
12723 string att_type = "None";
12724
12725 if (ConfigIsExisting("soundAttType"))
12726 {
12727 att_type = ConfigGetString("soundAttType");
12728 }
12729
12731 }
12732
12734 {
12736 }
12737
12738
12739
12740
12741
12747
12749 {
12752
12754 }
12755
12756
12758 {
12760 return;
12761
12763
12766
12769
12770 SoundParameters params = new SoundParameters();
12774 }
12775
12776
12778 {
12780 return;
12781
12783 SetSynchDirty();
12784
12787 }
12788
12789
12791 {
12793 return;
12794
12796 SetSynchDirty();
12797
12800 }
12801
12803 {
12805 }
12806
12808 {
12810 }
12811
12814 {
12815 if (!
GetGame().IsDedicatedServer())
12816 {
12817 if (ConfigIsExisting("attachSoundSet"))
12818 {
12819 string cfg_path = "";
12820 string soundset = "";
12821 string type_name =
GetType();
12822
12825 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12826 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12827
12828 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12829 {
12830 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12831 {
12832 if (cfg_slot_array[i] == slot_type)
12833 {
12834 soundset = cfg_soundset_array[i];
12835 break;
12836 }
12837 }
12838 }
12839
12840 if (soundset != "")
12841 {
12842 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12844 }
12845 }
12846 }
12847 }
12848
12850 {
12851
12852 }
12853
12854 void OnApply(PlayerBase player);
12855
12857 {
12858 return 1.0;
12859 };
12860
12862 {
12864 }
12865
12867 {
12869 }
12870
12872
12874 {
12875 SetDynamicPhysicsLifeTime(0.01);
12877 }
12878
12880 {
12881 array<string> zone_names = new array<string>;
12882 GetDamageZones(zone_names);
12883 for (int i = 0; i < zone_names.Count(); i++)
12884 {
12885 SetHealthMax(zone_names.Get(i),"Health");
12886 }
12887 SetHealthMax("","Health");
12888 }
12889
12892 {
12893 float global_health = GetHealth01("","Health");
12894 array<string> zones = new array<string>;
12895 GetDamageZones(zones);
12896
12897 for (int i = 0; i < zones.Count(); i++)
12898 {
12899 SetHealth01(zones.Get(i),"Health",global_health);
12900 }
12901 }
12902
12905 {
12906 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12907 }
12908
12910 {
12911 if (!hasRootAsPlayer)
12912 {
12913 if (refParentIB)
12914 {
12915
12916 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12917 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12918
12919 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12920 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12921
12924 }
12925 else
12926 {
12927
12930 }
12931 }
12932 }
12933
12935 {
12937 {
12938 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12939 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12940 {
12941 float heatPermCoef = 1.0;
12943 while (ent)
12944 {
12945 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12946 ent = ent.GetHierarchyParent();
12947 }
12948
12949 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12950 }
12951 }
12952 }
12953
12955 {
12956
12957 EntityAI parent = GetHierarchyParent();
12958 if (!parent)
12959 {
12960 hasParent = false;
12961 hasRootAsPlayer = false;
12962 }
12963 else
12964 {
12965 hasParent = true;
12966 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12967 refParentIB =
ItemBase.Cast(parent);
12968 }
12969 }
12970
12971 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12972 {
12973
12974 }
12975
12977 {
12978
12979 return false;
12980 }
12981
12983 {
12984
12985
12986 return false;
12987 }
12988
12990 {
12991
12992 return false;
12993 }
12994
12997 {
12998 return !GetIsFrozen() &&
IsOpen();
12999 }
13000
13002 {
13003 bool hasParent = false, hasRootAsPlayer = false;
13005
13006 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13007 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13008
13009 if (wwtu || foodDecay)
13010 {
13014
13015 if (processWetness || processTemperature || processDecay)
13016 {
13018
13019 if (processWetness)
13020 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13021
13022 if (processTemperature)
13024
13025 if (processDecay)
13026 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13027 }
13028 }
13029 }
13030
13033 {
13035 }
13036
13038 {
13041
13042 return super.GetTemperatureFreezeThreshold();
13043 }
13044
13046 {
13049
13050 return super.GetTemperatureThawThreshold();
13051 }
13052
13054 {
13057
13058 return super.GetItemOverheatThreshold();
13059 }
13060
13062 {
13064 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13065
13066 return super.GetTemperatureFreezeTime();
13067 }
13068
13070 {
13072 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13073
13074 return super.GetTemperatureThawTime();
13075 }
13076
13081
13083 {
13084 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13085 }
13086
13088 {
13089 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13090 }
13091
13094 {
13096 }
13097
13099 {
13101 }
13102
13104 {
13106 }
13107
13110 {
13111 return null;
13112 }
13113
13116 {
13117 return false;
13118 }
13119
13121 {
13123 {
13126 if (!trg)
13127 {
13129 explosive = this;
13130 }
13131
13132 explosive.PairRemote(trg);
13134
13135 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13136 trg.SetPersistentPairID(persistentID);
13137 explosive.SetPersistentPairID(persistentID);
13138
13139 return true;
13140 }
13141 return false;
13142 }
13143
13146 {
13147 float ret = 1.0;
13150 ret *= GetHealth01();
13151
13152 return ret;
13153 }
13154
13155 #ifdef DEVELOPER
13156 override void SetDebugItem()
13157 {
13158 super.SetDebugItem();
13159 _itemBase = this;
13160 }
13161
13163 {
13164 string text = super.GetDebugText();
13165
13167 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13168
13169 return text;
13170 }
13171 #endif
13172
13174 {
13175 return true;
13176 }
13177
13179
13181
13183 {
13186 }
13187
13188
13196
13212}
13213
13215{
13217 if (entity)
13218 {
13219 bool is_item = entity.IsInherited(
ItemBase);
13220 if (is_item && full_quantity)
13221 {
13224 }
13225 }
13226 else
13227 {
13229 return NULL;
13230 }
13231 return entity;
13232}
13233
13235{
13236 if (item)
13237 {
13238 if (health > 0)
13239 item.SetHealth("", "", health);
13240
13241 if (item.CanHaveTemperature())
13242 {
13244 if (item.CanFreeze())
13245 item.SetFrozen(false);
13246 }
13247
13248 if (item.HasEnergyManager())
13249 {
13250 if (quantity >= 0)
13251 {
13252 item.GetCompEM().SetEnergy0To1(quantity);
13253 }
13254 else
13255 {
13257 }
13258 }
13259 else if (item.IsMagazine())
13260 {
13261 Magazine mag = Magazine.Cast(item);
13262 if (quantity >= 0)
13263 {
13264 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13265 }
13266 else
13267 {
13269 }
13270
13271 }
13272 else
13273 {
13274 if (quantity >= 0)
13275 {
13276 item.SetQuantityNormalized(quantity, false);
13277 }
13278 else
13279 {
13281 }
13282
13283 }
13284 }
13285}
13286
13287#ifdef DEVELOPER
13289#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.