8320{
8322 {
8323 return true;
8324 }
8325};
8326
8327
8328
8330{
8334
8336
8339
8340
8341
8342
8343
8352
8358
8363
8368
8389 protected bool m_IsResultOfSplit
8390
8392
8397
8398
8399
8401
8405
8406
8407
8409
8412
8413
8414
8420
8421
8429
8432
8433
8435
8436
8438
8439
8444
8445
8450
8451
8453
8454
8456 {
8461
8462 if (!
GetGame().IsDedicatedServer())
8463 {
8465 {
8467
8469 {
8471 }
8472 }
8473
8476 }
8477
8478 m_OldLocation = null;
8479
8481 {
8483 }
8484
8485 if (ConfigIsExisting("headSelectionsToHide"))
8486 {
8489 }
8490
8492 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8493 {
8495 }
8496
8498
8499 m_IsResultOfSplit = false;
8500
8502 }
8503
8505 {
8506 super.InitItemVariables();
8507
8513 m_Count = ConfigGetInt(
"count");
8514
8517
8522
8525
8530
8542
8546
8547
8550 if (ConfigIsExisting("canBeSplit"))
8551 {
8554 }
8555
8557 if (ConfigIsExisting("itemBehaviour"))
8559
8560
8563 RegisterNetSyncVariableInt("m_VarLiquidType");
8564 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8565
8566 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8567 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8568 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8569
8570 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8571 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8572 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8573 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8574
8575 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8576 RegisterNetSyncVariableBool("m_IsTakeable");
8577 RegisterNetSyncVariableBool("m_IsHologram");
8578
8581 {
8584 }
8585
8587
8589 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8591
8592 }
8593
8595 {
8597 }
8598
8600 {
8603 {
8608 }
8609 }
8610
8611 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8612 {
8614 {
8617 }
8618
8620 }
8621
8623 {
8629 }
8630
8632
8634 {
8636
8637 if (!action)
8638 {
8639 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8640 return;
8641 }
8642
8644 if (!ai)
8645 {
8647 return;
8648 }
8649
8651 if (!action_array)
8652 {
8653 action_array = new array<ActionBase_Basic>;
8655 }
8656 if (LogManager.IsActionLogEnable())
8657 {
8658 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8659 }
8660
8661 if (action_array.Find(action) != -1)
8662 {
8663 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8664 }
8665 else
8666 {
8667 action_array.Insert(action);
8668 }
8669 }
8670
8672 {
8674 ActionBase action = player.GetActionManager().GetAction(actionName);
8677
8678 if (action_array)
8679 {
8680 action_array.RemoveItem(action);
8681 }
8682 }
8683
8684
8685
8687 {
8688 ActionOverrideData overrideData = new ActionOverrideData();
8692
8694 if (!actionMap)
8695 {
8698 }
8699
8700 actionMap.Insert(this.
Type(), overrideData);
8701
8702 }
8703
8705
8707
8708
8710 {
8713
8716
8717 string config_to_search = "CfgVehicles";
8718 string muzzle_owner_config;
8719
8721 {
8722 if (IsInherited(Weapon))
8723 config_to_search = "CfgWeapons";
8724
8725 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8726
8727 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8728
8730
8731 if (config_OnFire_subclass_count > 0)
8732 {
8733 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8734
8735 for (int i = 0; i < config_OnFire_subclass_count; i++)
8736 {
8737 string particle_class = "";
8739 string config_OnFire_entry = config_OnFire_class + particle_class;
8740 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8741 WPOF_array.Insert(WPOF);
8742 }
8743
8744
8746 }
8747 }
8748
8750 {
8751 config_to_search = "CfgWeapons";
8752 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8753
8754 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8755
8757
8758 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8759 {
8760 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8761
8762 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8763 {
8764 string particle_class2 = "";
8766 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8767 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8768 WPOBE_array.Insert(WPOBE);
8769 }
8770
8771
8773 }
8774 }
8775 }
8776
8777
8779 {
8782
8784 {
8785 string config_to_search = "CfgVehicles";
8786
8787 if (IsInherited(Weapon))
8788 config_to_search = "CfgWeapons";
8789
8790 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8791 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8792
8793 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8794 {
8795
8797
8799 {
8801 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8803 return;
8804 }
8805
8808
8809
8810
8812 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8813
8814 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8815 {
8816 string particle_class = "";
8818 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8820
8821 if (entry_type == CT_CLASS)
8822 {
8823 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8824 WPOOH_array.Insert(WPOF);
8825 }
8826 }
8827
8828
8830 }
8831 }
8832 }
8833
8835 {
8837 }
8838
8840 {
8842 {
8844
8847
8850
8851 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8852 }
8853 }
8854
8856 {
8858 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8859
8861 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8862
8864 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8865
8867 {
8869 }
8870 }
8871
8873 {
8875 }
8876
8878 {
8881 else
8883
8885 {
8888 }
8889 else
8890 {
8893
8896 }
8897
8899 }
8900
8902 {
8904 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8905 }
8906
8908 {
8910 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8912 }
8913
8915 {
8917 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8918 }
8919
8921 {
8924
8925 OverheatingParticle OP = new OverheatingParticle();
8930
8932 }
8933
8935 {
8938
8939 return -1;
8940 }
8941
8943 {
8945 {
8948
8949 for (int i = count; i > 0; --i)
8950 {
8951 int id = i - 1;
8954
8957
8958 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8959 {
8960 if (p)
8961 {
8964 }
8965 }
8966 }
8967 }
8968 }
8969
8971 {
8973 {
8975 {
8976 int id = i - 1;
8978
8979 if (OP)
8980 {
8982
8983 if (p)
8984 {
8986 }
8987
8988 delete OP;
8989 }
8990 }
8991
8994 }
8995 }
8996
8999 {
9000 return 0.0;
9001 }
9002
9003
9005 {
9006 return 250;
9007 }
9008
9010 {
9011 return 0;
9012 }
9013
9016 {
9018 return true;
9019
9020 return false;
9021 }
9022
9025 {
9028
9030 {
9032 }
9033 else
9034 {
9035
9037 }
9038
9040 }
9041
9048 {
9049 return -1;
9050 }
9051
9052
9053
9054
9056 {
9058 {
9060 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9061
9062 if (r_index >= 0)
9063 {
9064 InventoryLocation r_il = new InventoryLocation;
9065 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9066
9067 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9070 {
9071 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9072 }
9074 {
9075 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9076 }
9077
9078 }
9079
9080 player.GetHumanInventory().ClearUserReservedLocation(this);
9081 }
9082
9085 }
9086
9087
9088
9089
9091 {
9092 return ItemBase.m_DebugActionsMask;
9093 }
9094
9096 {
9097 return ItemBase.m_DebugActionsMask & mask;
9098 }
9099
9101 {
9102 ItemBase.m_DebugActionsMask = mask;
9103 }
9104
9106 {
9107 ItemBase.m_DebugActionsMask |= mask;
9108 }
9109
9111 {
9112 ItemBase.m_DebugActionsMask &= ~mask;
9113 }
9114
9116 {
9118 {
9120 }
9121 else
9122 {
9124 }
9125 }
9126
9127
9129 {
9130 if (GetEconomyProfile())
9131 {
9132 float q_max = GetEconomyProfile().GetQuantityMax();
9133 if (q_max > 0)
9134 {
9135 float q_min = GetEconomyProfile().GetQuantityMin();
9136 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9137
9139 {
9140 ComponentEnergyManager comp = GetCompEM();
9142 {
9144 }
9145 }
9147 {
9149
9150 }
9151
9152 }
9153 }
9154 }
9155
9158 {
9159 EntityAI parent = GetHierarchyParent();
9160
9161 if (parent)
9162 {
9163 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9164 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9165 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9166 }
9167 }
9168
9171 {
9172 EntityAI parent = GetHierarchyParent();
9173
9174 if (parent)
9175 {
9176 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9177 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9178 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9179 }
9180 }
9181
9183 {
9184
9185
9186
9187
9189
9191 {
9192 if (ScriptInputUserData.CanStoreInputUserData())
9193 {
9194 ScriptInputUserData ctx = new ScriptInputUserData;
9200 ctx.
Write(use_stack_max);
9203
9205 {
9206 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9207 }
9208 }
9209 }
9210 else if (!
GetGame().IsMultiplayer())
9211 {
9213 }
9214 }
9215
9217 {
9219 }
9220
9222 {
9224 }
9225
9227 {
9229 }
9230
9232 {
9233
9234 return false;
9235 }
9236
9238 {
9239 return false;
9240 }
9241
9245 {
9246 return false;
9247 }
9248
9250 {
9251 return "";
9252 }
9253
9255
9257 {
9258 return false;
9259 }
9260
9262 {
9263 return true;
9264 }
9265
9266
9267
9269 {
9270 return true;
9271 }
9272
9274 {
9275 return true;
9276 }
9277
9279 {
9280 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9282 }
9283
9285 {
9287 }
9288
9290 {
9292 if (!is_being_placed)
9294 SetSynchDirty();
9295 }
9296
9297
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9311 {
9312 return 1;
9313 }
9314
9316 {
9317 return false;
9318 }
9319
9321 {
9323 SetSynchDirty();
9324 }
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9361 {
9362 super.OnMovedInsideCargo(container);
9363
9364 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9365 }
9366
9367 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9368 {
9369 super.EEItemLocationChanged(oldLoc,newLoc);
9370
9371 PlayerBase new_player = null;
9372 PlayerBase old_player = null;
9373
9374 if (newLoc.GetParent())
9375 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9376
9377 if (oldLoc.GetParent())
9378 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9379
9381 {
9382 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9383
9384 if (r_index >= 0)
9385 {
9386 InventoryLocation r_il = new InventoryLocation;
9387 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9388
9389 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9392 {
9393 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9394 }
9396 {
9397 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9398 }
9399
9400 }
9401 }
9402
9404 {
9405 if (new_player)
9406 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9407
9408 if (new_player == old_player)
9409 {
9410
9411 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9412 {
9414 {
9415 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9416 {
9417 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9418 }
9419 }
9420 else
9421 {
9422 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9423 }
9424 }
9425
9426 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9427 {
9428 int type = oldLoc.GetType();
9430 {
9431 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9432 }
9434 {
9435 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9436 }
9437 }
9438 if (!m_OldLocation)
9439 {
9440 m_OldLocation = new InventoryLocation;
9441 }
9442 m_OldLocation.Copy(oldLoc);
9443 }
9444 else
9445 {
9446 if (m_OldLocation)
9447 {
9448 m_OldLocation.Reset();
9449 }
9450 }
9451
9453 }
9454 else
9455 {
9456 if (new_player)
9457 {
9458 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9459 if (res_index >= 0)
9460 {
9461 InventoryLocation il = new InventoryLocation;
9462 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9464 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9467 {
9468 il.
GetParent().GetOnReleaseLock().Invoke(it);
9469 }
9471 {
9473 }
9474
9475 }
9476 }
9478 {
9479
9481 }
9482
9483 if (m_OldLocation)
9484 {
9485 m_OldLocation.Reset();
9486 }
9487 }
9488 }
9489
9490 override void EOnContact(IEntity other, Contact extra)
9491 {
9493 {
9494 int liquidType = -1;
9496 if (impactSpeed > 0.0)
9497 {
9499 #ifndef SERVER
9501 #else
9503 SetSynchDirty();
9504 #endif
9506 }
9507 }
9508
9509 #ifdef SERVER
9510 if (GetCompEM() && GetCompEM().IsPlugged())
9511 {
9512 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9513 GetCompEM().UnplugThis();
9514 }
9515 #endif
9516 }
9517
9519
9521 {
9523 }
9524
9526 {
9527
9528 }
9529
9531 {
9532 super.OnItemLocationChanged(old_owner, new_owner);
9533
9534 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9535 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9536
9537 if (!relatedPlayer && playerNew)
9538 relatedPlayer = playerNew;
9539
9540 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9541 {
9543 if (actionMgr)
9544 {
9545 ActionBase currentAction = actionMgr.GetRunningAction();
9546 if (currentAction)
9548 }
9549 }
9550
9551 Man ownerPlayerOld = null;
9552 Man ownerPlayerNew = null;
9553
9554 if (old_owner)
9555 {
9556 if (old_owner.
IsMan())
9557 {
9558 ownerPlayerOld = Man.Cast(old_owner);
9559 }
9560 else
9561 {
9562 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9563 }
9564 }
9565 else
9566 {
9568 {
9570
9571 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9572 {
9573 GetCompEM().UnplugThis();
9574 }
9575 }
9576 }
9577
9578 if (new_owner)
9579 {
9580 if (new_owner.
IsMan())
9581 {
9582 ownerPlayerNew = Man.Cast(new_owner);
9583 }
9584 else
9585 {
9586 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9587 }
9588 }
9589
9590 if (ownerPlayerOld != ownerPlayerNew)
9591 {
9592 if (ownerPlayerOld)
9593 {
9594 array<EntityAI> subItemsExit = new array<EntityAI>;
9596 for (int i = 0; i < subItemsExit.Count(); i++)
9597 {
9600 }
9601 }
9602
9603 if (ownerPlayerNew)
9604 {
9605 array<EntityAI> subItemsEnter = new array<EntityAI>;
9607 for (int j = 0; j < subItemsEnter.Count(); j++)
9608 {
9611 }
9612 }
9613 }
9614 else if (ownerPlayerNew != null)
9615 {
9616 PlayerBase nplayer;
9617 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9618 {
9619 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9621 for (int k = 0; k < subItemsUpdate.Count(); k++)
9622 {
9624 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9625 }
9626 }
9627 }
9628
9629 if (old_owner)
9630 old_owner.OnChildItemRemoved(this);
9631 if (new_owner)
9632 new_owner.OnChildItemReceived(this);
9633 }
9634
9635
9637 {
9638 super.EEDelete(parent);
9639 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9640 if (player)
9641 {
9643
9644 if (player.IsAlive())
9645 {
9646 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9647 if (r_index >= 0)
9648 {
9649 InventoryLocation r_il = new InventoryLocation;
9650 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9651
9652 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9655 {
9656 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9657 }
9659 {
9660 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9661 }
9662
9663 }
9664
9665 player.RemoveQuickBarEntityShortcut(this);
9666 }
9667 }
9668 }
9669
9671 {
9672 super.EEKilled(killer);
9673
9676 {
9677 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9678 {
9679 if (IsMagazine())
9680 {
9681 if (Magazine.Cast(this).GetAmmoCount() > 0)
9682 {
9684 }
9685 }
9686 else
9687 {
9689 }
9690 }
9691 }
9692 }
9693
9695 {
9696 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9697
9698 super.OnWasAttached(parent, slot_id);
9699
9702
9704 }
9705
9707 {
9708 super.OnWasDetached(parent, slot_id);
9709
9712 }
9713
9715 {
9716 int idx;
9719
9720 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9721 if (inventory_slots.Count() < 1)
9722 {
9723 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9724 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9725 }
9726 else
9727 {
9728 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9729 }
9730
9731 idx = inventory_slots.Find(slot);
9732 if (idx < 0)
9733 return "";
9734
9735 return attach_types.Get(idx);
9736 }
9737
9739 {
9740 int idx = -1;
9741 string slot;
9742
9745
9746 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9747 if (inventory_slots.Count() < 1)
9748 {
9749 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9750 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9751 }
9752 else
9753 {
9754 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9755 if (detach_types.Count() < 1)
9756 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9757 }
9758
9759 for (int i = 0; i < inventory_slots.Count(); i++)
9760 {
9761 slot = inventory_slots.Get(i);
9762 }
9763
9764 if (slot != "")
9765 {
9766 if (detach_types.Count() == 1)
9767 idx = 0;
9768 else
9769 idx = inventory_slots.Find(slot);
9770 }
9771 if (idx < 0)
9772 return "";
9773
9774 return detach_types.Get(idx);
9775 }
9776
9778 {
9779
9781
9782
9783 float min_time = 1;
9784 float max_time = 3;
9785 float delay = Math.RandomFloat(min_time, max_time);
9786
9787 explode_timer.Run(delay, this, "DoAmmoExplosion");
9788 }
9789
9791 {
9792 Magazine magazine = Magazine.Cast(this);
9793 int pop_sounds_count = 6;
9794 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9795
9796
9797 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9798 string sound_name = pop_sounds[ sound_idx ];
9800
9801
9802 magazine.ServerAddAmmoCount(-1);
9803
9804
9805 float min_temp_to_explode = 100;
9806
9807 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9808 {
9810 }
9811 }
9812
9813
9814 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9815 {
9816 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9817
9818 const int CHANCE_DAMAGE_CARGO = 4;
9819 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9820 const int CHANCE_DAMAGE_NOTHING = 2;
9821
9823 {
9824 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9825 int chances;
9826 int rnd;
9827
9828 if (GetInventory().GetCargo())
9829 {
9830 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9831 rnd = Math.RandomInt(0,chances);
9832
9833 if (rnd < CHANCE_DAMAGE_CARGO)
9834 {
9836 }
9837 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9838 {
9840 }
9841 }
9842 else
9843 {
9844 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9845 rnd = Math.RandomInt(0,chances);
9846
9847 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9848 {
9850 }
9851 }
9852 }
9853 }
9854
9856 {
9857 if (GetInventory().GetCargo())
9858 {
9859 int item_count = GetInventory().GetCargo().GetItemCount();
9860 if (item_count > 0)
9861 {
9862 int random_pick = Math.RandomInt(0, item_count);
9864 if (!item.IsExplosive())
9865 {
9866 item.AddHealth("","",damage);
9867 return true;
9868 }
9869 }
9870 }
9871 return false;
9872 }
9873
9875 {
9876 int attachment_count = GetInventory().AttachmentCount();
9877 if (attachment_count > 0)
9878 {
9879 int random_pick = Math.RandomInt(0, attachment_count);
9880 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9881 if (!attachment.IsExplosive())
9882 {
9883 attachment.AddHealth("","",damage);
9884 return true;
9885 }
9886 }
9887 return false;
9888 }
9889
9891 {
9893 }
9894
9896 {
9898 return GetInventory().CanRemoveEntity();
9899
9900 return false;
9901 }
9902
9904 {
9905
9907 return false;
9908
9909
9911 return false;
9912
9913
9914
9916 if (delta == 0)
9917 return false;
9918
9919
9920 return true;
9921 }
9922
9924 {
9926 {
9927 if (ScriptInputUserData.CanStoreInputUserData())
9928 {
9929 ScriptInputUserData ctx = new ScriptInputUserData;
9934 ctx.
Write(destination_entity);
9938 }
9939 }
9940 else if (!
GetGame().IsMultiplayer())
9941 {
9943 }
9944 }
9945
9947 {
9948 float split_quantity_new;
9952 InventoryLocation loc = new InventoryLocation;
9953
9954 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9955 {
9957 split_quantity_new = stack_max;
9958 else
9960
9962 {
9963 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9964 if (new_item)
9965 {
9966 new_item.SetResultOfSplit(true);
9967 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9969 new_item.
SetQuantity(split_quantity_new,
false,
true);
9970 }
9971 }
9972 }
9973 else if (destination_entity && slot_id == -1)
9974 {
9975 if (quantity > stack_max)
9976 split_quantity_new = stack_max;
9977 else
9978 split_quantity_new = quantity;
9979
9981 {
9983 {
9986 }
9987
9988 if (new_item)
9989 {
9990 new_item.SetResultOfSplit(true);
9991 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9993 new_item.
SetQuantity(split_quantity_new,
false,
true);
9994 }
9995 }
9996 }
9997 else
9998 {
9999 if (stack_max != 0)
10000 {
10002 {
10004 }
10005
10006 if (split_quantity_new == 0)
10007 {
10008 if (!
GetGame().IsMultiplayer())
10009 player.PhysicalPredictiveDropItem(this);
10010 else
10011 player.ServerDropEntity(this);
10012 return;
10013 }
10014
10016 {
10018
10019 if (new_item)
10020 {
10021 new_item.SetResultOfSplit(true);
10022 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10025 new_item.PlaceOnSurface();
10026 }
10027 }
10028 }
10029 }
10030 }
10031
10033 {
10034 float split_quantity_new;
10038 InventoryLocation loc = new InventoryLocation;
10039
10040 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10041 {
10043 split_quantity_new = stack_max;
10044 else
10046
10048 {
10049 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10050 if (new_item)
10051 {
10052 new_item.SetResultOfSplit(true);
10053 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10055 new_item.
SetQuantity(split_quantity_new,
false,
true);
10056 }
10057 }
10058 }
10059 else if (destination_entity && slot_id == -1)
10060 {
10061 if (quantity > stack_max)
10062 split_quantity_new = stack_max;
10063 else
10064 split_quantity_new = quantity;
10065
10067 {
10069 {
10072 }
10073
10074 if (new_item)
10075 {
10076 new_item.SetResultOfSplit(true);
10077 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10079 new_item.
SetQuantity(split_quantity_new,
false,
true);
10080 }
10081 }
10082 }
10083 else
10084 {
10085 if (stack_max != 0)
10086 {
10088 {
10090 }
10091
10093 {
10095
10096 if (new_item)
10097 {
10098 new_item.SetResultOfSplit(true);
10099 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10102 new_item.PlaceOnSurface();
10103 }
10104 }
10105 }
10106 }
10107 }
10108
10110 {
10112 {
10113 if (ScriptInputUserData.CanStoreInputUserData())
10114 {
10115 ScriptInputUserData ctx = new ScriptInputUserData;
10120 dst.WriteToContext(ctx);
10122 }
10123 }
10124 else if (!
GetGame().IsMultiplayer())
10125 {
10127 }
10128 }
10129
10131 {
10133 {
10134 if (ScriptInputUserData.CanStoreInputUserData())
10135 {
10136 ScriptInputUserData ctx = new ScriptInputUserData;
10141 ctx.
Write(destination_entity);
10147 }
10148 }
10149 else if (!
GetGame().IsMultiplayer())
10150 {
10152 }
10153 }
10154
10156 {
10158 }
10159
10161 {
10163 float split_quantity_new;
10165 if (dst.IsValid())
10166 {
10167 int slot_id = dst.GetSlot();
10169
10170 if (quantity > stack_max)
10171 split_quantity_new = stack_max;
10172 else
10173 split_quantity_new = quantity;
10174
10176 {
10178
10179 if (new_item)
10180 {
10181 new_item.SetResultOfSplit(true);
10182 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10184 new_item.
SetQuantity(split_quantity_new,
false,
true);
10185 }
10186
10187 return new_item;
10188 }
10189 }
10190
10191 return null;
10192 }
10193
10195 {
10197 float split_quantity_new;
10199 if (destination_entity)
10200 {
10202 if (quantity > stackable)
10203 split_quantity_new = stackable;
10204 else
10205 split_quantity_new = quantity;
10206
10208 {
10209 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10210 if (new_item)
10211 {
10212 new_item.SetResultOfSplit(true);
10213 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10215 new_item.
SetQuantity(split_quantity_new,
false,
true);
10216 }
10217 }
10218 }
10219 }
10220
10222 {
10224 {
10225 if (ScriptInputUserData.CanStoreInputUserData())
10226 {
10227 ScriptInputUserData ctx = new ScriptInputUserData;
10232 ItemBase destination_entity =
this;
10233 ctx.
Write(destination_entity);
10237 }
10238 }
10239 else if (!
GetGame().IsMultiplayer())
10240 {
10242 }
10243 }
10244
10246 {
10248 float split_quantity_new;
10250 if (player)
10251 {
10253 if (quantity > stackable)
10254 split_quantity_new = stackable;
10255 else
10256 split_quantity_new = quantity;
10257
10259 {
10260 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10261 new_item =
ItemBase.Cast(in_hands);
10262 if (new_item)
10263 {
10264 new_item.SetResultOfSplit(true);
10265 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10267 new_item.SetQuantity(split_quantity_new, false, true);
10268 }
10269 }
10270 }
10271 }
10272
10274 {
10276 float split_quantity_new = Math.Floor(quantity * 0.5);
10277
10279 return;
10280
10282
10283 if (new_item)
10284 {
10285 if (new_item.GetQuantityMax() < split_quantity_new)
10286 {
10287 split_quantity_new = new_item.GetQuantityMax();
10288 }
10289
10290 new_item.SetResultOfSplit(true);
10291 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10292
10294 {
10297 }
10298 else
10299 {
10301 new_item.
SetQuantity(split_quantity_new,
false,
true);
10302 }
10303 }
10304 }
10305
10307 {
10309 float split_quantity_new = Math.Floor(quantity / 2);
10310
10312 return;
10313
10314 InventoryLocation invloc = new InventoryLocation;
10316
10318 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10319
10320 if (new_item)
10321 {
10322 if (new_item.GetQuantityMax() < split_quantity_new)
10323 {
10324 split_quantity_new = new_item.GetQuantityMax();
10325 }
10327 {
10330 }
10331 else if (split_quantity_new > 1)
10332 {
10334 new_item.
SetQuantity(split_quantity_new,
false,
true);
10335 }
10336 }
10337 }
10338
10341 {
10342 SetWeightDirty();
10344
10345 if (parent)
10346 parent.OnAttachmentQuantityChangedEx(this, delta);
10347
10349 {
10351 {
10353 }
10355 {
10356 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10358 }
10359 }
10360
10361 }
10362
10365 {
10366
10367 }
10368
10371 {
10373 }
10374
10376 {
10377 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10378
10380 {
10381 if (newLevel == GameConstants.STATE_RUINED)
10382 {
10384 EntityAI parent = GetHierarchyParent();
10385 if (parent && parent.IsFireplace())
10386 {
10387 CargoBase cargo = GetInventory().GetCargo();
10388 if (cargo)
10389 {
10391 {
10393 }
10394 }
10395 }
10396 }
10397
10399 {
10400
10402 return;
10403 }
10404
10405 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10406 {
10408 }
10409 }
10410 }
10411
10412
10414 {
10415 super.OnRightClick();
10416
10418 {
10420 {
10421 if (ScriptInputUserData.CanStoreInputUserData())
10422 {
10423 EntityAI root = GetHierarchyRoot();
10424 Man playerOwner = GetHierarchyRootPlayer();
10425 InventoryLocation dst = new InventoryLocation;
10426
10427
10428 if (!playerOwner && root && root == this)
10429 {
10431 }
10432 else
10433 {
10434
10435 GetInventory().GetCurrentInventoryLocation(dst);
10437 {
10440 {
10442 }
10443 else
10444 {
10446
10447
10448 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10449 {
10451 }
10452 else
10453 {
10454 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10455 }
10456 }
10457 }
10458 }
10459
10460 ScriptInputUserData ctx = new ScriptInputUserData;
10468 }
10469 }
10470 else if (!
GetGame().IsMultiplayer())
10471 {
10473 }
10474 }
10475 }
10476
10478 {
10479 if (root)
10480 {
10481 vector m4[4];
10482 root.GetTransform(m4);
10483 dst.SetGround(this, m4);
10484 }
10485 else
10486 {
10487 GetInventory().GetCurrentInventoryLocation(dst);
10488 }
10489 }
10490
10491 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10492 {
10493
10494 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10495 return false;
10496
10497 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10498 return false;
10499
10500
10502 return false;
10503
10504
10505 Magazine mag = Magazine.Cast(this);
10506 if (mag)
10507 {
10508 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10509 return false;
10510
10511 if (stack_max_limit)
10512 {
10513 Magazine other_mag = Magazine.Cast(other_item);
10514 if (other_item)
10515 {
10516 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10517 return false;
10518 }
10519
10520 }
10521 }
10522 else
10523 {
10524
10526 return false;
10527
10529 return false;
10530 }
10531
10532 PlayerBase player = null;
10533 if (CastTo(player, GetHierarchyRootPlayer()))
10534 {
10535 if (player.GetInventory().HasAttachment(this))
10536 return false;
10537
10538 if (player.IsItemsToDelete())
10539 return false;
10540 }
10541
10542 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10543 return false;
10544
10545 int slotID;
10547 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10548 return false;
10549
10550 return true;
10551 }
10552
10554 {
10556 }
10557
10559 {
10560 return m_IsResultOfSplit;
10561 }
10562
10564 {
10565 m_IsResultOfSplit = value;
10566 }
10567
10569 {
10571 }
10572
10574 {
10575 float other_item_quantity = other_item.GetQuantity();
10576 float this_free_space;
10577
10579
10581
10582 if (other_item_quantity > this_free_space)
10583 {
10584 return this_free_space;
10585 }
10586 else
10587 {
10588 return other_item_quantity;
10589 }
10590 }
10591
10593 {
10595 }
10596
10598 {
10600 return;
10601
10602 if (!IsMagazine() && other_item)
10603 {
10605 if (quantity_used != 0)
10606 {
10607 float hp1 = GetHealth01("","");
10608 float hp2 = other_item.GetHealth01("","");
10609 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10610 hpResult = hpResult / (
GetQuantity() + quantity_used);
10611
10612 hpResult *= GetMaxHealth();
10613 Math.Round(hpResult);
10614 SetHealth("", "Health", hpResult);
10615
10617 other_item.AddQuantity(-quantity_used);
10618 }
10619 }
10621 }
10622
10624 {
10625 #ifdef SERVER
10626 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10627 GetHierarchyParent().IncreaseLifetimeUp();
10628 #endif
10629 };
10630
10632 {
10633 PlayerBase p = PlayerBase.Cast(player);
10634
10635 array<int> recipesIds = p.m_Recipes;
10636 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10637 if (moduleRecipesManager)
10638 {
10639 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10640 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10641 }
10642
10643 for (int i = 0;i < recipesIds.Count(); i++)
10644 {
10645 int key = recipesIds.Get(i);
10646 string recipeName = moduleRecipesManager.GetRecipeName(key);
10648 }
10649 }
10650
10651
10652 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10653 {
10654 super.GetDebugActions(outputList);
10655
10656
10662
10663
10668
10673
10674
10678
10679
10681 {
10685 }
10686
10689
10690
10694
10696
10697 InventoryLocation loc = new InventoryLocation();
10698 GetInventory().GetCurrentInventoryLocation(loc);
10700 {
10701 if (Gizmo_IsSupported())
10704 }
10705
10707 }
10708
10709
10710
10711
10713 {
10714 super.OnAction(action_id, player, ctx);
10715
10717 {
10718 switch (action_id)
10719 {
10722 return true;
10725 return true;
10726 }
10727 }
10728
10730 {
10731 switch (action_id)
10732 {
10734 Delete();
10735 return true;
10736 }
10737 }
10738
10739 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10740 {
10741 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10742 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10743 PlayerBase p = PlayerBase.Cast(player);
10744 if (
EActions.RECIPES_RANGE_START < 1000)
10745 {
10746 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10747 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10748 }
10749 }
10750 #ifndef SERVER
10751 else if (action_id ==
EActions.WATCH_PLAYER)
10752 {
10753 PluginDeveloper.SetDeveloperItemClientEx(player);
10754 }
10755 #endif
10757 {
10758 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10759 {
10760 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10761 OnDebugButtonPressServer(id + 1);
10762 }
10763
10764 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10765 {
10766 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10768 }
10769
10770 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10771 {
10772 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10774 }
10775
10776 else if (action_id ==
EActions.ADD_QUANTITY)
10777 {
10778 if (IsMagazine())
10779 {
10780 Magazine mag = Magazine.Cast(this);
10781 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10782 }
10783 else
10784 {
10786 }
10787
10788 if (m_EM)
10789 {
10790 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10791 }
10792
10793 }
10794
10795 else if (action_id ==
EActions.REMOVE_QUANTITY)
10796 {
10797 if (IsMagazine())
10798 {
10799 Magazine mag2 = Magazine.Cast(this);
10800 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10801 }
10802 else
10803 {
10805 }
10806 if (m_EM)
10807 {
10808 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10809 }
10810
10811 }
10812
10813 else if (action_id ==
EActions.SET_QUANTITY_0)
10814 {
10816
10817 if (m_EM)
10818 {
10819 m_EM.SetEnergy(0);
10820 }
10821 }
10822
10823 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10824 {
10826
10827 if (m_EM)
10828 {
10829 m_EM.SetEnergy(m_EM.GetEnergyMax());
10830 }
10831 }
10832
10833 else if (action_id ==
EActions.ADD_HEALTH)
10834 {
10835 AddHealth("","",GetMaxHealth("","Health")/5);
10836 }
10837 else if (action_id ==
EActions.REMOVE_HEALTH)
10838 {
10839 AddHealth("","",-GetMaxHealth("","Health")/5);
10840 }
10841 else if (action_id ==
EActions.DESTROY_HEALTH)
10842 {
10843 SetHealth01("","",0);
10844 }
10845 else if (action_id ==
EActions.WATCH_ITEM)
10846 {
10848 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10849 #ifdef DEVELOPER
10850 SetDebugDeveloper_item(this);
10851 #endif
10852 }
10853
10854 else if (action_id ==
EActions.ADD_TEMPERATURE)
10855 {
10856 AddTemperature(20);
10857
10858 }
10859
10860 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10861 {
10862 AddTemperature(-20);
10863
10864 }
10865
10866 else if (action_id ==
EActions.FLIP_FROZEN)
10867 {
10868 SetFrozen(!GetIsFrozen());
10869
10870 }
10871
10872 else if (action_id ==
EActions.ADD_WETNESS)
10873 {
10875
10876 }
10877
10878 else if (action_id ==
EActions.REMOVE_WETNESS)
10879 {
10881
10882 }
10883
10884 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10885 {
10888
10889
10890 }
10891
10892 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10893 {
10896 }
10897
10898 else if (action_id ==
EActions.MAKE_SPECIAL)
10899 {
10900 auto debugParams = DebugSpawnParams.WithPlayer(player);
10901 OnDebugSpawnEx(debugParams);
10902 }
10903
10904 }
10905
10906
10907 return false;
10908 }
10909
10910
10911
10912
10916
10919
10920
10921
10923 {
10924 return false;
10925 }
10926
10927
10929 {
10930 return true;
10931 }
10932
10933
10935 {
10936 return true;
10937 }
10938
10939
10940
10942 {
10943 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10945 }
10946
10949 {
10950 return null;
10951 }
10952
10954 {
10955 return false;
10956 }
10957
10959 {
10960 return false;
10961 }
10962
10966
10967
10969 {
10970 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10971 return module_repairing.CanRepair(this, item_repair_kit);
10972 }
10973
10974
10975 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10976 {
10977 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10978 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10979 }
10980
10981
10983 {
10984
10985
10986
10987
10988
10989
10990
10991
10992 return 1;
10993 }
10994
10995
10996
10998 {
11000 }
11001
11002
11003
11005 {
11007 }
11008
11009
11018 {
11019 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11020
11021 if (player)
11022 {
11023 player.MessageStatus(text);
11024 }
11025 }
11026
11027
11036 {
11037 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11038
11039 if (player)
11040 {
11041 player.MessageAction(text);
11042 }
11043 }
11044
11045
11054 {
11055 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11056
11057 if (player)
11058 {
11059 player.MessageFriendly(text);
11060 }
11061 }
11062
11063
11072 {
11073 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11074
11075 if (player)
11076 {
11077 player.MessageImportant(text);
11078 }
11079 }
11080
11082 {
11083 return true;
11084 }
11085
11086
11087 override bool KindOf(
string tag)
11088 {
11089 bool found = false;
11090 string item_name = this.
GetType();
11093
11094 int array_size = item_tag_array.Count();
11095 for (int i = 0; i < array_size; i++)
11096 {
11097 if (item_tag_array.Get(i) == tag)
11098 {
11099 found = true;
11100 break;
11101 }
11102 }
11103 return found;
11104 }
11105
11106
11108 {
11109
11110 super.OnRPC(sender, rpc_type,ctx);
11111
11112
11113 switch (rpc_type)
11114 {
11115 #ifndef SERVER
11116 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11117 Param2<bool, string> p = new Param2<bool, string>(false, "");
11118
11120 return;
11121
11122 bool play = p.param1;
11123 string soundSet = p.param2;
11124
11125 if (play)
11126 {
11128 {
11130 {
11132 }
11133 }
11134 else
11135 {
11137 }
11138 }
11139 else
11140 {
11142 }
11143
11144 break;
11145 #endif
11146
11147 }
11148
11150 {
11152 }
11153 }
11154
11155
11156
11157
11159 {
11160 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11161 return plugin.GetID(
name);
11162 }
11163
11165 {
11166 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11167 return plugin.GetName(id);
11168 }
11169
11172 {
11173
11174
11175 int varFlags;
11176 if (!ctx.
Read(varFlags))
11177 return;
11178
11179 if (varFlags & ItemVariableFlags.FLOAT)
11180 {
11182 }
11183 }
11184
11186 {
11187
11188 super.SerializeNumericalVars(floats_out);
11189
11190
11191
11193 {
11195 }
11196
11198 {
11200 }
11201
11203 {
11205 }
11206
11208 {
11213 }
11214
11216 {
11218 }
11219 }
11220
11222 {
11223
11224 super.DeSerializeNumericalVars(floats);
11225
11226
11227 int index = 0;
11228 int mask = Math.Round(floats.Get(index));
11229
11230 index++;
11231
11233 {
11235 {
11237 }
11238 else
11239 {
11240 float quantity = floats.Get(index);
11241 SetQuantity(quantity,
true,
false,
false,
false);
11242 }
11243 index++;
11244 }
11245
11247 {
11248 float wet = floats.Get(index);
11250 index++;
11251 }
11252
11254 {
11255 int liquidtype = Math.Round(floats.Get(index));
11257 index++;
11258 }
11259
11261 {
11263 index++;
11265 index++;
11267 index++;
11269 index++;
11270 }
11271
11273 {
11274 int cleanness = Math.Round(floats.Get(index));
11276 index++;
11277 }
11278 }
11279
11281 {
11282 super.WriteVarsToCTX(ctx);
11283
11284
11286 {
11288 }
11289
11291 {
11293 }
11294
11296 {
11298 }
11299
11301 {
11302 int r,g,b,a;
11308 }
11309
11311 {
11313 }
11314 }
11315
11317 {
11318 if (!super.ReadVarsFromCTX(ctx,version))
11319 return false;
11320
11321 int intValue;
11322 float value;
11323
11324 if (version < 140)
11325 {
11326 if (!ctx.
Read(intValue))
11327 return false;
11328
11329 m_VariablesMask = intValue;
11330 }
11331
11333 {
11334 if (!ctx.
Read(value))
11335 return false;
11336
11338 {
11340 }
11341 else
11342 {
11344 }
11345 }
11346
11347 if (version < 140)
11348 {
11350 {
11351 if (!ctx.
Read(value))
11352 return false;
11353 SetTemperatureDirect(value);
11354 }
11355 }
11356
11358 {
11359 if (!ctx.
Read(value))
11360 return false;
11362 }
11363
11365 {
11366 if (!ctx.
Read(intValue))
11367 return false;
11369 }
11370
11372 {
11373 int r,g,b,a;
11375 return false;
11377 return false;
11379 return false;
11381 return false;
11382
11384 }
11385
11387 {
11388 if (!ctx.
Read(intValue))
11389 return false;
11391 }
11392
11393 if (version >= 138 && version < 140)
11394 {
11396 {
11397 if (!ctx.
Read(intValue))
11398 return false;
11399 SetFrozen(intValue);
11400 }
11401 }
11402
11403 return true;
11404 }
11405
11406
11408 {
11411 {
11413 }
11414
11415 if (!super.OnStoreLoad(ctx, version))
11416 {
11418 return false;
11419 }
11420
11421 if (version >= 114)
11422 {
11423 bool hasQuickBarIndexSaved;
11424
11425 if (!ctx.
Read(hasQuickBarIndexSaved))
11426 {
11428 return false;
11429 }
11430
11431 if (hasQuickBarIndexSaved)
11432 {
11433 int itmQBIndex;
11434
11435
11436 if (!ctx.
Read(itmQBIndex))
11437 {
11439 return false;
11440 }
11441
11442 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11443 if (itmQBIndex != -1 && parentPlayer)
11444 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11445 }
11446 }
11447 else
11448 {
11449
11450 PlayerBase player;
11451 int itemQBIndex;
11452 if (version ==
int.
MAX)
11453 {
11454 if (!ctx.
Read(itemQBIndex))
11455 {
11457 return false;
11458 }
11459 }
11460 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11461 {
11462
11463 if (!ctx.
Read(itemQBIndex))
11464 {
11466 return false;
11467 }
11468 if (itemQBIndex != -1 && player)
11469 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11470 }
11471 }
11472
11473 if (version < 140)
11474 {
11475
11476 if (!LoadVariables(ctx, version))
11477 {
11479 return false;
11480 }
11481 }
11482
11483
11485 {
11487 return false;
11488 }
11489 if (version >= 132)
11490 {
11492 if (raib)
11493 {
11495 {
11497 return false;
11498 }
11499 }
11500 }
11501
11503 return true;
11504 }
11505
11506
11507
11509 {
11510 super.OnStoreSave(ctx);
11511
11512 PlayerBase player;
11513 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11514 {
11516
11517 int itemQBIndex = -1;
11518 itemQBIndex = player.FindQuickBarEntityIndex(this);
11519 ctx.
Write(itemQBIndex);
11520 }
11521 else
11522 {
11524 }
11525
11527
11529 if (raib)
11530 {
11532 }
11533 }
11534
11535
11537 {
11538 super.AfterStoreLoad();
11539
11541 {
11543 }
11544
11546 {
11549 }
11550 }
11551
11553 {
11554 super.EEOnAfterLoad();
11555
11557 {
11559 }
11560
11563 }
11564
11566 {
11567 return false;
11568 }
11569
11570
11571
11573 {
11575 {
11576 #ifdef PLATFORM_CONSOLE
11577
11579 {
11581 if (menu)
11582 {
11584 }
11585 }
11586 #endif
11587 }
11588
11590 {
11593 }
11594
11596 {
11597 SetWeightDirty();
11599 }
11601 {
11604 }
11605
11607 {
11610 }
11612 {
11615 }
11616
11617 super.OnVariablesSynchronized();
11618 }
11619
11620
11621
11623 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11624 {
11625 if (!IsServerCheck(allow_client))
11626 return false;
11627
11629 return false;
11630
11633
11634 if (value <= (min + 0.001))
11635 value = min;
11636
11637 if (value == min)
11638 {
11639 if (destroy_config)
11640 {
11641 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11642 if (dstr)
11643 {
11645 this.Delete();
11646 return true;
11647 }
11648 }
11649 else if (destroy_forced)
11650 {
11652 this.Delete();
11653 return true;
11654 }
11655
11657 }
11658
11661
11663 {
11665
11666 if (delta)
11668 }
11669
11671
11672 return false;
11673 }
11674
11675
11677 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11678 {
11680 }
11681
11683 {
11686 }
11687
11689 {
11692 }
11693
11695 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11696 {
11697 float value_clamped = Math.Clamp(value, 0, 1);
11699 SetQuantity(result, destroy_config, destroy_forced);
11700 }
11701
11702
11705 {
11707 }
11708
11710 {
11712 }
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11724 {
11725 int slot = -1;
11726 if (GetInventory())
11727 {
11728 InventoryLocation il = new InventoryLocation;
11729 GetInventory().GetCurrentInventoryLocation(il);
11731 }
11732
11734 }
11735
11737 {
11738 float quantity_max = 0;
11739
11741 {
11742 if (attSlotID != -1)
11743 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11744
11745 if (quantity_max <= 0)
11747 }
11748
11749 if (quantity_max <= 0)
11751
11752 return quantity_max;
11753 }
11754
11756 {
11758 }
11759
11761 {
11763 }
11764
11765
11767 {
11769 }
11770
11772 {
11774 }
11775
11777 {
11779 }
11780
11781
11783 {
11784
11785 float weightEx = GetWeightEx();
11786 float special = GetInventoryAndCargoWeight();
11787 return weightEx - special;
11788 }
11789
11790
11792 {
11794 }
11795
11797 {
11799 {
11800 #ifdef DEVELOPER
11801 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11802 {
11803 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11805 }
11806 #endif
11807
11808 return GetQuantity() * GetConfigWeightModified();
11809 }
11810 else if (HasEnergyManager())
11811 {
11812 #ifdef DEVELOPER
11813 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11814 {
11815 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11816 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11817 }
11818 #endif
11819 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11820 }
11821 else
11822 {
11823 #ifdef DEVELOPER
11824 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11825 {
11826 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11827 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11828 }
11829 #endif
11830 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11831 }
11832 }
11833
11836 {
11837 int item_count = 0;
11839
11840 if (GetInventory().GetCargo() != NULL)
11841 {
11842 item_count = GetInventory().GetCargo().GetItemCount();
11843 }
11844
11845 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11846 {
11847 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11848 if (item)
11849 item_count += item.GetNumberOfItems();
11850 }
11851 return item_count;
11852 }
11853
11856 {
11857 float weight = 0;
11858 float wetness = 1;
11859 if (include_wetness)
11862 {
11863 weight = wetness * m_ConfigWeight;
11864 }
11866 {
11867 weight = 1;
11868 }
11869 return weight;
11870 }
11871
11872
11873
11875 {
11876 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11877 {
11878 GameInventory inv = GetInventory();
11879 array<EntityAI> items = new array<EntityAI>;
11881 for (int i = 0; i < items.Count(); i++)
11882 {
11884 if (item)
11885 {
11887 }
11888 }
11889 }
11890 }
11891
11892
11893
11894
11896 {
11897 float energy = 0;
11898 if (HasEnergyManager())
11899 {
11900 energy = GetCompEM().GetEnergy();
11901 }
11902 return energy;
11903 }
11904
11905
11907 {
11908 super.OnEnergyConsumed();
11909
11911 }
11912
11914 {
11915 super.OnEnergyAdded();
11916
11918 }
11919
11920
11922 {
11923 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11924 {
11926 {
11927 float energy_0to1 = GetCompEM().GetEnergy0To1();
11929 }
11930 }
11931 }
11932
11933
11935 {
11936 return ConfigGetFloat("heatIsolation");
11937 }
11938
11940 {
11942 }
11943
11945 {
11946 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11947 if (
GetGame().ConfigIsExisting(paramPath))
11949
11950 return 0.0;
11951 }
11952
11954 {
11955 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11956 if (
GetGame().ConfigIsExisting(paramPath))
11958
11959 return 0.0;
11960 }
11961
11962 override void SetWet(
float value,
bool allow_client =
false)
11963 {
11964 if (!IsServerCheck(allow_client))
11965 return;
11966
11969
11971
11972 m_VarWet = Math.Clamp(value, min, max);
11973
11975 {
11978 }
11979 }
11980
11981 override void AddWet(
float value)
11982 {
11984 }
11985
11987 {
11989 }
11990
11992 {
11994 }
11995
11997 {
11999 }
12000
12002 {
12004 }
12005
12007 {
12009 }
12010
12011 override void OnWetChanged(
float newVal,
float oldVal)
12012 {
12015 if (newLevel != oldLevel)
12016 {
12018 }
12019 }
12020
12022 {
12023 SetWeightDirty();
12024 }
12025
12027 {
12028 return GetWetLevelInternal(
m_VarWet);
12029 }
12030
12031
12032
12034 {
12036 }
12037
12039 {
12041 }
12042
12044 {
12046 }
12047
12049 {
12051 }
12052
12053
12054
12056 {
12057 if (ConfigIsExisting("itemModelLength"))
12058 {
12059 return ConfigGetFloat("itemModelLength");
12060 }
12061 return 0;
12062 }
12063
12065 {
12066 if (ConfigIsExisting("itemAttachOffset"))
12067 {
12068 return ConfigGetFloat("itemAttachOffset");
12069 }
12070 return 0;
12071 }
12072
12073 override void SetCleanness(
int value,
bool allow_client =
false)
12074 {
12075 if (!IsServerCheck(allow_client))
12076 return;
12077
12079
12081
12084 }
12085
12087 {
12089 }
12090
12092 {
12093 return true;
12094 }
12095
12096
12097
12098
12100 {
12102 }
12103
12105 {
12107 }
12108
12109
12110
12111
12112 override void SetColor(
int r,
int g,
int b,
int a)
12113 {
12119 }
12121 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12122 {
12127 }
12128
12130 {
12132 }
12133
12136 {
12137 int r,g,b,a;
12139 r = r/255;
12140 g = g/255;
12141 b = b/255;
12142 a = a/255;
12143 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12144 }
12145
12146
12147
12148 override void SetLiquidType(
int value,
bool allow_client =
false)
12149 {
12150 if (!IsServerCheck(allow_client))
12151 return;
12152
12157 }
12158
12160 {
12161 return ConfigGetInt("varLiquidTypeInit");
12162 }
12163
12165 {
12167 }
12168
12170 {
12172 SetFrozen(false);
12173 }
12174
12177 {
12178 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12179 }
12180
12181
12184 {
12185 PlayerBase nplayer;
12186 if (PlayerBase.CastTo(nplayer, player))
12187 {
12189
12190 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12191 }
12192 }
12193
12194
12197 {
12198 PlayerBase nplayer;
12199 if (PlayerBase.CastTo(nplayer,player))
12200 {
12201
12202 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12203
12204 }
12205
12206
12207 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12208
12209
12210 if (HasEnergyManager())
12211 {
12212 GetCompEM().UpdatePlugState();
12213 }
12214 }
12215
12216
12218 {
12219 super.OnPlacementStarted(player);
12220
12222 }
12223
12224 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12225 {
12227 {
12228 m_AdminLog.OnPlacementComplete(player,
this);
12229 }
12230
12231 super.OnPlacementComplete(player, position, orientation);
12232 }
12233
12234
12235
12236
12237
12239 {
12241 {
12242 return true;
12243 }
12244 else
12245 {
12246 return false;
12247 }
12248 }
12249
12250
12252 {
12254 {
12256 }
12257 }
12258
12259
12261 {
12263 }
12264
12266 {
12268 }
12269
12270 override void InsertAgent(
int agent,
float count = 1)
12271 {
12272 if (count < 1)
12273 return;
12274
12276 }
12277
12280 {
12282 }
12283
12284
12286 {
12288 }
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12332 {
12334 return false;
12335 return true;
12336 }
12337
12339 {
12340
12342 }
12343
12344
12347 {
12348 super.CheckForRoofLimited(timeTresholdMS);
12349
12351 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12352 {
12353 m_PreviousRoofTestTime = time;
12354 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12355 }
12356 }
12357
12358
12360 {
12362 {
12363 return 0;
12364 }
12365
12366 if (GetInventory().GetAttachmentSlotsCount() != 0)
12367 {
12368 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12369 if (filter)
12370 return filter.GetProtectionLevel(type, false, system);
12371 else
12372 return 0;
12373 }
12374
12375 string subclassPath, entryName;
12376
12377 switch (type)
12378 {
12380 entryName = "biological";
12381 break;
12383 entryName = "chemical";
12384 break;
12385 default:
12386 entryName = "biological";
12387 break;
12388 }
12389
12390 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12391
12393 }
12394
12395
12396
12399 {
12400 if (!IsMagazine())
12402
12404 }
12405
12406
12407
12408
12409
12414 {
12415 return true;
12416 }
12417
12419 {
12421 }
12422
12423
12424
12425
12426
12428 {
12429 if (parent)
12430 {
12431 if (parent.IsInherited(DayZInfected))
12432 return true;
12433
12434 if (!parent.IsRuined())
12435 return true;
12436 }
12437
12438 return true;
12439 }
12440
12442 {
12443 if (!super.CanPutAsAttachment(parent))
12444 {
12445 return false;
12446 }
12447
12448 if (!IsRuined() && !parent.IsRuined())
12449 {
12450 return true;
12451 }
12452
12453 return false;
12454 }
12455
12457 {
12458
12459
12460
12461
12462 return super.CanReceiveItemIntoCargo(item);
12463 }
12464
12466 {
12467
12468
12469
12470
12471 GameInventory attachmentInv = attachment.GetInventory();
12473 {
12474 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12475 return false;
12476 }
12477
12478 InventoryLocation loc = new InventoryLocation();
12479 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12480 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12481 return false;
12482
12483 return super.CanReceiveAttachment(attachment, slotId);
12484 }
12485
12487 {
12488 if (!super.CanReleaseAttachment(attachment))
12489 return false;
12490
12491 return GetInventory().AreChildrenAccessible();
12492 }
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12515 {
12516 int id = muzzle_owner.GetMuzzleID();
12517 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12518
12519 if (WPOF_array)
12520 {
12521 for (int i = 0; i < WPOF_array.Count(); i++)
12522 {
12523 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12524
12525 if (WPOF)
12526 {
12527 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12528 }
12529 }
12530 }
12531 }
12532
12533
12535 {
12536 int id = muzzle_owner.GetMuzzleID();
12538
12539 if (WPOBE_array)
12540 {
12541 for (int i = 0; i < WPOBE_array.Count(); i++)
12542 {
12543 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12544
12545 if (WPOBE)
12546 {
12547 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12548 }
12549 }
12550 }
12551 }
12552
12553
12555 {
12556 int id = muzzle_owner.GetMuzzleID();
12557 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12558
12559 if (WPOOH_array)
12560 {
12561 for (int i = 0; i < WPOOH_array.Count(); i++)
12562 {
12563 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12564
12565 if (WPOOH)
12566 {
12567 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12568 }
12569 }
12570 }
12571 }
12572
12573
12575 {
12576 int id = muzzle_owner.GetMuzzleID();
12577 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12578
12579 if (WPOOH_array)
12580 {
12581 for (int i = 0; i < WPOOH_array.Count(); i++)
12582 {
12583 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12584
12585 if (WPOOH)
12586 {
12587 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12588 }
12589 }
12590 }
12591 }
12592
12593
12595 {
12596 int id = muzzle_owner.GetMuzzleID();
12597 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12598
12599 if (WPOOH_array)
12600 {
12601 for (int i = 0; i < WPOOH_array.Count(); i++)
12602 {
12603 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12604
12605 if (WPOOH)
12606 {
12607 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12608 }
12609 }
12610 }
12611 }
12612
12613
12614
12616 {
12618 {
12619 return true;
12620 }
12621
12622 return false;
12623 }
12624
12626 {
12628 {
12629 return true;
12630 }
12631
12632 return false;
12633 }
12634
12636 {
12638 {
12639 return true;
12640 }
12641
12642 return false;
12643 }
12644
12646 {
12647 return false;
12648 }
12649
12652 {
12653 return UATimeSpent.DEFAULT_DEPLOY;
12654 }
12655
12656
12657
12658
12660 {
12662 SetSynchDirty();
12663 }
12664
12666 {
12668 }
12669
12670
12672 {
12673 return false;
12674 }
12675
12678 {
12679 string att_type = "None";
12680
12681 if (ConfigIsExisting("soundAttType"))
12682 {
12683 att_type = ConfigGetString("soundAttType");
12684 }
12685
12687 }
12688
12690 {
12692 }
12693
12694
12695
12696
12697
12703
12705 {
12708
12710 }
12711
12712
12714 {
12716 return;
12717
12719
12722
12725
12726 SoundParameters params = new SoundParameters();
12730 }
12731
12732
12734 {
12736 return;
12737
12739 SetSynchDirty();
12740
12743 }
12744
12745
12747 {
12749 return;
12750
12752 SetSynchDirty();
12753
12756 }
12757
12759 {
12761 }
12762
12764 {
12766 }
12767
12770 {
12771 if (!
GetGame().IsDedicatedServer())
12772 {
12773 if (ConfigIsExisting("attachSoundSet"))
12774 {
12775 string cfg_path = "";
12776 string soundset = "";
12777 string type_name =
GetType();
12778
12781 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12782 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12783
12784 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12785 {
12786 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12787 {
12788 if (cfg_slot_array[i] == slot_type)
12789 {
12790 soundset = cfg_soundset_array[i];
12791 break;
12792 }
12793 }
12794 }
12795
12796 if (soundset != "")
12797 {
12798 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12800 }
12801 }
12802 }
12803 }
12804
12806 {
12807
12808 }
12809
12810 void OnApply(PlayerBase player);
12811
12813 {
12814 return 1.0;
12815 };
12816
12818 {
12820 }
12821
12823 {
12825 }
12826
12828
12830 {
12831 SetDynamicPhysicsLifeTime(0.01);
12833 }
12834
12836 {
12837 array<string> zone_names = new array<string>;
12838 GetDamageZones(zone_names);
12839 for (int i = 0; i < zone_names.Count(); i++)
12840 {
12841 SetHealthMax(zone_names.Get(i),"Health");
12842 }
12843 SetHealthMax("","Health");
12844 }
12845
12848 {
12849 float global_health = GetHealth01("","Health");
12850 array<string> zones = new array<string>;
12851 GetDamageZones(zones);
12852
12853 for (int i = 0; i < zones.Count(); i++)
12854 {
12855 SetHealth01(zones.Get(i),"Health",global_health);
12856 }
12857 }
12858
12861 {
12862 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12863 }
12864
12866 {
12867 if (!hasRootAsPlayer)
12868 {
12869 if (refParentIB)
12870 {
12871
12872 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12873 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12874
12875 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12876 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12877
12880 }
12881 else
12882 {
12883
12886 }
12887 }
12888 }
12889
12891 {
12893 {
12894 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12895 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12896 {
12897 float heatPermCoef = 1.0;
12899 while (ent)
12900 {
12901 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12902 ent = ent.GetHierarchyParent();
12903 }
12904
12905 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12906 }
12907 }
12908 }
12909
12911 {
12912
12913 EntityAI parent = GetHierarchyParent();
12914 if (!parent)
12915 {
12916 hasParent = false;
12917 hasRootAsPlayer = false;
12918 }
12919 else
12920 {
12921 hasParent = true;
12922 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12923 refParentIB =
ItemBase.Cast(parent);
12924 }
12925 }
12926
12927 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12928 {
12929
12930 }
12931
12933 {
12934
12935 return false;
12936 }
12937
12939 {
12940
12941
12942 return false;
12943 }
12944
12946 {
12947
12948 return false;
12949 }
12950
12953 {
12954 return !GetIsFrozen() &&
IsOpen();
12955 }
12956
12958 {
12959 bool hasParent = false, hasRootAsPlayer = false;
12961
12962 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12963 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12964
12965 if (wwtu || foodDecay)
12966 {
12970
12971 if (processWetness || processTemperature || processDecay)
12972 {
12974
12975 if (processWetness)
12976 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12977
12978 if (processTemperature)
12980
12981 if (processDecay)
12982 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12983 }
12984 }
12985 }
12986
12989 {
12991 }
12992
12994 {
12997
12998 return super.GetTemperatureFreezeThreshold();
12999 }
13000
13002 {
13005
13006 return super.GetTemperatureThawThreshold();
13007 }
13008
13010 {
13013
13014 return super.GetItemOverheatThreshold();
13015 }
13016
13018 {
13020 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13021
13022 return super.GetTemperatureFreezeTime();
13023 }
13024
13026 {
13028 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13029
13030 return super.GetTemperatureThawTime();
13031 }
13032
13037
13039 {
13040 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13041 }
13042
13044 {
13045 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13046 }
13047
13050 {
13052 }
13053
13055 {
13057 }
13058
13060 {
13062 }
13063
13066 {
13067 return null;
13068 }
13069
13072 {
13073 return false;
13074 }
13075
13077 {
13079 {
13082 if (!trg)
13083 {
13085 explosive = this;
13086 }
13087
13088 explosive.PairRemote(trg);
13090
13091 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13092 trg.SetPersistentPairID(persistentID);
13093 explosive.SetPersistentPairID(persistentID);
13094
13095 return true;
13096 }
13097 return false;
13098 }
13099
13102 {
13103 float ret = 1.0;
13106 ret *= GetHealth01();
13107
13108 return ret;
13109 }
13110
13111 #ifdef DEVELOPER
13112 override void SetDebugItem()
13113 {
13114 super.SetDebugItem();
13115 _itemBase = this;
13116 }
13117
13119 {
13120 string text = super.GetDebugText();
13121
13123 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13124
13125 return text;
13126 }
13127 #endif
13128
13130 {
13131 return true;
13132 }
13133
13135
13137
13139 {
13142 }
13143
13144
13152
13168}
13169
13171{
13173 if (entity)
13174 {
13175 bool is_item = entity.IsInherited(
ItemBase);
13176 if (is_item && full_quantity)
13177 {
13180 }
13181 }
13182 else
13183 {
13185 return NULL;
13186 }
13187 return entity;
13188}
13189
13191{
13192 if (item)
13193 {
13194 if (health > 0)
13195 item.SetHealth("", "", health);
13196
13197 if (item.CanHaveTemperature())
13198 {
13200 if (item.CanFreeze())
13201 item.SetFrozen(false);
13202 }
13203
13204 if (item.HasEnergyManager())
13205 {
13206 if (quantity >= 0)
13207 {
13208 item.GetCompEM().SetEnergy0To1(quantity);
13209 }
13210 else
13211 {
13213 }
13214 }
13215 else if (item.IsMagazine())
13216 {
13217 Magazine mag = Magazine.Cast(item);
13218 if (quantity >= 0)
13219 {
13220 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13221 }
13222 else
13223 {
13225 }
13226
13227 }
13228 else
13229 {
13230 if (quantity >= 0)
13231 {
13232 item.SetQuantityNormalized(quantity, false);
13233 }
13234 else
13235 {
13237 }
13238
13239 }
13240 }
13241}
13242
13243#ifdef DEVELOPER
13245#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.