8180{
8182 {
8183 return true;
8184 }
8185};
8186
8188{
8189
8190};
8191
8192
8193
8195{
8199
8201
8204
8205
8206
8207
8208
8217
8223
8228
8233
8254 protected bool m_IsResultOfSplit
8255
8257
8262
8263
8264
8266
8270
8271
8272
8274
8277
8278
8279
8285
8286
8294
8297
8298
8300
8301
8303
8304
8309
8310
8315
8317
8318
8320
8321
8323 {
8328
8329 if (!
g_Game.IsDedicatedServer())
8330 {
8332 {
8334
8336 {
8338 }
8339 }
8340
8343 }
8344
8345 m_OldLocation = null;
8346
8348 {
8350 }
8351
8352 if (ConfigIsExisting("headSelectionsToHide"))
8353 {
8356 }
8357
8359 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8360 {
8362 }
8363
8365
8366 m_IsResultOfSplit = false;
8367
8369 }
8370
8372 {
8373 super.InitItemVariables();
8374
8380 m_Count = ConfigGetInt(
"count");
8381
8384
8389
8392
8397
8409
8413
8414
8417 if (ConfigIsExisting("canBeSplit"))
8418 {
8421 }
8422
8424 if (ConfigIsExisting("itemBehaviour"))
8426
8427
8430 RegisterNetSyncVariableInt("m_VarLiquidType");
8431 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8432
8433 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8434 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8435 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8436
8437 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8438 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8439 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8440 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8441
8442 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8443 RegisterNetSyncVariableBool("m_IsTakeable");
8444 RegisterNetSyncVariableBool("m_IsHologram");
8445
8448 {
8451 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8452 }
8453
8455
8457 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8459
8461 }
8462
8464 {
8466 }
8467
8469 {
8472 {
8477 }
8478 }
8479
8480 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8481 {
8483 {
8486 }
8487
8489 }
8490
8492 {
8498 }
8499
8501
8503 {
8505
8506 if (!action)
8507 {
8508 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8509 return;
8510 }
8511
8513 if (!ai)
8514 {
8516 return;
8517 }
8518
8520 if (!action_array)
8521 {
8522 action_array = new array<ActionBase_Basic>;
8524 }
8525 if (LogManager.IsActionLogEnable())
8526 {
8527 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8528 }
8529
8530 if (action_array.Find(action) != -1)
8531 {
8532 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8533 }
8534 else
8535 {
8536 action_array.Insert(action);
8537 }
8538 }
8539
8541 {
8542 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8543 ActionBase action = player.GetActionManager().GetAction(actionName);
8546
8547 if (action_array)
8548 {
8549 action_array.RemoveItem(action);
8550 }
8551 }
8552
8553
8554
8556 {
8557 ActionOverrideData overrideData = new ActionOverrideData();
8561
8563 if (!actionMap)
8564 {
8567 }
8568
8569 actionMap.Insert(this.
Type(), overrideData);
8570
8571 }
8572
8574
8576
8577
8579 {
8582
8585
8586 string config_to_search = "CfgVehicles";
8587 string muzzle_owner_config;
8588
8590 {
8591 if (IsInherited(Weapon))
8592 config_to_search = "CfgWeapons";
8593
8594 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8595
8596 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8597
8598 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8599
8600 if (config_OnFire_subclass_count > 0)
8601 {
8602 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8603
8604 for (int i = 0; i < config_OnFire_subclass_count; i++)
8605 {
8606 string particle_class = "";
8607 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8608 string config_OnFire_entry = config_OnFire_class + particle_class;
8609 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8610 WPOF_array.Insert(WPOF);
8611 }
8612
8613
8615 }
8616 }
8617
8619 {
8620 config_to_search = "CfgWeapons";
8621 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8622
8623 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8624
8625 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8626
8627 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8628 {
8629 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8630
8631 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8632 {
8633 string particle_class2 = "";
8634 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8635 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8636 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8637 WPOBE_array.Insert(WPOBE);
8638 }
8639
8640
8642 }
8643 }
8644 }
8645
8646
8648 {
8651
8653 {
8654 string config_to_search = "CfgVehicles";
8655
8656 if (IsInherited(Weapon))
8657 config_to_search = "CfgWeapons";
8658
8659 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8660 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8661
8662 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8663 {
8664
8666
8668 {
8670 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8672 return;
8673 }
8674
8677
8678
8679
8680 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8681 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8682
8683 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8684 {
8685 string particle_class = "";
8686 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8687 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8688 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8689
8690 if (entry_type == CT_CLASS)
8691 {
8692 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8693 WPOOH_array.Insert(WPOF);
8694 }
8695 }
8696
8697
8699 }
8700 }
8701 }
8702
8704 {
8706 }
8707
8709 {
8711 {
8713
8716
8719
8720 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8721 }
8722 }
8723
8725 {
8727 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8728
8730 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8731
8733 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8734
8736 {
8738 }
8739 }
8740
8742 {
8744 }
8745
8747 {
8750 else
8752
8754 {
8757 }
8758 else
8759 {
8762
8765 }
8766
8768 }
8769
8771 {
8773 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8774 }
8775
8777 {
8779 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8781 }
8782
8784 {
8786 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8787 }
8788
8790 {
8793
8794 OverheatingParticle OP = new OverheatingParticle();
8799
8801 }
8802
8804 {
8807
8808 return -1;
8809 }
8810
8812 {
8814 {
8817
8818 for (int i = count; i > 0; --i)
8819 {
8820 int id = i - 1;
8823
8826
8827 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8828 {
8829 if (p)
8830 {
8833 }
8834 }
8835 }
8836 }
8837 }
8838
8840 {
8842 {
8844 {
8845 int id = i - 1;
8847
8848 if (OP)
8849 {
8851
8852 if (p)
8853 {
8855 }
8856
8857 delete OP;
8858 }
8859 }
8860
8863 }
8864 }
8865
8868 {
8869 return 0.0;
8870 }
8871
8872
8874 {
8875 return 250;
8876 }
8877
8879 {
8880 return 0;
8881 }
8882
8885 {
8887 return true;
8888
8889 return false;
8890 }
8891
8894 {
8897
8899 {
8901 }
8902 else
8903 {
8904
8906 }
8907
8909 }
8910
8917 {
8918 return -1;
8919 }
8920
8921
8922
8923
8925 {
8927 {
8928 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8929 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8930
8931 if (r_index >= 0)
8932 {
8933 InventoryLocation r_il = new InventoryLocation;
8934 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8935
8936 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8939 {
8940 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8941 }
8943 {
8944 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8945 }
8946
8947 }
8948
8949 player.GetHumanInventory().ClearUserReservedLocation(this);
8950 }
8951
8954 }
8955
8956
8957
8958
8960 {
8961 return ItemBase.m_DebugActionsMask;
8962 }
8963
8965 {
8966 return ItemBase.m_DebugActionsMask & mask;
8967 }
8968
8970 {
8971 ItemBase.m_DebugActionsMask = mask;
8972 }
8973
8975 {
8976 ItemBase.m_DebugActionsMask |= mask;
8977 }
8978
8980 {
8981 ItemBase.m_DebugActionsMask &= ~mask;
8982 }
8983
8985 {
8987 {
8989 }
8990 else
8991 {
8993 }
8994 }
8995
8996
8998 {
8999 if (GetEconomyProfile())
9000 {
9001 float q_max = GetEconomyProfile().GetQuantityMax();
9002 if (q_max > 0)
9003 {
9004 float q_min = GetEconomyProfile().GetQuantityMin();
9005 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9006
9008 {
9009 ComponentEnergyManager comp = GetCompEM();
9011 {
9013 }
9014 }
9016 {
9018
9019 }
9020
9021 }
9022 }
9023 }
9024
9027 {
9028 EntityAI parent = GetHierarchyParent();
9029
9030 if (parent)
9031 {
9032 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9033 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9034 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9035 }
9036 }
9037
9040 {
9041 EntityAI parent = GetHierarchyParent();
9042
9043 if (parent)
9044 {
9045 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9046 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9047 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9048 }
9049 }
9050
9052 {
9053
9054
9055
9056
9058
9060 {
9061 if (ScriptInputUserData.CanStoreInputUserData())
9062 {
9063 ScriptInputUserData ctx = new ScriptInputUserData;
9069 ctx.
Write(use_stack_max);
9072
9074 {
9075 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9076 }
9077 }
9078 }
9079 else if (!
g_Game.IsMultiplayer())
9080 {
9082 }
9083 }
9084
9086 {
9088 }
9089
9091 {
9093 }
9094
9096 {
9098 }
9099
9101 {
9102
9103 return false;
9104 }
9105
9107 {
9108 return false;
9109 }
9110
9114 {
9115 return false;
9116 }
9117
9119 {
9120 return "";
9121 }
9122
9124
9126 {
9127 return false;
9128 }
9129
9131 {
9132 return true;
9133 }
9134
9135
9136
9138 {
9139 return true;
9140 }
9141
9143 {
9144 return true;
9145 }
9146
9148 {
9149 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9151 }
9152
9154 {
9156 }
9157
9159 {
9161 if (!is_being_placed)
9163 SetSynchDirty();
9164 }
9165
9166
9168
9170 {
9172 }
9173
9175 {
9177 }
9178
9180 {
9181 return 1;
9182 }
9183
9185 {
9186 return false;
9187 }
9188
9190 {
9192 SetSynchDirty();
9193 }
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9230 {
9231 super.OnMovedInsideCargo(container);
9232
9233 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9234 }
9235
9236 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9237 {
9238 super.EEItemLocationChanged(oldLoc, newLoc);
9239
9240 PlayerBase newPlayer = null;
9241 PlayerBase oldPlayer = null;
9242
9243 if (newLoc.GetParent())
9244 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9245
9246 if (oldLoc.GetParent())
9247 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9248
9250 {
9251 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9252
9253 if (rIndex >= 0)
9254 {
9255 InventoryLocation rIl = new InventoryLocation;
9256 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9257
9258 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9261 {
9262 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9263 }
9265 {
9267 }
9268
9269 }
9270 }
9271
9273 {
9274 if (newPlayer)
9275 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9276
9277 if (newPlayer == oldPlayer)
9278 {
9279 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9280 {
9282 {
9283 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9284 {
9285 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9286 }
9287 }
9288 else
9289 {
9290 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9291 }
9292 }
9293
9294 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9295 {
9296 int type = oldLoc.GetType();
9298 {
9299 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9300 }
9302 {
9303 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9304 }
9305 }
9306 if (!m_OldLocation)
9307 {
9308 m_OldLocation = new InventoryLocation;
9309 }
9310 m_OldLocation.Copy(oldLoc);
9311 }
9312 else
9313 {
9314 if (m_OldLocation)
9315 {
9316 m_OldLocation.Reset();
9317 }
9318 }
9319
9320 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9321 }
9322 else
9323 {
9324 if (newPlayer)
9325 {
9326 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9327 if (resIndex >= 0)
9328 {
9329 InventoryLocation il = new InventoryLocation;
9330 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9332 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9335 {
9336 il.
GetParent().GetOnReleaseLock().Invoke(it);
9337 }
9339 {
9341 }
9342
9343 }
9344 }
9346 {
9347
9349 }
9350
9351 if (m_OldLocation)
9352 {
9353 m_OldLocation.Reset();
9354 }
9355 }
9356
9358 {
9359 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9360 }
9361
9363 {
9364 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9365 }
9366 }
9367
9368 override void EOnContact(IEntity other, Contact extra)
9369 {
9371 {
9372 int liquidType = -1;
9374 if (impactSpeed > 0.0)
9375 {
9377 #ifndef SERVER
9379 #else
9381 SetSynchDirty();
9382 #endif
9384 }
9385 }
9386
9387 #ifdef SERVER
9388 if (GetCompEM() && GetCompEM().IsPlugged())
9389 {
9390 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9391 GetCompEM().UnplugThis();
9392 }
9393 #endif
9394 }
9395
9397
9399 {
9401 }
9402
9404 {
9405
9406 }
9407
9409 {
9410 super.OnItemLocationChanged(old_owner, new_owner);
9411
9412 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9413 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9414
9415 if (!relatedPlayer && playerNew)
9416 relatedPlayer = playerNew;
9417
9418 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9419 {
9421 if (actionMgr)
9422 {
9423 ActionBase currentAction = actionMgr.GetRunningAction();
9424 if (currentAction)
9426 }
9427 }
9428
9429 Man ownerPlayerOld = null;
9430 Man ownerPlayerNew = null;
9431
9432 if (old_owner)
9433 {
9434 if (old_owner.
IsMan())
9435 {
9436 ownerPlayerOld = Man.Cast(old_owner);
9437 }
9438 else
9439 {
9440 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9441 }
9442 }
9443 else
9444 {
9446 {
9448
9449 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9450 {
9451 GetCompEM().UnplugThis();
9452 }
9453 }
9454 }
9455
9456 if (new_owner)
9457 {
9458 if (new_owner.
IsMan())
9459 {
9460 ownerPlayerNew = Man.Cast(new_owner);
9461 }
9462 else
9463 {
9464 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9465 }
9466 }
9467
9468 if (ownerPlayerOld != ownerPlayerNew)
9469 {
9470 if (ownerPlayerOld)
9471 {
9472 array<EntityAI> subItemsExit = new array<EntityAI>;
9474 for (int i = 0; i < subItemsExit.Count(); i++)
9475 {
9478 }
9479 }
9480
9481 if (ownerPlayerNew)
9482 {
9483 array<EntityAI> subItemsEnter = new array<EntityAI>;
9485 for (int j = 0; j < subItemsEnter.Count(); j++)
9486 {
9489 }
9490 }
9491 }
9492 else if (ownerPlayerNew != null)
9493 {
9494 PlayerBase nplayer;
9495 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9496 {
9497 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9499 for (int k = 0; k < subItemsUpdate.Count(); k++)
9500 {
9502 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9503 }
9504 }
9505 }
9506
9507 if (old_owner)
9508 old_owner.OnChildItemRemoved(this);
9509 if (new_owner)
9510 new_owner.OnChildItemReceived(this);
9511 }
9512
9513
9515 {
9516 super.EEDelete(parent);
9517 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9518 if (player)
9519 {
9521
9522 if (player.IsAlive())
9523 {
9524 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9525 if (r_index >= 0)
9526 {
9527 InventoryLocation r_il = new InventoryLocation;
9528 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9529
9530 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9533 {
9534 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9535 }
9537 {
9538 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9539 }
9540
9541 }
9542
9543 player.RemoveQuickBarEntityShortcut(this);
9544 }
9545 }
9546 }
9547
9549 {
9550 super.EEKilled(killer);
9551
9554 {
9555 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9556 {
9557 if (IsMagazine())
9558 {
9559 if (Magazine.Cast(this).GetAmmoCount() > 0)
9560 {
9562 }
9563 }
9564 else
9565 {
9567 }
9568 }
9569 }
9570 }
9571
9573 {
9574 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9575
9576 super.OnWasAttached(parent, slot_id);
9577
9580
9583 }
9584
9586 {
9587 super.OnWasDetached(parent, slot_id);
9588
9591
9594 }
9595
9597 {
9598 int idx;
9601
9602 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9603 if (inventory_slots.Count() < 1)
9604 {
9605 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9606 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9607 }
9608 else
9609 {
9610 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9611 }
9612
9613 idx = inventory_slots.Find(slot);
9614 if (idx < 0)
9615 return "";
9616
9617 return attach_types.Get(idx);
9618 }
9619
9621 {
9622 int idx = -1;
9623 string slot;
9624
9627
9628 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9629 if (inventory_slots.Count() < 1)
9630 {
9631 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9632 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9633 }
9634 else
9635 {
9636 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9637 if (detach_types.Count() < 1)
9638 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9639 }
9640
9641 for (int i = 0; i < inventory_slots.Count(); i++)
9642 {
9643 slot = inventory_slots.Get(i);
9644 }
9645
9646 if (slot != "")
9647 {
9648 if (detach_types.Count() == 1)
9649 idx = 0;
9650 else
9651 idx = inventory_slots.Find(slot);
9652 }
9653 if (idx < 0)
9654 return "";
9655
9656 return detach_types.Get(idx);
9657 }
9658
9660 {
9661
9663
9664
9665 float min_time = 1;
9666 float max_time = 3;
9667 float delay = Math.RandomFloat(min_time, max_time);
9668
9669 explode_timer.Run(delay, this, "DoAmmoExplosion");
9670 }
9671
9673 {
9674 Magazine magazine = Magazine.Cast(this);
9675 int pop_sounds_count = 6;
9676 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9677
9678
9679 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9680 string sound_name = pop_sounds[ sound_idx ];
9681 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9682
9683
9684 magazine.ServerAddAmmoCount(-1);
9685
9686
9687 float min_temp_to_explode = 100;
9688
9689 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9690 {
9692 }
9693 }
9694
9695
9696 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9697 {
9698 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9699
9700 const int CHANCE_DAMAGE_CARGO = 4;
9701 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9702 const int CHANCE_DAMAGE_NOTHING = 2;
9703
9705 {
9706 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9707 int chances;
9708 int rnd;
9709
9710 if (GetInventory().GetCargo())
9711 {
9712 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9713 rnd = Math.RandomInt(0,chances);
9714
9715 if (rnd < CHANCE_DAMAGE_CARGO)
9716 {
9718 }
9719 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9720 {
9722 }
9723 }
9724 else
9725 {
9726 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9727 rnd = Math.RandomInt(0,chances);
9728
9729 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9730 {
9732 }
9733 }
9734 }
9735 }
9736
9738 {
9739 CargoBase cargo = GetInventory().GetCargo();
9740 if (cargo)
9741 {
9743 if (item_count > 0)
9744 {
9745 int random_pick = Math.RandomInt(0, item_count);
9747 if (!item.IsExplosive())
9748 {
9749 item.AddHealth("","",damage);
9750 return true;
9751 }
9752 }
9753 }
9754 return false;
9755 }
9756
9758 {
9759 GameInventory inventory = GetInventory();
9761 if (attachment_count > 0)
9762 {
9763 int random_pick = Math.RandomInt(0, attachment_count);
9765 if (!attachment.IsExplosive())
9766 {
9767 attachment.AddHealth("","",damage);
9768 return true;
9769 }
9770 }
9771 return false;
9772 }
9773
9775 {
9777 }
9778
9780 {
9782 return GetInventory().CanRemoveEntity();
9783
9784 return false;
9785 }
9786
9788 {
9789
9791 return false;
9792
9793
9795 return false;
9796
9797
9798
9800 if (delta == 0)
9801 return false;
9802
9803
9804 return true;
9805 }
9806
9808 {
9810 {
9811 if (ScriptInputUserData.CanStoreInputUserData())
9812 {
9813 ScriptInputUserData ctx = new ScriptInputUserData;
9818 ctx.
Write(destination_entity);
9822 }
9823 }
9824 else if (!
g_Game.IsMultiplayer())
9825 {
9827 }
9828 }
9829
9831 {
9832 float split_quantity_new;
9836 InventoryLocation loc = new InventoryLocation;
9837
9838 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9839 {
9841 split_quantity_new = stack_max;
9842 else
9844
9846 {
9847 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9848 if (new_item)
9849 {
9850 new_item.SetResultOfSplit(true);
9851 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9853 new_item.
SetQuantity(split_quantity_new,
false,
true);
9854 }
9855 }
9856 }
9857 else if (destination_entity && slot_id == -1)
9858 {
9859 if (quantity > stack_max)
9860 split_quantity_new = stack_max;
9861 else
9862 split_quantity_new = quantity;
9863
9865 {
9866 GameInventory destinationInventory = destination_entity.GetInventory();
9868 {
9871 }
9872
9873 if (new_item)
9874 {
9875 new_item.SetResultOfSplit(true);
9876 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9878 new_item.
SetQuantity(split_quantity_new,
false,
true);
9879 }
9880 }
9881 }
9882 else
9883 {
9884 if (stack_max != 0)
9885 {
9887 {
9889 }
9890
9891 if (split_quantity_new == 0)
9892 {
9893 if (!
g_Game.IsMultiplayer())
9894 player.PhysicalPredictiveDropItem(this);
9895 else
9896 player.ServerDropEntity(this);
9897 return;
9898 }
9899
9901 {
9903
9904 if (new_item)
9905 {
9906 new_item.SetResultOfSplit(true);
9907 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9910 new_item.PlaceOnSurface();
9911 }
9912 }
9913 }
9914 }
9915 }
9916
9918 {
9919 float split_quantity_new;
9923 InventoryLocation loc = new InventoryLocation;
9924
9925 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9926 {
9928 split_quantity_new = stack_max;
9929 else
9931
9933 {
9934 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9935 if (new_item)
9936 {
9937 new_item.SetResultOfSplit(true);
9938 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9940 new_item.
SetQuantity(split_quantity_new,
false,
true);
9941 }
9942 }
9943 }
9944 else if (destination_entity && slot_id == -1)
9945 {
9946 if (quantity > stack_max)
9947 split_quantity_new = stack_max;
9948 else
9949 split_quantity_new = quantity;
9950
9952 {
9953 GameInventory destinationInventory = destination_entity.GetInventory();
9955 {
9958 }
9959
9960 if (new_item)
9961 {
9962 new_item.SetResultOfSplit(true);
9963 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9965 new_item.
SetQuantity(split_quantity_new,
false,
true);
9966 }
9967 }
9968 }
9969 else
9970 {
9971 if (stack_max != 0)
9972 {
9974 {
9976 }
9977
9979 {
9981
9982 if (new_item)
9983 {
9984 new_item.SetResultOfSplit(true);
9985 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9988 new_item.PlaceOnSurface();
9989 }
9990 }
9991 }
9992 }
9993 }
9994
9996 {
9998 {
9999 if (ScriptInputUserData.CanStoreInputUserData())
10000 {
10001 ScriptInputUserData ctx = new ScriptInputUserData;
10006 dst.WriteToContext(ctx);
10008 }
10009 }
10010 else if (!
g_Game.IsMultiplayer())
10011 {
10013 }
10014 }
10015
10017 {
10019 {
10020 if (ScriptInputUserData.CanStoreInputUserData())
10021 {
10022 ScriptInputUserData ctx = new ScriptInputUserData;
10027 ctx.
Write(destination_entity);
10033 }
10034 }
10035 else if (!
g_Game.IsMultiplayer())
10036 {
10038 }
10039 }
10040
10042 {
10044 }
10045
10047 {
10049 float split_quantity_new;
10051 if (dst.IsValid())
10052 {
10053 int slot_id = dst.GetSlot();
10055
10056 if (quantity > stack_max)
10057 split_quantity_new = stack_max;
10058 else
10059 split_quantity_new = quantity;
10060
10062 {
10064
10065 if (new_item)
10066 {
10067 new_item.SetResultOfSplit(true);
10068 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10070 new_item.
SetQuantity(split_quantity_new,
false,
true);
10071 }
10072
10073 return new_item;
10074 }
10075 }
10076
10077 return null;
10078 }
10079
10081 {
10083 float split_quantity_new;
10085 if (destination_entity)
10086 {
10088 if (quantity > stackable)
10089 split_quantity_new = stackable;
10090 else
10091 split_quantity_new = quantity;
10092
10094 {
10095 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10096 if (new_item)
10097 {
10098 new_item.SetResultOfSplit(true);
10099 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10101 new_item.
SetQuantity(split_quantity_new,
false,
true);
10102 }
10103 }
10104 }
10105 }
10106
10108 {
10110 {
10111 if (ScriptInputUserData.CanStoreInputUserData())
10112 {
10113 ScriptInputUserData ctx = new ScriptInputUserData;
10118 ItemBase destination_entity =
this;
10119 ctx.
Write(destination_entity);
10123 }
10124 }
10125 else if (!
g_Game.IsMultiplayer())
10126 {
10128 }
10129 }
10130
10132 {
10134 float split_quantity_new;
10136 if (player)
10137 {
10139 if (quantity > stackable)
10140 split_quantity_new = stackable;
10141 else
10142 split_quantity_new = quantity;
10143
10145 {
10146 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10147 new_item =
ItemBase.Cast(in_hands);
10148 if (new_item)
10149 {
10150 new_item.SetResultOfSplit(true);
10151 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10153 new_item.SetQuantity(split_quantity_new, false, true);
10154 }
10155 }
10156 }
10157 }
10158
10160 {
10162 float split_quantity_new = Math.Floor(quantity * 0.5);
10163
10165 return;
10166
10168
10169 if (new_item)
10170 {
10171 if (new_item.GetQuantityMax() < split_quantity_new)
10172 {
10173 split_quantity_new = new_item.GetQuantityMax();
10174 }
10175
10176 new_item.SetResultOfSplit(true);
10177 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10178
10180 {
10183 }
10184 else
10185 {
10187 new_item.
SetQuantity(split_quantity_new,
false,
true);
10188 }
10189 }
10190 }
10191
10193 {
10195 float split_quantity_new = Math.Floor(quantity / 2);
10196
10198 return;
10199
10200 InventoryLocation invloc = new InventoryLocation;
10202
10204 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10205
10206 if (new_item)
10207 {
10208 if (new_item.GetQuantityMax() < split_quantity_new)
10209 {
10210 split_quantity_new = new_item.GetQuantityMax();
10211 }
10213 {
10216 }
10217 else if (split_quantity_new > 1)
10218 {
10220 new_item.
SetQuantity(split_quantity_new,
false,
true);
10221 }
10222 }
10223 }
10224
10227 {
10228 SetWeightDirty();
10230
10231 if (parent)
10232 parent.OnAttachmentQuantityChangedEx(this, delta);
10233
10235 {
10237 {
10239 }
10241 {
10242 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10244 }
10245 }
10246 }
10247
10250 {
10251
10252 }
10253
10256 {
10258 }
10259
10261 {
10262 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10263
10265 {
10266 if (newLevel == GameConstants.STATE_RUINED)
10267 {
10269 EntityAI parent = GetHierarchyParent();
10270 if (parent && parent.IsFireplace())
10271 {
10272 CargoBase cargo = GetInventory().GetCargo();
10273 if (cargo)
10274 {
10276 {
10278 }
10279 }
10280 }
10281 }
10282
10284 {
10285
10287 return;
10288 }
10289
10290 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10291 {
10293 }
10294 }
10295 }
10296
10297
10299 {
10300 super.OnRightClick();
10301
10303 {
10305 {
10306 if (ScriptInputUserData.CanStoreInputUserData())
10307 {
10308 EntityAI root = GetHierarchyRoot();
10309 Man playerOwner = GetHierarchyRootPlayer();
10310 InventoryLocation dst = new InventoryLocation;
10311
10312
10313 if (!playerOwner && root && root == this)
10314 {
10316 }
10317 else
10318 {
10319
10320 GetInventory().GetCurrentInventoryLocation(dst);
10322 {
10323 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10325 {
10327 }
10328 else
10329 {
10331
10332
10333 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10334 {
10336 }
10337 else
10338 {
10339 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10340 }
10341 }
10342 }
10343 }
10344
10345 ScriptInputUserData ctx = new ScriptInputUserData;
10353 }
10354 }
10355 else if (!
g_Game.IsMultiplayer())
10356 {
10358 }
10359 }
10360 }
10361
10363 {
10364 if (root)
10365 {
10366 vector m4[4];
10367 root.GetTransform(m4);
10368 dst.SetGround(this, m4);
10369 }
10370 else
10371 {
10372 GetInventory().GetCurrentInventoryLocation(dst);
10373 }
10374 }
10375
10376 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10377 {
10378
10379 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10380 return false;
10381
10382 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10383 return false;
10384
10385
10387 return false;
10388
10389
10390 Magazine mag = Magazine.Cast(this);
10391 if (mag)
10392 {
10393 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10394 return false;
10395
10396 if (stack_max_limit)
10397 {
10398 Magazine other_mag = Magazine.Cast(other_item);
10399 if (other_item)
10400 {
10401 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10402 return false;
10403 }
10404
10405 }
10406 }
10407 else
10408 {
10409
10411 return false;
10412
10414 return false;
10415 }
10416
10417 PlayerBase player = null;
10418 if (CastTo(player, GetHierarchyRootPlayer()))
10419 {
10420 if (player.GetInventory().HasAttachment(this))
10421 return false;
10422
10423 if (player.IsItemsToDelete())
10424 return false;
10425 }
10426
10427 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10428 return false;
10429
10430 int slotID;
10432 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10433 return false;
10434
10435 return true;
10436 }
10437
10439 {
10441 }
10442
10444 {
10445 return m_IsResultOfSplit;
10446 }
10447
10449 {
10450 m_IsResultOfSplit = value;
10451 }
10452
10454 {
10456 }
10457
10459 {
10460 float other_item_quantity = other_item.GetQuantity();
10461 float this_free_space;
10462
10464
10466
10467 if (other_item_quantity > this_free_space)
10468 {
10469 return this_free_space;
10470 }
10471 else
10472 {
10473 return other_item_quantity;
10474 }
10475 }
10476
10478 {
10480 }
10481
10483 {
10485 return;
10486
10487 if (!IsMagazine() && other_item)
10488 {
10490 if (quantity_used != 0)
10491 {
10492 float hp1 = GetHealth01("","");
10493 float hp2 = other_item.GetHealth01("","");
10494 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10495 hpResult = hpResult / (
GetQuantity() + quantity_used);
10496
10497 hpResult *= GetMaxHealth();
10498 Math.Round(hpResult);
10499 SetHealth("", "Health", hpResult);
10500
10502 other_item.AddQuantity(-quantity_used);
10503 }
10504 }
10506 }
10507
10509 {
10510 #ifdef SERVER
10511 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10512 GetHierarchyParent().IncreaseLifetimeUp();
10513 #endif
10514 };
10515
10517 {
10518 PlayerBase p = PlayerBase.Cast(player);
10519
10520 array<int> recipesIds = p.m_Recipes;
10521 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10522 if (moduleRecipesManager)
10523 {
10524 EntityAI itemInHands = player.GetEntityInHands();
10525 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10526 }
10527
10528 for (int i = 0;i < recipesIds.Count(); i++)
10529 {
10530 int key = recipesIds.Get(i);
10531 string recipeName = moduleRecipesManager.GetRecipeName(key);
10533 }
10534 }
10535
10536
10537 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10538 {
10539 super.GetDebugActions(outputList);
10540
10541
10547
10548
10553
10558
10559
10563
10564
10566 {
10570 }
10571
10574
10575
10579
10581
10582 InventoryLocation loc = new InventoryLocation();
10583 GetInventory().GetCurrentInventoryLocation(loc);
10585 {
10586 if (Gizmo_IsSupported())
10589 }
10590
10592 }
10593
10594
10595
10596
10598 {
10599 super.OnAction(action_id, player, ctx);
10600
10602 {
10603 switch (action_id)
10604 {
10608 return true;
10612 return true;
10613 }
10614 }
10615
10617 {
10618 switch (action_id)
10619 {
10621 Delete();
10622 return true;
10623 }
10624 }
10625
10626 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10627 {
10628 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10629 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10630 PlayerBase p = PlayerBase.Cast(player);
10631 if (
EActions.RECIPES_RANGE_START < 1000)
10632 {
10633 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10634 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10635 }
10636 }
10637 #ifndef SERVER
10638 else if (action_id ==
EActions.WATCH_PLAYER)
10639 {
10640 PluginDeveloper.SetDeveloperItemClientEx(player);
10641 }
10642 #endif
10644 {
10645 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10646 {
10647 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10648 OnDebugButtonPressServer(id + 1);
10649 }
10650
10651 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10652 {
10653 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10655 }
10656
10657 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10658 {
10659 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10661 }
10662
10663 else if (action_id ==
EActions.ADD_QUANTITY)
10664 {
10665 if (IsMagazine())
10666 {
10667 Magazine mag = Magazine.Cast(this);
10668 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10669 }
10670 else
10671 {
10673 }
10674
10675 if (m_EM)
10676 {
10677 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10678 }
10679
10680 }
10681
10682 else if (action_id ==
EActions.REMOVE_QUANTITY)
10683 {
10684 if (IsMagazine())
10685 {
10686 Magazine mag2 = Magazine.Cast(this);
10687 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10688 }
10689 else
10690 {
10692 }
10693 if (m_EM)
10694 {
10695 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10696 }
10697
10698 }
10699
10700 else if (action_id ==
EActions.SET_QUANTITY_0)
10701 {
10703
10704 if (m_EM)
10705 {
10706 m_EM.SetEnergy(0);
10707 }
10708 }
10709
10710 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10711 {
10713
10714 if (m_EM)
10715 {
10716 m_EM.SetEnergy(m_EM.GetEnergyMax());
10717 }
10718 }
10719
10720 else if (action_id ==
EActions.ADD_HEALTH)
10721 {
10722 AddHealth("","",GetMaxHealth("","Health")/5);
10723 }
10724 else if (action_id ==
EActions.REMOVE_HEALTH)
10725 {
10726 AddHealth("","",-GetMaxHealth("","Health")/5);
10727 }
10728 else if (action_id ==
EActions.DESTROY_HEALTH)
10729 {
10730 SetHealth01("","",0);
10731 }
10732 else if (action_id ==
EActions.WATCH_ITEM)
10733 {
10735 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10736 #ifdef DEVELOPER
10737 SetDebugDeveloper_item(this);
10738 #endif
10739 }
10740
10741 else if (action_id ==
EActions.ADD_TEMPERATURE)
10742 {
10743 AddTemperature(20);
10744
10745 }
10746
10747 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10748 {
10749 AddTemperature(-20);
10750
10751 }
10752
10753 else if (action_id ==
EActions.FLIP_FROZEN)
10754 {
10755 SetFrozen(!GetIsFrozen());
10756
10757 }
10758
10759 else if (action_id ==
EActions.ADD_WETNESS)
10760 {
10762
10763 }
10764
10765 else if (action_id ==
EActions.REMOVE_WETNESS)
10766 {
10768
10769 }
10770
10771 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10772 {
10775
10776
10777 }
10778
10779 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10780 {
10783 }
10784
10785 else if (action_id ==
EActions.MAKE_SPECIAL)
10786 {
10787 auto debugParams = DebugSpawnParams.WithPlayer(player);
10788 OnDebugSpawnEx(debugParams);
10789 }
10790
10791 }
10792
10793
10794 return false;
10795 }
10796
10797
10798
10799
10803
10806
10807
10808
10810 {
10811 return false;
10812 }
10813
10814
10816 {
10817 return true;
10818 }
10819
10820
10822 {
10823 return true;
10824 }
10825
10826
10827
10829 {
10830 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10831 return g_Game.ConfigIsExisting(config_path);
10832 }
10833
10836 {
10837 return null;
10838 }
10839
10841 {
10842 return false;
10843 }
10844
10846 {
10847 return false;
10848 }
10849
10853
10854
10856 {
10857 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10858 return module_repairing.CanRepair(this, item_repair_kit);
10859 }
10860
10861
10862 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10863 {
10864 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10865 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10866 }
10867
10868
10870 {
10871
10872
10873
10874
10875
10876
10877
10878
10879 return 1;
10880 }
10881
10882
10883
10885 {
10887 }
10888
10889
10890
10892 {
10894 }
10895
10896
10905 {
10906 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10907
10908 if (player)
10909 {
10910 player.MessageStatus(text);
10911 }
10912 }
10913
10914
10923 {
10924 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10925
10926 if (player)
10927 {
10928 player.MessageAction(text);
10929 }
10930 }
10931
10932
10941 {
10942 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10943
10944 if (player)
10945 {
10946 player.MessageFriendly(text);
10947 }
10948 }
10949
10950
10959 {
10960 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10961
10962 if (player)
10963 {
10964 player.MessageImportant(text);
10965 }
10966 }
10967
10969 {
10970 return true;
10971 }
10972
10973
10974 override bool KindOf(
string tag)
10975 {
10976 bool found = false;
10977 string item_name = this.
GetType();
10979 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10980
10981 int array_size = item_tag_array.Count();
10982 for (int i = 0; i < array_size; i++)
10983 {
10984 if (item_tag_array.Get(i) == tag)
10985 {
10986 found = true;
10987 break;
10988 }
10989 }
10990 return found;
10991 }
10992
10993
10995 {
10996
10997 super.OnRPC(sender, rpc_type,ctx);
10998
10999
11000 switch (rpc_type)
11001 {
11002 #ifndef SERVER
11003 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11004 Param2<bool, string> p = new Param2<bool, string>(false, "");
11005
11007 return;
11008
11009 bool play = p.param1;
11010 string soundSet = p.param2;
11011
11012 if (play)
11013 {
11015 {
11017 {
11019 }
11020 }
11021 else
11022 {
11024 }
11025 }
11026 else
11027 {
11029 }
11030
11031 break;
11032 #endif
11033
11034 }
11035
11037 {
11039 }
11040 }
11041
11042
11043
11044
11046 {
11047 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11048 return plugin.GetID(
name);
11049 }
11050
11052 {
11053 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11054 return plugin.GetName(id);
11055 }
11056
11059 {
11060
11061
11062 int varFlags;
11063 if (!ctx.
Read(varFlags))
11064 return;
11065
11066 if (varFlags & ItemVariableFlags.FLOAT)
11067 {
11069 }
11070 }
11071
11073 {
11074
11075 super.SerializeNumericalVars(floats_out);
11076
11077
11078
11080 {
11082 }
11083
11085 {
11087 }
11088
11090 {
11092 }
11093
11095 {
11100 }
11101
11103 {
11105 }
11106 }
11107
11109 {
11110
11111 super.DeSerializeNumericalVars(floats);
11112
11113
11114 int index = 0;
11115 int mask = Math.Round(floats.Get(index));
11116
11117 index++;
11118
11120 {
11122 {
11124 }
11125 else
11126 {
11127 float quantity = floats.Get(index);
11128 SetQuantity(quantity,
true,
false,
false,
false);
11129 }
11130 index++;
11131 }
11132
11134 {
11135 float wet = floats.Get(index);
11137 index++;
11138 }
11139
11141 {
11142 int liquidtype = Math.Round(floats.Get(index));
11144 index++;
11145 }
11146
11148 {
11150 index++;
11152 index++;
11154 index++;
11156 index++;
11157 }
11158
11160 {
11161 int cleanness = Math.Round(floats.Get(index));
11163 index++;
11164 }
11165 }
11166
11168 {
11169 super.WriteVarsToCTX(ctx);
11170
11171
11173 {
11175 }
11176
11178 {
11180 }
11181
11183 {
11185 }
11186
11188 {
11189 int r,g,b,a;
11195 }
11196
11198 {
11200 }
11201 }
11202
11204 {
11205 if (!super.ReadVarsFromCTX(ctx,version))
11206 return false;
11207
11208 int intValue;
11209 float value;
11210
11211 if (version < 140)
11212 {
11213 if (!ctx.
Read(intValue))
11214 return false;
11215
11216 m_VariablesMask = intValue;
11217 }
11218
11220 {
11221 if (!ctx.
Read(value))
11222 return false;
11223
11225 {
11227 }
11228 else
11229 {
11231 }
11232 }
11233
11234 if (version < 140)
11235 {
11237 {
11238 if (!ctx.
Read(value))
11239 return false;
11240 SetTemperatureDirect(value);
11241 }
11242 }
11243
11245 {
11246 if (!ctx.
Read(value))
11247 return false;
11249 }
11250
11252 {
11253 if (!ctx.
Read(intValue))
11254 return false;
11256 }
11257
11259 {
11260 int r,g,b,a;
11262 return false;
11264 return false;
11266 return false;
11268 return false;
11269
11271 }
11272
11274 {
11275 if (!ctx.
Read(intValue))
11276 return false;
11278 }
11279
11280 if (version >= 138 && version < 140)
11281 {
11283 {
11284 if (!ctx.
Read(intValue))
11285 return false;
11286 SetFrozen(intValue);
11287 }
11288 }
11289
11290 return true;
11291 }
11292
11293
11295 {
11298 {
11300 }
11301
11302 if (!super.OnStoreLoad(ctx, version))
11303 {
11305 return false;
11306 }
11307
11308 if (version >= 114)
11309 {
11310 bool hasQuickBarIndexSaved;
11311
11312 if (!ctx.
Read(hasQuickBarIndexSaved))
11313 {
11315 return false;
11316 }
11317
11318 if (hasQuickBarIndexSaved)
11319 {
11320 int itmQBIndex;
11321
11322
11323 if (!ctx.
Read(itmQBIndex))
11324 {
11326 return false;
11327 }
11328
11329 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11330 if (itmQBIndex != -1 && parentPlayer)
11331 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11332 }
11333 }
11334 else
11335 {
11336
11337 PlayerBase player;
11338 int itemQBIndex;
11339 if (version ==
int.
MAX)
11340 {
11341 if (!ctx.
Read(itemQBIndex))
11342 {
11344 return false;
11345 }
11346 }
11347 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11348 {
11349
11350 if (!ctx.
Read(itemQBIndex))
11351 {
11353 return false;
11354 }
11355 if (itemQBIndex != -1 && player)
11356 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11357 }
11358 }
11359
11360 if (version < 140)
11361 {
11362
11363 if (!LoadVariables(ctx, version))
11364 {
11366 return false;
11367 }
11368 }
11369
11370
11372 {
11374 return false;
11375 }
11376 if (version >= 132)
11377 {
11379 if (raib)
11380 {
11382 {
11384 return false;
11385 }
11386 }
11387 }
11388
11390 return true;
11391 }
11392
11393
11394
11396 {
11397 super.OnStoreSave(ctx);
11398
11399 PlayerBase player;
11400 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11401 {
11403
11404 int itemQBIndex = -1;
11405 itemQBIndex = player.FindQuickBarEntityIndex(this);
11406 ctx.
Write(itemQBIndex);
11407 }
11408 else
11409 {
11411 }
11412
11414
11416 if (raib)
11417 {
11419 }
11420 }
11421
11422
11424 {
11425 super.AfterStoreLoad();
11426
11428 {
11430 }
11431
11433 {
11436 }
11437 }
11438
11440 {
11441 super.EEOnAfterLoad();
11442
11444 {
11446 }
11447
11450 }
11451
11453 {
11454 return false;
11455 }
11456
11457
11458
11460 {
11462 {
11463 #ifdef PLATFORM_CONSOLE
11464
11466 {
11468 if (menu)
11469 {
11471 }
11472 }
11473 #endif
11474 }
11475
11477 {
11480 }
11481
11483 {
11484 SetWeightDirty();
11486 }
11488 {
11491 }
11492
11494 {
11497
11500 }
11502 {
11506 }
11507
11508 super.OnVariablesSynchronized();
11509 }
11510
11511
11512
11514 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11515 {
11516 if (!IsServerCheck(allow_client))
11517 return false;
11518
11520 return false;
11521
11524
11525 if (value <= (min + 0.001))
11526 value = min;
11527
11528 if (value == min)
11529 {
11530 if (destroy_config)
11531 {
11532 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11533 if (dstr)
11534 {
11536 this.Delete();
11537 return true;
11538 }
11539 }
11540 else if (destroy_forced)
11541 {
11543 this.Delete();
11544 return true;
11545 }
11546
11548 }
11549
11552
11554 {
11555 EntityAI parent = GetHierarchyRoot();
11556 InventoryLocation iLoc = new InventoryLocation();
11557 GetInventory().GetCurrentInventoryLocation(iLoc);
11559 {
11560 int iLocSlot = iLoc.
GetSlot();
11562 {
11564 }
11566 {
11568 }
11569 }
11570 }
11571
11573 {
11575
11576 if (delta)
11578 }
11579
11581
11582 return false;
11583 }
11584
11585
11587 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11588 {
11590 }
11591
11593 {
11596 }
11597
11599 {
11602 }
11603
11605 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11606 {
11607 float value_clamped = Math.Clamp(value, 0, 1);
11609 SetQuantity(result, destroy_config, destroy_forced);
11610 }
11611
11612
11615 {
11617 }
11618
11620 {
11622 }
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11634 {
11635 int slot = -1;
11636 GameInventory inventory = GetInventory();
11637 if (inventory)
11638 {
11639 InventoryLocation il = new InventoryLocation;
11642 }
11643
11645 }
11646
11648 {
11649 float quantity_max = 0;
11650
11652 {
11653 if (attSlotID != -1)
11654 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11655
11656 if (quantity_max <= 0)
11658 }
11659
11660 if (quantity_max <= 0)
11662
11663 return quantity_max;
11664 }
11665
11667 {
11669 }
11670
11672 {
11674 }
11675
11676
11678 {
11680 }
11681
11683 {
11685 }
11686
11688 {
11690 }
11691
11692
11694 {
11695
11696 float weightEx = GetWeightEx();
11697 float special = GetInventoryAndCargoWeight();
11698 return weightEx - special;
11699 }
11700
11701
11703 {
11705 }
11706
11708 {
11710 {
11711 #ifdef DEVELOPER
11712 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11713 {
11714 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11716 }
11717 #endif
11718
11719 return GetQuantity() * GetConfigWeightModified();
11720 }
11721 else if (HasEnergyManager())
11722 {
11723 #ifdef DEVELOPER
11724 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11725 {
11726 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11727 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11728 }
11729 #endif
11730 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11731 }
11732 else
11733 {
11734 #ifdef DEVELOPER
11735 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11736 {
11737 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11738 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11739 }
11740 #endif
11741 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11742 }
11743 }
11744
11747 {
11748 int item_count = 0;
11750
11751 GameInventory inventory = GetInventory();
11752 CargoBase cargo = inventory.
GetCargo();
11753 if (cargo != NULL)
11754 {
11756 }
11757
11759 for (int i = 0; i < nAttachments; ++i)
11760 {
11762 if (item)
11763 item_count += item.GetNumberOfItems();
11764 }
11765 return item_count;
11766 }
11767
11770 {
11771 float weight = 0;
11772 float wetness = 1;
11773 if (include_wetness)
11776 {
11777 weight = wetness * m_ConfigWeight;
11778 }
11780 {
11781 weight = 1;
11782 }
11783 return weight;
11784 }
11785
11786
11787
11789 {
11790 GameInventory inventory = GetInventory();
11791 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11792 {
11793 array<EntityAI> items = new array<EntityAI>;
11795 for (int i = 0; i < items.Count(); ++i)
11796 {
11798 if (item)
11799 {
11800 g_Game.ObjectDelete(item);
11801 }
11802 }
11803 }
11804 }
11805
11806
11807
11808
11810 {
11811 float energy = 0;
11812 if (HasEnergyManager())
11813 {
11814 energy = GetCompEM().GetEnergy();
11815 }
11816 return energy;
11817 }
11818
11819
11821 {
11822 super.OnEnergyConsumed();
11823
11825 }
11826
11828 {
11829 super.OnEnergyAdded();
11830
11832 }
11833
11834
11836 {
11837 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11838 {
11840 {
11841 float energy_0to1 = GetCompEM().GetEnergy0To1();
11843 }
11844 }
11845 }
11846
11847
11849 {
11850 return ConfigGetFloat("heatIsolation");
11851 }
11852
11854 {
11856 }
11857
11859 {
11860 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11861 if (
g_Game.ConfigIsExisting(paramPath))
11862 return g_Game.ConfigGetFloat(paramPath);
11863
11864 return 0.0;
11865 }
11866
11868 {
11869 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11870 if (
g_Game.ConfigIsExisting(paramPath))
11871 return g_Game.ConfigGetFloat(paramPath);
11872
11873 return 0.0;
11874 }
11875
11876 override void SetWet(
float value,
bool allow_client =
false)
11877 {
11878 if (!IsServerCheck(allow_client))
11879 return;
11880
11883
11885
11886 m_VarWet = Math.Clamp(value, min, max);
11887
11889 {
11892 }
11893 }
11894
11895 override void AddWet(
float value)
11896 {
11898 }
11899
11901 {
11903 }
11904
11906 {
11908 }
11909
11911 {
11913 }
11914
11916 {
11918 }
11919
11921 {
11923 }
11924
11925 override void OnWetChanged(
float newVal,
float oldVal)
11926 {
11929 if (newLevel != oldLevel)
11930 {
11932 }
11933 }
11934
11936 {
11937 SetWeightDirty();
11938 }
11939
11941 {
11942 return GetWetLevelInternal(
m_VarWet);
11943 }
11944
11945
11946
11948 {
11950 }
11951
11953 {
11955 }
11956
11958 {
11960 }
11961
11963 {
11965 }
11966
11967
11968
11970 {
11971 if (ConfigIsExisting("itemModelLength"))
11972 {
11973 return ConfigGetFloat("itemModelLength");
11974 }
11975 return 0;
11976 }
11977
11979 {
11980 if (ConfigIsExisting("itemAttachOffset"))
11981 {
11982 return ConfigGetFloat("itemAttachOffset");
11983 }
11984 return 0;
11985 }
11986
11987 override void SetCleanness(
int value,
bool allow_client =
false)
11988 {
11989 if (!IsServerCheck(allow_client))
11990 return;
11991
11993
11995
11998 }
11999
12001 {
12003 }
12004
12006 {
12007 return true;
12008 }
12009
12010
12011
12012
12014 {
12016 }
12017
12019 {
12021 }
12022
12023
12024
12025
12026 override void SetColor(
int r,
int g,
int b,
int a)
12027 {
12033 }
12035 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12036 {
12041 }
12042
12044 {
12046 }
12047
12050 {
12051 int r,g,b,a;
12053 r = r/255;
12054 g = g/255;
12055 b = b/255;
12056 a = a/255;
12057 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12058 }
12059
12060
12061
12062 override void SetLiquidType(
int value,
bool allow_client =
false)
12063 {
12064 if (!IsServerCheck(allow_client))
12065 return;
12066
12071 }
12072
12074 {
12075 return ConfigGetInt("varLiquidTypeInit");
12076 }
12077
12079 {
12081 }
12082
12084 {
12086 SetFrozen(false);
12087 }
12088
12091 {
12092 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12093 }
12094
12095
12098 {
12099 PlayerBase nplayer;
12100 if (PlayerBase.CastTo(nplayer, player))
12101 {
12103 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12104 }
12105 }
12106
12107
12110 {
12111 PlayerBase nplayer;
12112 if (PlayerBase.CastTo(nplayer,player))
12113 {
12114 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12115 }
12116
12117 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12118
12119 if (HasEnergyManager())
12120 {
12121 GetCompEM().UpdatePlugState();
12122 }
12123 }
12124
12125
12127 {
12128 super.OnPlacementStarted(player);
12129
12131 }
12132
12133 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12134 {
12136 {
12137 m_AdminLog.OnPlacementComplete(player,
this);
12138 }
12139
12140 super.OnPlacementComplete(player, position, orientation);
12141 }
12142
12143
12144
12145
12146
12148 {
12150 {
12151 return true;
12152 }
12153 else
12154 {
12155 return false;
12156 }
12157 }
12158
12159
12161 {
12163 {
12165 }
12166 }
12167
12168
12170 {
12172 }
12173
12175 {
12177 }
12178
12179 override void InsertAgent(
int agent,
float count = 1)
12180 {
12181 if (count < 1)
12182 return;
12183
12185 }
12186
12189 {
12191 }
12192
12193
12195 {
12197 }
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12241 {
12243 return false;
12244 return true;
12245 }
12246
12248 {
12249
12251 }
12252
12253
12256 {
12257 super.CheckForRoofLimited(timeTresholdMS);
12258
12259 float time =
g_Game.GetTime();
12260 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12261 {
12262 m_PreviousRoofTestTime = time;
12263 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12264 }
12265 }
12266
12267
12269 {
12271 {
12272 return 0;
12273 }
12274
12275 if (GetInventory().GetAttachmentSlotsCount() != 0)
12276 {
12277 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12278 if (filter)
12279 return filter.GetProtectionLevel(type, false, system);
12280 else
12281 return 0;
12282 }
12283
12284 string subclassPath, entryName;
12285
12286 switch (type)
12287 {
12289 entryName = "biological";
12290 break;
12292 entryName = "chemical";
12293 break;
12294 default:
12295 entryName = "biological";
12296 break;
12297 }
12298
12299 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12300
12301 return g_Game.ConfigGetFloat(subclassPath + entryName);
12302 }
12303
12304
12305
12308 {
12309 if (!IsMagazine())
12311
12313 }
12314
12315
12316
12317
12318
12323 {
12324 return true;
12325 }
12326
12328 {
12330 }
12331
12332
12333
12334
12335
12337 {
12338 if (parent)
12339 {
12340 if (parent.IsInherited(DayZInfected))
12341 return true;
12342
12343 if (!parent.IsRuined())
12344 return true;
12345 }
12346
12347 return true;
12348 }
12349
12351 {
12352 if (!super.CanPutAsAttachment(parent))
12353 {
12354 return false;
12355 }
12356
12357 if (!IsRuined() && !parent.IsRuined())
12358 {
12359 return true;
12360 }
12361
12362 return false;
12363 }
12364
12366 {
12367
12368
12369
12370
12371 return super.CanReceiveItemIntoCargo(item);
12372 }
12373
12375 {
12376
12377
12378
12379
12380 GameInventory attachmentInv = attachment.GetInventory();
12382 {
12383 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12384 return false;
12385 }
12386
12387 InventoryLocation loc = new InventoryLocation();
12388 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12389 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12390 return false;
12391
12392 return super.CanReceiveAttachment(attachment, slotId);
12393 }
12394
12396 {
12397 if (!super.CanReleaseAttachment(attachment))
12398 return false;
12399
12400 return GetInventory().AreChildrenAccessible();
12401 }
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12424 {
12425 int id = muzzle_owner.GetMuzzleID();
12426 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12427
12428 if (WPOF_array)
12429 {
12430 for (int i = 0; i < WPOF_array.Count(); i++)
12431 {
12432 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12433
12434 if (WPOF)
12435 {
12436 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12437 }
12438 }
12439 }
12440 }
12441
12442
12444 {
12445 int id = muzzle_owner.GetMuzzleID();
12447
12448 if (WPOBE_array)
12449 {
12450 for (int i = 0; i < WPOBE_array.Count(); i++)
12451 {
12452 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12453
12454 if (WPOBE)
12455 {
12456 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12497 }
12498 }
12499 }
12500 }
12501
12502
12504 {
12505 int id = muzzle_owner.GetMuzzleID();
12506 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12507
12508 if (WPOOH_array)
12509 {
12510 for (int i = 0; i < WPOOH_array.Count(); i++)
12511 {
12512 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12513
12514 if (WPOOH)
12515 {
12516 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12517 }
12518 }
12519 }
12520 }
12521
12522
12523
12525 {
12527 {
12528 return true;
12529 }
12530
12531 return false;
12532 }
12533
12535 {
12537 {
12538 return true;
12539 }
12540
12541 return false;
12542 }
12543
12545 {
12547 {
12548 return true;
12549 }
12550
12551 return false;
12552 }
12553
12555 {
12556 return false;
12557 }
12558
12561 {
12562 return UATimeSpent.DEFAULT_DEPLOY;
12563 }
12564
12565
12566
12567
12569 {
12571 SetSynchDirty();
12572 }
12573
12575 {
12577 }
12578
12579
12581 {
12582 return false;
12583 }
12584
12587 {
12588 string att_type = "None";
12589
12590 if (ConfigIsExisting("soundAttType"))
12591 {
12592 att_type = ConfigGetString("soundAttType");
12593 }
12594
12596 }
12597
12599 {
12601 }
12602
12603
12604
12605
12606
12612
12614 {
12617
12619 }
12620
12621
12623 {
12625 return;
12626
12628
12631
12634
12635 SoundParameters params = new SoundParameters();
12639 }
12640
12641
12643 {
12645 {
12648
12649 SetSynchDirty();
12650
12653 }
12654 }
12655
12657 {
12659 }
12660
12661
12663 {
12665 return;
12666
12668 SetSynchDirty();
12669
12672 }
12673
12675 {
12678 }
12679
12681 {
12683 }
12684
12685 void OnApply(PlayerBase player);
12686
12688 {
12689 return 1.0;
12690 };
12691
12693 {
12695 }
12696
12698 {
12700 }
12701
12703
12705 {
12706 SetDynamicPhysicsLifeTime(0.01);
12708 }
12709
12711 {
12712 array<string> zone_names = new array<string>;
12713 GetDamageZones(zone_names);
12714 for (int i = 0; i < zone_names.Count(); i++)
12715 {
12716 SetHealthMax(zone_names.Get(i),"Health");
12717 }
12718 SetHealthMax("","Health");
12719 }
12720
12723 {
12724 float global_health = GetHealth01("","Health");
12725 array<string> zones = new array<string>;
12726 GetDamageZones(zones);
12727
12728 for (int i = 0; i < zones.Count(); i++)
12729 {
12730 SetHealth01(zones.Get(i),"Health",global_health);
12731 }
12732 }
12733
12736 {
12737 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12738 }
12739
12741 {
12742 if (!hasRootAsPlayer)
12743 {
12744 if (refParentIB)
12745 {
12746
12747 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12748 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12749
12750 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12751 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12752
12755 }
12756 else
12757 {
12758
12761 }
12762 }
12763 }
12764
12766 {
12768 {
12769 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12770 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12771 {
12772 float heatPermCoef = 1.0;
12774 while (ent)
12775 {
12776 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12777 ent = ent.GetHierarchyParent();
12778 }
12779
12780 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12781 }
12782 }
12783 }
12784
12786 {
12787
12788 EntityAI parent = GetHierarchyParent();
12789 if (!parent)
12790 {
12791 hasParent = false;
12792 hasRootAsPlayer = false;
12793 }
12794 else
12795 {
12796 hasParent = true;
12797 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12798 refParentIB =
ItemBase.Cast(parent);
12799 }
12800 }
12801
12802 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12803 {
12804
12805 }
12806
12808 {
12809
12810 return false;
12811 }
12812
12814 {
12815
12816
12817 return false;
12818 }
12819
12821 {
12822
12823 return false;
12824 }
12825
12828 {
12829 return !GetIsFrozen() &&
IsOpen();
12830 }
12831
12833 {
12834 bool hasParent = false, hasRootAsPlayer = false;
12836
12837 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12838 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12839
12840 if (wwtu || foodDecay)
12841 {
12845
12846 if (processWetness || processTemperature || processDecay)
12847 {
12849
12850 if (processWetness)
12851 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12852
12853 if (processTemperature)
12855
12856 if (processDecay)
12857 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12858 }
12859 }
12860 }
12861
12864 {
12866 }
12867
12869 {
12872
12873 return super.GetTemperatureFreezeThreshold();
12874 }
12875
12877 {
12880
12881 return super.GetTemperatureThawThreshold();
12882 }
12883
12885 {
12888
12889 return super.GetItemOverheatThreshold();
12890 }
12891
12893 {
12895 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12896
12897 return super.GetTemperatureFreezeTime();
12898 }
12899
12901 {
12903 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12904
12905 return super.GetTemperatureThawTime();
12906 }
12907
12912
12914 {
12915 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12916 }
12917
12919 {
12920 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12921 }
12922
12925 {
12927 }
12928
12930 {
12932 }
12933
12935 {
12937 }
12938
12941 {
12942 return null;
12943 }
12944
12947 {
12948 return false;
12949 }
12950
12952 {
12954 {
12957 if (!trg)
12958 {
12960 explosive = this;
12961 }
12962
12963 explosive.PairRemote(trg);
12965
12966 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12967 trg.SetPersistentPairID(persistentID);
12968 explosive.SetPersistentPairID(persistentID);
12969
12970 return true;
12971 }
12972 return false;
12973 }
12974
12977 {
12978 float ret = 1.0;
12981 ret *= GetHealth01();
12982
12983 return ret;
12984 }
12985
12986 #ifdef DEVELOPER
12987 override void SetDebugItem()
12988 {
12989 super.SetDebugItem();
12990 _itemBase = this;
12991 }
12992
12994 {
12995 string text = super.GetDebugText();
12996
12998 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12999
13000 return text;
13001 }
13002 #endif
13003
13005 {
13006 return true;
13007 }
13008
13010
13012
13014 {
13017 }
13018
13019
13027
13043
13044 [
Obsolete(
"Use ItemSoundHandler instead")]
13047 {
13048 if (!
g_Game.IsDedicatedServer())
13049 {
13050 if (ConfigIsExisting("attachSoundSet"))
13051 {
13052 string cfg_path = "";
13053 string soundset = "";
13054 string type_name =
GetType();
13055
13058 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13059 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13060
13061 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13062 {
13063 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13064 {
13065 if (cfg_slot_array[i] == slot_type)
13066 {
13067 soundset = cfg_soundset_array[i];
13068 break;
13069 }
13070 }
13071 }
13072
13073 if (soundset != "")
13074 {
13075 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13077 }
13078 }
13079 }
13080 }
13081
13083}
13084
13086{
13088 if (entity)
13089 {
13090 bool is_item = entity.IsInherited(
ItemBase);
13091 if (is_item && full_quantity)
13092 {
13095 }
13096 }
13097 else
13098 {
13100 return NULL;
13101 }
13102 return entity;
13103}
13104
13106{
13107 if (item)
13108 {
13109 if (health > 0)
13110 item.SetHealth("", "", health);
13111
13112 if (item.CanHaveTemperature())
13113 {
13115 if (item.CanFreeze())
13116 item.SetFrozen(false);
13117 }
13118
13119 if (item.HasEnergyManager())
13120 {
13121 if (quantity >= 0)
13122 {
13123 item.GetCompEM().SetEnergy0To1(quantity);
13124 }
13125 else
13126 {
13128 }
13129 }
13130 else if (item.IsMagazine())
13131 {
13132 Magazine mag = Magazine.Cast(item);
13133 if (quantity >= 0)
13134 {
13135 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13136 }
13137 else
13138 {
13140 }
13141
13142 }
13143 else
13144 {
13145 if (quantity >= 0)
13146 {
13147 item.SetQuantityNormalized(quantity, false);
13148 }
13149 else
13150 {
13152 }
13153
13154 }
13155 }
13156}
13157
13158#ifdef DEVELOPER
13160#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.