8398{
8400 {
8401 return true;
8402 }
8403};
8404
8406{
8407
8408};
8409
8410
8411
8413{
8417
8419
8422
8423
8424
8425
8426
8435
8441
8446
8451
8472 protected bool m_IsResultOfSplit
8473
8475
8480
8481
8482
8484
8488
8489
8490
8492
8495
8496
8497
8503
8504
8512
8515
8516
8518
8519
8521
8522
8527
8528
8533
8535
8536
8538
8539
8541 {
8546
8547 if (!
g_Game.IsDedicatedServer())
8548 {
8550 {
8552
8554 {
8556 }
8557 }
8558
8561 }
8562
8563 m_OldLocation = null;
8564
8566 {
8568 }
8569
8570 if (ConfigIsExisting("headSelectionsToHide"))
8571 {
8574 }
8575
8577 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8578 {
8580 }
8581
8583
8584 m_IsResultOfSplit = false;
8585
8587 }
8588
8590 {
8591 super.InitItemVariables();
8592
8598 m_Count = ConfigGetInt(
"count");
8599
8602
8607
8610
8615
8627
8631
8632
8635 if (ConfigIsExisting("canBeSplit"))
8636 {
8639 }
8640
8642 if (ConfigIsExisting("itemBehaviour"))
8644
8645
8648 RegisterNetSyncVariableInt("m_VarLiquidType");
8649 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8650
8651 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8652 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8653 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8654
8655 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8656 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8657 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8658 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8659
8660 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8661 RegisterNetSyncVariableBool("m_IsTakeable");
8662 RegisterNetSyncVariableBool("m_IsHologram");
8663
8666 {
8669 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8670 }
8671
8673
8675 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8677
8679 }
8680
8682 {
8684 }
8685
8687 {
8690 {
8695 }
8696 }
8697
8698 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8699 {
8701 {
8704 }
8705
8707 }
8708
8710 {
8716 }
8717
8719
8721 {
8723
8724 if (!action)
8725 {
8726 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8727 return;
8728 }
8729
8731 if (!ai)
8732 {
8734 return;
8735 }
8736
8738 if (!action_array)
8739 {
8740 action_array = new array<ActionBase_Basic>;
8742 }
8743 if (LogManager.IsActionLogEnable())
8744 {
8745 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8746 }
8747
8748 if (action_array.Find(action) != -1)
8749 {
8750 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8751 }
8752 else
8753 {
8754 action_array.Insert(action);
8755 }
8756 }
8757
8759 {
8760 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8761 ActionBase action = player.GetActionManager().GetAction(actionName);
8764
8765 if (action_array)
8766 {
8767 action_array.RemoveItem(action);
8768 }
8769 }
8770
8771
8772
8774 {
8775 ActionOverrideData overrideData = new ActionOverrideData();
8779
8781 if (!actionMap)
8782 {
8785 }
8786
8787 actionMap.Insert(this.
Type(), overrideData);
8788
8789 }
8790
8792
8794
8795
8797 {
8800
8803
8804 string config_to_search = "CfgVehicles";
8805 string muzzle_owner_config;
8806
8808 {
8809 if (IsInherited(Weapon))
8810 config_to_search = "CfgWeapons";
8811
8812 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8813
8814 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8815
8816 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8817
8818 if (config_OnFire_subclass_count > 0)
8819 {
8820 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8821
8822 for (int i = 0; i < config_OnFire_subclass_count; i++)
8823 {
8824 string particle_class = "";
8825 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8826 string config_OnFire_entry = config_OnFire_class + particle_class;
8827 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8828 WPOF_array.Insert(WPOF);
8829 }
8830
8831
8833 }
8834 }
8835
8837 {
8838 config_to_search = "CfgWeapons";
8839 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8840
8841 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8842
8843 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8844
8845 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8846 {
8847 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8848
8849 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8850 {
8851 string particle_class2 = "";
8852 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8853 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8854 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8855 WPOBE_array.Insert(WPOBE);
8856 }
8857
8858
8860 }
8861 }
8862 }
8863
8864
8866 {
8869
8871 {
8872 string config_to_search = "CfgVehicles";
8873
8874 if (IsInherited(Weapon))
8875 config_to_search = "CfgWeapons";
8876
8877 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8878 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8879
8880 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8881 {
8882
8884
8886 {
8888 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8890 return;
8891 }
8892
8895
8896
8897
8898 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8899 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8900
8901 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8902 {
8903 string particle_class = "";
8904 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8905 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8906 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8907
8908 if (entry_type == CT_CLASS)
8909 {
8910 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8911 WPOOH_array.Insert(WPOF);
8912 }
8913 }
8914
8915
8917 }
8918 }
8919 }
8920
8922 {
8924 }
8925
8927 {
8929 {
8931
8934
8937
8938 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8939 }
8940 }
8941
8943 {
8945 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8946
8948 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8949
8951 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8952
8954 {
8956 }
8957 }
8958
8960 {
8962 }
8963
8965 {
8968 else
8970
8972 {
8975 }
8976 else
8977 {
8980
8983 }
8984
8986 }
8987
8989 {
8991 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8992 }
8993
8995 {
8997 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8999 }
9000
9002 {
9004 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9005 }
9006
9008 {
9011
9012 OverheatingParticle OP = new OverheatingParticle();
9017
9019 }
9020
9022 {
9025
9026 return -1;
9027 }
9028
9030 {
9032 {
9035
9036 for (int i = count; i > 0; --i)
9037 {
9038 int id = i - 1;
9041
9044
9045 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9046 {
9047 if (p)
9048 {
9051 }
9052 }
9053 }
9054 }
9055 }
9056
9058 {
9060 {
9062 {
9063 int id = i - 1;
9065
9066 if (OP)
9067 {
9069
9070 if (p)
9071 {
9073 }
9074
9075 delete OP;
9076 }
9077 }
9078
9081 }
9082 }
9083
9086 {
9087 return 0.0;
9088 }
9089
9090
9092 {
9093 return 250;
9094 }
9095
9097 {
9098 return 0;
9099 }
9100
9103 {
9105 return true;
9106
9107 return false;
9108 }
9109
9112 {
9115
9117 {
9119 }
9120 else
9121 {
9122
9124 }
9125
9127 }
9128
9135 {
9136 return -1;
9137 }
9138
9139
9140
9141
9143 {
9145 {
9146 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9147 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9148
9149 if (r_index >= 0)
9150 {
9151 InventoryLocation r_il = new InventoryLocation;
9152 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9153
9154 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9157 {
9158 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9159 }
9161 {
9162 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9163 }
9164
9165 }
9166
9167 player.GetHumanInventory().ClearUserReservedLocation(this);
9168 }
9169
9172 }
9173
9174
9175
9176
9178 {
9179 return ItemBase.m_DebugActionsMask;
9180 }
9181
9183 {
9184 return ItemBase.m_DebugActionsMask & mask;
9185 }
9186
9188 {
9189 ItemBase.m_DebugActionsMask = mask;
9190 }
9191
9193 {
9194 ItemBase.m_DebugActionsMask |= mask;
9195 }
9196
9198 {
9199 ItemBase.m_DebugActionsMask &= ~mask;
9200 }
9201
9203 {
9205 {
9207 }
9208 else
9209 {
9211 }
9212 }
9213
9214
9216 {
9217 if (GetEconomyProfile())
9218 {
9219 float q_max = GetEconomyProfile().GetQuantityMax();
9220 if (q_max > 0)
9221 {
9222 float q_min = GetEconomyProfile().GetQuantityMin();
9223 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9224
9226 {
9227 ComponentEnergyManager comp = GetCompEM();
9229 {
9231 }
9232 }
9234 {
9236
9237 }
9238
9239 }
9240 }
9241 }
9242
9245 {
9246 EntityAI parent = GetHierarchyParent();
9247
9248 if (parent)
9249 {
9250 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9251 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9252 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9253 }
9254 }
9255
9258 {
9259 EntityAI parent = GetHierarchyParent();
9260
9261 if (parent)
9262 {
9263 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9264 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9265 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9266 }
9267 }
9268
9270 {
9271
9272
9273
9274
9276
9278 {
9279 if (ScriptInputUserData.CanStoreInputUserData())
9280 {
9281 ScriptInputUserData ctx = new ScriptInputUserData;
9287 ctx.
Write(use_stack_max);
9290
9292 {
9293 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9294 }
9295 }
9296 }
9297 else if (!
g_Game.IsMultiplayer())
9298 {
9300 }
9301 }
9302
9304 {
9306 }
9307
9309 {
9311 }
9312
9314 {
9316 }
9317
9319 {
9320
9321 return false;
9322 }
9323
9325 {
9326 return false;
9327 }
9328
9332 {
9333 return false;
9334 }
9335
9337 {
9338 return "";
9339 }
9340
9342
9344 {
9345 return false;
9346 }
9347
9349 {
9350 return true;
9351 }
9352
9353
9354
9356 {
9357 return true;
9358 }
9359
9361 {
9362 return true;
9363 }
9364
9366 {
9367 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9369 }
9370
9372 {
9374 }
9375
9377 {
9379 if (!is_being_placed)
9381 SetSynchDirty();
9382 }
9383
9384
9386
9388 {
9390 }
9391
9393 {
9395 }
9396
9398 {
9399 return 1;
9400 }
9401
9403 {
9404 return false;
9405 }
9406
9408 {
9410 SetSynchDirty();
9411 }
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9448 {
9449 super.OnMovedInsideCargo(container);
9450
9451 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9452 }
9453
9454 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9455 {
9456 super.EEItemLocationChanged(oldLoc, newLoc);
9457
9458 PlayerBase newPlayer = null;
9459 PlayerBase oldPlayer = null;
9460
9461 if (newLoc.GetParent())
9462 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9463
9464 if (oldLoc.GetParent())
9465 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9466
9468 {
9469 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9470
9471 if (rIndex >= 0)
9472 {
9473 InventoryLocation rIl = new InventoryLocation;
9474 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9475
9476 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9479 {
9480 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9481 }
9483 {
9485 }
9486
9487 }
9488 }
9489
9491 {
9492 if (newPlayer)
9493 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9494
9495 if (newPlayer == oldPlayer)
9496 {
9497 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9498 {
9500 {
9501 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9502 {
9503 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9504 }
9505 }
9506 else
9507 {
9508 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9509 }
9510 }
9511
9512 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9513 {
9514 int type = oldLoc.GetType();
9516 {
9517 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9518 }
9520 {
9521 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9522 }
9523 }
9524 if (!m_OldLocation)
9525 {
9526 m_OldLocation = new InventoryLocation;
9527 }
9528 m_OldLocation.Copy(oldLoc);
9529 }
9530 else
9531 {
9532 if (m_OldLocation)
9533 {
9534 m_OldLocation.Reset();
9535 }
9536 }
9537
9538 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9539 }
9540 else
9541 {
9542 if (newPlayer)
9543 {
9544 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9545 if (resIndex >= 0)
9546 {
9547 InventoryLocation il = new InventoryLocation;
9548 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9550 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9553 {
9554 il.
GetParent().GetOnReleaseLock().Invoke(it);
9555 }
9557 {
9559 }
9560
9561 }
9562 }
9564 {
9565
9567 }
9568
9569 if (m_OldLocation)
9570 {
9571 m_OldLocation.Reset();
9572 }
9573 }
9574
9576 {
9577 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9578 }
9579
9581 {
9582 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9583 }
9584 }
9585
9586 override void EOnContact(IEntity other, Contact extra)
9587 {
9589 {
9590 int liquidType = -1;
9592 if (impactSpeed > 0.0)
9593 {
9595 #ifndef SERVER
9597 #else
9599 SetSynchDirty();
9600 #endif
9602 }
9603 }
9604
9605 #ifdef SERVER
9606 if (GetCompEM() && GetCompEM().IsPlugged())
9607 {
9608 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9609 GetCompEM().UnplugThis();
9610 }
9611 #endif
9612 }
9613
9615
9617 {
9619 }
9620
9622 {
9623
9624 }
9625
9627 {
9628 super.OnItemLocationChanged(old_owner, new_owner);
9629
9630 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9631 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9632
9633 if (!relatedPlayer && playerNew)
9634 relatedPlayer = playerNew;
9635
9636 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9637 {
9639 if (actionMgr)
9640 {
9641 ActionBase currentAction = actionMgr.GetRunningAction();
9642 if (currentAction)
9644 }
9645 }
9646
9647 Man ownerPlayerOld = null;
9648 Man ownerPlayerNew = null;
9649
9650 if (old_owner)
9651 {
9652 if (old_owner.
IsMan())
9653 {
9654 ownerPlayerOld = Man.Cast(old_owner);
9655 }
9656 else
9657 {
9658 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9659 }
9660 }
9661 else
9662 {
9664 {
9666
9667 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9668 {
9669 GetCompEM().UnplugThis();
9670 }
9671 }
9672 }
9673
9674 if (new_owner)
9675 {
9676 if (new_owner.
IsMan())
9677 {
9678 ownerPlayerNew = Man.Cast(new_owner);
9679 }
9680 else
9681 {
9682 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9683 }
9684 }
9685
9686 if (ownerPlayerOld != ownerPlayerNew)
9687 {
9688 if (ownerPlayerOld)
9689 {
9690 array<EntityAI> subItemsExit = new array<EntityAI>;
9692 for (int i = 0; i < subItemsExit.Count(); i++)
9693 {
9696 }
9697 }
9698
9699 if (ownerPlayerNew)
9700 {
9701 array<EntityAI> subItemsEnter = new array<EntityAI>;
9703 for (int j = 0; j < subItemsEnter.Count(); j++)
9704 {
9707 }
9708 }
9709 }
9710 else if (ownerPlayerNew != null)
9711 {
9712 PlayerBase nplayer;
9713 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9714 {
9715 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9717 for (int k = 0; k < subItemsUpdate.Count(); k++)
9718 {
9720 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9721 }
9722 }
9723 }
9724
9725 if (old_owner)
9726 old_owner.OnChildItemRemoved(this);
9727 if (new_owner)
9728 new_owner.OnChildItemReceived(this);
9729 }
9730
9731
9733 {
9734 super.EEDelete(parent);
9735 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9736 if (player)
9737 {
9739
9740 if (player.IsAlive())
9741 {
9742 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9743 if (r_index >= 0)
9744 {
9745 InventoryLocation r_il = new InventoryLocation;
9746 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9747
9748 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9751 {
9752 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9753 }
9755 {
9756 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9757 }
9758
9759 }
9760
9761 player.RemoveQuickBarEntityShortcut(this);
9762 }
9763 }
9764 }
9765
9767 {
9768 super.EEKilled(killer);
9769
9772 {
9773 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9774 {
9775 if (IsMagazine())
9776 {
9777 if (Magazine.Cast(this).GetAmmoCount() > 0)
9778 {
9780 }
9781 }
9782 else
9783 {
9785 }
9786 }
9787 }
9788 }
9789
9791 {
9792 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9793
9794 super.OnWasAttached(parent, slot_id);
9795
9798
9801 }
9802
9804 {
9805 super.OnWasDetached(parent, slot_id);
9806
9809
9812 }
9813
9815 {
9816 int idx;
9819
9820 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9821 if (inventory_slots.Count() < 1)
9822 {
9823 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9824 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9825 }
9826 else
9827 {
9828 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9829 }
9830
9831 idx = inventory_slots.Find(slot);
9832 if (idx < 0)
9833 return "";
9834
9835 return attach_types.Get(idx);
9836 }
9837
9839 {
9840 int idx = -1;
9841 string slot;
9842
9845
9846 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9847 if (inventory_slots.Count() < 1)
9848 {
9849 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9850 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9851 }
9852 else
9853 {
9854 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9855 if (detach_types.Count() < 1)
9856 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9857 }
9858
9859 for (int i = 0; i < inventory_slots.Count(); i++)
9860 {
9861 slot = inventory_slots.Get(i);
9862 }
9863
9864 if (slot != "")
9865 {
9866 if (detach_types.Count() == 1)
9867 idx = 0;
9868 else
9869 idx = inventory_slots.Find(slot);
9870 }
9871 if (idx < 0)
9872 return "";
9873
9874 return detach_types.Get(idx);
9875 }
9876
9878 {
9879
9881
9882
9883 float min_time = 1;
9884 float max_time = 3;
9885 float delay = Math.RandomFloat(min_time, max_time);
9886
9887 explode_timer.Run(delay, this, "DoAmmoExplosion");
9888 }
9889
9891 {
9892 Magazine magazine = Magazine.Cast(this);
9893 int pop_sounds_count = 6;
9894 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9895
9896
9897 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9898 string sound_name = pop_sounds[ sound_idx ];
9899 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9900
9901
9902 magazine.ServerAddAmmoCount(-1);
9903
9904
9905 float min_temp_to_explode = 100;
9906
9907 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9908 {
9910 }
9911 }
9912
9913
9914 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9915 {
9916 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9917
9918 const int CHANCE_DAMAGE_CARGO = 4;
9919 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9920 const int CHANCE_DAMAGE_NOTHING = 2;
9921
9923 {
9924 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9925 int chances;
9926 int rnd;
9927
9928 if (GetInventory().GetCargo())
9929 {
9930 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9931 rnd = Math.RandomInt(0,chances);
9932
9933 if (rnd < CHANCE_DAMAGE_CARGO)
9934 {
9936 }
9937 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9938 {
9940 }
9941 }
9942 else
9943 {
9944 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9945 rnd = Math.RandomInt(0,chances);
9946
9947 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9948 {
9950 }
9951 }
9952 }
9953 }
9954
9956 {
9957 CargoBase cargo = GetInventory().GetCargo();
9958 if (cargo)
9959 {
9961 if (item_count > 0)
9962 {
9963 int random_pick = Math.RandomInt(0, item_count);
9965 if (!item.IsExplosive())
9966 {
9967 item.AddHealth("","",damage);
9968 return true;
9969 }
9970 }
9971 }
9972 return false;
9973 }
9974
9976 {
9977 GameInventory inventory = GetInventory();
9979 if (attachment_count > 0)
9980 {
9981 int random_pick = Math.RandomInt(0, attachment_count);
9983 if (!attachment.IsExplosive())
9984 {
9985 attachment.AddHealth("","",damage);
9986 return true;
9987 }
9988 }
9989 return false;
9990 }
9991
9993 {
9995 }
9996
9998 {
10000 return GetInventory().CanRemoveEntity();
10001
10002 return false;
10003 }
10004
10006 {
10007
10009 return false;
10010
10011
10013 return false;
10014
10015
10016
10018 if (delta == 0)
10019 return false;
10020
10021
10022 return true;
10023 }
10024
10026 {
10028 {
10029 if (ScriptInputUserData.CanStoreInputUserData())
10030 {
10031 ScriptInputUserData ctx = new ScriptInputUserData;
10036 ctx.
Write(destination_entity);
10038 ctx.
Write(slot_id);
10040 }
10041 }
10042 else if (!
g_Game.IsMultiplayer())
10043 {
10045 }
10046 }
10047
10049 {
10050 float split_quantity_new;
10054 InventoryLocation loc = new InventoryLocation;
10055
10056 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10057 {
10059 split_quantity_new = stack_max;
10060 else
10062
10064 {
10065 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10066 if (new_item)
10067 {
10068 new_item.SetResultOfSplit(true);
10069 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10071 new_item.
SetQuantity(split_quantity_new,
false,
true);
10072 }
10073 }
10074 }
10075 else if (destination_entity && slot_id == -1)
10076 {
10077 if (quantity > stack_max)
10078 split_quantity_new = stack_max;
10079 else
10080 split_quantity_new = quantity;
10081
10083 {
10084 GameInventory destinationInventory = destination_entity.GetInventory();
10086 {
10089 }
10090
10091 if (new_item)
10092 {
10093 new_item.SetResultOfSplit(true);
10094 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10096 new_item.
SetQuantity(split_quantity_new,
false,
true);
10097 }
10098 }
10099 }
10100 else
10101 {
10102 if (stack_max != 0)
10103 {
10105 {
10107 }
10108
10109 if (split_quantity_new == 0)
10110 {
10111 if (!
g_Game.IsMultiplayer())
10112 player.PhysicalPredictiveDropItem(this);
10113 else
10114 player.ServerDropEntity(this);
10115 return;
10116 }
10117
10119 {
10121
10122 if (new_item)
10123 {
10124 new_item.SetResultOfSplit(true);
10125 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10128 new_item.PlaceOnSurface();
10129 }
10130 }
10131 }
10132 }
10133 }
10134
10136 {
10137 float split_quantity_new;
10141 InventoryLocation loc = new InventoryLocation;
10142
10143 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10144 {
10146 split_quantity_new = stack_max;
10147 else
10149
10151 {
10152 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10153 if (new_item)
10154 {
10155 new_item.SetResultOfSplit(true);
10156 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10158 new_item.
SetQuantity(split_quantity_new,
false,
true);
10159 }
10160 }
10161 }
10162 else if (destination_entity && slot_id == -1)
10163 {
10164 if (quantity > stack_max)
10165 split_quantity_new = stack_max;
10166 else
10167 split_quantity_new = quantity;
10168
10170 {
10171 GameInventory destinationInventory = destination_entity.GetInventory();
10173 {
10176 }
10177
10178 if (new_item)
10179 {
10180 new_item.SetResultOfSplit(true);
10181 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10183 new_item.
SetQuantity(split_quantity_new,
false,
true);
10184 }
10185 }
10186 }
10187 else
10188 {
10189 if (stack_max != 0)
10190 {
10192 {
10194 }
10195
10197 {
10199
10200 if (new_item)
10201 {
10202 new_item.SetResultOfSplit(true);
10203 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10206 new_item.PlaceOnSurface();
10207 }
10208 }
10209 }
10210 }
10211 }
10212
10214 {
10216 {
10217 if (ScriptInputUserData.CanStoreInputUserData())
10218 {
10219 ScriptInputUserData ctx = new ScriptInputUserData;
10224 dst.WriteToContext(ctx);
10226 }
10227 }
10228 else if (!
g_Game.IsMultiplayer())
10229 {
10231 }
10232 }
10233
10235 {
10237 {
10238 if (ScriptInputUserData.CanStoreInputUserData())
10239 {
10240 ScriptInputUserData ctx = new ScriptInputUserData;
10245 ctx.
Write(destination_entity);
10251 }
10252 }
10253 else if (!
g_Game.IsMultiplayer())
10254 {
10256 }
10257 }
10258
10260 {
10262 }
10263
10265 {
10267 float split_quantity_new;
10269 if (dst.IsValid())
10270 {
10271 int slot_id = dst.GetSlot();
10273
10274 if (quantity > stack_max)
10275 split_quantity_new = stack_max;
10276 else
10277 split_quantity_new = quantity;
10278
10280 {
10282
10283 if (new_item)
10284 {
10285 new_item.SetResultOfSplit(true);
10286 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10288 new_item.
SetQuantity(split_quantity_new,
false,
true);
10289 }
10290
10291 return new_item;
10292 }
10293 }
10294
10295 return null;
10296 }
10297
10299 {
10301 float split_quantity_new;
10303 if (destination_entity)
10304 {
10306 if (quantity > stackable)
10307 split_quantity_new = stackable;
10308 else
10309 split_quantity_new = quantity;
10310
10312 {
10313 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10314 if (new_item)
10315 {
10316 new_item.SetResultOfSplit(true);
10317 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10319 new_item.
SetQuantity(split_quantity_new,
false,
true);
10320 }
10321 }
10322 }
10323 }
10324
10326 {
10328 {
10329 if (ScriptInputUserData.CanStoreInputUserData())
10330 {
10331 ScriptInputUserData ctx = new ScriptInputUserData;
10336 ItemBase destination_entity =
this;
10337 ctx.
Write(destination_entity);
10341 }
10342 }
10343 else if (!
g_Game.IsMultiplayer())
10344 {
10346 }
10347 }
10348
10350 {
10352 float split_quantity_new;
10354 if (player)
10355 {
10357 if (quantity > stackable)
10358 split_quantity_new = stackable;
10359 else
10360 split_quantity_new = quantity;
10361
10363 {
10364 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10365 new_item =
ItemBase.Cast(in_hands);
10366 if (new_item)
10367 {
10368 new_item.SetResultOfSplit(true);
10369 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10371 new_item.SetQuantity(split_quantity_new, false, true);
10372 }
10373 }
10374 }
10375 }
10376
10378 {
10380 float split_quantity_new = Math.Floor(quantity * 0.5);
10381
10383 return;
10384
10386
10387 if (new_item)
10388 {
10389 if (new_item.GetQuantityMax() < split_quantity_new)
10390 {
10391 split_quantity_new = new_item.GetQuantityMax();
10392 }
10393
10394 new_item.SetResultOfSplit(true);
10395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10396
10398 {
10401 }
10402 else
10403 {
10405 new_item.
SetQuantity(split_quantity_new,
false,
true);
10406 }
10407 }
10408 }
10409
10411 {
10413 float split_quantity_new = Math.Floor(quantity / 2);
10414
10416 return;
10417
10418 InventoryLocation invloc = new InventoryLocation;
10420
10422 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10423
10424 if (new_item)
10425 {
10426 if (new_item.GetQuantityMax() < split_quantity_new)
10427 {
10428 split_quantity_new = new_item.GetQuantityMax();
10429 }
10431 {
10434 }
10435 else if (split_quantity_new > 1)
10436 {
10438 new_item.
SetQuantity(split_quantity_new,
false,
true);
10439 }
10440 }
10441 }
10442
10445 {
10446 SetWeightDirty();
10448
10449 if (parent)
10450 parent.OnAttachmentQuantityChangedEx(this, delta);
10451
10453 {
10455 {
10457 }
10459 {
10460 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10462 }
10463 }
10464 }
10465
10468 {
10469
10470 }
10471
10474 {
10476 }
10477
10479 {
10480 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10481
10483 {
10484 if (newLevel == GameConstants.STATE_RUINED)
10485 {
10487 EntityAI parent = GetHierarchyParent();
10488 if (parent && parent.IsFireplace())
10489 {
10490 CargoBase cargo = GetInventory().GetCargo();
10491 if (cargo)
10492 {
10494 {
10496 }
10497 }
10498 }
10499 }
10500
10502 {
10503
10505 return;
10506 }
10507
10508 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10509 {
10511 }
10512 }
10513 }
10514
10515
10517 {
10518 super.OnRightClick();
10519
10521 {
10523 {
10524 if (ScriptInputUserData.CanStoreInputUserData())
10525 {
10526 EntityAI root = GetHierarchyRoot();
10527 Man playerOwner = GetHierarchyRootPlayer();
10528 InventoryLocation dst = new InventoryLocation;
10529
10530
10531 if (!playerOwner && root && root == this)
10532 {
10534 }
10535 else
10536 {
10537
10538 GetInventory().GetCurrentInventoryLocation(dst);
10540 {
10541 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10543 {
10545 }
10546 else
10547 {
10549
10550
10551 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10552 {
10554 }
10555 else
10556 {
10557 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10558 }
10559 }
10560 }
10561 }
10562
10563 ScriptInputUserData ctx = new ScriptInputUserData;
10571 }
10572 }
10573 else if (!
g_Game.IsMultiplayer())
10574 {
10576 }
10577 }
10578 }
10579
10581 {
10582 if (root)
10583 {
10584 vector m4[4];
10585 root.GetTransform(m4);
10586 dst.SetGround(this, m4);
10587 }
10588 else
10589 {
10590 GetInventory().GetCurrentInventoryLocation(dst);
10591 }
10592 }
10593
10594 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10595 {
10596
10597 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10598 return false;
10599
10600 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10601 return false;
10602
10603
10605 return false;
10606
10607
10608 Magazine mag = Magazine.Cast(this);
10609 if (mag)
10610 {
10611 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10612 return false;
10613
10614 if (stack_max_limit)
10615 {
10616 Magazine other_mag = Magazine.Cast(other_item);
10617 if (other_item)
10618 {
10619 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10620 return false;
10621 }
10622
10623 }
10624 }
10625 else
10626 {
10627
10629 return false;
10630
10632 return false;
10633 }
10634
10635 PlayerBase player = null;
10636 if (CastTo(player, GetHierarchyRootPlayer()))
10637 {
10638 if (player.GetInventory().HasAttachment(this))
10639 return false;
10640
10641 if (player.IsItemsToDelete())
10642 return false;
10643 }
10644
10645 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10646 return false;
10647
10648 int slotID;
10650 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10651 return false;
10652
10653 return true;
10654 }
10655
10657 {
10659 }
10660
10662 {
10663 return m_IsResultOfSplit;
10664 }
10665
10667 {
10668 m_IsResultOfSplit = value;
10669 }
10670
10672 {
10674 }
10675
10677 {
10678 float other_item_quantity = other_item.GetQuantity();
10679 float this_free_space;
10680
10682
10684
10685 if (other_item_quantity > this_free_space)
10686 {
10687 return this_free_space;
10688 }
10689 else
10690 {
10691 return other_item_quantity;
10692 }
10693 }
10694
10696 {
10698 }
10699
10701 {
10703 return;
10704
10705 if (!IsMagazine() && other_item)
10706 {
10708 if (quantity_used != 0)
10709 {
10710 float hp1 = GetHealth01("","");
10711 float hp2 = other_item.GetHealth01("","");
10712 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10713 hpResult = hpResult / (
GetQuantity() + quantity_used);
10714
10715 hpResult *= GetMaxHealth();
10716 Math.Round(hpResult);
10717 SetHealth("", "Health", hpResult);
10718
10720 other_item.AddQuantity(-quantity_used);
10721 }
10722 }
10724 }
10725
10727 {
10728 #ifdef SERVER
10729 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10730 GetHierarchyParent().IncreaseLifetimeUp();
10731 #endif
10732 };
10733
10735 {
10736 PlayerBase p = PlayerBase.Cast(player);
10737
10738 array<int> recipesIds = p.m_Recipes;
10739 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10740 if (moduleRecipesManager)
10741 {
10742 EntityAI itemInHands = player.GetEntityInHands();
10743 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10744 }
10745
10746 for (int i = 0;i < recipesIds.Count(); i++)
10747 {
10748 int key = recipesIds.Get(i);
10749 string recipeName = moduleRecipesManager.GetRecipeName(key);
10751 }
10752 }
10753
10754
10755 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10756 {
10757 super.GetDebugActions(outputList);
10758
10759
10765
10766
10771
10776
10777
10781
10782
10784 {
10788 }
10789
10792
10793
10797
10799
10800 InventoryLocation loc = new InventoryLocation();
10801 GetInventory().GetCurrentInventoryLocation(loc);
10803 {
10804 if (Gizmo_IsSupported())
10807 }
10808
10810 }
10811
10812
10813
10814
10816 {
10817 super.OnAction(action_id, player, ctx);
10818
10820 {
10821 switch (action_id)
10822 {
10826 return true;
10830 return true;
10831 }
10832 }
10833
10835 {
10836 switch (action_id)
10837 {
10839 Delete();
10840 return true;
10841 }
10842 }
10843
10844 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10845 {
10846 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10847 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10848 PlayerBase p = PlayerBase.Cast(player);
10849 if (
EActions.RECIPES_RANGE_START < 1000)
10850 {
10851 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10852 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10853 }
10854 }
10855 #ifndef SERVER
10856 else if (action_id ==
EActions.WATCH_PLAYER)
10857 {
10858 PluginDeveloper.SetDeveloperItemClientEx(player);
10859 }
10860 #endif
10862 {
10863 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10864 {
10865 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10866 OnDebugButtonPressServer(id + 1);
10867 }
10868
10869 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10870 {
10871 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10873 }
10874
10875 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10876 {
10877 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10879 }
10880
10881 else if (action_id ==
EActions.ADD_QUANTITY)
10882 {
10883 if (IsMagazine())
10884 {
10885 Magazine mag = Magazine.Cast(this);
10886 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10887 }
10888 else
10889 {
10891 }
10892
10893 if (m_EM)
10894 {
10895 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10896 }
10897
10898 }
10899
10900 else if (action_id ==
EActions.REMOVE_QUANTITY)
10901 {
10902 if (IsMagazine())
10903 {
10904 Magazine mag2 = Magazine.Cast(this);
10905 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10906 }
10907 else
10908 {
10910 }
10911 if (m_EM)
10912 {
10913 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10914 }
10915
10916 }
10917
10918 else if (action_id ==
EActions.SET_QUANTITY_0)
10919 {
10921
10922 if (m_EM)
10923 {
10924 m_EM.SetEnergy(0);
10925 }
10926 }
10927
10928 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10929 {
10931
10932 if (m_EM)
10933 {
10934 m_EM.SetEnergy(m_EM.GetEnergyMax());
10935 }
10936 }
10937
10938 else if (action_id ==
EActions.ADD_HEALTH)
10939 {
10940 AddHealth("","",GetMaxHealth("","Health")/5);
10941 }
10942 else if (action_id ==
EActions.REMOVE_HEALTH)
10943 {
10944 AddHealth("","",-GetMaxHealth("","Health")/5);
10945 }
10946 else if (action_id ==
EActions.DESTROY_HEALTH)
10947 {
10948 SetHealth01("","",0);
10949 }
10950 else if (action_id ==
EActions.WATCH_ITEM)
10951 {
10953 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10954 #ifdef DEVELOPER
10955 SetDebugDeveloper_item(this);
10956 #endif
10957 }
10958
10959 else if (action_id ==
EActions.ADD_TEMPERATURE)
10960 {
10961 AddTemperature(20);
10962
10963 }
10964
10965 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10966 {
10967 AddTemperature(-20);
10968
10969 }
10970
10971 else if (action_id ==
EActions.FLIP_FROZEN)
10972 {
10973 SetFrozen(!GetIsFrozen());
10974
10975 }
10976
10977 else if (action_id ==
EActions.ADD_WETNESS)
10978 {
10980
10981 }
10982
10983 else if (action_id ==
EActions.REMOVE_WETNESS)
10984 {
10986
10987 }
10988
10989 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10990 {
10993
10994
10995 }
10996
10997 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10998 {
11001 }
11002
11003 else if (action_id ==
EActions.MAKE_SPECIAL)
11004 {
11005 auto debugParams = DebugSpawnParams.WithPlayer(player);
11006 OnDebugSpawnEx(debugParams);
11007 }
11008
11009 }
11010
11011
11012 return false;
11013 }
11014
11015
11016
11017
11021
11024
11025
11026
11028 {
11029 return false;
11030 }
11031
11032
11034 {
11035 return true;
11036 }
11037
11038
11040 {
11041 return true;
11042 }
11043
11044
11045
11047 {
11048 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11049 return g_Game.ConfigIsExisting(config_path);
11050 }
11051
11054 {
11055 return null;
11056 }
11057
11059 {
11060 return false;
11061 }
11062
11064 {
11065 return false;
11066 }
11067
11071
11072
11074 {
11075 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11076 return module_repairing.CanRepair(this, item_repair_kit);
11077 }
11078
11079
11080 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11081 {
11082 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11083 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11084 }
11085
11086
11088 {
11089
11090
11091
11092
11093
11094
11095
11096
11097 return 1;
11098 }
11099
11100
11101
11103 {
11105 }
11106
11107
11108
11110 {
11112 }
11113
11114
11123 {
11124 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11125
11126 if (player)
11127 {
11128 player.MessageStatus(text);
11129 }
11130 }
11131
11132
11141 {
11142 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11143
11144 if (player)
11145 {
11146 player.MessageAction(text);
11147 }
11148 }
11149
11150
11159 {
11160 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11161
11162 if (player)
11163 {
11164 player.MessageFriendly(text);
11165 }
11166 }
11167
11168
11177 {
11178 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11179
11180 if (player)
11181 {
11182 player.MessageImportant(text);
11183 }
11184 }
11185
11187 {
11188 return true;
11189 }
11190
11191
11192 override bool KindOf(
string tag)
11193 {
11194 bool found = false;
11195 string item_name = this.
GetType();
11197 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11198
11199 int array_size = item_tag_array.Count();
11200 for (int i = 0; i < array_size; i++)
11201 {
11202 if (item_tag_array.Get(i) == tag)
11203 {
11204 found = true;
11205 break;
11206 }
11207 }
11208 return found;
11209 }
11210
11211
11213 {
11214
11215 super.OnRPC(sender, rpc_type,ctx);
11216
11217
11218 switch (rpc_type)
11219 {
11220 #ifndef SERVER
11221 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11222 Param2<bool, string> p = new Param2<bool, string>(false, "");
11223
11225 return;
11226
11227 bool play = p.param1;
11228 string soundSet = p.param2;
11229
11230 if (play)
11231 {
11233 {
11235 {
11237 }
11238 }
11239 else
11240 {
11242 }
11243 }
11244 else
11245 {
11247 }
11248
11249 break;
11250 #endif
11251
11252 }
11253
11255 {
11257 }
11258 }
11259
11260
11261
11262
11264 {
11265 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11266 return plugin.GetID(
name);
11267 }
11268
11270 {
11271 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11272 return plugin.GetName(id);
11273 }
11274
11277 {
11278
11279
11280 int varFlags;
11281 if (!ctx.
Read(varFlags))
11282 return;
11283
11284 if (varFlags & ItemVariableFlags.FLOAT)
11285 {
11287 }
11288 }
11289
11291 {
11292
11293 super.SerializeNumericalVars(floats_out);
11294
11295
11296
11298 {
11300 }
11301
11303 {
11305 }
11306
11308 {
11310 }
11311
11313 {
11318 }
11319
11321 {
11323 }
11324 }
11325
11327 {
11328
11329 super.DeSerializeNumericalVars(floats);
11330
11331
11332 int index = 0;
11333 int mask = Math.Round(floats.Get(index));
11334
11335 index++;
11336
11338 {
11340 {
11342 }
11343 else
11344 {
11345 float quantity = floats.Get(index);
11346 SetQuantity(quantity,
true,
false,
false,
false);
11347 }
11348 index++;
11349 }
11350
11352 {
11353 float wet = floats.Get(index);
11355 index++;
11356 }
11357
11359 {
11360 int liquidtype = Math.Round(floats.Get(index));
11362 index++;
11363 }
11364
11366 {
11368 index++;
11370 index++;
11372 index++;
11374 index++;
11375 }
11376
11378 {
11379 int cleanness = Math.Round(floats.Get(index));
11381 index++;
11382 }
11383 }
11384
11386 {
11387 super.WriteVarsToCTX(ctx);
11388
11389
11391 {
11393 }
11394
11396 {
11398 }
11399
11401 {
11403 }
11404
11406 {
11407 int r,g,b,a;
11413 }
11414
11416 {
11418 }
11419 }
11420
11422 {
11423 if (!super.ReadVarsFromCTX(ctx,version))
11424 return false;
11425
11426 int intValue;
11427 float value;
11428
11429 if (version < 140)
11430 {
11431 if (!ctx.
Read(intValue))
11432 return false;
11433
11434 m_VariablesMask = intValue;
11435 }
11436
11438 {
11439 if (!ctx.
Read(value))
11440 return false;
11441
11443 {
11445 }
11446 else
11447 {
11449 }
11450 }
11451
11452 if (version < 140)
11453 {
11455 {
11456 if (!ctx.
Read(value))
11457 return false;
11458 SetTemperatureDirect(value);
11459 }
11460 }
11461
11463 {
11464 if (!ctx.
Read(value))
11465 return false;
11467 }
11468
11470 {
11471 if (!ctx.
Read(intValue))
11472 return false;
11474 }
11475
11477 {
11478 int r,g,b,a;
11480 return false;
11482 return false;
11484 return false;
11486 return false;
11487
11489 }
11490
11492 {
11493 if (!ctx.
Read(intValue))
11494 return false;
11496 }
11497
11498 if (version >= 138 && version < 140)
11499 {
11501 {
11502 if (!ctx.
Read(intValue))
11503 return false;
11504 SetFrozen(intValue);
11505 }
11506 }
11507
11508 return true;
11509 }
11510
11511
11513 {
11516 {
11518 }
11519
11520 if (!super.OnStoreLoad(ctx, version))
11521 {
11523 return false;
11524 }
11525
11526 if (version >= 114)
11527 {
11528 bool hasQuickBarIndexSaved;
11529
11530 if (!ctx.
Read(hasQuickBarIndexSaved))
11531 {
11533 return false;
11534 }
11535
11536 if (hasQuickBarIndexSaved)
11537 {
11538 int itmQBIndex;
11539
11540
11541 if (!ctx.
Read(itmQBIndex))
11542 {
11544 return false;
11545 }
11546
11547 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11548 if (itmQBIndex != -1 && parentPlayer)
11549 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11550 }
11551 }
11552 else
11553 {
11554
11555 PlayerBase player;
11556 int itemQBIndex;
11557 if (version ==
int.
MAX)
11558 {
11559 if (!ctx.
Read(itemQBIndex))
11560 {
11562 return false;
11563 }
11564 }
11565 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11566 {
11567
11568 if (!ctx.
Read(itemQBIndex))
11569 {
11571 return false;
11572 }
11573 if (itemQBIndex != -1 && player)
11574 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11575 }
11576 }
11577
11578 if (version < 140)
11579 {
11580
11581 if (!LoadVariables(ctx, version))
11582 {
11584 return false;
11585 }
11586 }
11587
11588
11590 {
11592 return false;
11593 }
11594 if (version >= 132)
11595 {
11597 if (raib)
11598 {
11600 {
11602 return false;
11603 }
11604 }
11605 }
11606
11608 return true;
11609 }
11610
11611
11612
11614 {
11615 super.OnStoreSave(ctx);
11616
11617 PlayerBase player;
11618 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11619 {
11621
11622 int itemQBIndex = -1;
11623 itemQBIndex = player.FindQuickBarEntityIndex(this);
11624 ctx.
Write(itemQBIndex);
11625 }
11626 else
11627 {
11629 }
11630
11632
11634 if (raib)
11635 {
11637 }
11638 }
11639
11640
11642 {
11643 super.AfterStoreLoad();
11644
11646 {
11648 }
11649
11651 {
11654 }
11655 }
11656
11658 {
11659 super.EEOnAfterLoad();
11660
11662 {
11664 }
11665
11668 }
11669
11671 {
11672 return false;
11673 }
11674
11675
11676
11678 {
11680 {
11681 #ifdef PLATFORM_CONSOLE
11682
11684 {
11686 if (menu)
11687 {
11689 }
11690 }
11691 #endif
11692 }
11693
11695 {
11698 }
11699
11701 {
11702 SetWeightDirty();
11704 }
11706 {
11709 }
11710
11712 {
11715
11718 }
11720 {
11724 }
11725
11726 super.OnVariablesSynchronized();
11727 }
11728
11729
11730
11732 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11733 {
11734 if (!IsServerCheck(allow_client))
11735 return false;
11736
11738 return false;
11739
11742
11743 if (value <= (min + 0.001))
11744 value = min;
11745
11746 if (value == min)
11747 {
11748 if (destroy_config)
11749 {
11750 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11751 if (dstr)
11752 {
11754 this.Delete();
11755 return true;
11756 }
11757 }
11758 else if (destroy_forced)
11759 {
11761 this.Delete();
11762 return true;
11763 }
11764
11766 }
11767
11770
11772 {
11773 EntityAI parent = GetHierarchyRoot();
11774 InventoryLocation iLoc = new InventoryLocation();
11775 GetInventory().GetCurrentInventoryLocation(iLoc);
11777 {
11778 int iLocSlot = iLoc.
GetSlot();
11780 {
11782 }
11784 {
11786 }
11787 }
11788 }
11789
11791 {
11793
11794 if (delta)
11796 }
11797
11799
11800 return false;
11801 }
11802
11803
11805 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11806 {
11808 }
11809
11811 {
11814 }
11815
11817 {
11820 }
11821
11823 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11824 {
11825 float value_clamped = Math.Clamp(value, 0, 1);
11827 SetQuantity(result, destroy_config, destroy_forced);
11828 }
11829
11830
11833 {
11835 }
11836
11838 {
11840 }
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11852 {
11853 int slot = -1;
11854 GameInventory inventory = GetInventory();
11855 if (inventory)
11856 {
11857 InventoryLocation il = new InventoryLocation;
11860 }
11861
11863 }
11864
11866 {
11867 float quantity_max = 0;
11868
11870 {
11871 if (attSlotID != -1)
11872 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11873
11874 if (quantity_max <= 0)
11876 }
11877
11878 if (quantity_max <= 0)
11880
11881 return quantity_max;
11882 }
11883
11885 {
11887 }
11888
11890 {
11892 }
11893
11894
11896 {
11898 }
11899
11901 {
11903 }
11904
11906 {
11908 }
11909
11910
11912 {
11913
11914 float weightEx = GetWeightEx();
11915 float special = GetInventoryAndCargoWeight();
11916 return weightEx - special;
11917 }
11918
11919
11921 {
11923 }
11924
11926 {
11928 {
11929 #ifdef DEVELOPER
11930 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11931 {
11932 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11934 }
11935 #endif
11936
11937 return GetQuantity() * GetConfigWeightModified();
11938 }
11939 else if (HasEnergyManager())
11940 {
11941 #ifdef DEVELOPER
11942 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11943 {
11944 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11945 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11946 }
11947 #endif
11948 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11949 }
11950 else
11951 {
11952 #ifdef DEVELOPER
11953 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11954 {
11955 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11956 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11957 }
11958 #endif
11959 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11960 }
11961 }
11962
11965 {
11966 int item_count = 0;
11968
11969 GameInventory inventory = GetInventory();
11970 CargoBase cargo = inventory.
GetCargo();
11971 if (cargo != NULL)
11972 {
11974 }
11975
11977 for (int i = 0; i < nAttachments; ++i)
11978 {
11980 if (item)
11981 item_count += item.GetNumberOfItems();
11982 }
11983 return item_count;
11984 }
11985
11988 {
11989 float weight = 0;
11990 float wetness = 1;
11991 if (include_wetness)
11994 {
11995 weight = wetness * m_ConfigWeight;
11996 }
11998 {
11999 weight = 1;
12000 }
12001 return weight;
12002 }
12003
12004
12005
12007 {
12008 GameInventory inventory = GetInventory();
12009 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12010 {
12011 array<EntityAI> items = new array<EntityAI>;
12013 for (int i = 0; i < items.Count(); ++i)
12014 {
12016 if (item)
12017 {
12018 g_Game.ObjectDelete(item);
12019 }
12020 }
12021 }
12022 }
12023
12024
12025
12026
12028 {
12029 float energy = 0;
12030 if (HasEnergyManager())
12031 {
12032 energy = GetCompEM().GetEnergy();
12033 }
12034 return energy;
12035 }
12036
12037
12039 {
12040 super.OnEnergyConsumed();
12041
12043 }
12044
12046 {
12047 super.OnEnergyAdded();
12048
12050 }
12051
12052
12054 {
12055 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12056 {
12058 {
12059 float energy_0to1 = GetCompEM().GetEnergy0To1();
12061 }
12062 }
12063 }
12064
12065
12067 {
12068 return ConfigGetFloat("heatIsolation");
12069 }
12070
12072 {
12074 }
12075
12077 {
12078 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12079 if (
g_Game.ConfigIsExisting(paramPath))
12080 return g_Game.ConfigGetFloat(paramPath);
12081
12082 return 0.0;
12083 }
12084
12086 {
12087 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12088 if (
g_Game.ConfigIsExisting(paramPath))
12089 return g_Game.ConfigGetFloat(paramPath);
12090
12091 return 0.0;
12092 }
12093
12094 override void SetWet(
float value,
bool allow_client =
false)
12095 {
12096 if (!IsServerCheck(allow_client))
12097 return;
12098
12101
12103
12104 m_VarWet = Math.Clamp(value, min, max);
12105
12107 {
12110 }
12111 }
12112
12113 override void AddWet(
float value)
12114 {
12116 }
12117
12119 {
12121 }
12122
12124 {
12126 }
12127
12129 {
12131 }
12132
12134 {
12136 }
12137
12139 {
12141 }
12142
12143 override void OnWetChanged(
float newVal,
float oldVal)
12144 {
12147 if (newLevel != oldLevel)
12148 {
12150 }
12151 }
12152
12154 {
12155 SetWeightDirty();
12156 }
12157
12159 {
12160 return GetWetLevelInternal(
m_VarWet);
12161 }
12162
12163
12164
12166 {
12168 }
12169
12171 {
12173 }
12174
12176 {
12178 }
12179
12181 {
12183 }
12184
12185
12186
12188 {
12189 if (ConfigIsExisting("itemModelLength"))
12190 {
12191 return ConfigGetFloat("itemModelLength");
12192 }
12193 return 0;
12194 }
12195
12197 {
12198 if (ConfigIsExisting("itemAttachOffset"))
12199 {
12200 return ConfigGetFloat("itemAttachOffset");
12201 }
12202 return 0;
12203 }
12204
12205 override void SetCleanness(
int value,
bool allow_client =
false)
12206 {
12207 if (!IsServerCheck(allow_client))
12208 return;
12209
12211
12213
12216 }
12217
12219 {
12221 }
12222
12224 {
12225 return true;
12226 }
12227
12228
12229
12230
12232 {
12234 }
12235
12237 {
12239 }
12240
12241
12242
12243
12244 override void SetColor(
int r,
int g,
int b,
int a)
12245 {
12251 }
12253 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12254 {
12259 }
12260
12262 {
12264 }
12265
12268 {
12269 int r,g,b,a;
12271 r = r/255;
12272 g = g/255;
12273 b = b/255;
12274 a = a/255;
12275 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12276 }
12277
12278
12279
12280 override void SetLiquidType(
int value,
bool allow_client =
false)
12281 {
12282 if (!IsServerCheck(allow_client))
12283 return;
12284
12289 }
12290
12292 {
12293 return ConfigGetInt("varLiquidTypeInit");
12294 }
12295
12297 {
12299 }
12300
12302 {
12304 SetFrozen(false);
12305 }
12306
12309 {
12310 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12311 }
12312
12313
12316 {
12317 PlayerBase nplayer;
12318 if (PlayerBase.CastTo(nplayer, player))
12319 {
12321 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12322 }
12323 }
12324
12325
12328 {
12329 PlayerBase nplayer;
12330 if (PlayerBase.CastTo(nplayer,player))
12331 {
12332 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12333 }
12334
12335 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12336
12337 if (HasEnergyManager())
12338 {
12339 GetCompEM().UpdatePlugState();
12340 }
12341 }
12342
12343
12345 {
12346 super.OnPlacementStarted(player);
12347
12349 }
12350
12351 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12352 {
12354 {
12355 m_AdminLog.OnPlacementComplete(player,
this);
12356 }
12357
12358 super.OnPlacementComplete(player, position, orientation);
12359 }
12360
12361
12362
12363
12364
12366 {
12368 {
12369 return true;
12370 }
12371 else
12372 {
12373 return false;
12374 }
12375 }
12376
12377
12379 {
12381 {
12383 }
12384 }
12385
12386
12388 {
12390 }
12391
12393 {
12395 }
12396
12397 override void InsertAgent(
int agent,
float count = 1)
12398 {
12399 if (count < 1)
12400 return;
12401
12403 }
12404
12407 {
12409 }
12410
12411
12413 {
12415 }
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12459 {
12461 return false;
12462 return true;
12463 }
12464
12466 {
12467
12469 }
12470
12471
12474 {
12475 super.CheckForRoofLimited(timeTresholdMS);
12476
12477 float time =
g_Game.GetTime();
12478 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12479 {
12480 m_PreviousRoofTestTime = time;
12481 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12482 }
12483 }
12484
12485
12487 {
12489 {
12490 return 0;
12491 }
12492
12493 if (GetInventory().GetAttachmentSlotsCount() != 0)
12494 {
12495 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12496 if (filter)
12497 return filter.GetProtectionLevel(type, false, system);
12498 else
12499 return 0;
12500 }
12501
12502 string subclassPath, entryName;
12503
12504 switch (type)
12505 {
12507 entryName = "biological";
12508 break;
12510 entryName = "chemical";
12511 break;
12512 default:
12513 entryName = "biological";
12514 break;
12515 }
12516
12517 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12518
12519 return g_Game.ConfigGetFloat(subclassPath + entryName);
12520 }
12521
12522
12523
12526 {
12527 if (!IsMagazine())
12529
12531 }
12532
12533
12534
12535
12536
12541 {
12542 return true;
12543 }
12544
12546 {
12548 }
12549
12550
12551
12552
12553
12555 {
12556 if (parent)
12557 {
12558 if (parent.IsInherited(DayZInfected))
12559 return true;
12560
12561 if (!parent.IsRuined())
12562 return true;
12563 }
12564
12565 return true;
12566 }
12567
12569 {
12570 if (!super.CanPutAsAttachment(parent))
12571 {
12572 return false;
12573 }
12574
12575 if (!IsRuined() && !parent.IsRuined())
12576 {
12577 return true;
12578 }
12579
12580 return false;
12581 }
12582
12584 {
12585
12586
12587
12588
12589 return super.CanReceiveItemIntoCargo(item);
12590 }
12591
12593 {
12594
12595
12596
12597
12598 GameInventory attachmentInv = attachment.GetInventory();
12600 {
12601 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12602 return false;
12603 }
12604
12605 InventoryLocation loc = new InventoryLocation();
12606 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12607 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12608 return false;
12609
12610 return super.CanReceiveAttachment(attachment, slotId);
12611 }
12612
12614 {
12615 if (!super.CanReleaseAttachment(attachment))
12616 return false;
12617
12618 return GetInventory().AreChildrenAccessible();
12619 }
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12642 {
12643 int id = muzzle_owner.GetMuzzleID();
12644 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12645
12646 if (WPOF_array)
12647 {
12648 for (int i = 0; i < WPOF_array.Count(); i++)
12649 {
12650 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12651
12652 if (WPOF)
12653 {
12654 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12655 }
12656 }
12657 }
12658 }
12659
12660
12662 {
12663 int id = muzzle_owner.GetMuzzleID();
12665
12666 if (WPOBE_array)
12667 {
12668 for (int i = 0; i < WPOBE_array.Count(); i++)
12669 {
12670 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12671
12672 if (WPOBE)
12673 {
12674 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12675 }
12676 }
12677 }
12678 }
12679
12680
12682 {
12683 int id = muzzle_owner.GetMuzzleID();
12684 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12685
12686 if (WPOOH_array)
12687 {
12688 for (int i = 0; i < WPOOH_array.Count(); i++)
12689 {
12690 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12691
12692 if (WPOOH)
12693 {
12694 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12695 }
12696 }
12697 }
12698 }
12699
12700
12702 {
12703 int id = muzzle_owner.GetMuzzleID();
12704 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12705
12706 if (WPOOH_array)
12707 {
12708 for (int i = 0; i < WPOOH_array.Count(); i++)
12709 {
12710 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12711
12712 if (WPOOH)
12713 {
12714 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12715 }
12716 }
12717 }
12718 }
12719
12720
12722 {
12723 int id = muzzle_owner.GetMuzzleID();
12724 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12725
12726 if (WPOOH_array)
12727 {
12728 for (int i = 0; i < WPOOH_array.Count(); i++)
12729 {
12730 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12731
12732 if (WPOOH)
12733 {
12734 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12735 }
12736 }
12737 }
12738 }
12739
12740
12741
12743 {
12745 {
12746 return true;
12747 }
12748
12749 return false;
12750 }
12751
12753 {
12755 {
12756 return true;
12757 }
12758
12759 return false;
12760 }
12761
12763 {
12765 {
12766 return true;
12767 }
12768
12769 return false;
12770 }
12771
12773 {
12774 return false;
12775 }
12776
12779 {
12780 return UATimeSpent.DEFAULT_DEPLOY;
12781 }
12782
12783
12784
12785
12787 {
12789 SetSynchDirty();
12790 }
12791
12793 {
12795 }
12796
12797
12799 {
12800 return false;
12801 }
12802
12805 {
12806 string att_type = "None";
12807
12808 if (ConfigIsExisting("soundAttType"))
12809 {
12810 att_type = ConfigGetString("soundAttType");
12811 }
12812
12814 }
12815
12817 {
12819 }
12820
12821
12822
12823
12824
12830
12832 {
12835
12837 }
12838
12839
12841 {
12843 return;
12844
12846
12849
12852
12853 SoundParameters params = new SoundParameters();
12857 }
12858
12859
12861 {
12863 {
12866
12867 SetSynchDirty();
12868
12871 }
12872 }
12873
12875 {
12877 }
12878
12879
12881 {
12883 return;
12884
12886 SetSynchDirty();
12887
12890 }
12891
12893 {
12896 }
12897
12899 {
12901 }
12902
12903 void OnApply(PlayerBase player);
12904
12906 {
12907 return 1.0;
12908 };
12909
12911 {
12913 }
12914
12916 {
12918 }
12919
12921
12923 {
12924 SetDynamicPhysicsLifeTime(0.01);
12926 }
12927
12929 {
12930 array<string> zone_names = new array<string>;
12931 GetDamageZones(zone_names);
12932 for (int i = 0; i < zone_names.Count(); i++)
12933 {
12934 SetHealthMax(zone_names.Get(i),"Health");
12935 }
12936 SetHealthMax("","Health");
12937 }
12938
12941 {
12942 float global_health = GetHealth01("","Health");
12943 array<string> zones = new array<string>;
12944 GetDamageZones(zones);
12945
12946 for (int i = 0; i < zones.Count(); i++)
12947 {
12948 SetHealth01(zones.Get(i),"Health",global_health);
12949 }
12950 }
12951
12954 {
12955 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12956 }
12957
12959 {
12960 if (!hasRootAsPlayer)
12961 {
12962 if (refParentIB)
12963 {
12964
12965 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12966 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12967
12968 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12969 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12970
12973 }
12974 else
12975 {
12976
12979 }
12980 }
12981 }
12982
12984 {
12986 {
12987 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12988 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12989 {
12990 float heatPermCoef = 1.0;
12992 while (ent)
12993 {
12994 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12995 ent = ent.GetHierarchyParent();
12996 }
12997
12998 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12999 }
13000 }
13001 }
13002
13004 {
13005
13006 EntityAI parent = GetHierarchyParent();
13007 if (!parent)
13008 {
13009 hasParent = false;
13010 hasRootAsPlayer = false;
13011 }
13012 else
13013 {
13014 hasParent = true;
13015 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13016 refParentIB =
ItemBase.Cast(parent);
13017 }
13018 }
13019
13020 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13021 {
13022
13023 }
13024
13026 {
13027
13028 return false;
13029 }
13030
13032 {
13033
13034
13035 return false;
13036 }
13037
13039 {
13040
13041 return false;
13042 }
13043
13046 {
13047 return !GetIsFrozen() &&
IsOpen();
13048 }
13049
13051 {
13052 bool hasParent = false, hasRootAsPlayer = false;
13054
13055 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13056 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13057
13058 if (wwtu || foodDecay)
13059 {
13063
13064 if (processWetness || processTemperature || processDecay)
13065 {
13067
13068 if (processWetness)
13069 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13070
13071 if (processTemperature)
13073
13074 if (processDecay)
13075 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13076 }
13077 }
13078 }
13079
13082 {
13084 }
13085
13087 {
13090
13091 return super.GetTemperatureFreezeThreshold();
13092 }
13093
13095 {
13098
13099 return super.GetTemperatureThawThreshold();
13100 }
13101
13103 {
13106
13107 return super.GetItemOverheatThreshold();
13108 }
13109
13111 {
13113 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13114
13115 return super.GetTemperatureFreezeTime();
13116 }
13117
13119 {
13121 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13122
13123 return super.GetTemperatureThawTime();
13124 }
13125
13130
13132 {
13133 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13134 }
13135
13137 {
13138 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13139 }
13140
13143 {
13145 }
13146
13148 {
13150 }
13151
13153 {
13155 }
13156
13159 {
13160 return null;
13161 }
13162
13165 {
13166 return false;
13167 }
13168
13170 {
13172 {
13175 if (!trg)
13176 {
13178 explosive = this;
13179 }
13180
13181 explosive.PairRemote(trg);
13183
13184 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13185 trg.SetPersistentPairID(persistentID);
13186 explosive.SetPersistentPairID(persistentID);
13187
13188 return true;
13189 }
13190 return false;
13191 }
13192
13195 {
13196 float ret = 1.0;
13199 ret *= GetHealth01();
13200
13201 return ret;
13202 }
13203
13204 #ifdef DEVELOPER
13205 override void SetDebugItem()
13206 {
13207 super.SetDebugItem();
13208 _itemBase = this;
13209 }
13210
13212 {
13213 string text = super.GetDebugText();
13214
13216 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13217
13218 return text;
13219 }
13220 #endif
13221
13223 {
13224 return true;
13225 }
13226
13228
13230
13232 {
13235 }
13236
13237
13245
13261
13262 [
Obsolete(
"Use ItemSoundHandler instead")]
13265 {
13266 if (!
g_Game.IsDedicatedServer())
13267 {
13268 if (ConfigIsExisting("attachSoundSet"))
13269 {
13270 string cfg_path = "";
13271 string soundset = "";
13272 string type_name =
GetType();
13273
13276 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13277 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13278
13279 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13280 {
13281 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13282 {
13283 if (cfg_slot_array[i] == slot_type)
13284 {
13285 soundset = cfg_soundset_array[i];
13286 break;
13287 }
13288 }
13289 }
13290
13291 if (soundset != "")
13292 {
13293 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13295 }
13296 }
13297 }
13298 }
13299
13301}
13302
13304{
13306 if (entity)
13307 {
13308 bool is_item = entity.IsInherited(
ItemBase);
13309 if (is_item && full_quantity)
13310 {
13313 }
13314 }
13315 else
13316 {
13318 return NULL;
13319 }
13320 return entity;
13321}
13322
13324{
13325 if (item)
13326 {
13327 if (health > 0)
13328 item.SetHealth("", "", health);
13329
13330 if (item.CanHaveTemperature())
13331 {
13333 if (item.CanFreeze())
13334 item.SetFrozen(false);
13335 }
13336
13337 if (item.HasEnergyManager())
13338 {
13339 if (quantity >= 0)
13340 {
13341 item.GetCompEM().SetEnergy0To1(quantity);
13342 }
13343 else
13344 {
13346 }
13347 }
13348 else if (item.IsMagazine())
13349 {
13350 Magazine mag = Magazine.Cast(item);
13351 if (quantity >= 0)
13352 {
13353 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13354 }
13355 else
13356 {
13358 }
13359
13360 }
13361 else
13362 {
13363 if (quantity >= 0)
13364 {
13365 item.SetQuantityNormalized(quantity, false);
13366 }
13367 else
13368 {
13370 }
13371
13372 }
13373 }
13374}
13375
13376#ifdef DEVELOPER
13378#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.