8387{
8389 {
8390 return true;
8391 }
8392};
8393
8395{
8396
8397};
8398
8399
8400
8402{
8406
8408
8411
8412
8413
8414
8415
8424
8430
8435
8440
8461 protected bool m_IsResultOfSplit
8462
8464
8469
8470
8471
8473
8477
8478
8479
8481
8484
8485
8486
8492
8493
8501
8504
8505
8507
8508
8510
8511
8516
8517
8522
8524
8525
8527
8528
8530 {
8535
8536 if (!
g_Game.IsDedicatedServer())
8537 {
8539 {
8541
8543 {
8545 }
8546 }
8547
8550 }
8551
8552 m_OldLocation = null;
8553
8555 {
8557 }
8558
8559 if (ConfigIsExisting("headSelectionsToHide"))
8560 {
8563 }
8564
8566 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8567 {
8569 }
8570
8572
8573 m_IsResultOfSplit = false;
8574
8576 }
8577
8579 {
8580 super.InitItemVariables();
8581
8587 m_Count = ConfigGetInt(
"count");
8588
8591
8596
8599
8604
8616
8620
8621
8624 if (ConfigIsExisting("canBeSplit"))
8625 {
8628 }
8629
8631 if (ConfigIsExisting("itemBehaviour"))
8633
8634
8637 RegisterNetSyncVariableInt("m_VarLiquidType");
8638 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8639
8640 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8641 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8642 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8643
8644 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8645 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8646 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8647 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8648
8649 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8650 RegisterNetSyncVariableBool("m_IsTakeable");
8651 RegisterNetSyncVariableBool("m_IsHologram");
8652
8655 {
8658 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8659 }
8660
8662
8664 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8666
8668 }
8669
8671 {
8673 }
8674
8676 {
8679 {
8684 }
8685 }
8686
8687 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8688 {
8690 {
8693 }
8694
8696 }
8697
8699 {
8705 }
8706
8708
8710 {
8712
8713 if (!action)
8714 {
8715 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8716 return;
8717 }
8718
8720 if (!ai)
8721 {
8723 return;
8724 }
8725
8727 if (!action_array)
8728 {
8729 action_array = new array<ActionBase_Basic>;
8731 }
8732 if (LogManager.IsActionLogEnable())
8733 {
8734 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8735 }
8736
8737 if (action_array.Find(action) != -1)
8738 {
8739 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8740 }
8741 else
8742 {
8743 action_array.Insert(action);
8744 }
8745 }
8746
8748 {
8749 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8750 ActionBase action = player.GetActionManager().GetAction(actionName);
8753
8754 if (action_array)
8755 {
8756 action_array.RemoveItem(action);
8757 }
8758 }
8759
8760
8761
8763 {
8764 ActionOverrideData overrideData = new ActionOverrideData();
8768
8770 if (!actionMap)
8771 {
8774 }
8775
8776 actionMap.Insert(this.
Type(), overrideData);
8777
8778 }
8779
8781
8783
8784
8786 {
8789
8792
8793 string config_to_search = "CfgVehicles";
8794 string muzzle_owner_config;
8795
8797 {
8798 if (IsInherited(Weapon))
8799 config_to_search = "CfgWeapons";
8800
8801 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8802
8803 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8804
8805 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8806
8807 if (config_OnFire_subclass_count > 0)
8808 {
8809 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8810
8811 for (int i = 0; i < config_OnFire_subclass_count; i++)
8812 {
8813 string particle_class = "";
8814 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8815 string config_OnFire_entry = config_OnFire_class + particle_class;
8816 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8817 WPOF_array.Insert(WPOF);
8818 }
8819
8820
8822 }
8823 }
8824
8826 {
8827 config_to_search = "CfgWeapons";
8828 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8829
8830 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8831
8832 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8833
8834 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8835 {
8836 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8837
8838 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8839 {
8840 string particle_class2 = "";
8841 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8842 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8843 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8844 WPOBE_array.Insert(WPOBE);
8845 }
8846
8847
8849 }
8850 }
8851 }
8852
8853
8855 {
8858
8860 {
8861 string config_to_search = "CfgVehicles";
8862
8863 if (IsInherited(Weapon))
8864 config_to_search = "CfgWeapons";
8865
8866 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8867 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8868
8869 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8870 {
8871
8873
8875 {
8877 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8879 return;
8880 }
8881
8884
8885
8886
8887 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8888 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8889
8890 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8891 {
8892 string particle_class = "";
8893 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8894 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8895 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8896
8897 if (entry_type == CT_CLASS)
8898 {
8899 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8900 WPOOH_array.Insert(WPOF);
8901 }
8902 }
8903
8904
8906 }
8907 }
8908 }
8909
8911 {
8913 }
8914
8916 {
8918 {
8920
8923
8926
8927 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8928 }
8929 }
8930
8932 {
8934 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8935
8937 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8938
8940 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8941
8943 {
8945 }
8946 }
8947
8949 {
8951 }
8952
8954 {
8957 else
8959
8961 {
8964 }
8965 else
8966 {
8969
8972 }
8973
8975 }
8976
8978 {
8980 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8981 }
8982
8984 {
8986 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8988 }
8989
8991 {
8993 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8994 }
8995
8997 {
9000
9001 OverheatingParticle OP = new OverheatingParticle();
9006
9008 }
9009
9011 {
9014
9015 return -1;
9016 }
9017
9019 {
9021 {
9024
9025 for (int i = count; i > 0; --i)
9026 {
9027 int id = i - 1;
9030
9033
9034 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9035 {
9036 if (p)
9037 {
9040 }
9041 }
9042 }
9043 }
9044 }
9045
9047 {
9049 {
9051 {
9052 int id = i - 1;
9054
9055 if (OP)
9056 {
9058
9059 if (p)
9060 {
9062 }
9063
9064 delete OP;
9065 }
9066 }
9067
9070 }
9071 }
9072
9075 {
9076 return 0.0;
9077 }
9078
9079
9081 {
9082 return 250;
9083 }
9084
9086 {
9087 return 0;
9088 }
9089
9092 {
9094 return true;
9095
9096 return false;
9097 }
9098
9101 {
9104
9106 {
9108 }
9109 else
9110 {
9111
9113 }
9114
9116 }
9117
9124 {
9125 return -1;
9126 }
9127
9128
9129
9130
9132 {
9134 {
9135 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9136 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9137
9138 if (r_index >= 0)
9139 {
9140 InventoryLocation r_il = new InventoryLocation;
9141 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9142
9143 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9146 {
9147 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9148 }
9150 {
9151 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9152 }
9153
9154 }
9155
9156 player.GetHumanInventory().ClearUserReservedLocation(this);
9157 }
9158
9161 }
9162
9163
9164
9165
9167 {
9168 return ItemBase.m_DebugActionsMask;
9169 }
9170
9172 {
9173 return ItemBase.m_DebugActionsMask & mask;
9174 }
9175
9177 {
9178 ItemBase.m_DebugActionsMask = mask;
9179 }
9180
9182 {
9183 ItemBase.m_DebugActionsMask |= mask;
9184 }
9185
9187 {
9188 ItemBase.m_DebugActionsMask &= ~mask;
9189 }
9190
9192 {
9194 {
9196 }
9197 else
9198 {
9200 }
9201 }
9202
9203
9205 {
9206 if (GetEconomyProfile())
9207 {
9208 float q_max = GetEconomyProfile().GetQuantityMax();
9209 if (q_max > 0)
9210 {
9211 float q_min = GetEconomyProfile().GetQuantityMin();
9212 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9213
9215 {
9216 ComponentEnergyManager comp = GetCompEM();
9218 {
9220 }
9221 }
9223 {
9225
9226 }
9227
9228 }
9229 }
9230 }
9231
9234 {
9235 EntityAI parent = GetHierarchyParent();
9236
9237 if (parent)
9238 {
9239 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9240 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9241 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9242 }
9243 }
9244
9247 {
9248 EntityAI parent = GetHierarchyParent();
9249
9250 if (parent)
9251 {
9252 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9253 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9254 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9255 }
9256 }
9257
9259 {
9260
9261
9262
9263
9265
9267 {
9268 if (ScriptInputUserData.CanStoreInputUserData())
9269 {
9270 ScriptInputUserData ctx = new ScriptInputUserData;
9276 ctx.
Write(use_stack_max);
9279
9281 {
9282 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9283 }
9284 }
9285 }
9286 else if (!
g_Game.IsMultiplayer())
9287 {
9289 }
9290 }
9291
9293 {
9295 }
9296
9298 {
9300 }
9301
9303 {
9305 }
9306
9308 {
9309
9310 return false;
9311 }
9312
9314 {
9315 return false;
9316 }
9317
9321 {
9322 return false;
9323 }
9324
9326 {
9327 return "";
9328 }
9329
9331
9333 {
9334 return false;
9335 }
9336
9338 {
9339 return true;
9340 }
9341
9342
9343
9345 {
9346 return true;
9347 }
9348
9350 {
9351 return true;
9352 }
9353
9355 {
9356 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9358 }
9359
9361 {
9363 }
9364
9366 {
9368 if (!is_being_placed)
9370 SetSynchDirty();
9371 }
9372
9373
9375
9377 {
9379 }
9380
9382 {
9384 }
9385
9387 {
9388 return 1;
9389 }
9390
9392 {
9393 return false;
9394 }
9395
9397 {
9399 SetSynchDirty();
9400 }
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
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
9437 {
9438 super.OnMovedInsideCargo(container);
9439
9440 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9441 }
9442
9443 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9444 {
9445 super.EEItemLocationChanged(oldLoc, newLoc);
9446
9447 PlayerBase newPlayer = null;
9448 PlayerBase oldPlayer = null;
9449
9450 if (newLoc.GetParent())
9451 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9452
9453 if (oldLoc.GetParent())
9454 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9455
9457 {
9458 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9459
9460 if (rIndex >= 0)
9461 {
9462 InventoryLocation rIl = new InventoryLocation;
9463 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9464
9465 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9468 {
9469 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9470 }
9472 {
9474 }
9475
9476 }
9477 }
9478
9480 {
9481 if (newPlayer)
9482 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9483
9484 if (newPlayer == oldPlayer)
9485 {
9486 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9487 {
9489 {
9490 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9491 {
9492 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9493 }
9494 }
9495 else
9496 {
9497 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9498 }
9499 }
9500
9501 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9502 {
9503 int type = oldLoc.GetType();
9505 {
9506 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9507 }
9509 {
9510 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9511 }
9512 }
9513 if (!m_OldLocation)
9514 {
9515 m_OldLocation = new InventoryLocation;
9516 }
9517 m_OldLocation.Copy(oldLoc);
9518 }
9519 else
9520 {
9521 if (m_OldLocation)
9522 {
9523 m_OldLocation.Reset();
9524 }
9525 }
9526
9527 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9528 }
9529 else
9530 {
9531 if (newPlayer)
9532 {
9533 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9534 if (resIndex >= 0)
9535 {
9536 InventoryLocation il = new InventoryLocation;
9537 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9539 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9542 {
9543 il.
GetParent().GetOnReleaseLock().Invoke(it);
9544 }
9546 {
9548 }
9549
9550 }
9551 }
9553 {
9554
9556 }
9557
9558 if (m_OldLocation)
9559 {
9560 m_OldLocation.Reset();
9561 }
9562 }
9563
9565 {
9566 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9567 }
9568
9570 {
9571 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9572 }
9573 }
9574
9575 override void EOnContact(IEntity other, Contact extra)
9576 {
9578 {
9579 int liquidType = -1;
9581 if (impactSpeed > 0.0)
9582 {
9584 #ifndef SERVER
9586 #else
9588 SetSynchDirty();
9589 #endif
9591 }
9592 }
9593
9594 #ifdef SERVER
9595 if (GetCompEM() && GetCompEM().IsPlugged())
9596 {
9597 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9598 GetCompEM().UnplugThis();
9599 }
9600 #endif
9601 }
9602
9604
9606 {
9608 }
9609
9611 {
9612
9613 }
9614
9616 {
9617 super.OnItemLocationChanged(old_owner, new_owner);
9618
9619 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9620 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9621
9622 if (!relatedPlayer && playerNew)
9623 relatedPlayer = playerNew;
9624
9625 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9626 {
9628 if (actionMgr)
9629 {
9630 ActionBase currentAction = actionMgr.GetRunningAction();
9631 if (currentAction)
9633 }
9634 }
9635
9636 Man ownerPlayerOld = null;
9637 Man ownerPlayerNew = null;
9638
9639 if (old_owner)
9640 {
9641 if (old_owner.
IsMan())
9642 {
9643 ownerPlayerOld = Man.Cast(old_owner);
9644 }
9645 else
9646 {
9647 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9648 }
9649 }
9650 else
9651 {
9653 {
9655
9656 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9657 {
9658 GetCompEM().UnplugThis();
9659 }
9660 }
9661 }
9662
9663 if (new_owner)
9664 {
9665 if (new_owner.
IsMan())
9666 {
9667 ownerPlayerNew = Man.Cast(new_owner);
9668 }
9669 else
9670 {
9671 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9672 }
9673 }
9674
9675 if (ownerPlayerOld != ownerPlayerNew)
9676 {
9677 if (ownerPlayerOld)
9678 {
9679 array<EntityAI> subItemsExit = new array<EntityAI>;
9681 for (int i = 0; i < subItemsExit.Count(); i++)
9682 {
9685 }
9686 }
9687
9688 if (ownerPlayerNew)
9689 {
9690 array<EntityAI> subItemsEnter = new array<EntityAI>;
9692 for (int j = 0; j < subItemsEnter.Count(); j++)
9693 {
9696 }
9697 }
9698 }
9699 else if (ownerPlayerNew != null)
9700 {
9701 PlayerBase nplayer;
9702 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9703 {
9704 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9706 for (int k = 0; k < subItemsUpdate.Count(); k++)
9707 {
9709 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9710 }
9711 }
9712 }
9713
9714 if (old_owner)
9715 old_owner.OnChildItemRemoved(this);
9716 if (new_owner)
9717 new_owner.OnChildItemReceived(this);
9718 }
9719
9720
9722 {
9723 super.EEDelete(parent);
9724 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9725 if (player)
9726 {
9728
9729 if (player.IsAlive())
9730 {
9731 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9732 if (r_index >= 0)
9733 {
9734 InventoryLocation r_il = new InventoryLocation;
9735 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9736
9737 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9740 {
9741 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9742 }
9744 {
9745 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9746 }
9747
9748 }
9749
9750 player.RemoveQuickBarEntityShortcut(this);
9751 }
9752 }
9753 }
9754
9756 {
9757 super.EEKilled(killer);
9758
9761 {
9762 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9763 {
9764 if (IsMagazine())
9765 {
9766 if (Magazine.Cast(this).GetAmmoCount() > 0)
9767 {
9769 }
9770 }
9771 else
9772 {
9774 }
9775 }
9776 }
9777 }
9778
9780 {
9781 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9782
9783 super.OnWasAttached(parent, slot_id);
9784
9787
9790 }
9791
9793 {
9794 super.OnWasDetached(parent, slot_id);
9795
9798
9801 }
9802
9804 {
9805 int idx;
9808
9809 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9810 if (inventory_slots.Count() < 1)
9811 {
9812 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9813 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9814 }
9815 else
9816 {
9817 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9818 }
9819
9820 idx = inventory_slots.Find(slot);
9821 if (idx < 0)
9822 return "";
9823
9824 return attach_types.Get(idx);
9825 }
9826
9828 {
9829 int idx = -1;
9830 string slot;
9831
9834
9835 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9836 if (inventory_slots.Count() < 1)
9837 {
9838 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9839 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9840 }
9841 else
9842 {
9843 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9844 if (detach_types.Count() < 1)
9845 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9846 }
9847
9848 for (int i = 0; i < inventory_slots.Count(); i++)
9849 {
9850 slot = inventory_slots.Get(i);
9851 }
9852
9853 if (slot != "")
9854 {
9855 if (detach_types.Count() == 1)
9856 idx = 0;
9857 else
9858 idx = inventory_slots.Find(slot);
9859 }
9860 if (idx < 0)
9861 return "";
9862
9863 return detach_types.Get(idx);
9864 }
9865
9867 {
9868
9870
9871
9872 float min_time = 1;
9873 float max_time = 3;
9874 float delay = Math.RandomFloat(min_time, max_time);
9875
9876 explode_timer.Run(delay, this, "DoAmmoExplosion");
9877 }
9878
9880 {
9881 Magazine magazine = Magazine.Cast(this);
9882 int pop_sounds_count = 6;
9883 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9884
9885
9886 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9887 string sound_name = pop_sounds[ sound_idx ];
9888 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9889
9890
9891 magazine.ServerAddAmmoCount(-1);
9892
9893
9894 float min_temp_to_explode = 100;
9895
9896 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9897 {
9899 }
9900 }
9901
9902
9903 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9904 {
9905 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9906
9907 const int CHANCE_DAMAGE_CARGO = 4;
9908 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9909 const int CHANCE_DAMAGE_NOTHING = 2;
9910
9912 {
9913 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9914 int chances;
9915 int rnd;
9916
9917 if (GetInventory().GetCargo())
9918 {
9919 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9920 rnd = Math.RandomInt(0,chances);
9921
9922 if (rnd < CHANCE_DAMAGE_CARGO)
9923 {
9925 }
9926 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9927 {
9929 }
9930 }
9931 else
9932 {
9933 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9934 rnd = Math.RandomInt(0,chances);
9935
9936 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9937 {
9939 }
9940 }
9941 }
9942 }
9943
9945 {
9946 CargoBase cargo = GetInventory().GetCargo();
9947 if (cargo)
9948 {
9950 if (item_count > 0)
9951 {
9952 int random_pick = Math.RandomInt(0, item_count);
9954 if (!item.IsExplosive())
9955 {
9956 item.AddHealth("","",damage);
9957 return true;
9958 }
9959 }
9960 }
9961 return false;
9962 }
9963
9965 {
9966 GameInventory inventory = GetInventory();
9968 if (attachment_count > 0)
9969 {
9970 int random_pick = Math.RandomInt(0, attachment_count);
9972 if (!attachment.IsExplosive())
9973 {
9974 attachment.AddHealth("","",damage);
9975 return true;
9976 }
9977 }
9978 return false;
9979 }
9980
9982 {
9984 }
9985
9987 {
9989 return GetInventory().CanRemoveEntity();
9990
9991 return false;
9992 }
9993
9995 {
9996
9998 return false;
9999
10000
10002 return false;
10003
10004
10005
10007 if (delta == 0)
10008 return false;
10009
10010
10011 return true;
10012 }
10013
10015 {
10017 {
10018 if (ScriptInputUserData.CanStoreInputUserData())
10019 {
10020 ScriptInputUserData ctx = new ScriptInputUserData;
10025 ctx.
Write(destination_entity);
10027 ctx.
Write(slot_id);
10029 }
10030 }
10031 else if (!
g_Game.IsMultiplayer())
10032 {
10034 }
10035 }
10036
10038 {
10039 float split_quantity_new;
10043 InventoryLocation loc = new InventoryLocation;
10044
10045 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10046 {
10048 split_quantity_new = stack_max;
10049 else
10051
10053 {
10054 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10055 if (new_item)
10056 {
10057 new_item.SetResultOfSplit(true);
10058 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10060 new_item.
SetQuantity(split_quantity_new,
false,
true);
10061 }
10062 }
10063 }
10064 else if (destination_entity && slot_id == -1)
10065 {
10066 if (quantity > stack_max)
10067 split_quantity_new = stack_max;
10068 else
10069 split_quantity_new = quantity;
10070
10072 {
10073 GameInventory destinationInventory = destination_entity.GetInventory();
10075 {
10078 }
10079
10080 if (new_item)
10081 {
10082 new_item.SetResultOfSplit(true);
10083 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10085 new_item.
SetQuantity(split_quantity_new,
false,
true);
10086 }
10087 }
10088 }
10089 else
10090 {
10091 if (stack_max != 0)
10092 {
10094 {
10096 }
10097
10098 if (split_quantity_new == 0)
10099 {
10100 if (!
g_Game.IsMultiplayer())
10101 player.PhysicalPredictiveDropItem(this);
10102 else
10103 player.ServerDropEntity(this);
10104 return;
10105 }
10106
10108 {
10110
10111 if (new_item)
10112 {
10113 new_item.SetResultOfSplit(true);
10114 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10117 new_item.PlaceOnSurface();
10118 }
10119 }
10120 }
10121 }
10122 }
10123
10125 {
10126 float split_quantity_new;
10130 InventoryLocation loc = new InventoryLocation;
10131
10132 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10133 {
10135 split_quantity_new = stack_max;
10136 else
10138
10140 {
10141 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10142 if (new_item)
10143 {
10144 new_item.SetResultOfSplit(true);
10145 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10147 new_item.
SetQuantity(split_quantity_new,
false,
true);
10148 }
10149 }
10150 }
10151 else if (destination_entity && slot_id == -1)
10152 {
10153 if (quantity > stack_max)
10154 split_quantity_new = stack_max;
10155 else
10156 split_quantity_new = quantity;
10157
10159 {
10160 GameInventory destinationInventory = destination_entity.GetInventory();
10162 {
10165 }
10166
10167 if (new_item)
10168 {
10169 new_item.SetResultOfSplit(true);
10170 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10172 new_item.
SetQuantity(split_quantity_new,
false,
true);
10173 }
10174 }
10175 }
10176 else
10177 {
10178 if (stack_max != 0)
10179 {
10181 {
10183 }
10184
10186 {
10188
10189 if (new_item)
10190 {
10191 new_item.SetResultOfSplit(true);
10192 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10195 new_item.PlaceOnSurface();
10196 }
10197 }
10198 }
10199 }
10200 }
10201
10203 {
10205 {
10206 if (ScriptInputUserData.CanStoreInputUserData())
10207 {
10208 ScriptInputUserData ctx = new ScriptInputUserData;
10213 dst.WriteToContext(ctx);
10215 }
10216 }
10217 else if (!
g_Game.IsMultiplayer())
10218 {
10220 }
10221 }
10222
10224 {
10226 {
10227 if (ScriptInputUserData.CanStoreInputUserData())
10228 {
10229 ScriptInputUserData ctx = new ScriptInputUserData;
10234 ctx.
Write(destination_entity);
10240 }
10241 }
10242 else if (!
g_Game.IsMultiplayer())
10243 {
10245 }
10246 }
10247
10249 {
10251 }
10252
10254 {
10256 float split_quantity_new;
10258 if (dst.IsValid())
10259 {
10260 int slot_id = dst.GetSlot();
10262
10263 if (quantity > stack_max)
10264 split_quantity_new = stack_max;
10265 else
10266 split_quantity_new = quantity;
10267
10269 {
10271
10272 if (new_item)
10273 {
10274 new_item.SetResultOfSplit(true);
10275 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10277 new_item.
SetQuantity(split_quantity_new,
false,
true);
10278 }
10279
10280 return new_item;
10281 }
10282 }
10283
10284 return null;
10285 }
10286
10288 {
10290 float split_quantity_new;
10292 if (destination_entity)
10293 {
10295 if (quantity > stackable)
10296 split_quantity_new = stackable;
10297 else
10298 split_quantity_new = quantity;
10299
10301 {
10302 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10303 if (new_item)
10304 {
10305 new_item.SetResultOfSplit(true);
10306 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10308 new_item.
SetQuantity(split_quantity_new,
false,
true);
10309 }
10310 }
10311 }
10312 }
10313
10315 {
10317 {
10318 if (ScriptInputUserData.CanStoreInputUserData())
10319 {
10320 ScriptInputUserData ctx = new ScriptInputUserData;
10325 ItemBase destination_entity =
this;
10326 ctx.
Write(destination_entity);
10330 }
10331 }
10332 else if (!
g_Game.IsMultiplayer())
10333 {
10335 }
10336 }
10337
10339 {
10341 float split_quantity_new;
10343 if (player)
10344 {
10346 if (quantity > stackable)
10347 split_quantity_new = stackable;
10348 else
10349 split_quantity_new = quantity;
10350
10352 {
10353 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10354 new_item =
ItemBase.Cast(in_hands);
10355 if (new_item)
10356 {
10357 new_item.SetResultOfSplit(true);
10358 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10360 new_item.SetQuantity(split_quantity_new, false, true);
10361 }
10362 }
10363 }
10364 }
10365
10367 {
10369 float split_quantity_new = Math.Floor(quantity * 0.5);
10370
10372 return;
10373
10375
10376 if (new_item)
10377 {
10378 if (new_item.GetQuantityMax() < split_quantity_new)
10379 {
10380 split_quantity_new = new_item.GetQuantityMax();
10381 }
10382
10383 new_item.SetResultOfSplit(true);
10384 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10385
10387 {
10390 }
10391 else
10392 {
10394 new_item.
SetQuantity(split_quantity_new,
false,
true);
10395 }
10396 }
10397 }
10398
10400 {
10402 float split_quantity_new = Math.Floor(quantity / 2);
10403
10405 return;
10406
10407 InventoryLocation invloc = new InventoryLocation;
10409
10411 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10412
10413 if (new_item)
10414 {
10415 if (new_item.GetQuantityMax() < split_quantity_new)
10416 {
10417 split_quantity_new = new_item.GetQuantityMax();
10418 }
10420 {
10423 }
10424 else if (split_quantity_new > 1)
10425 {
10427 new_item.
SetQuantity(split_quantity_new,
false,
true);
10428 }
10429 }
10430 }
10431
10434 {
10435 SetWeightDirty();
10437
10438 if (parent)
10439 parent.OnAttachmentQuantityChangedEx(this, delta);
10440
10442 {
10444 {
10446 }
10448 {
10449 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10451 }
10452 }
10453 }
10454
10457 {
10458
10459 }
10460
10463 {
10465 }
10466
10468 {
10469 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10470
10472 {
10473 if (newLevel == GameConstants.STATE_RUINED)
10474 {
10476 EntityAI parent = GetHierarchyParent();
10477 if (parent && parent.IsFireplace())
10478 {
10479 CargoBase cargo = GetInventory().GetCargo();
10480 if (cargo)
10481 {
10483 {
10485 }
10486 }
10487 }
10488 }
10489
10491 {
10492
10494 return;
10495 }
10496
10497 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10498 {
10500 }
10501 }
10502 }
10503
10504
10506 {
10507 super.OnRightClick();
10508
10510 {
10512 {
10513 if (ScriptInputUserData.CanStoreInputUserData())
10514 {
10515 EntityAI root = GetHierarchyRoot();
10516 Man playerOwner = GetHierarchyRootPlayer();
10517 InventoryLocation dst = new InventoryLocation;
10518
10519
10520 if (!playerOwner && root && root == this)
10521 {
10523 }
10524 else
10525 {
10526
10527 GetInventory().GetCurrentInventoryLocation(dst);
10529 {
10530 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10532 {
10534 }
10535 else
10536 {
10538
10539
10540 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10541 {
10543 }
10544 else
10545 {
10546 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10547 }
10548 }
10549 }
10550 }
10551
10552 ScriptInputUserData ctx = new ScriptInputUserData;
10560 }
10561 }
10562 else if (!
g_Game.IsMultiplayer())
10563 {
10565 }
10566 }
10567 }
10568
10570 {
10571 if (root)
10572 {
10573 vector m4[4];
10574 root.GetTransform(m4);
10575 dst.SetGround(this, m4);
10576 }
10577 else
10578 {
10579 GetInventory().GetCurrentInventoryLocation(dst);
10580 }
10581 }
10582
10583 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10584 {
10585
10586 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10587 return false;
10588
10589 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10590 return false;
10591
10592
10594 return false;
10595
10596
10597 Magazine mag = Magazine.Cast(this);
10598 if (mag)
10599 {
10600 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10601 return false;
10602
10603 if (stack_max_limit)
10604 {
10605 Magazine other_mag = Magazine.Cast(other_item);
10606 if (other_item)
10607 {
10608 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10609 return false;
10610 }
10611
10612 }
10613 }
10614 else
10615 {
10616
10618 return false;
10619
10621 return false;
10622 }
10623
10624 PlayerBase player = null;
10625 if (CastTo(player, GetHierarchyRootPlayer()))
10626 {
10627 if (player.GetInventory().HasAttachment(this))
10628 return false;
10629
10630 if (player.IsItemsToDelete())
10631 return false;
10632 }
10633
10634 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10635 return false;
10636
10637 int slotID;
10639 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10640 return false;
10641
10642 return true;
10643 }
10644
10646 {
10648 }
10649
10651 {
10652 return m_IsResultOfSplit;
10653 }
10654
10656 {
10657 m_IsResultOfSplit = value;
10658 }
10659
10661 {
10663 }
10664
10666 {
10667 float other_item_quantity = other_item.GetQuantity();
10668 float this_free_space;
10669
10671
10673
10674 if (other_item_quantity > this_free_space)
10675 {
10676 return this_free_space;
10677 }
10678 else
10679 {
10680 return other_item_quantity;
10681 }
10682 }
10683
10685 {
10687 }
10688
10690 {
10692 return;
10693
10694 if (!IsMagazine() && other_item)
10695 {
10697 if (quantity_used != 0)
10698 {
10699 float hp1 = GetHealth01("","");
10700 float hp2 = other_item.GetHealth01("","");
10701 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10702 hpResult = hpResult / (
GetQuantity() + quantity_used);
10703
10704 hpResult *= GetMaxHealth();
10705 Math.Round(hpResult);
10706 SetHealth("", "Health", hpResult);
10707
10709 other_item.AddQuantity(-quantity_used);
10710 }
10711 }
10713 }
10714
10716 {
10717 #ifdef SERVER
10718 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10719 GetHierarchyParent().IncreaseLifetimeUp();
10720 #endif
10721 };
10722
10724 {
10725 PlayerBase p = PlayerBase.Cast(player);
10726
10727 array<int> recipesIds = p.m_Recipes;
10728 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10729 if (moduleRecipesManager)
10730 {
10731 EntityAI itemInHands = player.GetEntityInHands();
10732 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10733 }
10734
10735 for (int i = 0;i < recipesIds.Count(); i++)
10736 {
10737 int key = recipesIds.Get(i);
10738 string recipeName = moduleRecipesManager.GetRecipeName(key);
10740 }
10741 }
10742
10743
10744 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10745 {
10746 super.GetDebugActions(outputList);
10747
10748
10754
10755
10760
10765
10766
10770
10771
10773 {
10777 }
10778
10781
10782
10786
10788
10789 InventoryLocation loc = new InventoryLocation();
10790 GetInventory().GetCurrentInventoryLocation(loc);
10792 {
10793 if (Gizmo_IsSupported())
10796 }
10797
10799 }
10800
10801
10802
10803
10805 {
10806 super.OnAction(action_id, player, ctx);
10807
10809 {
10810 switch (action_id)
10811 {
10815 return true;
10819 return true;
10820 }
10821 }
10822
10824 {
10825 switch (action_id)
10826 {
10828 Delete();
10829 return true;
10830 }
10831 }
10832
10833 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10834 {
10835 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10836 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10837 PlayerBase p = PlayerBase.Cast(player);
10838 if (
EActions.RECIPES_RANGE_START < 1000)
10839 {
10840 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10841 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10842 }
10843 }
10844 #ifndef SERVER
10845 else if (action_id ==
EActions.WATCH_PLAYER)
10846 {
10847 PluginDeveloper.SetDeveloperItemClientEx(player);
10848 }
10849 #endif
10851 {
10852 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10853 {
10854 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10855 OnDebugButtonPressServer(id + 1);
10856 }
10857
10858 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10859 {
10860 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10862 }
10863
10864 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10865 {
10866 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10868 }
10869
10870 else if (action_id ==
EActions.ADD_QUANTITY)
10871 {
10872 if (IsMagazine())
10873 {
10874 Magazine mag = Magazine.Cast(this);
10875 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10876 }
10877 else
10878 {
10880 }
10881
10882 if (m_EM)
10883 {
10884 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10885 }
10886
10887 }
10888
10889 else if (action_id ==
EActions.REMOVE_QUANTITY)
10890 {
10891 if (IsMagazine())
10892 {
10893 Magazine mag2 = Magazine.Cast(this);
10894 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10895 }
10896 else
10897 {
10899 }
10900 if (m_EM)
10901 {
10902 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10903 }
10904
10905 }
10906
10907 else if (action_id ==
EActions.SET_QUANTITY_0)
10908 {
10910
10911 if (m_EM)
10912 {
10913 m_EM.SetEnergy(0);
10914 }
10915 }
10916
10917 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10918 {
10920
10921 if (m_EM)
10922 {
10923 m_EM.SetEnergy(m_EM.GetEnergyMax());
10924 }
10925 }
10926
10927 else if (action_id ==
EActions.ADD_HEALTH)
10928 {
10929 AddHealth("","",GetMaxHealth("","Health")/5);
10930 }
10931 else if (action_id ==
EActions.REMOVE_HEALTH)
10932 {
10933 AddHealth("","",-GetMaxHealth("","Health")/5);
10934 }
10935 else if (action_id ==
EActions.DESTROY_HEALTH)
10936 {
10937 SetHealth01("","",0);
10938 }
10939 else if (action_id ==
EActions.WATCH_ITEM)
10940 {
10942 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10943 #ifdef DEVELOPER
10944 SetDebugDeveloper_item(this);
10945 #endif
10946 }
10947
10948 else if (action_id ==
EActions.ADD_TEMPERATURE)
10949 {
10950 AddTemperature(20);
10951
10952 }
10953
10954 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10955 {
10956 AddTemperature(-20);
10957
10958 }
10959
10960 else if (action_id ==
EActions.FLIP_FROZEN)
10961 {
10962 SetFrozen(!GetIsFrozen());
10963
10964 }
10965
10966 else if (action_id ==
EActions.ADD_WETNESS)
10967 {
10969
10970 }
10971
10972 else if (action_id ==
EActions.REMOVE_WETNESS)
10973 {
10975
10976 }
10977
10978 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10979 {
10982
10983
10984 }
10985
10986 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10987 {
10990 }
10991
10992 else if (action_id ==
EActions.MAKE_SPECIAL)
10993 {
10994 auto debugParams = DebugSpawnParams.WithPlayer(player);
10995 OnDebugSpawnEx(debugParams);
10996 }
10997
10998 }
10999
11000
11001 return false;
11002 }
11003
11004
11005
11006
11010
11013
11014
11015
11017 {
11018 return false;
11019 }
11020
11021
11023 {
11024 return true;
11025 }
11026
11027
11029 {
11030 return true;
11031 }
11032
11033
11034
11036 {
11037 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11038 return g_Game.ConfigIsExisting(config_path);
11039 }
11040
11043 {
11044 return null;
11045 }
11046
11048 {
11049 return false;
11050 }
11051
11053 {
11054 return false;
11055 }
11056
11060
11061
11063 {
11064 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11065 return module_repairing.CanRepair(this, item_repair_kit);
11066 }
11067
11068
11069 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11070 {
11071 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11072 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11073 }
11074
11075
11077 {
11078
11079
11080
11081
11082
11083
11084
11085
11086 return 1;
11087 }
11088
11089
11090
11092 {
11094 }
11095
11096
11097
11099 {
11101 }
11102
11103
11112 {
11113 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11114
11115 if (player)
11116 {
11117 player.MessageStatus(text);
11118 }
11119 }
11120
11121
11130 {
11131 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11132
11133 if (player)
11134 {
11135 player.MessageAction(text);
11136 }
11137 }
11138
11139
11148 {
11149 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11150
11151 if (player)
11152 {
11153 player.MessageFriendly(text);
11154 }
11155 }
11156
11157
11166 {
11167 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11168
11169 if (player)
11170 {
11171 player.MessageImportant(text);
11172 }
11173 }
11174
11176 {
11177 return true;
11178 }
11179
11180
11181 override bool KindOf(
string tag)
11182 {
11183 bool found = false;
11184 string item_name = this.
GetType();
11186 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11187
11188 int array_size = item_tag_array.Count();
11189 for (int i = 0; i < array_size; i++)
11190 {
11191 if (item_tag_array.Get(i) == tag)
11192 {
11193 found = true;
11194 break;
11195 }
11196 }
11197 return found;
11198 }
11199
11200
11202 {
11203
11204 super.OnRPC(sender, rpc_type,ctx);
11205
11206
11207 switch (rpc_type)
11208 {
11209 #ifndef SERVER
11210 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11211 Param2<bool, string> p = new Param2<bool, string>(false, "");
11212
11214 return;
11215
11216 bool play = p.param1;
11217 string soundSet = p.param2;
11218
11219 if (play)
11220 {
11222 {
11224 {
11226 }
11227 }
11228 else
11229 {
11231 }
11232 }
11233 else
11234 {
11236 }
11237
11238 break;
11239 #endif
11240
11241 }
11242
11244 {
11246 }
11247 }
11248
11249
11250
11251
11253 {
11254 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11255 return plugin.GetID(
name);
11256 }
11257
11259 {
11260 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11261 return plugin.GetName(id);
11262 }
11263
11266 {
11267
11268
11269 int varFlags;
11270 if (!ctx.
Read(varFlags))
11271 return;
11272
11273 if (varFlags & ItemVariableFlags.FLOAT)
11274 {
11276 }
11277 }
11278
11280 {
11281
11282 super.SerializeNumericalVars(floats_out);
11283
11284
11285
11287 {
11289 }
11290
11292 {
11294 }
11295
11297 {
11299 }
11300
11302 {
11307 }
11308
11310 {
11312 }
11313 }
11314
11316 {
11317
11318 super.DeSerializeNumericalVars(floats);
11319
11320
11321 int index = 0;
11322 int mask = Math.Round(floats.Get(index));
11323
11324 index++;
11325
11327 {
11329 {
11331 }
11332 else
11333 {
11334 float quantity = floats.Get(index);
11335 SetQuantity(quantity,
true,
false,
false,
false);
11336 }
11337 index++;
11338 }
11339
11341 {
11342 float wet = floats.Get(index);
11344 index++;
11345 }
11346
11348 {
11349 int liquidtype = Math.Round(floats.Get(index));
11351 index++;
11352 }
11353
11355 {
11357 index++;
11359 index++;
11361 index++;
11363 index++;
11364 }
11365
11367 {
11368 int cleanness = Math.Round(floats.Get(index));
11370 index++;
11371 }
11372 }
11373
11375 {
11376 super.WriteVarsToCTX(ctx);
11377
11378
11380 {
11382 }
11383
11385 {
11387 }
11388
11390 {
11392 }
11393
11395 {
11396 int r,g,b,a;
11402 }
11403
11405 {
11407 }
11408 }
11409
11411 {
11412 if (!super.ReadVarsFromCTX(ctx,version))
11413 return false;
11414
11415 int intValue;
11416 float value;
11417
11418 if (version < 140)
11419 {
11420 if (!ctx.
Read(intValue))
11421 return false;
11422
11423 m_VariablesMask = intValue;
11424 }
11425
11427 {
11428 if (!ctx.
Read(value))
11429 return false;
11430
11432 {
11434 }
11435 else
11436 {
11438 }
11439 }
11440
11441 if (version < 140)
11442 {
11444 {
11445 if (!ctx.
Read(value))
11446 return false;
11447 SetTemperatureDirect(value);
11448 }
11449 }
11450
11452 {
11453 if (!ctx.
Read(value))
11454 return false;
11456 }
11457
11459 {
11460 if (!ctx.
Read(intValue))
11461 return false;
11463 }
11464
11466 {
11467 int r,g,b,a;
11469 return false;
11471 return false;
11473 return false;
11475 return false;
11476
11478 }
11479
11481 {
11482 if (!ctx.
Read(intValue))
11483 return false;
11485 }
11486
11487 if (version >= 138 && version < 140)
11488 {
11490 {
11491 if (!ctx.
Read(intValue))
11492 return false;
11493 SetFrozen(intValue);
11494 }
11495 }
11496
11497 return true;
11498 }
11499
11500
11502 {
11505 {
11507 }
11508
11509 if (!super.OnStoreLoad(ctx, version))
11510 {
11512 return false;
11513 }
11514
11515 if (version >= 114)
11516 {
11517 bool hasQuickBarIndexSaved;
11518
11519 if (!ctx.
Read(hasQuickBarIndexSaved))
11520 {
11522 return false;
11523 }
11524
11525 if (hasQuickBarIndexSaved)
11526 {
11527 int itmQBIndex;
11528
11529
11530 if (!ctx.
Read(itmQBIndex))
11531 {
11533 return false;
11534 }
11535
11536 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11537 if (itmQBIndex != -1 && parentPlayer)
11538 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11539 }
11540 }
11541 else
11542 {
11543
11544 PlayerBase player;
11545 int itemQBIndex;
11546 if (version ==
int.
MAX)
11547 {
11548 if (!ctx.
Read(itemQBIndex))
11549 {
11551 return false;
11552 }
11553 }
11554 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11555 {
11556
11557 if (!ctx.
Read(itemQBIndex))
11558 {
11560 return false;
11561 }
11562 if (itemQBIndex != -1 && player)
11563 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11564 }
11565 }
11566
11567 if (version < 140)
11568 {
11569
11570 if (!LoadVariables(ctx, version))
11571 {
11573 return false;
11574 }
11575 }
11576
11577
11579 {
11581 return false;
11582 }
11583 if (version >= 132)
11584 {
11586 if (raib)
11587 {
11589 {
11591 return false;
11592 }
11593 }
11594 }
11595
11597 return true;
11598 }
11599
11600
11601
11603 {
11604 super.OnStoreSave(ctx);
11605
11606 PlayerBase player;
11607 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11608 {
11610
11611 int itemQBIndex = -1;
11612 itemQBIndex = player.FindQuickBarEntityIndex(this);
11613 ctx.
Write(itemQBIndex);
11614 }
11615 else
11616 {
11618 }
11619
11621
11623 if (raib)
11624 {
11626 }
11627 }
11628
11629
11631 {
11632 super.AfterStoreLoad();
11633
11635 {
11637 }
11638
11640 {
11643 }
11644 }
11645
11647 {
11648 super.EEOnAfterLoad();
11649
11651 {
11653 }
11654
11657 }
11658
11660 {
11661 return false;
11662 }
11663
11664
11665
11667 {
11669 {
11670 #ifdef PLATFORM_CONSOLE
11671
11673 {
11675 if (menu)
11676 {
11678 }
11679 }
11680 #endif
11681 }
11682
11684 {
11687 }
11688
11690 {
11691 SetWeightDirty();
11693 }
11695 {
11698 }
11699
11701 {
11704
11707 }
11709 {
11713 }
11714
11715 super.OnVariablesSynchronized();
11716 }
11717
11718
11719
11721 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11722 {
11723 if (!IsServerCheck(allow_client))
11724 return false;
11725
11727 return false;
11728
11731
11732 if (value <= (min + 0.001))
11733 value = min;
11734
11735 if (value == min)
11736 {
11737 if (destroy_config)
11738 {
11739 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11740 if (dstr)
11741 {
11743 this.Delete();
11744 return true;
11745 }
11746 }
11747 else if (destroy_forced)
11748 {
11750 this.Delete();
11751 return true;
11752 }
11753
11755 }
11756
11759
11761 {
11762 EntityAI parent = GetHierarchyRoot();
11763 InventoryLocation iLoc = new InventoryLocation();
11764 GetInventory().GetCurrentInventoryLocation(iLoc);
11766 {
11767 int iLocSlot = iLoc.
GetSlot();
11769 {
11771 }
11773 {
11775 }
11776 }
11777 }
11778
11780 {
11782
11783 if (delta)
11785 }
11786
11788
11789 return false;
11790 }
11791
11792
11794 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11795 {
11797 }
11798
11800 {
11803 }
11804
11806 {
11809 }
11810
11812 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11813 {
11814 float value_clamped = Math.Clamp(value, 0, 1);
11816 SetQuantity(result, destroy_config, destroy_forced);
11817 }
11818
11819
11822 {
11824 }
11825
11827 {
11829 }
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11841 {
11842 int slot = -1;
11843 GameInventory inventory = GetInventory();
11844 if (inventory)
11845 {
11846 InventoryLocation il = new InventoryLocation;
11849 }
11850
11852 }
11853
11855 {
11856 float quantity_max = 0;
11857
11859 {
11860 if (attSlotID != -1)
11861 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11862
11863 if (quantity_max <= 0)
11865 }
11866
11867 if (quantity_max <= 0)
11869
11870 return quantity_max;
11871 }
11872
11874 {
11876 }
11877
11879 {
11881 }
11882
11883
11885 {
11887 }
11888
11890 {
11892 }
11893
11895 {
11897 }
11898
11899
11901 {
11902
11903 float weightEx = GetWeightEx();
11904 float special = GetInventoryAndCargoWeight();
11905 return weightEx - special;
11906 }
11907
11908
11910 {
11912 }
11913
11915 {
11917 {
11918 #ifdef DEVELOPER
11919 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11920 {
11921 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11923 }
11924 #endif
11925
11926 return GetQuantity() * GetConfigWeightModified();
11927 }
11928 else if (HasEnergyManager())
11929 {
11930 #ifdef DEVELOPER
11931 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11932 {
11933 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11934 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11935 }
11936 #endif
11937 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11938 }
11939 else
11940 {
11941 #ifdef DEVELOPER
11942 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11943 {
11944 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11945 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11946 }
11947 #endif
11948 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11949 }
11950 }
11951
11954 {
11955 int item_count = 0;
11957
11958 GameInventory inventory = GetInventory();
11959 CargoBase cargo = inventory.
GetCargo();
11960 if (cargo != NULL)
11961 {
11963 }
11964
11966 for (int i = 0; i < nAttachments; ++i)
11967 {
11969 if (item)
11970 item_count += item.GetNumberOfItems();
11971 }
11972 return item_count;
11973 }
11974
11977 {
11978 float weight = 0;
11979 float wetness = 1;
11980 if (include_wetness)
11983 {
11984 weight = wetness * m_ConfigWeight;
11985 }
11987 {
11988 weight = 1;
11989 }
11990 return weight;
11991 }
11992
11993
11994
11996 {
11997 GameInventory inventory = GetInventory();
11998 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11999 {
12000 array<EntityAI> items = new array<EntityAI>;
12002 for (int i = 0; i < items.Count(); ++i)
12003 {
12005 if (item)
12006 {
12007 g_Game.ObjectDelete(item);
12008 }
12009 }
12010 }
12011 }
12012
12013
12014
12015
12017 {
12018 float energy = 0;
12019 if (HasEnergyManager())
12020 {
12021 energy = GetCompEM().GetEnergy();
12022 }
12023 return energy;
12024 }
12025
12026
12028 {
12029 super.OnEnergyConsumed();
12030
12032 }
12033
12035 {
12036 super.OnEnergyAdded();
12037
12039 }
12040
12041
12043 {
12044 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12045 {
12047 {
12048 float energy_0to1 = GetCompEM().GetEnergy0To1();
12050 }
12051 }
12052 }
12053
12054
12056 {
12057 return ConfigGetFloat("heatIsolation");
12058 }
12059
12061 {
12063 }
12064
12066 {
12067 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12068 if (
g_Game.ConfigIsExisting(paramPath))
12069 return g_Game.ConfigGetFloat(paramPath);
12070
12071 return 0.0;
12072 }
12073
12075 {
12076 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12077 if (
g_Game.ConfigIsExisting(paramPath))
12078 return g_Game.ConfigGetFloat(paramPath);
12079
12080 return 0.0;
12081 }
12082
12083 override void SetWet(
float value,
bool allow_client =
false)
12084 {
12085 if (!IsServerCheck(allow_client))
12086 return;
12087
12090
12092
12093 m_VarWet = Math.Clamp(value, min, max);
12094
12096 {
12099 }
12100 }
12101
12102 override void AddWet(
float value)
12103 {
12105 }
12106
12108 {
12110 }
12111
12113 {
12115 }
12116
12118 {
12120 }
12121
12123 {
12125 }
12126
12128 {
12130 }
12131
12132 override void OnWetChanged(
float newVal,
float oldVal)
12133 {
12136 if (newLevel != oldLevel)
12137 {
12139 }
12140 }
12141
12143 {
12144 SetWeightDirty();
12145 }
12146
12148 {
12149 return GetWetLevelInternal(
m_VarWet);
12150 }
12151
12152
12153
12155 {
12157 }
12158
12160 {
12162 }
12163
12165 {
12167 }
12168
12170 {
12172 }
12173
12174
12175
12177 {
12178 if (ConfigIsExisting("itemModelLength"))
12179 {
12180 return ConfigGetFloat("itemModelLength");
12181 }
12182 return 0;
12183 }
12184
12186 {
12187 if (ConfigIsExisting("itemAttachOffset"))
12188 {
12189 return ConfigGetFloat("itemAttachOffset");
12190 }
12191 return 0;
12192 }
12193
12194 override void SetCleanness(
int value,
bool allow_client =
false)
12195 {
12196 if (!IsServerCheck(allow_client))
12197 return;
12198
12200
12202
12205 }
12206
12208 {
12210 }
12211
12213 {
12214 return true;
12215 }
12216
12217
12218
12219
12221 {
12223 }
12224
12226 {
12228 }
12229
12230
12231
12232
12233 override void SetColor(
int r,
int g,
int b,
int a)
12234 {
12240 }
12242 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12243 {
12248 }
12249
12251 {
12253 }
12254
12257 {
12258 int r,g,b,a;
12260 r = r/255;
12261 g = g/255;
12262 b = b/255;
12263 a = a/255;
12264 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12265 }
12266
12267
12268
12269 override void SetLiquidType(
int value,
bool allow_client =
false)
12270 {
12271 if (!IsServerCheck(allow_client))
12272 return;
12273
12278 }
12279
12281 {
12282 return ConfigGetInt("varLiquidTypeInit");
12283 }
12284
12286 {
12288 }
12289
12291 {
12293 SetFrozen(false);
12294 }
12295
12298 {
12299 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12300 }
12301
12302
12305 {
12306 PlayerBase nplayer;
12307 if (PlayerBase.CastTo(nplayer, player))
12308 {
12310 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12311 }
12312 }
12313
12314
12317 {
12318 PlayerBase nplayer;
12319 if (PlayerBase.CastTo(nplayer,player))
12320 {
12321 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12322 }
12323
12324 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12325
12326 if (HasEnergyManager())
12327 {
12328 GetCompEM().UpdatePlugState();
12329 }
12330 }
12331
12332
12334 {
12335 super.OnPlacementStarted(player);
12336
12338 }
12339
12340 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12341 {
12343 {
12344 m_AdminLog.OnPlacementComplete(player,
this);
12345 }
12346
12347 super.OnPlacementComplete(player, position, orientation);
12348 }
12349
12350
12351
12352
12353
12355 {
12357 {
12358 return true;
12359 }
12360 else
12361 {
12362 return false;
12363 }
12364 }
12365
12366
12368 {
12370 {
12372 }
12373 }
12374
12375
12377 {
12379 }
12380
12382 {
12384 }
12385
12386 override void InsertAgent(
int agent,
float count = 1)
12387 {
12388 if (count < 1)
12389 return;
12390
12392 }
12393
12396 {
12398 }
12399
12400
12402 {
12404 }
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
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
12448 {
12450 return false;
12451 return true;
12452 }
12453
12455 {
12456
12458 }
12459
12460
12463 {
12464 super.CheckForRoofLimited(timeTresholdMS);
12465
12466 float time =
g_Game.GetTime();
12467 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12468 {
12469 m_PreviousRoofTestTime = time;
12470 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12471 }
12472 }
12473
12474
12476 {
12478 {
12479 return 0;
12480 }
12481
12482 if (GetInventory().GetAttachmentSlotsCount() != 0)
12483 {
12484 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12485 if (filter)
12486 return filter.GetProtectionLevel(type, false, system);
12487 else
12488 return 0;
12489 }
12490
12491 string subclassPath, entryName;
12492
12493 switch (type)
12494 {
12496 entryName = "biological";
12497 break;
12499 entryName = "chemical";
12500 break;
12501 default:
12502 entryName = "biological";
12503 break;
12504 }
12505
12506 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12507
12508 return g_Game.ConfigGetFloat(subclassPath + entryName);
12509 }
12510
12511
12512
12515 {
12516 if (!IsMagazine())
12518
12520 }
12521
12522
12523
12524
12525
12530 {
12531 return true;
12532 }
12533
12535 {
12537 }
12538
12539
12540
12541
12542
12544 {
12545 if (parent)
12546 {
12547 if (parent.IsInherited(DayZInfected))
12548 return true;
12549
12550 if (!parent.IsRuined())
12551 return true;
12552 }
12553
12554 return true;
12555 }
12556
12558 {
12559 if (!super.CanPutAsAttachment(parent))
12560 {
12561 return false;
12562 }
12563
12564 if (!IsRuined() && !parent.IsRuined())
12565 {
12566 return true;
12567 }
12568
12569 return false;
12570 }
12571
12573 {
12574
12575
12576
12577
12578 return super.CanReceiveItemIntoCargo(item);
12579 }
12580
12582 {
12583
12584
12585
12586
12587 GameInventory attachmentInv = attachment.GetInventory();
12589 {
12590 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12591 return false;
12592 }
12593
12594 InventoryLocation loc = new InventoryLocation();
12595 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12596 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12597 return false;
12598
12599 return super.CanReceiveAttachment(attachment, slotId);
12600 }
12601
12603 {
12604 if (!super.CanReleaseAttachment(attachment))
12605 return false;
12606
12607 return GetInventory().AreChildrenAccessible();
12608 }
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12631 {
12632 int id = muzzle_owner.GetMuzzleID();
12633 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12634
12635 if (WPOF_array)
12636 {
12637 for (int i = 0; i < WPOF_array.Count(); i++)
12638 {
12639 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12640
12641 if (WPOF)
12642 {
12643 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12644 }
12645 }
12646 }
12647 }
12648
12649
12651 {
12652 int id = muzzle_owner.GetMuzzleID();
12654
12655 if (WPOBE_array)
12656 {
12657 for (int i = 0; i < WPOBE_array.Count(); i++)
12658 {
12659 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12660
12661 if (WPOBE)
12662 {
12663 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12664 }
12665 }
12666 }
12667 }
12668
12669
12671 {
12672 int id = muzzle_owner.GetMuzzleID();
12673 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12674
12675 if (WPOOH_array)
12676 {
12677 for (int i = 0; i < WPOOH_array.Count(); i++)
12678 {
12679 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12680
12681 if (WPOOH)
12682 {
12683 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12684 }
12685 }
12686 }
12687 }
12688
12689
12691 {
12692 int id = muzzle_owner.GetMuzzleID();
12693 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12694
12695 if (WPOOH_array)
12696 {
12697 for (int i = 0; i < WPOOH_array.Count(); i++)
12698 {
12699 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12700
12701 if (WPOOH)
12702 {
12703 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12704 }
12705 }
12706 }
12707 }
12708
12709
12711 {
12712 int id = muzzle_owner.GetMuzzleID();
12713 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12714
12715 if (WPOOH_array)
12716 {
12717 for (int i = 0; i < WPOOH_array.Count(); i++)
12718 {
12719 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12720
12721 if (WPOOH)
12722 {
12723 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12724 }
12725 }
12726 }
12727 }
12728
12729
12730
12732 {
12734 {
12735 return true;
12736 }
12737
12738 return false;
12739 }
12740
12742 {
12744 {
12745 return true;
12746 }
12747
12748 return false;
12749 }
12750
12752 {
12754 {
12755 return true;
12756 }
12757
12758 return false;
12759 }
12760
12762 {
12763 return false;
12764 }
12765
12768 {
12769 return UATimeSpent.DEFAULT_DEPLOY;
12770 }
12771
12772
12773
12774
12776 {
12778 SetSynchDirty();
12779 }
12780
12782 {
12784 }
12785
12786
12788 {
12789 return false;
12790 }
12791
12794 {
12795 string att_type = "None";
12796
12797 if (ConfigIsExisting("soundAttType"))
12798 {
12799 att_type = ConfigGetString("soundAttType");
12800 }
12801
12803 }
12804
12806 {
12808 }
12809
12810
12811
12812
12813
12819
12821 {
12824
12826 }
12827
12828
12830 {
12832 return;
12833
12835
12838
12841
12842 SoundParameters params = new SoundParameters();
12846 }
12847
12848
12850 {
12852 {
12855
12856 SetSynchDirty();
12857
12860 }
12861 }
12862
12864 {
12866 }
12867
12868
12870 {
12872 return;
12873
12875 SetSynchDirty();
12876
12879 }
12880
12882 {
12885 }
12886
12888 {
12890 }
12891
12892 void OnApply(PlayerBase player);
12893
12895 {
12896 return 1.0;
12897 };
12898
12900 {
12902 }
12903
12905 {
12907 }
12908
12910
12912 {
12913 SetDynamicPhysicsLifeTime(0.01);
12915 }
12916
12918 {
12919 array<string> zone_names = new array<string>;
12920 GetDamageZones(zone_names);
12921 for (int i = 0; i < zone_names.Count(); i++)
12922 {
12923 SetHealthMax(zone_names.Get(i),"Health");
12924 }
12925 SetHealthMax("","Health");
12926 }
12927
12930 {
12931 float global_health = GetHealth01("","Health");
12932 array<string> zones = new array<string>;
12933 GetDamageZones(zones);
12934
12935 for (int i = 0; i < zones.Count(); i++)
12936 {
12937 SetHealth01(zones.Get(i),"Health",global_health);
12938 }
12939 }
12940
12943 {
12944 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12945 }
12946
12948 {
12949 if (!hasRootAsPlayer)
12950 {
12951 if (refParentIB)
12952 {
12953
12954 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12955 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12956
12957 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12958 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12959
12962 }
12963 else
12964 {
12965
12968 }
12969 }
12970 }
12971
12973 {
12975 {
12976 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12977 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12978 {
12979 float heatPermCoef = 1.0;
12981 while (ent)
12982 {
12983 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12984 ent = ent.GetHierarchyParent();
12985 }
12986
12987 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12988 }
12989 }
12990 }
12991
12993 {
12994
12995 EntityAI parent = GetHierarchyParent();
12996 if (!parent)
12997 {
12998 hasParent = false;
12999 hasRootAsPlayer = false;
13000 }
13001 else
13002 {
13003 hasParent = true;
13004 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13005 refParentIB =
ItemBase.Cast(parent);
13006 }
13007 }
13008
13009 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13010 {
13011
13012 }
13013
13015 {
13016
13017 return false;
13018 }
13019
13021 {
13022
13023
13024 return false;
13025 }
13026
13028 {
13029
13030 return false;
13031 }
13032
13035 {
13036 return !GetIsFrozen() &&
IsOpen();
13037 }
13038
13040 {
13041 bool hasParent = false, hasRootAsPlayer = false;
13043
13044 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13045 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13046
13047 if (wwtu || foodDecay)
13048 {
13052
13053 if (processWetness || processTemperature || processDecay)
13054 {
13056
13057 if (processWetness)
13058 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13059
13060 if (processTemperature)
13062
13063 if (processDecay)
13064 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13065 }
13066 }
13067 }
13068
13071 {
13073 }
13074
13076 {
13079
13080 return super.GetTemperatureFreezeThreshold();
13081 }
13082
13084 {
13087
13088 return super.GetTemperatureThawThreshold();
13089 }
13090
13092 {
13095
13096 return super.GetItemOverheatThreshold();
13097 }
13098
13100 {
13102 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13103
13104 return super.GetTemperatureFreezeTime();
13105 }
13106
13108 {
13110 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13111
13112 return super.GetTemperatureThawTime();
13113 }
13114
13119
13121 {
13122 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13123 }
13124
13126 {
13127 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13128 }
13129
13132 {
13134 }
13135
13137 {
13139 }
13140
13142 {
13144 }
13145
13148 {
13149 return null;
13150 }
13151
13154 {
13155 return false;
13156 }
13157
13159 {
13161 {
13164 if (!trg)
13165 {
13167 explosive = this;
13168 }
13169
13170 explosive.PairRemote(trg);
13172
13173 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13174 trg.SetPersistentPairID(persistentID);
13175 explosive.SetPersistentPairID(persistentID);
13176
13177 return true;
13178 }
13179 return false;
13180 }
13181
13184 {
13185 float ret = 1.0;
13188 ret *= GetHealth01();
13189
13190 return ret;
13191 }
13192
13193 #ifdef DEVELOPER
13194 override void SetDebugItem()
13195 {
13196 super.SetDebugItem();
13197 _itemBase = this;
13198 }
13199
13201 {
13202 string text = super.GetDebugText();
13203
13205 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13206
13207 return text;
13208 }
13209 #endif
13210
13212 {
13213 return true;
13214 }
13215
13217
13219
13221 {
13224 }
13225
13226
13234
13250
13251 [
Obsolete(
"Use ItemSoundHandler instead")]
13254 {
13255 if (!
g_Game.IsDedicatedServer())
13256 {
13257 if (ConfigIsExisting("attachSoundSet"))
13258 {
13259 string cfg_path = "";
13260 string soundset = "";
13261 string type_name =
GetType();
13262
13265 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13266 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13267
13268 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13269 {
13270 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13271 {
13272 if (cfg_slot_array[i] == slot_type)
13273 {
13274 soundset = cfg_soundset_array[i];
13275 break;
13276 }
13277 }
13278 }
13279
13280 if (soundset != "")
13281 {
13282 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13284 }
13285 }
13286 }
13287 }
13288
13290}
13291
13293{
13295 if (entity)
13296 {
13297 bool is_item = entity.IsInherited(
ItemBase);
13298 if (is_item && full_quantity)
13299 {
13302 }
13303 }
13304 else
13305 {
13307 return NULL;
13308 }
13309 return entity;
13310}
13311
13313{
13314 if (item)
13315 {
13316 if (health > 0)
13317 item.SetHealth("", "", health);
13318
13319 if (item.CanHaveTemperature())
13320 {
13322 if (item.CanFreeze())
13323 item.SetFrozen(false);
13324 }
13325
13326 if (item.HasEnergyManager())
13327 {
13328 if (quantity >= 0)
13329 {
13330 item.GetCompEM().SetEnergy0To1(quantity);
13331 }
13332 else
13333 {
13335 }
13336 }
13337 else if (item.IsMagazine())
13338 {
13339 Magazine mag = Magazine.Cast(item);
13340 if (quantity >= 0)
13341 {
13342 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13343 }
13344 else
13345 {
13347 }
13348
13349 }
13350 else
13351 {
13352 if (quantity >= 0)
13353 {
13354 item.SetQuantityNormalized(quantity, false);
13355 }
13356 else
13357 {
13359 }
13360
13361 }
13362 }
13363}
13364
13365#ifdef DEVELOPER
13367#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.