8293{
8295 {
8296 return true;
8297 }
8298};
8299
8300
8301
8303{
8307
8309
8312
8313
8314
8315
8316
8325
8331
8336
8341
8362 protected bool m_IsResultOfSplit
8363
8365
8370
8371
8372
8374
8378
8379
8380
8382
8385
8386
8387
8393
8394
8402
8405
8406
8408
8409
8411
8412
8417
8418
8423
8424
8426
8427
8429 {
8434
8435 if (!
GetGame().IsDedicatedServer())
8436 {
8438 {
8440
8442 {
8444 }
8445 }
8446
8449 }
8450
8451 m_OldLocation = null;
8452
8454 {
8456 }
8457
8458 if (ConfigIsExisting("headSelectionsToHide"))
8459 {
8462 }
8463
8465 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8466 {
8468 }
8469
8471
8472 m_IsResultOfSplit = false;
8473
8475 }
8476
8478 {
8479 super.InitItemVariables();
8480
8486 m_Count = ConfigGetInt(
"count");
8487
8490
8495
8498
8503
8515
8519
8520
8523 if (ConfigIsExisting("canBeSplit"))
8524 {
8527 }
8528
8530 if (ConfigIsExisting("itemBehaviour"))
8532
8533
8536 RegisterNetSyncVariableInt("m_VarLiquidType");
8537 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8538
8539 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8540 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8541 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8542
8543 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8544 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8545 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8546 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8547
8548 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8549 RegisterNetSyncVariableBool("m_IsTakeable");
8550 RegisterNetSyncVariableBool("m_IsHologram");
8551
8554 {
8557 }
8558
8560
8562 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8564
8565 }
8566
8568 {
8570 }
8571
8573 {
8576 {
8581 }
8582 }
8583
8584 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8585 {
8587 {
8590 }
8591
8593 }
8594
8596 {
8602 }
8603
8605
8607 {
8609
8610 if (!action)
8611 {
8612 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8613 return;
8614 }
8615
8617 if (!ai)
8618 {
8620 return;
8621 }
8622
8624 if (!action_array)
8625 {
8626 action_array = new array<ActionBase_Basic>;
8628 }
8629 if (LogManager.IsActionLogEnable())
8630 {
8631 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8632 }
8633
8634 if (action_array.Find(action) != -1)
8635 {
8636 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8637 }
8638 else
8639 {
8640 action_array.Insert(action);
8641 }
8642 }
8643
8645 {
8647 ActionBase action = player.GetActionManager().GetAction(actionName);
8650
8651 if (action_array)
8652 {
8653 action_array.RemoveItem(action);
8654 }
8655 }
8656
8657
8658
8660 {
8661 ActionOverrideData overrideData = new ActionOverrideData();
8665
8667 if (!actionMap)
8668 {
8671 }
8672
8673 actionMap.Insert(this.
Type(), overrideData);
8674
8675 }
8676
8678
8680
8681
8683 {
8686
8689
8690 string config_to_search = "CfgVehicles";
8691 string muzzle_owner_config;
8692
8694 {
8695 if (IsInherited(Weapon))
8696 config_to_search = "CfgWeapons";
8697
8698 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8699
8700 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8701
8703
8704 if (config_OnFire_subclass_count > 0)
8705 {
8706 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8707
8708 for (int i = 0; i < config_OnFire_subclass_count; i++)
8709 {
8710 string particle_class = "";
8712 string config_OnFire_entry = config_OnFire_class + particle_class;
8713 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8714 WPOF_array.Insert(WPOF);
8715 }
8716
8717
8719 }
8720 }
8721
8723 {
8724 config_to_search = "CfgWeapons";
8725 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8726
8727 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8728
8730
8731 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8732 {
8733 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8734
8735 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8736 {
8737 string particle_class2 = "";
8739 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8740 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8741 WPOBE_array.Insert(WPOBE);
8742 }
8743
8744
8746 }
8747 }
8748 }
8749
8750
8752 {
8755
8757 {
8758 string config_to_search = "CfgVehicles";
8759
8760 if (IsInherited(Weapon))
8761 config_to_search = "CfgWeapons";
8762
8763 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8764 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8765
8766 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8767 {
8768
8770
8772 {
8774 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8776 return;
8777 }
8778
8781
8782
8783
8785 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8786
8787 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8788 {
8789 string particle_class = "";
8791 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8793
8794 if (entry_type == CT_CLASS)
8795 {
8796 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8797 WPOOH_array.Insert(WPOF);
8798 }
8799 }
8800
8801
8803 }
8804 }
8805 }
8806
8808 {
8810 }
8811
8813 {
8815 {
8817
8820
8823
8824 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8825 }
8826 }
8827
8829 {
8831 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8832
8834 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8835
8837 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8838
8840 {
8842 }
8843 }
8844
8846 {
8848 }
8849
8851 {
8854 else
8856
8858 {
8861 }
8862 else
8863 {
8866
8869 }
8870
8872 }
8873
8875 {
8877 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8878 }
8879
8881 {
8883 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8885 }
8886
8888 {
8890 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8891 }
8892
8894 {
8897
8898 OverheatingParticle OP = new OverheatingParticle();
8903
8905 }
8906
8908 {
8911
8912 return -1;
8913 }
8914
8916 {
8918 {
8921
8922 for (int i = count; i > 0; --i)
8923 {
8924 int id = i - 1;
8927
8930
8931 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8932 {
8933 if (p)
8934 {
8937 }
8938 }
8939 }
8940 }
8941 }
8942
8944 {
8946 {
8948 {
8949 int id = i - 1;
8951
8952 if (OP)
8953 {
8955
8956 if (p)
8957 {
8959 }
8960
8961 delete OP;
8962 }
8963 }
8964
8967 }
8968 }
8969
8972 {
8973 return 0.0;
8974 }
8975
8976
8978 {
8979 return 250;
8980 }
8981
8983 {
8984 return 0;
8985 }
8986
8989 {
8991 return true;
8992
8993 return false;
8994 }
8995
8998 {
9001
9003 {
9005 }
9006 else
9007 {
9008
9010 }
9011
9013 }
9014
9021 {
9022 return -1;
9023 }
9024
9025
9026
9027
9029 {
9031 {
9033 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9034
9035 if (r_index >= 0)
9036 {
9037 InventoryLocation r_il = new InventoryLocation;
9038 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9039
9040 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9043 {
9044 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9045 }
9047 {
9048 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9049 }
9050
9051 }
9052
9053 player.GetHumanInventory().ClearUserReservedLocation(this);
9054 }
9055
9058 }
9059
9060
9061
9062
9064 {
9065 return ItemBase.m_DebugActionsMask;
9066 }
9067
9069 {
9070 return ItemBase.m_DebugActionsMask & mask;
9071 }
9072
9074 {
9075 ItemBase.m_DebugActionsMask = mask;
9076 }
9077
9079 {
9080 ItemBase.m_DebugActionsMask |= mask;
9081 }
9082
9084 {
9085 ItemBase.m_DebugActionsMask &= ~mask;
9086 }
9087
9089 {
9091 {
9093 }
9094 else
9095 {
9097 }
9098 }
9099
9100
9102 {
9103 if (GetEconomyProfile())
9104 {
9105 float q_max = GetEconomyProfile().GetQuantityMax();
9106 if (q_max > 0)
9107 {
9108 float q_min = GetEconomyProfile().GetQuantityMin();
9109 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9110
9112 {
9113 ComponentEnergyManager comp = GetCompEM();
9115 {
9117 }
9118 }
9120 {
9122
9123 }
9124
9125 }
9126 }
9127 }
9128
9131 {
9132 EntityAI parent = GetHierarchyParent();
9133
9134 if (parent)
9135 {
9136 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9137 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9138 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9139 }
9140 }
9141
9144 {
9145 EntityAI parent = GetHierarchyParent();
9146
9147 if (parent)
9148 {
9149 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9150 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9151 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9152 }
9153 }
9154
9156 {
9157
9158
9159
9160
9162
9164 {
9165 if (ScriptInputUserData.CanStoreInputUserData())
9166 {
9167 ScriptInputUserData ctx = new ScriptInputUserData;
9173 ctx.
Write(use_stack_max);
9176
9178 {
9179 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9180 }
9181 }
9182 }
9183 else if (!
GetGame().IsMultiplayer())
9184 {
9186 }
9187 }
9188
9190 {
9192 }
9193
9195 {
9197 }
9198
9200 {
9202 }
9203
9205 {
9206
9207 return false;
9208 }
9209
9211 {
9212 return false;
9213 }
9214
9218 {
9219 return false;
9220 }
9221
9223 {
9224 return "";
9225 }
9226
9228
9230 {
9231 return false;
9232 }
9233
9235 {
9236 return true;
9237 }
9238
9239
9240
9242 {
9243 return true;
9244 }
9245
9247 {
9248 return true;
9249 }
9250
9252 {
9253 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9255 }
9256
9258 {
9260 }
9261
9263 {
9265 if (!is_being_placed)
9267 SetSynchDirty();
9268 }
9269
9270
9272
9274 {
9276 }
9277
9279 {
9281 }
9282
9284 {
9285 return 1;
9286 }
9287
9289 {
9290 return false;
9291 }
9292
9294 {
9296 SetSynchDirty();
9297 }
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9334 {
9335 super.OnMovedInsideCargo(container);
9336
9337 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9338 }
9339
9340 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9341 {
9342 super.EEItemLocationChanged(oldLoc,newLoc);
9343
9344 PlayerBase new_player = null;
9345 PlayerBase old_player = null;
9346
9347 if (newLoc.GetParent())
9348 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9349
9350 if (oldLoc.GetParent())
9351 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9352
9354 {
9355 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9356
9357 if (r_index >= 0)
9358 {
9359 InventoryLocation r_il = new InventoryLocation;
9360 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9361
9362 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9365 {
9366 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9367 }
9369 {
9370 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9371 }
9372
9373 }
9374 }
9375
9377 {
9378 if (new_player)
9379 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9380
9381 if (new_player == old_player)
9382 {
9383
9384 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9385 {
9387 {
9388 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9389 {
9390 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9391 }
9392 }
9393 else
9394 {
9395 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9396 }
9397 }
9398
9399 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9400 {
9401 int type = oldLoc.GetType();
9403 {
9404 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9405 }
9407 {
9408 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9409 }
9410 }
9411 if (!m_OldLocation)
9412 {
9413 m_OldLocation = new InventoryLocation;
9414 }
9415 m_OldLocation.Copy(oldLoc);
9416 }
9417 else
9418 {
9419 if (m_OldLocation)
9420 {
9421 m_OldLocation.Reset();
9422 }
9423 }
9424
9426 }
9427 else
9428 {
9429 if (new_player)
9430 {
9431 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9432 if (res_index >= 0)
9433 {
9434 InventoryLocation il = new InventoryLocation;
9435 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9437 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9440 {
9441 il.
GetParent().GetOnReleaseLock().Invoke(it);
9442 }
9444 {
9446 }
9447
9448 }
9449 }
9451 {
9452
9454 }
9455
9456 if (m_OldLocation)
9457 {
9458 m_OldLocation.Reset();
9459 }
9460 }
9461 }
9462
9463 override void EOnContact(IEntity other, Contact extra)
9464 {
9466 {
9467 int liquidType = -1;
9469 if (impactSpeed > 0.0)
9470 {
9472 #ifndef SERVER
9474 #else
9476 SetSynchDirty();
9477 #endif
9479 }
9480 }
9481
9482 #ifdef SERVER
9483 if (GetCompEM() && GetCompEM().IsPlugged())
9484 {
9485 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9486 GetCompEM().UnplugThis();
9487 }
9488 #endif
9489 }
9490
9492
9494 {
9496 }
9497
9499 {
9500
9501 }
9502
9504 {
9505 super.OnItemLocationChanged(old_owner, new_owner);
9506
9507 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9508 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9509
9510 if (!relatedPlayer && playerNew)
9511 relatedPlayer = playerNew;
9512
9513 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9514 {
9516 if (actionMgr)
9517 {
9518 ActionBase currentAction = actionMgr.GetRunningAction();
9519 if (currentAction)
9521 }
9522 }
9523
9524 Man ownerPlayerOld = null;
9525 Man ownerPlayerNew = null;
9526
9527 if (old_owner)
9528 {
9529 if (old_owner.
IsMan())
9530 {
9531 ownerPlayerOld = Man.Cast(old_owner);
9532 }
9533 else
9534 {
9535 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9536 }
9537 }
9538 else
9539 {
9541 {
9543
9544 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9545 {
9546 GetCompEM().UnplugThis();
9547 }
9548 }
9549 }
9550
9551 if (new_owner)
9552 {
9553 if (new_owner.
IsMan())
9554 {
9555 ownerPlayerNew = Man.Cast(new_owner);
9556 }
9557 else
9558 {
9559 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9560 }
9561 }
9562
9563 if (ownerPlayerOld != ownerPlayerNew)
9564 {
9565 if (ownerPlayerOld)
9566 {
9567 array<EntityAI> subItemsExit = new array<EntityAI>;
9569 for (int i = 0; i < subItemsExit.Count(); i++)
9570 {
9573 }
9574 }
9575
9576 if (ownerPlayerNew)
9577 {
9578 array<EntityAI> subItemsEnter = new array<EntityAI>;
9580 for (int j = 0; j < subItemsEnter.Count(); j++)
9581 {
9584 }
9585 }
9586 }
9587 else if (ownerPlayerNew != null)
9588 {
9589 PlayerBase nplayer;
9590 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9591 {
9592 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9594 for (int k = 0; k < subItemsUpdate.Count(); k++)
9595 {
9597 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9598 }
9599 }
9600 }
9601
9602 if (old_owner)
9603 old_owner.OnChildItemRemoved(this);
9604 if (new_owner)
9605 new_owner.OnChildItemReceived(this);
9606 }
9607
9608
9610 {
9611 super.EEDelete(parent);
9612 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9613 if (player)
9614 {
9616
9617 if (player.IsAlive())
9618 {
9619 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9620 if (r_index >= 0)
9621 {
9622 InventoryLocation r_il = new InventoryLocation;
9623 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9624
9625 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9628 {
9629 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9630 }
9632 {
9633 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9634 }
9635
9636 }
9637
9638 player.RemoveQuickBarEntityShortcut(this);
9639 }
9640 }
9641 }
9642
9644 {
9645 super.EEKilled(killer);
9646
9649 {
9650 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9651 {
9652 if (IsMagazine())
9653 {
9654 if (Magazine.Cast(this).GetAmmoCount() > 0)
9655 {
9657 }
9658 }
9659 else
9660 {
9662 }
9663 }
9664 }
9665 }
9666
9668 {
9669 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9670
9671 super.OnWasAttached(parent, slot_id);
9672
9675
9677 }
9678
9680 {
9681 super.OnWasDetached(parent, slot_id);
9682
9685 }
9686
9688 {
9689 int idx;
9692
9693 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9694 if (inventory_slots.Count() < 1)
9695 {
9696 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9697 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9698 }
9699 else
9700 {
9701 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9702 }
9703
9704 idx = inventory_slots.Find(slot);
9705 if (idx < 0)
9706 return "";
9707
9708 return attach_types.Get(idx);
9709 }
9710
9712 {
9713 int idx = -1;
9714 string slot;
9715
9718
9719 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9720 if (inventory_slots.Count() < 1)
9721 {
9722 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9723 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9724 }
9725 else
9726 {
9727 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9728 if (detach_types.Count() < 1)
9729 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9730 }
9731
9732 for (int i = 0; i < inventory_slots.Count(); i++)
9733 {
9734 slot = inventory_slots.Get(i);
9735 }
9736
9737 if (slot != "")
9738 {
9739 if (detach_types.Count() == 1)
9740 idx = 0;
9741 else
9742 idx = inventory_slots.Find(slot);
9743 }
9744 if (idx < 0)
9745 return "";
9746
9747 return detach_types.Get(idx);
9748 }
9749
9751 {
9752
9754
9755
9756 float min_time = 1;
9757 float max_time = 3;
9758 float delay = Math.RandomFloat(min_time, max_time);
9759
9760 explode_timer.Run(delay, this, "DoAmmoExplosion");
9761 }
9762
9764 {
9765 Magazine magazine = Magazine.Cast(this);
9766 int pop_sounds_count = 6;
9767 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9768
9769
9770 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9771 string sound_name = pop_sounds[ sound_idx ];
9773
9774
9775 magazine.ServerAddAmmoCount(-1);
9776
9777
9778 float min_temp_to_explode = 100;
9779
9780 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
9781 {
9783 }
9784 }
9785
9786
9787 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9788 {
9789 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9790
9791 const int CHANCE_DAMAGE_CARGO = 4;
9792 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9793 const int CHANCE_DAMAGE_NOTHING = 2;
9794
9796 {
9797 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9798 int chances;
9799 int rnd;
9800
9801 if (GetInventory().GetCargo())
9802 {
9803 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9804 rnd = Math.RandomInt(0,chances);
9805
9806 if (rnd < CHANCE_DAMAGE_CARGO)
9807 {
9809 }
9810 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9811 {
9813 }
9814 }
9815 else
9816 {
9817 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9818 rnd = Math.RandomInt(0,chances);
9819
9820 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9821 {
9823 }
9824 }
9825 }
9826 }
9827
9829 {
9830 if (GetInventory().GetCargo())
9831 {
9832 int item_count = GetInventory().GetCargo().GetItemCount();
9833 if (item_count > 0)
9834 {
9835 int random_pick = Math.RandomInt(0, item_count);
9837 if (!item.IsExplosive())
9838 {
9839 item.AddHealth("","",damage);
9840 return true;
9841 }
9842 }
9843 }
9844 return false;
9845 }
9846
9848 {
9849 int attachment_count = GetInventory().AttachmentCount();
9850 if (attachment_count > 0)
9851 {
9852 int random_pick = Math.RandomInt(0, attachment_count);
9853 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9854 if (!attachment.IsExplosive())
9855 {
9856 attachment.AddHealth("","",damage);
9857 return true;
9858 }
9859 }
9860 return false;
9861 }
9862
9864 {
9866 }
9867
9869 {
9871 return GetInventory().CanRemoveEntity();
9872
9873 return false;
9874 }
9875
9877 {
9879 return;
9880
9882 {
9883 if (ScriptInputUserData.CanStoreInputUserData())
9884 {
9885 ScriptInputUserData ctx = new ScriptInputUserData;
9890 ctx.
Write(destination_entity);
9894 }
9895 }
9896 else if (!
GetGame().IsMultiplayer())
9897 {
9899 }
9900 }
9901
9903 {
9905 return;
9906
9907 float split_quantity_new;
9911 InventoryLocation loc = new InventoryLocation;
9912
9913 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9914 {
9916 split_quantity_new = stack_max;
9917 else
9919
9920 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9921 if (new_item)
9922 {
9923 new_item.SetResultOfSplit(true);
9924 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9926 new_item.SetQuantity(split_quantity_new);
9927 }
9928 }
9929 else if (destination_entity && slot_id == -1)
9930 {
9931 if (quantity > stack_max)
9932 split_quantity_new = stack_max;
9933 else
9934 split_quantity_new = quantity;
9935
9937 {
9940 }
9941
9942 if (new_item)
9943 {
9944 new_item.SetResultOfSplit(true);
9945 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9947 new_item.SetQuantity(split_quantity_new);
9948 }
9949 }
9950 else
9951 {
9952 if (stack_max != 0)
9953 {
9955 {
9957 }
9958
9959 if (split_quantity_new == 0)
9960 {
9961 if (!
GetGame().IsMultiplayer())
9962 player.PhysicalPredictiveDropItem(this);
9963 else
9964 player.ServerDropEntity(this);
9965 return;
9966 }
9967
9969
9970 if (new_item)
9971 {
9972 new_item.SetResultOfSplit(true);
9973 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9975 new_item.SetQuantity(stack_max);
9976 new_item.PlaceOnSurface();
9977 }
9978 }
9979 }
9980 }
9981
9983 {
9985 return;
9986
9987 float split_quantity_new;
9991 InventoryLocation loc = new InventoryLocation;
9992
9993 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9994 {
9996 split_quantity_new = stack_max;
9997 else
9999
10000 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10001 if (new_item)
10002 {
10003 new_item.SetResultOfSplit(true);
10004 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10006 new_item.SetQuantity(split_quantity_new);
10007 }
10008 }
10009 else if (destination_entity && slot_id == -1)
10010 {
10011 if (quantity > stack_max)
10012 split_quantity_new = stack_max;
10013 else
10014 split_quantity_new = quantity;
10015
10017 {
10020 }
10021
10022 if (new_item)
10023 {
10024 new_item.SetResultOfSplit(true);
10025 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10027 new_item.SetQuantity(split_quantity_new);
10028 }
10029 }
10030 else
10031 {
10032 if (stack_max != 0)
10033 {
10035 {
10037 }
10038
10040
10041 if (new_item)
10042 {
10043 new_item.SetResultOfSplit(true);
10044 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10046 new_item.SetQuantity(stack_max);
10047 new_item.PlaceOnSurface();
10048 }
10049 }
10050 }
10051 }
10052
10054 {
10056 return;
10057
10059 {
10060 if (ScriptInputUserData.CanStoreInputUserData())
10061 {
10062 ScriptInputUserData ctx = new ScriptInputUserData;
10067 dst.WriteToContext(ctx);
10069 }
10070 }
10071 else if (!
GetGame().IsMultiplayer())
10072 {
10074 }
10075 }
10076
10078 {
10080 return;
10081
10083 {
10084 if (ScriptInputUserData.CanStoreInputUserData())
10085 {
10086 ScriptInputUserData ctx = new ScriptInputUserData;
10091 ctx.
Write(destination_entity);
10097 }
10098 }
10099 else if (!
GetGame().IsMultiplayer())
10100 {
10102 }
10103 }
10104
10106 {
10108 }
10109
10111 {
10113 return this;
10114
10116 float split_quantity_new;
10118 if (dst.IsValid())
10119 {
10120 int slot_id = dst.GetSlot();
10122
10123 if (quantity > stack_max)
10124 split_quantity_new = stack_max;
10125 else
10126 split_quantity_new = quantity;
10127
10129
10130 if (new_item)
10131 {
10132 new_item.SetResultOfSplit(true);
10133 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10136 }
10137
10138 return new_item;
10139 }
10140
10141 return null;
10142 }
10143
10145 {
10147 return;
10148
10150 float split_quantity_new;
10152 if (destination_entity)
10153 {
10155 if (quantity > stackable)
10156 split_quantity_new = stackable;
10157 else
10158 split_quantity_new = quantity;
10159
10160 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10161 if (new_item)
10162 {
10163 new_item.SetResultOfSplit(true);
10164 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10166 new_item.SetQuantity(split_quantity_new);
10167 }
10168 }
10169 }
10170
10172 {
10174 return;
10175
10177 {
10178 if (ScriptInputUserData.CanStoreInputUserData())
10179 {
10180 ScriptInputUserData ctx = new ScriptInputUserData;
10185 ItemBase destination_entity =
this;
10186 ctx.
Write(destination_entity);
10190 }
10191 }
10192 else if (!
GetGame().IsMultiplayer())
10193 {
10195 }
10196 }
10197
10199 {
10201 return;
10202
10204 float split_quantity_new;
10206 if (player)
10207 {
10209 if (quantity > stackable)
10210 split_quantity_new = stackable;
10211 else
10212 split_quantity_new = quantity;
10213
10214 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10215 new_item =
ItemBase.Cast(in_hands);
10216 if (new_item)
10217 {
10218 new_item.SetResultOfSplit(true);
10219 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10221 new_item.SetQuantity(split_quantity_new);
10222 }
10223 }
10224 }
10225
10227 {
10229 return;
10230
10232 float split_quantity_new = Math.Floor(quantity * 0.5);
10233
10235
10236 if (new_item)
10237 {
10238 if (new_item.GetQuantityMax() < split_quantity_new)
10239 {
10240 split_quantity_new = new_item.GetQuantityMax();
10241 }
10242
10243 new_item.SetResultOfSplit(true);
10244 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10245
10247 {
10250 }
10251 else
10252 {
10255 }
10256 }
10257 }
10258
10260 {
10262 return;
10263
10265 float split_quantity_new = Math.Floor(quantity / 2);
10266
10267 InventoryLocation invloc = new InventoryLocation;
10269
10271 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10272
10273 if (new_item)
10274 {
10275 if (new_item.GetQuantityMax() < split_quantity_new)
10276 {
10277 split_quantity_new = new_item.GetQuantityMax();
10278 }
10280 {
10283 }
10284 else
10285 {
10288 }
10289 }
10290 }
10291
10294 {
10295 SetWeightDirty();
10297
10298 if (parent)
10299 parent.OnAttachmentQuantityChangedEx(this, delta);
10300
10302 {
10304 {
10306 }
10308 {
10309 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10311 }
10312 }
10313
10314 }
10315
10318 {
10319
10320 }
10321
10324 {
10326 }
10327
10329 {
10330 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10331
10333 {
10334 if (newLevel == GameConstants.STATE_RUINED)
10335 {
10337 EntityAI parent = GetHierarchyParent();
10338 if (parent && parent.IsFireplace())
10339 {
10340 CargoBase cargo = GetInventory().GetCargo();
10341 if (cargo)
10342 {
10344 {
10346 }
10347 }
10348 }
10349 }
10350
10352 {
10353
10355 return;
10356 }
10357
10358 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10359 {
10361 }
10362 }
10363 }
10364
10365
10367 {
10368 super.OnRightClick();
10369
10371 {
10373 {
10374 if (ScriptInputUserData.CanStoreInputUserData())
10375 {
10376 vector m4[4];
10378
10379 EntityAI root = GetHierarchyRoot();
10380
10381 InventoryLocation dst = new InventoryLocation;
10383 {
10384 if (root)
10385 {
10386 root.GetTransform(m4);
10388 }
10389 else
10390 GetInventory().GetCurrentInventoryLocation(dst);
10391 }
10392 else
10393 {
10395
10396
10397 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10398 {
10399 if (root)
10400 {
10401 root.GetTransform(m4);
10403 }
10404 else
10405 GetInventory().GetCurrentInventoryLocation(dst);
10406 }
10407 else
10408 {
10409 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10410 }
10411 }
10412
10413 ScriptInputUserData ctx = new ScriptInputUserData;
10421 }
10422 }
10423 else if (!
GetGame().IsMultiplayer())
10424 {
10426 }
10427 }
10428 }
10429
10430 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10431 {
10432
10433 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10434 return false;
10435
10436 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10437 return false;
10438
10439
10441 return false;
10442
10443
10444 Magazine mag = Magazine.Cast(this);
10445 if (mag)
10446 {
10447 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10448 return false;
10449
10450 if (stack_max_limit)
10451 {
10452 Magazine other_mag = Magazine.Cast(other_item);
10453 if (other_item)
10454 {
10455 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10456 return false;
10457 }
10458
10459 }
10460 }
10461 else
10462 {
10463
10465 return false;
10466
10468 return false;
10469 }
10470
10471 PlayerBase player = null;
10472 if (CastTo(player, GetHierarchyRootPlayer()))
10473 {
10474 if (player.GetInventory().HasAttachment(this))
10475 return false;
10476
10477 if (player.IsItemsToDelete())
10478 return false;
10479 }
10480
10481 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10482 return false;
10483
10484 int slotID;
10486 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10487 return false;
10488
10489 return true;
10490 }
10491
10493 {
10495 }
10496
10498 {
10499 return m_IsResultOfSplit;
10500 }
10501
10503 {
10504 m_IsResultOfSplit = value;
10505 }
10506
10508 {
10510 }
10511
10513 {
10514 float other_item_quantity = other_item.GetQuantity();
10515 float this_free_space;
10516
10518
10520
10521 if (other_item_quantity > this_free_space)
10522 {
10523 return this_free_space;
10524 }
10525 else
10526 {
10527 return other_item_quantity;
10528 }
10529 }
10530
10532 {
10534 }
10535
10537 {
10539 return;
10540
10541 if (!IsMagazine() && other_item)
10542 {
10544 if (quantity_used != 0)
10545 {
10546 float hp1 = GetHealth01("","");
10547 float hp2 = other_item.GetHealth01("","");
10548 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10549 hpResult = hpResult / (
GetQuantity() + quantity_used);
10550
10551 hpResult *= GetMaxHealth();
10552 Math.Round(hpResult);
10553 SetHealth("", "Health", hpResult);
10554
10556 other_item.AddQuantity(-quantity_used);
10557 }
10558 }
10560 }
10561
10563 {
10564 #ifdef SERVER
10565 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10566 GetHierarchyParent().IncreaseLifetimeUp();
10567 #endif
10568 };
10569
10571 {
10572 PlayerBase p = PlayerBase.Cast(player);
10573
10574 array<int> recipesIds = p.m_Recipes;
10575 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10576 if (moduleRecipesManager)
10577 {
10578 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10579 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10580 }
10581
10582 for (int i = 0;i < recipesIds.Count(); i++)
10583 {
10584 int key = recipesIds.Get(i);
10585 string recipeName = moduleRecipesManager.GetRecipeName(key);
10587 }
10588 }
10589
10590
10591 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10592 {
10593 super.GetDebugActions(outputList);
10594
10595
10600
10601
10605
10609
10610
10613
10614
10616 {
10619 }
10620
10622
10625
10629 }
10630
10631
10632
10633
10635 {
10636 super.OnAction(action_id, player, ctx);
10637 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10638 {
10639 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10640 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10641 PlayerBase p = PlayerBase.Cast(player);
10642 if (
EActions.RECIPES_RANGE_START < 1000)
10643 {
10644 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10645 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10646 }
10647 }
10648 #ifndef SERVER
10649 else if (action_id ==
EActions.WATCH_PLAYER)
10650 {
10651 PluginDeveloper.SetDeveloperItemClientEx(player);
10652 }
10653 #endif
10655 {
10656 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10657 {
10658 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10659 OnDebugButtonPressServer(id + 1);
10660 }
10661
10662 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10663 {
10664 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10666 }
10667
10668 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10669 {
10670 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10672 }
10673
10674 else if (action_id ==
EActions.ADD_QUANTITY)
10675 {
10676 if (IsMagazine())
10677 {
10678 Magazine mag = Magazine.Cast(this);
10679 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10680 }
10681 else
10682 {
10684 }
10685
10686 if (m_EM)
10687 {
10688 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10689 }
10690
10691 }
10692
10693 else if (action_id ==
EActions.REMOVE_QUANTITY)
10694 {
10695 if (IsMagazine())
10696 {
10697 Magazine mag2 = Magazine.Cast(this);
10698 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10699 }
10700 else
10701 {
10703 }
10704 if (m_EM)
10705 {
10706 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10707 }
10708
10709 }
10710
10711 else if (action_id ==
EActions.SET_QUANTITY_0)
10712 {
10714
10715 if (m_EM)
10716 {
10717 m_EM.SetEnergy(0);
10718 }
10719 }
10720
10721 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10722 {
10724
10725 if (m_EM)
10726 {
10727 m_EM.SetEnergy(m_EM.GetEnergyMax());
10728 }
10729 }
10730
10731 else if (action_id ==
EActions.ADD_HEALTH)
10732 {
10733 AddHealth("","",GetMaxHealth("","Health")/5);
10734 }
10735 else if (action_id ==
EActions.REMOVE_HEALTH)
10736 {
10737 AddHealth("","",-GetMaxHealth("","Health")/5);
10738 }
10739 else if (action_id ==
EActions.DESTROY_HEALTH)
10740 {
10741 SetHealth01("","",0);
10742 }
10743 else if (action_id ==
EActions.WATCH_ITEM)
10744 {
10746 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10747 #ifdef DEVELOPER
10748 SetDebugDeveloper_item(this);
10749 #endif
10750 }
10751
10752 else if (action_id ==
EActions.ADD_TEMPERATURE)
10753 {
10754 AddTemperature(20);
10755
10756 }
10757
10758 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10759 {
10760 AddTemperature(-20);
10761
10762 }
10763
10764 else if (action_id ==
EActions.FLIP_FROZEN)
10765 {
10766 SetFrozen(!GetIsFrozen());
10767
10768 }
10769
10770 else if (action_id ==
EActions.ADD_WETNESS)
10771 {
10773
10774 }
10775
10776 else if (action_id ==
EActions.REMOVE_WETNESS)
10777 {
10779
10780 }
10781
10782 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10783 {
10786
10787
10788 }
10789
10790 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10791 {
10794 }
10795
10796 else if (action_id ==
EActions.MAKE_SPECIAL)
10797 {
10798 auto debugParams = DebugSpawnParams.WithPlayer(player);
10799 OnDebugSpawnEx(debugParams);
10800 }
10801
10802 else if (action_id ==
EActions.DELETE)
10803 {
10804 Delete();
10805 }
10806
10807 }
10808
10809
10810 return false;
10811 }
10812
10813
10814
10815
10819
10822
10823
10824
10826 {
10827 return false;
10828 }
10829
10830
10832 {
10833 return true;
10834 }
10835
10836
10838 {
10839 return true;
10840 }
10841
10842
10843
10845 {
10846 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10848 }
10849
10852 {
10853 return null;
10854 }
10855
10857 {
10858 return false;
10859 }
10860
10862 {
10863 return false;
10864 }
10865
10869
10870
10872 {
10873 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10874 return module_repairing.CanRepair(this, item_repair_kit);
10875 }
10876
10877
10878 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10879 {
10880 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10881 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10882 }
10883
10884
10886 {
10887
10888
10889
10890
10891
10892
10893
10894
10895 return 1;
10896 }
10897
10898
10899
10901 {
10903 }
10904
10905
10906
10908 {
10910 }
10911
10912
10921 {
10922 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10923
10924 if (player)
10925 {
10926 player.MessageStatus(text);
10927 }
10928 }
10929
10930
10939 {
10940 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10941
10942 if (player)
10943 {
10944 player.MessageAction(text);
10945 }
10946 }
10947
10948
10957 {
10958 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10959
10960 if (player)
10961 {
10962 player.MessageFriendly(text);
10963 }
10964 }
10965
10966
10975 {
10976 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10977
10978 if (player)
10979 {
10980 player.MessageImportant(text);
10981 }
10982 }
10983
10985 {
10986 return true;
10987 }
10988
10989
10990 override bool KindOf(
string tag)
10991 {
10992 bool found = false;
10993 string item_name = this.
GetType();
10996
10997 int array_size = item_tag_array.Count();
10998 for (int i = 0; i < array_size; i++)
10999 {
11000 if (item_tag_array.Get(i) == tag)
11001 {
11002 found = true;
11003 break;
11004 }
11005 }
11006 return found;
11007 }
11008
11009
11011 {
11012
11013 super.OnRPC(sender, rpc_type,ctx);
11014
11015
11016 switch (rpc_type)
11017 {
11018 #ifndef SERVER
11019 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11020 Param2<bool, string> p = new Param2<bool, string>(false, "");
11021
11023 return;
11024
11025 bool play = p.param1;
11026 string soundSet = p.param2;
11027
11028 if (play)
11029 {
11031 {
11033 {
11035 }
11036 }
11037 else
11038 {
11040 }
11041 }
11042 else
11043 {
11045 }
11046
11047 break;
11048 #endif
11049
11050 }
11051
11053 {
11055 }
11056 }
11057
11058
11059
11060
11062 {
11063 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11064 return plugin.GetID(
name);
11065 }
11066
11068 {
11069 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11070 return plugin.GetName(id);
11071 }
11072
11075 {
11076
11077
11078 int varFlags;
11079 if (!ctx.
Read(varFlags))
11080 return;
11081
11082 if (varFlags & ItemVariableFlags.FLOAT)
11083 {
11085 }
11086 }
11087
11089 {
11090
11091 super.SerializeNumericalVars(floats_out);
11092
11093
11094
11096 {
11098 }
11099
11101 {
11103 }
11104
11106 {
11108 }
11109
11111 {
11116 }
11117
11119 {
11121 }
11122 }
11123
11125 {
11126
11127 super.DeSerializeNumericalVars(floats);
11128
11129
11130 int index = 0;
11131 int mask = Math.Round(floats.Get(index));
11132
11133 index++;
11134
11136 {
11138 {
11140 }
11141 else
11142 {
11143 float quantity = floats.Get(index);
11144 SetQuantity(quantity,
true,
false,
false,
false);
11145 }
11146 index++;
11147 }
11148
11150 {
11151 float wet = floats.Get(index);
11153 index++;
11154 }
11155
11157 {
11158 int liquidtype = Math.Round(floats.Get(index));
11160 index++;
11161 }
11162
11164 {
11166 index++;
11168 index++;
11170 index++;
11172 index++;
11173 }
11174
11176 {
11177 int cleanness = Math.Round(floats.Get(index));
11179 index++;
11180 }
11181 }
11182
11184 {
11185 super.WriteVarsToCTX(ctx);
11186
11187
11189 {
11191 }
11192
11194 {
11196 }
11197
11199 {
11201 }
11202
11204 {
11205 int r,g,b,a;
11211 }
11212
11214 {
11216 }
11217 }
11218
11220 {
11221 if (!super.ReadVarsFromCTX(ctx,version))
11222 return false;
11223
11224 int intValue;
11225 float value;
11226
11227 if (version < 140)
11228 {
11229 if (!ctx.
Read(intValue))
11230 return false;
11231
11232 m_VariablesMask = intValue;
11233 }
11234
11236 {
11237 if (!ctx.
Read(value))
11238 return false;
11239
11241 {
11243 }
11244 else
11245 {
11247 }
11248 }
11249
11250 if (version < 140)
11251 {
11253 {
11254 if (!ctx.
Read(value))
11255 return false;
11256 SetTemperatureDirect(value);
11257 }
11258 }
11259
11261 {
11262 if (!ctx.
Read(value))
11263 return false;
11265 }
11266
11268 {
11269 if (!ctx.
Read(intValue))
11270 return false;
11272 }
11273
11275 {
11276 int r,g,b,a;
11278 return false;
11280 return false;
11282 return false;
11284 return false;
11285
11287 }
11288
11290 {
11291 if (!ctx.
Read(intValue))
11292 return false;
11294 }
11295
11296 if (version >= 138 && version < 140)
11297 {
11299 {
11300 if (!ctx.
Read(intValue))
11301 return false;
11302 SetFrozen(intValue);
11303 }
11304 }
11305
11306 return true;
11307 }
11308
11309
11311 {
11314 {
11316 }
11317
11318 if (!super.OnStoreLoad(ctx, version))
11319 {
11321 return false;
11322 }
11323
11324 if (version >= 114)
11325 {
11326 bool hasQuickBarIndexSaved;
11327
11328 if (!ctx.
Read(hasQuickBarIndexSaved))
11329 {
11331 return false;
11332 }
11333
11334 if (hasQuickBarIndexSaved)
11335 {
11336 int itmQBIndex;
11337
11338
11339 if (!ctx.
Read(itmQBIndex))
11340 {
11342 return false;
11343 }
11344
11345 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11346 if (itmQBIndex != -1 && parentPlayer)
11347 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11348 }
11349 }
11350 else
11351 {
11352
11353 PlayerBase player;
11354 int itemQBIndex;
11355 if (version ==
int.
MAX)
11356 {
11357 if (!ctx.
Read(itemQBIndex))
11358 {
11360 return false;
11361 }
11362 }
11363 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11364 {
11365
11366 if (!ctx.
Read(itemQBIndex))
11367 {
11369 return false;
11370 }
11371 if (itemQBIndex != -1 && player)
11372 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11373 }
11374 }
11375
11376 if (version < 140)
11377 {
11378
11379 if (!LoadVariables(ctx, version))
11380 {
11382 return false;
11383 }
11384 }
11385
11386
11388 {
11390 return false;
11391 }
11392 if (version >= 132)
11393 {
11395 if (raib)
11396 {
11398 {
11400 return false;
11401 }
11402 }
11403 }
11404
11406 return true;
11407 }
11408
11409
11410
11412 {
11413 super.OnStoreSave(ctx);
11414
11415 PlayerBase player;
11416 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11417 {
11419
11420 int itemQBIndex = -1;
11421 itemQBIndex = player.FindQuickBarEntityIndex(this);
11422 ctx.
Write(itemQBIndex);
11423 }
11424 else
11425 {
11427 }
11428
11430
11432 if (raib)
11433 {
11435 }
11436 }
11437
11438
11440 {
11441 super.AfterStoreLoad();
11442
11444 {
11446 }
11447
11449 {
11452 }
11453 }
11454
11456 {
11457 super.EEOnAfterLoad();
11458
11460 {
11462 }
11463
11466 }
11467
11469 {
11470 return false;
11471 }
11472
11473
11474
11476 {
11478 {
11479 #ifdef PLATFORM_CONSOLE
11480
11482 {
11484 if (menu)
11485 {
11487 }
11488 }
11489 #endif
11490 }
11491
11493 {
11496 }
11497
11499 {
11500 SetWeightDirty();
11502 }
11504 {
11507 }
11508
11510 {
11513 }
11515 {
11518 }
11519
11520 super.OnVariablesSynchronized();
11521 }
11522
11523
11524
11526 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11527 {
11528 if (!IsServerCheck(allow_client))
11529 return false;
11530
11532 return false;
11533
11536
11537 if (value <= (min + 0.001))
11538 value = min;
11539
11540 if (value == min)
11541 {
11542 if (destroy_config)
11543 {
11544 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11545 if (dstr)
11546 {
11548 this.Delete();
11549 return true;
11550 }
11551 }
11552 else if (destroy_forced)
11553 {
11555 this.Delete();
11556 return true;
11557 }
11558
11560 }
11561
11564
11566 {
11568
11569 if (delta)
11571 }
11572
11574
11575 return false;
11576 }
11577
11578
11580 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11581 {
11583 }
11584
11586 {
11589 }
11590
11592 {
11595 }
11596
11599 {
11600 float value_clamped = Math.Clamp(value, 0, 1);
11602 SetQuantity(result, destroy_config, destroy_forced);
11603 }
11604
11605
11608 {
11610 }
11611
11613 {
11615 }
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11627 {
11628 int slot = -1;
11629 if (GetInventory())
11630 {
11631 InventoryLocation il = new InventoryLocation;
11632 GetInventory().GetCurrentInventoryLocation(il);
11634 }
11635
11637 }
11638
11640 {
11641 float quantity_max = 0;
11642
11644 {
11645 if (attSlotID != -1)
11646 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11647
11648 if (quantity_max <= 0)
11650 }
11651
11652 if (quantity_max <= 0)
11654
11655 return quantity_max;
11656 }
11657
11659 {
11661 }
11662
11664 {
11666 }
11667
11668
11670 {
11672 }
11673
11675 {
11677 }
11678
11680 {
11682 }
11683
11684
11686 {
11687
11688 float weightEx = GetWeightEx();
11689 float special = GetInventoryAndCargoWeight();
11690 return weightEx - special;
11691 }
11692
11693
11695 {
11697 }
11698
11700 {
11702 {
11703 #ifdef DEVELOPER
11704 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11705 {
11706 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11708 }
11709 #endif
11710
11711 return GetQuantity() * GetConfigWeightModified();
11712 }
11713 else if (HasEnergyManager())
11714 {
11715 #ifdef DEVELOPER
11716 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11717 {
11718 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11719 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11720 }
11721 #endif
11722 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11723 }
11724 else
11725 {
11726 #ifdef DEVELOPER
11727 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11728 {
11729 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11730 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11731 }
11732 #endif
11733 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
11734 }
11735 }
11736
11739 {
11740 int item_count = 0;
11742
11743 if (GetInventory().GetCargo() != NULL)
11744 {
11745 item_count = GetInventory().GetCargo().GetItemCount();
11746 }
11747
11748 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11749 {
11750 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11751 if (item)
11752 item_count += item.GetNumberOfItems();
11753 }
11754 return item_count;
11755 }
11756
11759 {
11760 float weight = 0;
11761 float wetness = 1;
11762 if (include_wetness)
11765 {
11766 weight = wetness * m_ConfigWeight;
11767 }
11769 {
11770 weight = 1;
11771 }
11772 return weight;
11773 }
11774
11775
11776
11778 {
11779 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11780 {
11781 GameInventory inv = GetInventory();
11782 array<EntityAI> items = new array<EntityAI>;
11784 for (int i = 0; i < items.Count(); i++)
11785 {
11787 if (item)
11788 {
11790 }
11791 }
11792 }
11793 }
11794
11795
11796
11797
11799 {
11800 float energy = 0;
11801 if (HasEnergyManager())
11802 {
11803 energy = GetCompEM().GetEnergy();
11804 }
11805 return energy;
11806 }
11807
11808
11810 {
11811 super.OnEnergyConsumed();
11812
11814 }
11815
11817 {
11818 super.OnEnergyAdded();
11819
11821 }
11822
11823
11825 {
11826 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11827 {
11829 {
11830 float energy_0to1 = GetCompEM().GetEnergy0To1();
11832 }
11833 }
11834 }
11835
11836
11838 {
11839 return ConfigGetFloat("heatIsolation");
11840 }
11841
11843 {
11845 }
11846
11848 {
11849 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11850 if (
GetGame().ConfigIsExisting(paramPath))
11852
11853 return 0.0;
11854 }
11855
11857 {
11858 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11859 if (
GetGame().ConfigIsExisting(paramPath))
11861
11862 return 0.0;
11863 }
11864
11865 override void SetWet(
float value,
bool allow_client =
false)
11866 {
11867 if (!IsServerCheck(allow_client))
11868 return;
11869
11872
11874
11875 m_VarWet = Math.Clamp(value, min, max);
11876
11878 {
11881 }
11882 }
11883
11884 override void AddWet(
float value)
11885 {
11887 }
11888
11890 {
11892 }
11893
11895 {
11897 }
11898
11900 {
11902 }
11903
11905 {
11907 }
11908
11910 {
11912 }
11913
11914 override void OnWetChanged(
float newVal,
float oldVal)
11915 {
11918 if (newLevel != oldLevel)
11919 {
11921 }
11922 }
11923
11925 {
11926 SetWeightDirty();
11927 }
11928
11930 {
11931 return GetWetLevelInternal(
m_VarWet);
11932 }
11933
11934
11935
11937 {
11939 }
11940
11942 {
11944 }
11945
11947 {
11949 }
11950
11952 {
11954 }
11955
11956
11957
11959 {
11960 if (ConfigIsExisting("itemModelLength"))
11961 {
11962 return ConfigGetFloat("itemModelLength");
11963 }
11964 return 0;
11965 }
11966
11968 {
11969 if (ConfigIsExisting("itemAttachOffset"))
11970 {
11971 return ConfigGetFloat("itemAttachOffset");
11972 }
11973 return 0;
11974 }
11975
11976 override void SetCleanness(
int value,
bool allow_client =
false)
11977 {
11978 if (!IsServerCheck(allow_client))
11979 return;
11980
11982
11984
11987 }
11988
11990 {
11992 }
11993
11995 {
11996 return true;
11997 }
11998
11999
12000
12001
12003 {
12005 }
12006
12008 {
12010 }
12011
12012
12013
12014
12015 override void SetColor(
int r,
int g,
int b,
int a)
12016 {
12022 }
12024 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12025 {
12030 }
12031
12033 {
12035 }
12036
12039 {
12040 int r,g,b,a;
12042 r = r/255;
12043 g = g/255;
12044 b = b/255;
12045 a = a/255;
12046 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12047 }
12048
12049
12050
12051 override void SetLiquidType(
int value,
bool allow_client =
false)
12052 {
12053 if (!IsServerCheck(allow_client))
12054 return;
12055
12060 }
12061
12063 {
12064 return ConfigGetInt("varLiquidTypeInit");
12065 }
12066
12068 {
12070 }
12071
12073 {
12075 SetFrozen(false);
12076 }
12077
12080 {
12081 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12082 }
12083
12084
12087 {
12088 PlayerBase nplayer;
12089 if (PlayerBase.CastTo(nplayer, player))
12090 {
12092
12093 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12094 }
12095 }
12096
12097
12100 {
12101 PlayerBase nplayer;
12102 if (PlayerBase.CastTo(nplayer,player))
12103 {
12104
12105 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12106
12107 }
12108
12109
12110 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12111
12112
12113 if (HasEnergyManager())
12114 {
12115 GetCompEM().UpdatePlugState();
12116 }
12117 }
12118
12119
12121 {
12122 super.OnPlacementStarted(player);
12123
12125 }
12126
12127 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12128 {
12130 {
12131 m_AdminLog.OnPlacementComplete(player,
this);
12132 }
12133
12134 super.OnPlacementComplete(player, position, orientation);
12135 }
12136
12137
12138
12139
12140
12142 {
12144 {
12145 return true;
12146 }
12147 else
12148 {
12149 return false;
12150 }
12151 }
12152
12153
12155 {
12157 {
12159 }
12160 }
12161
12162
12164 {
12166 }
12167
12169 {
12171 }
12172
12173 override void InsertAgent(
int agent,
float count = 1)
12174 {
12175 if (count < 1)
12176 return;
12177
12179 }
12180
12183 {
12185 }
12186
12187
12189 {
12191 }
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12235 {
12237 return false;
12238 return true;
12239 }
12240
12242 {
12243
12245 }
12246
12247
12250 {
12251 super.CheckForRoofLimited(timeTresholdMS);
12252
12254 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12255 {
12256 m_PreviousRoofTestTime = time;
12257 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12258 }
12259 }
12260
12261
12263 {
12265 {
12266 return 0;
12267 }
12268
12269 if (GetInventory().GetAttachmentSlotsCount() != 0)
12270 {
12271 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12272 if (filter)
12273 return filter.GetProtectionLevel(type, false, system);
12274 else
12275 return 0;
12276 }
12277
12278 string subclassPath, entryName;
12279
12280 switch (type)
12281 {
12283 entryName = "biological";
12284 break;
12286 entryName = "chemical";
12287 break;
12288 default:
12289 entryName = "biological";
12290 break;
12291 }
12292
12293 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12294
12296 }
12297
12298
12299
12302 {
12303 if (!IsMagazine())
12305
12307 }
12308
12309
12310
12311
12312
12317 {
12318 return true;
12319 }
12320
12322 {
12324 }
12325
12326
12327
12328
12329
12331 {
12332 if (parent)
12333 {
12334 if (parent.IsInherited(DayZInfected))
12335 return true;
12336
12337 if (!parent.IsRuined())
12338 return true;
12339 }
12340
12341 return true;
12342 }
12343
12345 {
12346 if (!super.CanPutAsAttachment(parent))
12347 {
12348 return false;
12349 }
12350
12351 if (!IsRuined() && !parent.IsRuined())
12352 {
12353 return true;
12354 }
12355
12356 return false;
12357 }
12358
12360 {
12361
12362
12363
12364
12365 return super.CanReceiveItemIntoCargo(item);
12366 }
12367
12369 {
12370
12371
12372
12373
12374 GameInventory attachmentInv = attachment.GetInventory();
12376 {
12377 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12378 return false;
12379 }
12380
12381 InventoryLocation loc = new InventoryLocation();
12382 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12383 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12384 return false;
12385
12386 return super.CanReceiveAttachment(attachment, slotId);
12387 }
12388
12390 {
12391 if (!super.CanReleaseAttachment(attachment))
12392 return false;
12393
12394 return GetInventory().AreChildrenAccessible();
12395 }
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12418 {
12419 int id = muzzle_owner.GetMuzzleID();
12420 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12421
12422 if (WPOF_array)
12423 {
12424 for (int i = 0; i < WPOF_array.Count(); i++)
12425 {
12426 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12427
12428 if (WPOF)
12429 {
12430 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12431 }
12432 }
12433 }
12434 }
12435
12436
12438 {
12439 int id = muzzle_owner.GetMuzzleID();
12441
12442 if (WPOBE_array)
12443 {
12444 for (int i = 0; i < WPOBE_array.Count(); i++)
12445 {
12446 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12447
12448 if (WPOBE)
12449 {
12450 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12451 }
12452 }
12453 }
12454 }
12455
12456
12458 {
12459 int id = muzzle_owner.GetMuzzleID();
12460 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12461
12462 if (WPOOH_array)
12463 {
12464 for (int i = 0; i < WPOOH_array.Count(); i++)
12465 {
12466 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12467
12468 if (WPOOH)
12469 {
12470 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12471 }
12472 }
12473 }
12474 }
12475
12476
12478 {
12479 int id = muzzle_owner.GetMuzzleID();
12480 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12481
12482 if (WPOOH_array)
12483 {
12484 for (int i = 0; i < WPOOH_array.Count(); i++)
12485 {
12486 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12487
12488 if (WPOOH)
12489 {
12490 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12491 }
12492 }
12493 }
12494 }
12495
12496
12498 {
12499 int id = muzzle_owner.GetMuzzleID();
12500 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12501
12502 if (WPOOH_array)
12503 {
12504 for (int i = 0; i < WPOOH_array.Count(); i++)
12505 {
12506 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12507
12508 if (WPOOH)
12509 {
12510 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12511 }
12512 }
12513 }
12514 }
12515
12516
12517
12519 {
12521 {
12522 return true;
12523 }
12524
12525 return false;
12526 }
12527
12529 {
12531 {
12532 return true;
12533 }
12534
12535 return false;
12536 }
12537
12539 {
12541 {
12542 return true;
12543 }
12544
12545 return false;
12546 }
12547
12549 {
12550 return false;
12551 }
12552
12555 {
12556 return UATimeSpent.DEFAULT_DEPLOY;
12557 }
12558
12559
12560
12561
12563 {
12565 SetSynchDirty();
12566 }
12567
12569 {
12571 }
12572
12573
12575 {
12576 return false;
12577 }
12578
12581 {
12582 string att_type = "None";
12583
12584 if (ConfigIsExisting("soundAttType"))
12585 {
12586 att_type = ConfigGetString("soundAttType");
12587 }
12588
12590 }
12591
12593 {
12595 }
12596
12597
12598
12599
12600
12604
12606 {
12609
12611 }
12612
12613
12615 {
12617 return;
12618
12620
12623
12626
12627 SoundParameters params = new SoundParameters();
12631 }
12632
12633
12635 {
12637 return;
12638
12640 SetSynchDirty();
12641
12644 }
12645
12646
12648 {
12650 return;
12651
12653 SetSynchDirty();
12654
12657 }
12658
12660 {
12662 }
12663
12665 {
12667 }
12668
12671 {
12672 if (!
GetGame().IsDedicatedServer())
12673 {
12674 if (ConfigIsExisting("attachSoundSet"))
12675 {
12676 string cfg_path = "";
12677 string soundset = "";
12678 string type_name =
GetType();
12679
12682 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12683 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12684
12685 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12686 {
12687 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12688 {
12689 if (cfg_slot_array[i] == slot_type)
12690 {
12691 soundset = cfg_soundset_array[i];
12692 break;
12693 }
12694 }
12695 }
12696
12697 if (soundset != "")
12698 {
12699 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12701 }
12702 }
12703 }
12704 }
12705
12707 {
12708
12709 }
12710
12711 void OnApply(PlayerBase player);
12712
12714 {
12715 return 1.0;
12716 };
12717
12719 {
12721 }
12722
12724 {
12726 }
12727
12729
12731 {
12732 SetDynamicPhysicsLifeTime(0.01);
12734 }
12735
12737 {
12738 array<string> zone_names = new array<string>;
12739 GetDamageZones(zone_names);
12740 for (int i = 0; i < zone_names.Count(); i++)
12741 {
12742 SetHealthMax(zone_names.Get(i),"Health");
12743 }
12744 SetHealthMax("","Health");
12745 }
12746
12749 {
12750 float global_health = GetHealth01("","Health");
12751 array<string> zones = new array<string>;
12752 GetDamageZones(zones);
12753
12754 for (int i = 0; i < zones.Count(); i++)
12755 {
12756 SetHealth01(zones.Get(i),"Health",global_health);
12757 }
12758 }
12759
12762 {
12763 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12764 }
12765
12767 {
12768 if (!hasRootAsPlayer)
12769 {
12770 if (refParentIB)
12771 {
12772
12773 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12774 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12775
12776 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12777 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12778
12781 }
12782 else
12783 {
12784
12787 }
12788 }
12789 }
12790
12792 {
12794 {
12795 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12796 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12797 {
12798 float heatPermCoef = 1.0;
12800 while (ent)
12801 {
12802 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12803 ent = ent.GetHierarchyParent();
12804 }
12805
12806 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12807 }
12808 }
12809 }
12810
12812 {
12813
12814 EntityAI parent = GetHierarchyParent();
12815 if (!parent)
12816 {
12817 hasParent = false;
12818 hasRootAsPlayer = false;
12819 }
12820 else
12821 {
12822 hasParent = true;
12823 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12824 refParentIB =
ItemBase.Cast(parent);
12825 }
12826 }
12827
12828 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12829 {
12830
12831 }
12832
12834 {
12835
12836 return false;
12837 }
12838
12840 {
12841
12842
12843 return false;
12844 }
12845
12847 {
12848
12849 return false;
12850 }
12851
12854 {
12855 return !GetIsFrozen() &&
IsOpen();
12856 }
12857
12859 {
12860 bool hasParent = false, hasRootAsPlayer = false;
12862
12863 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12864 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12865
12866 if (wwtu || foodDecay)
12867 {
12871
12872 if (processWetness || processTemperature || processDecay)
12873 {
12875
12876 if (processWetness)
12877 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12878
12879 if (processTemperature)
12881
12882 if (processDecay)
12883 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12884 }
12885 }
12886 }
12887
12890 {
12892 }
12893
12895 {
12898
12899 return super.GetTemperatureFreezeThreshold();
12900 }
12901
12903 {
12906
12907 return super.GetTemperatureThawThreshold();
12908 }
12909
12911 {
12914
12915 return super.GetItemOverheatThreshold();
12916 }
12917
12919 {
12921 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12922
12923 return super.GetTemperatureFreezeTime();
12924 }
12925
12927 {
12929 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12930
12931 return super.GetTemperatureThawTime();
12932 }
12933
12938
12940 {
12941 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12942 }
12943
12945 {
12946 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12947 }
12948
12951 {
12953 }
12954
12956 {
12958 }
12959
12961 {
12963 }
12964
12967 {
12968 return null;
12969 }
12970
12973 {
12974 return false;
12975 }
12976
12978 {
12980 {
12983 if (!trg)
12984 {
12986 explosive = this;
12987 }
12988
12989 explosive.PairRemote(trg);
12991
12992 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12993 trg.SetPersistentPairID(persistentID);
12994 explosive.SetPersistentPairID(persistentID);
12995
12996 return true;
12997 }
12998 return false;
12999 }
13000
13003 {
13004 float ret = 1.0;
13007 ret *= GetHealth01();
13008
13009 return ret;
13010 }
13011
13012 #ifdef DEVELOPER
13013 override void SetDebugItem()
13014 {
13015 super.SetDebugItem();
13016 _itemBase = this;
13017 }
13018
13020 {
13021 string text = super.GetDebugText();
13022
13024 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13025
13026 return text;
13027 }
13028 #endif
13029
13031 {
13032 return true;
13033 }
13034
13036
13038
13040 {
13043 }
13044
13045
13053
13069}
13070
13072{
13074 if (entity)
13075 {
13076 bool is_item = entity.IsInherited(
ItemBase);
13077 if (is_item && full_quantity)
13078 {
13081 }
13082 }
13083 else
13084 {
13086 return NULL;
13087 }
13088 return entity;
13089}
13090
13092{
13093 if (item)
13094 {
13095 if (health > 0)
13096 item.SetHealth("", "", health);
13097
13098 if (item.CanHaveTemperature())
13099 {
13101 if (item.CanFreeze())
13102 item.SetFrozen(false);
13103 }
13104
13105 if (item.HasEnergyManager())
13106 {
13107 if (quantity >= 0)
13108 {
13109 item.GetCompEM().SetEnergy0To1(quantity);
13110 }
13111 else
13112 {
13114 }
13115 }
13116 else if (item.IsMagazine())
13117 {
13118 Magazine mag = Magazine.Cast(item);
13119 if (quantity >= 0)
13120 {
13121 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13122 }
13123 else
13124 {
13126 }
13127
13128 }
13129 else
13130 {
13131 if (quantity >= 0)
13132 {
13133 item.SetQuantityNormalized(quantity, false);
13134 }
13135 else
13136 {
13138 }
13139
13140 }
13141 }
13142}
13143
13144#ifdef DEVELOPER
13146#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.