8160{
8162 {
8163 return true;
8164 }
8165};
8166
8168{
8169
8170};
8171
8172
8173
8175{
8179
8181
8184
8185
8186
8187
8188
8197
8203
8208
8213
8234 protected bool m_IsResultOfSplit
8235
8237
8242
8243
8244
8246
8250
8251
8252
8254
8257
8258
8259
8265
8266
8274
8277
8278
8280
8281
8283
8284
8289
8290
8295
8297
8298
8300
8301
8303 {
8308
8309 if (!
g_Game.IsDedicatedServer())
8310 {
8312 {
8314
8316 {
8318 }
8319 }
8320
8323 }
8324
8325 m_OldLocation = null;
8326
8328 {
8330 }
8331
8332 if (ConfigIsExisting("headSelectionsToHide"))
8333 {
8336 }
8337
8339 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8340 {
8342 }
8343
8345
8346 m_IsResultOfSplit = false;
8347
8349 }
8350
8352 {
8353 super.InitItemVariables();
8354
8360 m_Count = ConfigGetInt(
"count");
8361
8364
8369
8372
8377
8389
8393
8394
8397 if (ConfigIsExisting("canBeSplit"))
8398 {
8401 }
8402
8404 if (ConfigIsExisting("itemBehaviour"))
8406
8407
8410 RegisterNetSyncVariableInt("m_VarLiquidType");
8411 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8412
8413 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8414 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8415 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8416
8417 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8418 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8419 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8420 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8421
8422 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8423 RegisterNetSyncVariableBool("m_IsTakeable");
8424 RegisterNetSyncVariableBool("m_IsHologram");
8425
8428 {
8431 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8432 }
8433
8435
8437 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8439
8441 }
8442
8444 {
8446 }
8447
8449 {
8452 {
8457 }
8458 }
8459
8460 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8461 {
8463 {
8466 }
8467
8469 }
8470
8472 {
8478 }
8479
8481
8483 {
8485
8486 if (!action)
8487 {
8488 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8489 return;
8490 }
8491
8493 if (!ai)
8494 {
8496 return;
8497 }
8498
8500 if (!action_array)
8501 {
8502 action_array = new array<ActionBase_Basic>;
8504 }
8505 if (LogManager.IsActionLogEnable())
8506 {
8507 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8508 }
8509
8510 if (action_array.Find(action) != -1)
8511 {
8512 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8513 }
8514 else
8515 {
8516 action_array.Insert(action);
8517 }
8518 }
8519
8521 {
8522 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8523 ActionBase action = player.GetActionManager().GetAction(actionName);
8526
8527 if (action_array)
8528 {
8529 action_array.RemoveItem(action);
8530 }
8531 }
8532
8533
8534
8536 {
8537 ActionOverrideData overrideData = new ActionOverrideData();
8541
8543 if (!actionMap)
8544 {
8547 }
8548
8549 actionMap.Insert(this.
Type(), overrideData);
8550
8551 }
8552
8554
8556
8557
8559 {
8562
8565
8566 string config_to_search = "CfgVehicles";
8567 string muzzle_owner_config;
8568
8570 {
8571 if (IsInherited(Weapon))
8572 config_to_search = "CfgWeapons";
8573
8574 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8575
8576 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8577
8578 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8579
8580 if (config_OnFire_subclass_count > 0)
8581 {
8582 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8583
8584 for (int i = 0; i < config_OnFire_subclass_count; i++)
8585 {
8586 string particle_class = "";
8587 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8588 string config_OnFire_entry = config_OnFire_class + particle_class;
8589 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8590 WPOF_array.Insert(WPOF);
8591 }
8592
8593
8595 }
8596 }
8597
8599 {
8600 config_to_search = "CfgWeapons";
8601 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8602
8603 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8604
8605 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8606
8607 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8608 {
8609 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8610
8611 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8612 {
8613 string particle_class2 = "";
8614 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8615 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8616 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8617 WPOBE_array.Insert(WPOBE);
8618 }
8619
8620
8622 }
8623 }
8624 }
8625
8626
8628 {
8631
8633 {
8634 string config_to_search = "CfgVehicles";
8635
8636 if (IsInherited(Weapon))
8637 config_to_search = "CfgWeapons";
8638
8639 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8640 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8641
8642 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8643 {
8644
8646
8648 {
8650 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8652 return;
8653 }
8654
8657
8658
8659
8660 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8661 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8662
8663 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8664 {
8665 string particle_class = "";
8666 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8667 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8668 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8669
8670 if (entry_type == CT_CLASS)
8671 {
8672 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8673 WPOOH_array.Insert(WPOF);
8674 }
8675 }
8676
8677
8679 }
8680 }
8681 }
8682
8684 {
8686 }
8687
8689 {
8691 {
8693
8696
8699
8700 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8701 }
8702 }
8703
8705 {
8707 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8708
8710 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8711
8713 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8714
8716 {
8718 }
8719 }
8720
8722 {
8724 }
8725
8727 {
8730 else
8732
8734 {
8737 }
8738 else
8739 {
8742
8745 }
8746
8748 }
8749
8751 {
8753 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8754 }
8755
8757 {
8759 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8761 }
8762
8764 {
8766 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8767 }
8768
8770 {
8773
8774 OverheatingParticle OP = new OverheatingParticle();
8779
8781 }
8782
8784 {
8787
8788 return -1;
8789 }
8790
8792 {
8794 {
8797
8798 for (int i = count; i > 0; --i)
8799 {
8800 int id = i - 1;
8803
8806
8807 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8808 {
8809 if (p)
8810 {
8813 }
8814 }
8815 }
8816 }
8817 }
8818
8820 {
8822 {
8824 {
8825 int id = i - 1;
8827
8828 if (OP)
8829 {
8831
8832 if (p)
8833 {
8835 }
8836
8837 delete OP;
8838 }
8839 }
8840
8843 }
8844 }
8845
8848 {
8849 return 0.0;
8850 }
8851
8852
8854 {
8855 return 250;
8856 }
8857
8859 {
8860 return 0;
8861 }
8862
8865 {
8867 return true;
8868
8869 return false;
8870 }
8871
8874 {
8877
8879 {
8881 }
8882 else
8883 {
8884
8886 }
8887
8889 }
8890
8897 {
8898 return -1;
8899 }
8900
8901
8902
8903
8905 {
8907 {
8908 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8909 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8910
8911 if (r_index >= 0)
8912 {
8913 InventoryLocation r_il = new InventoryLocation;
8914 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8915
8916 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8919 {
8920 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8921 }
8923 {
8924 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8925 }
8926
8927 }
8928
8929 player.GetHumanInventory().ClearUserReservedLocation(this);
8930 }
8931
8934 }
8935
8936
8937
8938
8940 {
8941 return ItemBase.m_DebugActionsMask;
8942 }
8943
8945 {
8946 return ItemBase.m_DebugActionsMask & mask;
8947 }
8948
8950 {
8951 ItemBase.m_DebugActionsMask = mask;
8952 }
8953
8955 {
8956 ItemBase.m_DebugActionsMask |= mask;
8957 }
8958
8960 {
8961 ItemBase.m_DebugActionsMask &= ~mask;
8962 }
8963
8965 {
8967 {
8969 }
8970 else
8971 {
8973 }
8974 }
8975
8976
8978 {
8979 if (GetEconomyProfile())
8980 {
8981 float q_max = GetEconomyProfile().GetQuantityMax();
8982 if (q_max > 0)
8983 {
8984 float q_min = GetEconomyProfile().GetQuantityMin();
8985 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8986
8988 {
8989 ComponentEnergyManager comp = GetCompEM();
8991 {
8993 }
8994 }
8996 {
8998
8999 }
9000
9001 }
9002 }
9003 }
9004
9007 {
9008 EntityAI parent = GetHierarchyParent();
9009
9010 if (parent)
9011 {
9012 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9013 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9014 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9015 }
9016 }
9017
9020 {
9021 EntityAI parent = GetHierarchyParent();
9022
9023 if (parent)
9024 {
9025 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9026 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9027 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9028 }
9029 }
9030
9032 {
9033
9034
9035
9036
9038
9040 {
9041 if (ScriptInputUserData.CanStoreInputUserData())
9042 {
9043 ScriptInputUserData ctx = new ScriptInputUserData;
9049 ctx.
Write(use_stack_max);
9052
9054 {
9055 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9056 }
9057 }
9058 }
9059 else if (!
g_Game.IsMultiplayer())
9060 {
9062 }
9063 }
9064
9066 {
9068 }
9069
9071 {
9073 }
9074
9076 {
9078 }
9079
9081 {
9082
9083 return false;
9084 }
9085
9087 {
9088 return false;
9089 }
9090
9094 {
9095 return false;
9096 }
9097
9099 {
9100 return "";
9101 }
9102
9104
9106 {
9107 return false;
9108 }
9109
9111 {
9112 return true;
9113 }
9114
9115
9116
9118 {
9119 return true;
9120 }
9121
9123 {
9124 return true;
9125 }
9126
9128 {
9129 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9131 }
9132
9134 {
9136 }
9137
9139 {
9141 if (!is_being_placed)
9143 SetSynchDirty();
9144 }
9145
9146
9148
9150 {
9152 }
9153
9155 {
9157 }
9158
9160 {
9161 return 1;
9162 }
9163
9165 {
9166 return false;
9167 }
9168
9170 {
9172 SetSynchDirty();
9173 }
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9210 {
9211 super.OnMovedInsideCargo(container);
9212
9213 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9214 }
9215
9216 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9217 {
9218 super.EEItemLocationChanged(oldLoc, newLoc);
9219
9220 PlayerBase newPlayer = null;
9221 PlayerBase oldPlayer = null;
9222
9223 if (newLoc.GetParent())
9224 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9225
9226 if (oldLoc.GetParent())
9227 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9228
9230 {
9231 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9232
9233 if (rIndex >= 0)
9234 {
9235 InventoryLocation rIl = new InventoryLocation;
9236 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9237
9238 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9241 {
9242 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9243 }
9245 {
9247 }
9248
9249 }
9250 }
9251
9253 {
9254 if (newPlayer)
9255 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9256
9257 if (newPlayer == oldPlayer)
9258 {
9259 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9260 {
9262 {
9263 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9264 {
9265 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9266 }
9267 }
9268 else
9269 {
9270 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9271 }
9272 }
9273
9274 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9275 {
9276 int type = oldLoc.GetType();
9278 {
9279 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9280 }
9282 {
9283 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9284 }
9285 }
9286 if (!m_OldLocation)
9287 {
9288 m_OldLocation = new InventoryLocation;
9289 }
9290 m_OldLocation.Copy(oldLoc);
9291 }
9292 else
9293 {
9294 if (m_OldLocation)
9295 {
9296 m_OldLocation.Reset();
9297 }
9298 }
9299
9300 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9301 }
9302 else
9303 {
9304 if (newPlayer)
9305 {
9306 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9307 if (resIndex >= 0)
9308 {
9309 InventoryLocation il = new InventoryLocation;
9310 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9312 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9315 {
9316 il.
GetParent().GetOnReleaseLock().Invoke(it);
9317 }
9319 {
9321 }
9322
9323 }
9324 }
9326 {
9327
9329 }
9330
9331 if (m_OldLocation)
9332 {
9333 m_OldLocation.Reset();
9334 }
9335 }
9336
9338 {
9339 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9340 }
9341
9343 {
9344 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9345 }
9346 }
9347
9348 override void EOnContact(IEntity other, Contact extra)
9349 {
9351 {
9352 int liquidType = -1;
9354 if (impactSpeed > 0.0)
9355 {
9357 #ifndef SERVER
9359 #else
9361 SetSynchDirty();
9362 #endif
9364 }
9365 }
9366
9367 #ifdef SERVER
9368 if (GetCompEM() && GetCompEM().IsPlugged())
9369 {
9370 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9371 GetCompEM().UnplugThis();
9372 }
9373 #endif
9374 }
9375
9377
9379 {
9381 }
9382
9384 {
9385
9386 }
9387
9389 {
9390 super.OnItemLocationChanged(old_owner, new_owner);
9391
9392 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9393 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9394
9395 if (!relatedPlayer && playerNew)
9396 relatedPlayer = playerNew;
9397
9398 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9399 {
9401 if (actionMgr)
9402 {
9403 ActionBase currentAction = actionMgr.GetRunningAction();
9404 if (currentAction)
9406 }
9407 }
9408
9409 Man ownerPlayerOld = null;
9410 Man ownerPlayerNew = null;
9411
9412 if (old_owner)
9413 {
9414 if (old_owner.
IsMan())
9415 {
9416 ownerPlayerOld = Man.Cast(old_owner);
9417 }
9418 else
9419 {
9420 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9421 }
9422 }
9423 else
9424 {
9426 {
9428
9429 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9430 {
9431 GetCompEM().UnplugThis();
9432 }
9433 }
9434 }
9435
9436 if (new_owner)
9437 {
9438 if (new_owner.
IsMan())
9439 {
9440 ownerPlayerNew = Man.Cast(new_owner);
9441 }
9442 else
9443 {
9444 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9445 }
9446 }
9447
9448 if (ownerPlayerOld != ownerPlayerNew)
9449 {
9450 if (ownerPlayerOld)
9451 {
9452 array<EntityAI> subItemsExit = new array<EntityAI>;
9454 for (int i = 0; i < subItemsExit.Count(); i++)
9455 {
9458 }
9459 }
9460
9461 if (ownerPlayerNew)
9462 {
9463 array<EntityAI> subItemsEnter = new array<EntityAI>;
9465 for (int j = 0; j < subItemsEnter.Count(); j++)
9466 {
9469 }
9470 }
9471 }
9472 else if (ownerPlayerNew != null)
9473 {
9474 PlayerBase nplayer;
9475 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9476 {
9477 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9479 for (int k = 0; k < subItemsUpdate.Count(); k++)
9480 {
9482 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9483 }
9484 }
9485 }
9486
9487 if (old_owner)
9488 old_owner.OnChildItemRemoved(this);
9489 if (new_owner)
9490 new_owner.OnChildItemReceived(this);
9491 }
9492
9493
9495 {
9496 super.EEDelete(parent);
9497 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9498 if (player)
9499 {
9501
9502 if (player.IsAlive())
9503 {
9504 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9505 if (r_index >= 0)
9506 {
9507 InventoryLocation r_il = new InventoryLocation;
9508 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9509
9510 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9513 {
9514 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9515 }
9517 {
9518 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9519 }
9520
9521 }
9522
9523 player.RemoveQuickBarEntityShortcut(this);
9524 }
9525 }
9526 }
9527
9529 {
9530 super.EEKilled(killer);
9531
9534 {
9535 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9536 {
9537 if (IsMagazine())
9538 {
9539 if (Magazine.Cast(this).GetAmmoCount() > 0)
9540 {
9542 }
9543 }
9544 else
9545 {
9547 }
9548 }
9549 }
9550 }
9551
9553 {
9554 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9555
9556 super.OnWasAttached(parent, slot_id);
9557
9560
9563 }
9564
9566 {
9567 super.OnWasDetached(parent, slot_id);
9568
9571
9574 }
9575
9577 {
9578 int idx;
9581
9582 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9583 if (inventory_slots.Count() < 1)
9584 {
9585 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9586 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9587 }
9588 else
9589 {
9590 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9591 }
9592
9593 idx = inventory_slots.Find(slot);
9594 if (idx < 0)
9595 return "";
9596
9597 return attach_types.Get(idx);
9598 }
9599
9601 {
9602 int idx = -1;
9603 string slot;
9604
9607
9608 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9609 if (inventory_slots.Count() < 1)
9610 {
9611 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9612 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9613 }
9614 else
9615 {
9616 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9617 if (detach_types.Count() < 1)
9618 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9619 }
9620
9621 for (int i = 0; i < inventory_slots.Count(); i++)
9622 {
9623 slot = inventory_slots.Get(i);
9624 }
9625
9626 if (slot != "")
9627 {
9628 if (detach_types.Count() == 1)
9629 idx = 0;
9630 else
9631 idx = inventory_slots.Find(slot);
9632 }
9633 if (idx < 0)
9634 return "";
9635
9636 return detach_types.Get(idx);
9637 }
9638
9640 {
9641
9643
9644
9645 float min_time = 1;
9646 float max_time = 3;
9647 float delay = Math.RandomFloat(min_time, max_time);
9648
9649 explode_timer.Run(delay, this, "DoAmmoExplosion");
9650 }
9651
9653 {
9654 Magazine magazine = Magazine.Cast(this);
9655 int pop_sounds_count = 6;
9656 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9657
9658
9659 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9660 string sound_name = pop_sounds[ sound_idx ];
9661 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9662
9663
9664 magazine.ServerAddAmmoCount(-1);
9665
9666
9667 float min_temp_to_explode = 100;
9668
9669 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9670 {
9672 }
9673 }
9674
9675
9676 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9677 {
9678 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9679
9680 const int CHANCE_DAMAGE_CARGO = 4;
9681 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9682 const int CHANCE_DAMAGE_NOTHING = 2;
9683
9685 {
9686 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9687 int chances;
9688 int rnd;
9689
9690 if (GetInventory().GetCargo())
9691 {
9692 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9693 rnd = Math.RandomInt(0,chances);
9694
9695 if (rnd < CHANCE_DAMAGE_CARGO)
9696 {
9698 }
9699 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9700 {
9702 }
9703 }
9704 else
9705 {
9706 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9707 rnd = Math.RandomInt(0,chances);
9708
9709 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9710 {
9712 }
9713 }
9714 }
9715 }
9716
9718 {
9719 CargoBase cargo = GetInventory().GetCargo();
9720 if (cargo)
9721 {
9723 if (item_count > 0)
9724 {
9725 int random_pick = Math.RandomInt(0, item_count);
9727 if (!item.IsExplosive())
9728 {
9729 item.AddHealth("","",damage);
9730 return true;
9731 }
9732 }
9733 }
9734 return false;
9735 }
9736
9738 {
9739 GameInventory inventory = GetInventory();
9741 if (attachment_count > 0)
9742 {
9743 int random_pick = Math.RandomInt(0, attachment_count);
9745 if (!attachment.IsExplosive())
9746 {
9747 attachment.AddHealth("","",damage);
9748 return true;
9749 }
9750 }
9751 return false;
9752 }
9753
9755 {
9757 }
9758
9760 {
9762 return GetInventory().CanRemoveEntity();
9763
9764 return false;
9765 }
9766
9768 {
9769
9771 return false;
9772
9773
9775 return false;
9776
9777
9778
9780 if (delta == 0)
9781 return false;
9782
9783
9784 return true;
9785 }
9786
9788 {
9790 {
9791 if (ScriptInputUserData.CanStoreInputUserData())
9792 {
9793 ScriptInputUserData ctx = new ScriptInputUserData;
9798 ctx.
Write(destination_entity);
9802 }
9803 }
9804 else if (!
g_Game.IsMultiplayer())
9805 {
9807 }
9808 }
9809
9811 {
9812 float split_quantity_new;
9816 InventoryLocation loc = new InventoryLocation;
9817
9818 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9819 {
9821 split_quantity_new = stack_max;
9822 else
9824
9826 {
9827 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9828 if (new_item)
9829 {
9830 new_item.SetResultOfSplit(true);
9831 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9833 new_item.
SetQuantity(split_quantity_new,
false,
true);
9834 }
9835 }
9836 }
9837 else if (destination_entity && slot_id == -1)
9838 {
9839 if (quantity > stack_max)
9840 split_quantity_new = stack_max;
9841 else
9842 split_quantity_new = quantity;
9843
9845 {
9846 GameInventory destinationInventory = destination_entity.GetInventory();
9848 {
9851 }
9852
9853 if (new_item)
9854 {
9855 new_item.SetResultOfSplit(true);
9856 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9858 new_item.
SetQuantity(split_quantity_new,
false,
true);
9859 }
9860 }
9861 }
9862 else
9863 {
9864 if (stack_max != 0)
9865 {
9867 {
9869 }
9870
9871 if (split_quantity_new == 0)
9872 {
9873 if (!
g_Game.IsMultiplayer())
9874 player.PhysicalPredictiveDropItem(this);
9875 else
9876 player.ServerDropEntity(this);
9877 return;
9878 }
9879
9881 {
9883
9884 if (new_item)
9885 {
9886 new_item.SetResultOfSplit(true);
9887 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9890 new_item.PlaceOnSurface();
9891 }
9892 }
9893 }
9894 }
9895 }
9896
9898 {
9899 float split_quantity_new;
9903 InventoryLocation loc = new InventoryLocation;
9904
9905 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9906 {
9908 split_quantity_new = stack_max;
9909 else
9911
9913 {
9914 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9915 if (new_item)
9916 {
9917 new_item.SetResultOfSplit(true);
9918 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9920 new_item.
SetQuantity(split_quantity_new,
false,
true);
9921 }
9922 }
9923 }
9924 else if (destination_entity && slot_id == -1)
9925 {
9926 if (quantity > stack_max)
9927 split_quantity_new = stack_max;
9928 else
9929 split_quantity_new = quantity;
9930
9932 {
9933 GameInventory destinationInventory = destination_entity.GetInventory();
9935 {
9938 }
9939
9940 if (new_item)
9941 {
9942 new_item.SetResultOfSplit(true);
9943 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9945 new_item.
SetQuantity(split_quantity_new,
false,
true);
9946 }
9947 }
9948 }
9949 else
9950 {
9951 if (stack_max != 0)
9952 {
9954 {
9956 }
9957
9959 {
9961
9962 if (new_item)
9963 {
9964 new_item.SetResultOfSplit(true);
9965 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9968 new_item.PlaceOnSurface();
9969 }
9970 }
9971 }
9972 }
9973 }
9974
9976 {
9978 {
9979 if (ScriptInputUserData.CanStoreInputUserData())
9980 {
9981 ScriptInputUserData ctx = new ScriptInputUserData;
9986 dst.WriteToContext(ctx);
9988 }
9989 }
9990 else if (!
g_Game.IsMultiplayer())
9991 {
9993 }
9994 }
9995
9997 {
9999 {
10000 if (ScriptInputUserData.CanStoreInputUserData())
10001 {
10002 ScriptInputUserData ctx = new ScriptInputUserData;
10007 ctx.
Write(destination_entity);
10013 }
10014 }
10015 else if (!
g_Game.IsMultiplayer())
10016 {
10018 }
10019 }
10020
10022 {
10024 }
10025
10027 {
10029 float split_quantity_new;
10031 if (dst.IsValid())
10032 {
10033 int slot_id = dst.GetSlot();
10035
10036 if (quantity > stack_max)
10037 split_quantity_new = stack_max;
10038 else
10039 split_quantity_new = quantity;
10040
10042 {
10044
10045 if (new_item)
10046 {
10047 new_item.SetResultOfSplit(true);
10048 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10050 new_item.
SetQuantity(split_quantity_new,
false,
true);
10051 }
10052
10053 return new_item;
10054 }
10055 }
10056
10057 return null;
10058 }
10059
10061 {
10063 float split_quantity_new;
10065 if (destination_entity)
10066 {
10068 if (quantity > stackable)
10069 split_quantity_new = stackable;
10070 else
10071 split_quantity_new = quantity;
10072
10074 {
10075 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10076 if (new_item)
10077 {
10078 new_item.SetResultOfSplit(true);
10079 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10081 new_item.
SetQuantity(split_quantity_new,
false,
true);
10082 }
10083 }
10084 }
10085 }
10086
10088 {
10090 {
10091 if (ScriptInputUserData.CanStoreInputUserData())
10092 {
10093 ScriptInputUserData ctx = new ScriptInputUserData;
10098 ItemBase destination_entity =
this;
10099 ctx.
Write(destination_entity);
10103 }
10104 }
10105 else if (!
g_Game.IsMultiplayer())
10106 {
10108 }
10109 }
10110
10112 {
10114 float split_quantity_new;
10116 if (player)
10117 {
10119 if (quantity > stackable)
10120 split_quantity_new = stackable;
10121 else
10122 split_quantity_new = quantity;
10123
10125 {
10126 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10127 new_item =
ItemBase.Cast(in_hands);
10128 if (new_item)
10129 {
10130 new_item.SetResultOfSplit(true);
10131 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10133 new_item.SetQuantity(split_quantity_new, false, true);
10134 }
10135 }
10136 }
10137 }
10138
10140 {
10142 float split_quantity_new = Math.Floor(quantity * 0.5);
10143
10145 return;
10146
10148
10149 if (new_item)
10150 {
10151 if (new_item.GetQuantityMax() < split_quantity_new)
10152 {
10153 split_quantity_new = new_item.GetQuantityMax();
10154 }
10155
10156 new_item.SetResultOfSplit(true);
10157 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10158
10160 {
10163 }
10164 else
10165 {
10167 new_item.
SetQuantity(split_quantity_new,
false,
true);
10168 }
10169 }
10170 }
10171
10173 {
10175 float split_quantity_new = Math.Floor(quantity / 2);
10176
10178 return;
10179
10180 InventoryLocation invloc = new InventoryLocation;
10182
10184 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10185
10186 if (new_item)
10187 {
10188 if (new_item.GetQuantityMax() < split_quantity_new)
10189 {
10190 split_quantity_new = new_item.GetQuantityMax();
10191 }
10193 {
10196 }
10197 else if (split_quantity_new > 1)
10198 {
10200 new_item.
SetQuantity(split_quantity_new,
false,
true);
10201 }
10202 }
10203 }
10204
10207 {
10208 SetWeightDirty();
10210
10211 if (parent)
10212 parent.OnAttachmentQuantityChangedEx(this, delta);
10213
10215 {
10217 {
10219 }
10221 {
10222 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10224 }
10225 }
10226 }
10227
10230 {
10231
10232 }
10233
10236 {
10238 }
10239
10241 {
10242 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10243
10245 {
10246 if (newLevel == GameConstants.STATE_RUINED)
10247 {
10249 EntityAI parent = GetHierarchyParent();
10250 if (parent && parent.IsFireplace())
10251 {
10252 CargoBase cargo = GetInventory().GetCargo();
10253 if (cargo)
10254 {
10256 {
10258 }
10259 }
10260 }
10261 }
10262
10264 {
10265
10267 return;
10268 }
10269
10270 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10271 {
10273 }
10274 }
10275 }
10276
10277
10279 {
10280 super.OnRightClick();
10281
10283 {
10285 {
10286 if (ScriptInputUserData.CanStoreInputUserData())
10287 {
10288 EntityAI root = GetHierarchyRoot();
10289 Man playerOwner = GetHierarchyRootPlayer();
10290 InventoryLocation dst = new InventoryLocation;
10291
10292
10293 if (!playerOwner && root && root == this)
10294 {
10296 }
10297 else
10298 {
10299
10300 GetInventory().GetCurrentInventoryLocation(dst);
10302 {
10303 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10305 {
10307 }
10308 else
10309 {
10311
10312
10313 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10314 {
10316 }
10317 else
10318 {
10319 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10320 }
10321 }
10322 }
10323 }
10324
10325 ScriptInputUserData ctx = new ScriptInputUserData;
10333 }
10334 }
10335 else if (!
g_Game.IsMultiplayer())
10336 {
10338 }
10339 }
10340 }
10341
10343 {
10344 if (root)
10345 {
10346 vector m4[4];
10347 root.GetTransform(m4);
10348 dst.SetGround(this, m4);
10349 }
10350 else
10351 {
10352 GetInventory().GetCurrentInventoryLocation(dst);
10353 }
10354 }
10355
10356 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10357 {
10358
10359 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10360 return false;
10361
10362 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10363 return false;
10364
10365
10367 return false;
10368
10369
10370 Magazine mag = Magazine.Cast(this);
10371 if (mag)
10372 {
10373 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10374 return false;
10375
10376 if (stack_max_limit)
10377 {
10378 Magazine other_mag = Magazine.Cast(other_item);
10379 if (other_item)
10380 {
10381 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10382 return false;
10383 }
10384
10385 }
10386 }
10387 else
10388 {
10389
10391 return false;
10392
10394 return false;
10395 }
10396
10397 PlayerBase player = null;
10398 if (CastTo(player, GetHierarchyRootPlayer()))
10399 {
10400 if (player.GetInventory().HasAttachment(this))
10401 return false;
10402
10403 if (player.IsItemsToDelete())
10404 return false;
10405 }
10406
10407 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10408 return false;
10409
10410 int slotID;
10412 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10413 return false;
10414
10415 return true;
10416 }
10417
10419 {
10421 }
10422
10424 {
10425 return m_IsResultOfSplit;
10426 }
10427
10429 {
10430 m_IsResultOfSplit = value;
10431 }
10432
10434 {
10436 }
10437
10439 {
10440 float other_item_quantity = other_item.GetQuantity();
10441 float this_free_space;
10442
10444
10446
10447 if (other_item_quantity > this_free_space)
10448 {
10449 return this_free_space;
10450 }
10451 else
10452 {
10453 return other_item_quantity;
10454 }
10455 }
10456
10458 {
10460 }
10461
10463 {
10465 return;
10466
10467 if (!IsMagazine() && other_item)
10468 {
10470 if (quantity_used != 0)
10471 {
10472 float hp1 = GetHealth01("","");
10473 float hp2 = other_item.GetHealth01("","");
10474 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10475 hpResult = hpResult / (
GetQuantity() + quantity_used);
10476
10477 hpResult *= GetMaxHealth();
10478 Math.Round(hpResult);
10479 SetHealth("", "Health", hpResult);
10480
10482 other_item.AddQuantity(-quantity_used);
10483 }
10484 }
10486 }
10487
10489 {
10490 #ifdef SERVER
10491 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10492 GetHierarchyParent().IncreaseLifetimeUp();
10493 #endif
10494 };
10495
10497 {
10498 PlayerBase p = PlayerBase.Cast(player);
10499
10500 array<int> recipesIds = p.m_Recipes;
10501 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10502 if (moduleRecipesManager)
10503 {
10504 EntityAI itemInHands = player.GetEntityInHands();
10505 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10506 }
10507
10508 for (int i = 0;i < recipesIds.Count(); i++)
10509 {
10510 int key = recipesIds.Get(i);
10511 string recipeName = moduleRecipesManager.GetRecipeName(key);
10513 }
10514 }
10515
10516
10517 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10518 {
10519 super.GetDebugActions(outputList);
10520
10521
10527
10528
10533
10538
10539
10543
10544
10546 {
10550 }
10551
10554
10555
10559
10561
10562 InventoryLocation loc = new InventoryLocation();
10563 GetInventory().GetCurrentInventoryLocation(loc);
10565 {
10566 if (Gizmo_IsSupported())
10569 }
10570
10572 }
10573
10574
10575
10576
10578 {
10579 super.OnAction(action_id, player, ctx);
10580
10582 {
10583 switch (action_id)
10584 {
10588 return true;
10592 return true;
10593 }
10594 }
10595
10597 {
10598 switch (action_id)
10599 {
10601 Delete();
10602 return true;
10603 }
10604 }
10605
10606 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10607 {
10608 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10609 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10610 PlayerBase p = PlayerBase.Cast(player);
10611 if (
EActions.RECIPES_RANGE_START < 1000)
10612 {
10613 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10614 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10615 }
10616 }
10617 #ifndef SERVER
10618 else if (action_id ==
EActions.WATCH_PLAYER)
10619 {
10620 PluginDeveloper.SetDeveloperItemClientEx(player);
10621 }
10622 #endif
10624 {
10625 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10626 {
10627 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10628 OnDebugButtonPressServer(id + 1);
10629 }
10630
10631 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10632 {
10633 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10635 }
10636
10637 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10638 {
10639 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10641 }
10642
10643 else if (action_id ==
EActions.ADD_QUANTITY)
10644 {
10645 if (IsMagazine())
10646 {
10647 Magazine mag = Magazine.Cast(this);
10648 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10649 }
10650 else
10651 {
10653 }
10654
10655 if (m_EM)
10656 {
10657 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10658 }
10659
10660 }
10661
10662 else if (action_id ==
EActions.REMOVE_QUANTITY)
10663 {
10664 if (IsMagazine())
10665 {
10666 Magazine mag2 = Magazine.Cast(this);
10667 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10668 }
10669 else
10670 {
10672 }
10673 if (m_EM)
10674 {
10675 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10676 }
10677
10678 }
10679
10680 else if (action_id ==
EActions.SET_QUANTITY_0)
10681 {
10683
10684 if (m_EM)
10685 {
10686 m_EM.SetEnergy(0);
10687 }
10688 }
10689
10690 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10691 {
10693
10694 if (m_EM)
10695 {
10696 m_EM.SetEnergy(m_EM.GetEnergyMax());
10697 }
10698 }
10699
10700 else if (action_id ==
EActions.ADD_HEALTH)
10701 {
10702 AddHealth("","",GetMaxHealth("","Health")/5);
10703 }
10704 else if (action_id ==
EActions.REMOVE_HEALTH)
10705 {
10706 AddHealth("","",-GetMaxHealth("","Health")/5);
10707 }
10708 else if (action_id ==
EActions.DESTROY_HEALTH)
10709 {
10710 SetHealth01("","",0);
10711 }
10712 else if (action_id ==
EActions.WATCH_ITEM)
10713 {
10715 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10716 #ifdef DEVELOPER
10717 SetDebugDeveloper_item(this);
10718 #endif
10719 }
10720
10721 else if (action_id ==
EActions.ADD_TEMPERATURE)
10722 {
10723 AddTemperature(20);
10724
10725 }
10726
10727 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10728 {
10729 AddTemperature(-20);
10730
10731 }
10732
10733 else if (action_id ==
EActions.FLIP_FROZEN)
10734 {
10735 SetFrozen(!GetIsFrozen());
10736
10737 }
10738
10739 else if (action_id ==
EActions.ADD_WETNESS)
10740 {
10742
10743 }
10744
10745 else if (action_id ==
EActions.REMOVE_WETNESS)
10746 {
10748
10749 }
10750
10751 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10752 {
10755
10756
10757 }
10758
10759 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10760 {
10763 }
10764
10765 else if (action_id ==
EActions.MAKE_SPECIAL)
10766 {
10767 auto debugParams = DebugSpawnParams.WithPlayer(player);
10768 OnDebugSpawnEx(debugParams);
10769 }
10770
10771 }
10772
10773
10774 return false;
10775 }
10776
10777
10778
10779
10783
10786
10787
10788
10790 {
10791 return false;
10792 }
10793
10794
10796 {
10797 return true;
10798 }
10799
10800
10802 {
10803 return true;
10804 }
10805
10806
10807
10809 {
10810 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10811 return g_Game.ConfigIsExisting(config_path);
10812 }
10813
10816 {
10817 return null;
10818 }
10819
10821 {
10822 return false;
10823 }
10824
10826 {
10827 return false;
10828 }
10829
10833
10834
10836 {
10837 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10838 return module_repairing.CanRepair(this, item_repair_kit);
10839 }
10840
10841
10842 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10843 {
10844 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10845 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10846 }
10847
10848
10850 {
10851
10852
10853
10854
10855
10856
10857
10858
10859 return 1;
10860 }
10861
10862
10863
10865 {
10867 }
10868
10869
10870
10872 {
10874 }
10875
10876
10885 {
10886 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10887
10888 if (player)
10889 {
10890 player.MessageStatus(text);
10891 }
10892 }
10893
10894
10903 {
10904 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10905
10906 if (player)
10907 {
10908 player.MessageAction(text);
10909 }
10910 }
10911
10912
10921 {
10922 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10923
10924 if (player)
10925 {
10926 player.MessageFriendly(text);
10927 }
10928 }
10929
10930
10939 {
10940 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10941
10942 if (player)
10943 {
10944 player.MessageImportant(text);
10945 }
10946 }
10947
10949 {
10950 return true;
10951 }
10952
10953
10954 override bool KindOf(
string tag)
10955 {
10956 bool found = false;
10957 string item_name = this.
GetType();
10959 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10960
10961 int array_size = item_tag_array.Count();
10962 for (int i = 0; i < array_size; i++)
10963 {
10964 if (item_tag_array.Get(i) == tag)
10965 {
10966 found = true;
10967 break;
10968 }
10969 }
10970 return found;
10971 }
10972
10973
10975 {
10976
10977 super.OnRPC(sender, rpc_type,ctx);
10978
10979
10980 switch (rpc_type)
10981 {
10982 #ifndef SERVER
10983 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10984 Param2<bool, string> p = new Param2<bool, string>(false, "");
10985
10987 return;
10988
10989 bool play = p.param1;
10990 string soundSet = p.param2;
10991
10992 if (play)
10993 {
10995 {
10997 {
10999 }
11000 }
11001 else
11002 {
11004 }
11005 }
11006 else
11007 {
11009 }
11010
11011 break;
11012 #endif
11013
11014 }
11015
11017 {
11019 }
11020 }
11021
11022
11023
11024
11026 {
11027 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11028 return plugin.GetID(
name);
11029 }
11030
11032 {
11033 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11034 return plugin.GetName(id);
11035 }
11036
11039 {
11040
11041
11042 int varFlags;
11043 if (!ctx.
Read(varFlags))
11044 return;
11045
11046 if (varFlags & ItemVariableFlags.FLOAT)
11047 {
11049 }
11050 }
11051
11053 {
11054
11055 super.SerializeNumericalVars(floats_out);
11056
11057
11058
11060 {
11062 }
11063
11065 {
11067 }
11068
11070 {
11072 }
11073
11075 {
11080 }
11081
11083 {
11085 }
11086 }
11087
11089 {
11090
11091 super.DeSerializeNumericalVars(floats);
11092
11093
11094 int index = 0;
11095 int mask = Math.Round(floats.Get(index));
11096
11097 index++;
11098
11100 {
11102 {
11104 }
11105 else
11106 {
11107 float quantity = floats.Get(index);
11108 SetQuantity(quantity,
true,
false,
false,
false);
11109 }
11110 index++;
11111 }
11112
11114 {
11115 float wet = floats.Get(index);
11117 index++;
11118 }
11119
11121 {
11122 int liquidtype = Math.Round(floats.Get(index));
11124 index++;
11125 }
11126
11128 {
11130 index++;
11132 index++;
11134 index++;
11136 index++;
11137 }
11138
11140 {
11141 int cleanness = Math.Round(floats.Get(index));
11143 index++;
11144 }
11145 }
11146
11148 {
11149 super.WriteVarsToCTX(ctx);
11150
11151
11153 {
11155 }
11156
11158 {
11160 }
11161
11163 {
11165 }
11166
11168 {
11169 int r,g,b,a;
11175 }
11176
11178 {
11180 }
11181 }
11182
11184 {
11185 if (!super.ReadVarsFromCTX(ctx,version))
11186 return false;
11187
11188 int intValue;
11189 float value;
11190
11191 if (version < 140)
11192 {
11193 if (!ctx.
Read(intValue))
11194 return false;
11195
11196 m_VariablesMask = intValue;
11197 }
11198
11200 {
11201 if (!ctx.
Read(value))
11202 return false;
11203
11205 {
11207 }
11208 else
11209 {
11211 }
11212 }
11213
11214 if (version < 140)
11215 {
11217 {
11218 if (!ctx.
Read(value))
11219 return false;
11220 SetTemperatureDirect(value);
11221 }
11222 }
11223
11225 {
11226 if (!ctx.
Read(value))
11227 return false;
11229 }
11230
11232 {
11233 if (!ctx.
Read(intValue))
11234 return false;
11236 }
11237
11239 {
11240 int r,g,b,a;
11242 return false;
11244 return false;
11246 return false;
11248 return false;
11249
11251 }
11252
11254 {
11255 if (!ctx.
Read(intValue))
11256 return false;
11258 }
11259
11260 if (version >= 138 && version < 140)
11261 {
11263 {
11264 if (!ctx.
Read(intValue))
11265 return false;
11266 SetFrozen(intValue);
11267 }
11268 }
11269
11270 return true;
11271 }
11272
11273
11275 {
11278 {
11280 }
11281
11282 if (!super.OnStoreLoad(ctx, version))
11283 {
11285 return false;
11286 }
11287
11288 if (version >= 114)
11289 {
11290 bool hasQuickBarIndexSaved;
11291
11292 if (!ctx.
Read(hasQuickBarIndexSaved))
11293 {
11295 return false;
11296 }
11297
11298 if (hasQuickBarIndexSaved)
11299 {
11300 int itmQBIndex;
11301
11302
11303 if (!ctx.
Read(itmQBIndex))
11304 {
11306 return false;
11307 }
11308
11309 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11310 if (itmQBIndex != -1 && parentPlayer)
11311 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11312 }
11313 }
11314 else
11315 {
11316
11317 PlayerBase player;
11318 int itemQBIndex;
11319 if (version ==
int.
MAX)
11320 {
11321 if (!ctx.
Read(itemQBIndex))
11322 {
11324 return false;
11325 }
11326 }
11327 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11328 {
11329
11330 if (!ctx.
Read(itemQBIndex))
11331 {
11333 return false;
11334 }
11335 if (itemQBIndex != -1 && player)
11336 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11337 }
11338 }
11339
11340 if (version < 140)
11341 {
11342
11343 if (!LoadVariables(ctx, version))
11344 {
11346 return false;
11347 }
11348 }
11349
11350
11352 {
11354 return false;
11355 }
11356 if (version >= 132)
11357 {
11359 if (raib)
11360 {
11362 {
11364 return false;
11365 }
11366 }
11367 }
11368
11370 return true;
11371 }
11372
11373
11374
11376 {
11377 super.OnStoreSave(ctx);
11378
11379 PlayerBase player;
11380 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11381 {
11383
11384 int itemQBIndex = -1;
11385 itemQBIndex = player.FindQuickBarEntityIndex(this);
11386 ctx.
Write(itemQBIndex);
11387 }
11388 else
11389 {
11391 }
11392
11394
11396 if (raib)
11397 {
11399 }
11400 }
11401
11402
11404 {
11405 super.AfterStoreLoad();
11406
11408 {
11410 }
11411
11413 {
11416 }
11417 }
11418
11420 {
11421 super.EEOnAfterLoad();
11422
11424 {
11426 }
11427
11430 }
11431
11433 {
11434 return false;
11435 }
11436
11437
11438
11440 {
11442 {
11443 #ifdef PLATFORM_CONSOLE
11444
11446 {
11448 if (menu)
11449 {
11451 }
11452 }
11453 #endif
11454 }
11455
11457 {
11460 }
11461
11463 {
11464 SetWeightDirty();
11466 }
11468 {
11471 }
11472
11474 {
11477
11480 }
11482 {
11486 }
11487
11488 super.OnVariablesSynchronized();
11489 }
11490
11491
11492
11494 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11495 {
11496 if (!IsServerCheck(allow_client))
11497 return false;
11498
11500 return false;
11501
11504
11505 if (value <= (min + 0.001))
11506 value = min;
11507
11508 if (value == min)
11509 {
11510 if (destroy_config)
11511 {
11512 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11513 if (dstr)
11514 {
11516 this.Delete();
11517 return true;
11518 }
11519 }
11520 else if (destroy_forced)
11521 {
11523 this.Delete();
11524 return true;
11525 }
11526
11528 }
11529
11532
11534 {
11535 EntityAI parent = GetHierarchyRoot();
11536 InventoryLocation iLoc = new InventoryLocation();
11537 GetInventory().GetCurrentInventoryLocation(iLoc);
11539 {
11540 int iLocSlot = iLoc.
GetSlot();
11542 {
11544 }
11546 {
11548 }
11549 }
11550 }
11551
11553 {
11555
11556 if (delta)
11558 }
11559
11561
11562 return false;
11563 }
11564
11565
11567 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11568 {
11570 }
11571
11573 {
11576 }
11577
11579 {
11582 }
11583
11585 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11586 {
11587 float value_clamped = Math.Clamp(value, 0, 1);
11589 SetQuantity(result, destroy_config, destroy_forced);
11590 }
11591
11592
11595 {
11597 }
11598
11600 {
11602 }
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11614 {
11615 int slot = -1;
11616 GameInventory inventory = GetInventory();
11617 if (inventory)
11618 {
11619 InventoryLocation il = new InventoryLocation;
11622 }
11623
11625 }
11626
11628 {
11629 float quantity_max = 0;
11630
11632 {
11633 if (attSlotID != -1)
11634 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11635
11636 if (quantity_max <= 0)
11638 }
11639
11640 if (quantity_max <= 0)
11642
11643 return quantity_max;
11644 }
11645
11647 {
11649 }
11650
11652 {
11654 }
11655
11656
11658 {
11660 }
11661
11663 {
11665 }
11666
11668 {
11670 }
11671
11672
11674 {
11675
11676 float weightEx = GetWeightEx();
11677 float special = GetInventoryAndCargoWeight();
11678 return weightEx - special;
11679 }
11680
11681
11683 {
11685 }
11686
11688 {
11690 {
11691 #ifdef DEVELOPER
11692 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11693 {
11694 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11696 }
11697 #endif
11698
11699 return GetQuantity() * GetConfigWeightModified();
11700 }
11701 else if (HasEnergyManager())
11702 {
11703 #ifdef DEVELOPER
11704 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11705 {
11706 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11707 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11708 }
11709 #endif
11710 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11711 }
11712 else
11713 {
11714 #ifdef DEVELOPER
11715 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11716 {
11717 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11718 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11719 }
11720 #endif
11721 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11722 }
11723 }
11724
11727 {
11728 int item_count = 0;
11730
11731 GameInventory inventory = GetInventory();
11732 CargoBase cargo = inventory.
GetCargo();
11733 if (cargo != NULL)
11734 {
11736 }
11737
11739 for (int i = 0; i < nAttachments; ++i)
11740 {
11742 if (item)
11743 item_count += item.GetNumberOfItems();
11744 }
11745 return item_count;
11746 }
11747
11750 {
11751 float weight = 0;
11752 float wetness = 1;
11753 if (include_wetness)
11756 {
11757 weight = wetness * m_ConfigWeight;
11758 }
11760 {
11761 weight = 1;
11762 }
11763 return weight;
11764 }
11765
11766
11767
11769 {
11770 GameInventory inventory = GetInventory();
11771 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11772 {
11773 array<EntityAI> items = new array<EntityAI>;
11775 for (int i = 0; i < items.Count(); ++i)
11776 {
11778 if (item)
11779 {
11780 g_Game.ObjectDelete(item);
11781 }
11782 }
11783 }
11784 }
11785
11786
11787
11788
11790 {
11791 float energy = 0;
11792 if (HasEnergyManager())
11793 {
11794 energy = GetCompEM().GetEnergy();
11795 }
11796 return energy;
11797 }
11798
11799
11801 {
11802 super.OnEnergyConsumed();
11803
11805 }
11806
11808 {
11809 super.OnEnergyAdded();
11810
11812 }
11813
11814
11816 {
11817 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11818 {
11820 {
11821 float energy_0to1 = GetCompEM().GetEnergy0To1();
11823 }
11824 }
11825 }
11826
11827
11829 {
11830 return ConfigGetFloat("heatIsolation");
11831 }
11832
11834 {
11836 }
11837
11839 {
11840 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11841 if (
g_Game.ConfigIsExisting(paramPath))
11842 return g_Game.ConfigGetFloat(paramPath);
11843
11844 return 0.0;
11845 }
11846
11848 {
11849 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11850 if (
g_Game.ConfigIsExisting(paramPath))
11851 return g_Game.ConfigGetFloat(paramPath);
11852
11853 return 0.0;
11854 }
11855
11856 override void SetWet(
float value,
bool allow_client =
false)
11857 {
11858 if (!IsServerCheck(allow_client))
11859 return;
11860
11863
11865
11866 m_VarWet = Math.Clamp(value, min, max);
11867
11869 {
11872 }
11873 }
11874
11875 override void AddWet(
float value)
11876 {
11878 }
11879
11881 {
11883 }
11884
11886 {
11888 }
11889
11891 {
11893 }
11894
11896 {
11898 }
11899
11901 {
11903 }
11904
11905 override void OnWetChanged(
float newVal,
float oldVal)
11906 {
11909 if (newLevel != oldLevel)
11910 {
11912 }
11913 }
11914
11916 {
11917 SetWeightDirty();
11918 }
11919
11921 {
11922 return GetWetLevelInternal(
m_VarWet);
11923 }
11924
11925
11926
11928 {
11930 }
11931
11933 {
11935 }
11936
11938 {
11940 }
11941
11943 {
11945 }
11946
11947
11948
11950 {
11951 if (ConfigIsExisting("itemModelLength"))
11952 {
11953 return ConfigGetFloat("itemModelLength");
11954 }
11955 return 0;
11956 }
11957
11959 {
11960 if (ConfigIsExisting("itemAttachOffset"))
11961 {
11962 return ConfigGetFloat("itemAttachOffset");
11963 }
11964 return 0;
11965 }
11966
11967 override void SetCleanness(
int value,
bool allow_client =
false)
11968 {
11969 if (!IsServerCheck(allow_client))
11970 return;
11971
11973
11975
11978 }
11979
11981 {
11983 }
11984
11986 {
11987 return true;
11988 }
11989
11990
11991
11992
11994 {
11996 }
11997
11999 {
12001 }
12002
12003
12004
12005
12006 override void SetColor(
int r,
int g,
int b,
int a)
12007 {
12013 }
12015 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12016 {
12021 }
12022
12024 {
12026 }
12027
12030 {
12031 int r,g,b,a;
12033 r = r/255;
12034 g = g/255;
12035 b = b/255;
12036 a = a/255;
12037 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12038 }
12039
12040
12041
12042 override void SetLiquidType(
int value,
bool allow_client =
false)
12043 {
12044 if (!IsServerCheck(allow_client))
12045 return;
12046
12051 }
12052
12054 {
12055 return ConfigGetInt("varLiquidTypeInit");
12056 }
12057
12059 {
12061 }
12062
12064 {
12066 SetFrozen(false);
12067 }
12068
12071 {
12072 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12073 }
12074
12075
12078 {
12079 PlayerBase nplayer;
12080 if (PlayerBase.CastTo(nplayer, player))
12081 {
12083 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12084 }
12085 }
12086
12087
12090 {
12091 PlayerBase nplayer;
12092 if (PlayerBase.CastTo(nplayer,player))
12093 {
12094 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12095 }
12096
12097 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12098
12099 if (HasEnergyManager())
12100 {
12101 GetCompEM().UpdatePlugState();
12102 }
12103 }
12104
12105
12107 {
12108 super.OnPlacementStarted(player);
12109
12111 }
12112
12113 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12114 {
12116 {
12117 m_AdminLog.OnPlacementComplete(player,
this);
12118 }
12119
12120 super.OnPlacementComplete(player, position, orientation);
12121 }
12122
12123
12124
12125
12126
12128 {
12130 {
12131 return true;
12132 }
12133 else
12134 {
12135 return false;
12136 }
12137 }
12138
12139
12141 {
12143 {
12145 }
12146 }
12147
12148
12150 {
12152 }
12153
12155 {
12157 }
12158
12159 override void InsertAgent(
int agent,
float count = 1)
12160 {
12161 if (count < 1)
12162 return;
12163
12165 }
12166
12169 {
12171 }
12172
12173
12175 {
12177 }
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12221 {
12223 return false;
12224 return true;
12225 }
12226
12228 {
12229
12231 }
12232
12233
12236 {
12237 super.CheckForRoofLimited(timeTresholdMS);
12238
12239 float time =
g_Game.GetTime();
12240 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12241 {
12242 m_PreviousRoofTestTime = time;
12243 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12244 }
12245 }
12246
12247
12249 {
12251 {
12252 return 0;
12253 }
12254
12255 if (GetInventory().GetAttachmentSlotsCount() != 0)
12256 {
12257 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12258 if (filter)
12259 return filter.GetProtectionLevel(type, false, system);
12260 else
12261 return 0;
12262 }
12263
12264 string subclassPath, entryName;
12265
12266 switch (type)
12267 {
12269 entryName = "biological";
12270 break;
12272 entryName = "chemical";
12273 break;
12274 default:
12275 entryName = "biological";
12276 break;
12277 }
12278
12279 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12280
12281 return g_Game.ConfigGetFloat(subclassPath + entryName);
12282 }
12283
12284
12285
12288 {
12289 if (!IsMagazine())
12291
12293 }
12294
12295
12296
12297
12298
12303 {
12304 return true;
12305 }
12306
12308 {
12310 }
12311
12312
12313
12314
12315
12317 {
12318 if (parent)
12319 {
12320 if (parent.IsInherited(DayZInfected))
12321 return true;
12322
12323 if (!parent.IsRuined())
12324 return true;
12325 }
12326
12327 return true;
12328 }
12329
12331 {
12332 if (!super.CanPutAsAttachment(parent))
12333 {
12334 return false;
12335 }
12336
12337 if (!IsRuined() && !parent.IsRuined())
12338 {
12339 return true;
12340 }
12341
12342 return false;
12343 }
12344
12346 {
12347
12348
12349
12350
12351 return super.CanReceiveItemIntoCargo(item);
12352 }
12353
12355 {
12356
12357
12358
12359
12360 GameInventory attachmentInv = attachment.GetInventory();
12362 {
12363 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12364 return false;
12365 }
12366
12367 InventoryLocation loc = new InventoryLocation();
12368 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12369 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12370 return false;
12371
12372 return super.CanReceiveAttachment(attachment, slotId);
12373 }
12374
12376 {
12377 if (!super.CanReleaseAttachment(attachment))
12378 return false;
12379
12380 return GetInventory().AreChildrenAccessible();
12381 }
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12404 {
12405 int id = muzzle_owner.GetMuzzleID();
12406 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12407
12408 if (WPOF_array)
12409 {
12410 for (int i = 0; i < WPOF_array.Count(); i++)
12411 {
12412 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12413
12414 if (WPOF)
12415 {
12416 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12417 }
12418 }
12419 }
12420 }
12421
12422
12424 {
12425 int id = muzzle_owner.GetMuzzleID();
12427
12428 if (WPOBE_array)
12429 {
12430 for (int i = 0; i < WPOBE_array.Count(); i++)
12431 {
12432 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12433
12434 if (WPOBE)
12435 {
12436 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12437 }
12438 }
12439 }
12440 }
12441
12442
12444 {
12445 int id = muzzle_owner.GetMuzzleID();
12446 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12447
12448 if (WPOOH_array)
12449 {
12450 for (int i = 0; i < WPOOH_array.Count(); i++)
12451 {
12452 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12453
12454 if (WPOOH)
12455 {
12456 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12457 }
12458 }
12459 }
12460 }
12461
12462
12464 {
12465 int id = muzzle_owner.GetMuzzleID();
12466 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12467
12468 if (WPOOH_array)
12469 {
12470 for (int i = 0; i < WPOOH_array.Count(); i++)
12471 {
12472 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12473
12474 if (WPOOH)
12475 {
12476 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12477 }
12478 }
12479 }
12480 }
12481
12482
12484 {
12485 int id = muzzle_owner.GetMuzzleID();
12486 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12487
12488 if (WPOOH_array)
12489 {
12490 for (int i = 0; i < WPOOH_array.Count(); i++)
12491 {
12492 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12493
12494 if (WPOOH)
12495 {
12496 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12497 }
12498 }
12499 }
12500 }
12501
12502
12503
12505 {
12507 {
12508 return true;
12509 }
12510
12511 return false;
12512 }
12513
12515 {
12517 {
12518 return true;
12519 }
12520
12521 return false;
12522 }
12523
12525 {
12527 {
12528 return true;
12529 }
12530
12531 return false;
12532 }
12533
12535 {
12536 return false;
12537 }
12538
12541 {
12542 return UATimeSpent.DEFAULT_DEPLOY;
12543 }
12544
12545
12546
12547
12549 {
12551 SetSynchDirty();
12552 }
12553
12555 {
12557 }
12558
12559
12561 {
12562 return false;
12563 }
12564
12567 {
12568 string att_type = "None";
12569
12570 if (ConfigIsExisting("soundAttType"))
12571 {
12572 att_type = ConfigGetString("soundAttType");
12573 }
12574
12576 }
12577
12579 {
12581 }
12582
12583
12584
12585
12586
12592
12594 {
12597
12599 }
12600
12601
12603 {
12605 return;
12606
12608
12611
12614
12615 SoundParameters params = new SoundParameters();
12619 }
12620
12621
12623 {
12625 {
12628
12629 SetSynchDirty();
12630
12633 }
12634 }
12635
12637 {
12639 }
12640
12641
12643 {
12645 return;
12646
12648 SetSynchDirty();
12649
12652 }
12653
12655 {
12658 }
12659
12661 {
12663 }
12664
12665 void OnApply(PlayerBase player);
12666
12668 {
12669 return 1.0;
12670 };
12671
12673 {
12675 }
12676
12678 {
12680 }
12681
12683
12685 {
12686 SetDynamicPhysicsLifeTime(0.01);
12688 }
12689
12691 {
12692 array<string> zone_names = new array<string>;
12693 GetDamageZones(zone_names);
12694 for (int i = 0; i < zone_names.Count(); i++)
12695 {
12696 SetHealthMax(zone_names.Get(i),"Health");
12697 }
12698 SetHealthMax("","Health");
12699 }
12700
12703 {
12704 float global_health = GetHealth01("","Health");
12705 array<string> zones = new array<string>;
12706 GetDamageZones(zones);
12707
12708 for (int i = 0; i < zones.Count(); i++)
12709 {
12710 SetHealth01(zones.Get(i),"Health",global_health);
12711 }
12712 }
12713
12716 {
12717 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12718 }
12719
12721 {
12722 if (!hasRootAsPlayer)
12723 {
12724 if (refParentIB)
12725 {
12726
12727 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12728 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12729
12730 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12731 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12732
12735 }
12736 else
12737 {
12738
12741 }
12742 }
12743 }
12744
12746 {
12748 {
12749 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12750 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12751 {
12752 float heatPermCoef = 1.0;
12754 while (ent)
12755 {
12756 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12757 ent = ent.GetHierarchyParent();
12758 }
12759
12760 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12761 }
12762 }
12763 }
12764
12766 {
12767
12768 EntityAI parent = GetHierarchyParent();
12769 if (!parent)
12770 {
12771 hasParent = false;
12772 hasRootAsPlayer = false;
12773 }
12774 else
12775 {
12776 hasParent = true;
12777 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12778 refParentIB =
ItemBase.Cast(parent);
12779 }
12780 }
12781
12782 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12783 {
12784
12785 }
12786
12788 {
12789
12790 return false;
12791 }
12792
12794 {
12795
12796
12797 return false;
12798 }
12799
12801 {
12802
12803 return false;
12804 }
12805
12808 {
12809 return !GetIsFrozen() &&
IsOpen();
12810 }
12811
12813 {
12814 bool hasParent = false, hasRootAsPlayer = false;
12816
12817 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12818 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12819
12820 if (wwtu || foodDecay)
12821 {
12825
12826 if (processWetness || processTemperature || processDecay)
12827 {
12829
12830 if (processWetness)
12831 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12832
12833 if (processTemperature)
12835
12836 if (processDecay)
12837 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12838 }
12839 }
12840 }
12841
12844 {
12846 }
12847
12849 {
12852
12853 return super.GetTemperatureFreezeThreshold();
12854 }
12855
12857 {
12860
12861 return super.GetTemperatureThawThreshold();
12862 }
12863
12865 {
12868
12869 return super.GetItemOverheatThreshold();
12870 }
12871
12873 {
12875 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12876
12877 return super.GetTemperatureFreezeTime();
12878 }
12879
12881 {
12883 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12884
12885 return super.GetTemperatureThawTime();
12886 }
12887
12892
12894 {
12895 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12896 }
12897
12899 {
12900 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12901 }
12902
12905 {
12907 }
12908
12910 {
12912 }
12913
12915 {
12917 }
12918
12921 {
12922 return null;
12923 }
12924
12927 {
12928 return false;
12929 }
12930
12932 {
12934 {
12937 if (!trg)
12938 {
12940 explosive = this;
12941 }
12942
12943 explosive.PairRemote(trg);
12945
12946 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12947 trg.SetPersistentPairID(persistentID);
12948 explosive.SetPersistentPairID(persistentID);
12949
12950 return true;
12951 }
12952 return false;
12953 }
12954
12957 {
12958 float ret = 1.0;
12961 ret *= GetHealth01();
12962
12963 return ret;
12964 }
12965
12966 #ifdef DEVELOPER
12967 override void SetDebugItem()
12968 {
12969 super.SetDebugItem();
12970 _itemBase = this;
12971 }
12972
12974 {
12975 string text = super.GetDebugText();
12976
12978 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12979
12980 return text;
12981 }
12982 #endif
12983
12985 {
12986 return true;
12987 }
12988
12990
12992
12994 {
12997 }
12998
12999
13007
13023
13024 [
Obsolete(
"Use ItemSoundHandler instead")]
13027 {
13028 if (!
g_Game.IsDedicatedServer())
13029 {
13030 if (ConfigIsExisting("attachSoundSet"))
13031 {
13032 string cfg_path = "";
13033 string soundset = "";
13034 string type_name =
GetType();
13035
13038 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13039 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13040
13041 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13042 {
13043 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13044 {
13045 if (cfg_slot_array[i] == slot_type)
13046 {
13047 soundset = cfg_soundset_array[i];
13048 break;
13049 }
13050 }
13051 }
13052
13053 if (soundset != "")
13054 {
13055 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13057 }
13058 }
13059 }
13060 }
13061
13063}
13064
13066{
13068 if (entity)
13069 {
13070 bool is_item = entity.IsInherited(
ItemBase);
13071 if (is_item && full_quantity)
13072 {
13075 }
13076 }
13077 else
13078 {
13080 return NULL;
13081 }
13082 return entity;
13083}
13084
13086{
13087 if (item)
13088 {
13089 if (health > 0)
13090 item.SetHealth("", "", health);
13091
13092 if (item.CanHaveTemperature())
13093 {
13095 if (item.CanFreeze())
13096 item.SetFrozen(false);
13097 }
13098
13099 if (item.HasEnergyManager())
13100 {
13101 if (quantity >= 0)
13102 {
13103 item.GetCompEM().SetEnergy0To1(quantity);
13104 }
13105 else
13106 {
13108 }
13109 }
13110 else if (item.IsMagazine())
13111 {
13112 Magazine mag = Magazine.Cast(item);
13113 if (quantity >= 0)
13114 {
13115 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13116 }
13117 else
13118 {
13120 }
13121
13122 }
13123 else
13124 {
13125 if (quantity >= 0)
13126 {
13127 item.SetQuantityNormalized(quantity, false);
13128 }
13129 else
13130 {
13132 }
13133
13134 }
13135 }
13136}
13137
13138#ifdef DEVELOPER
13140#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.