8319{
8321 {
8322 return true;
8323 }
8324};
8325
8327{
8328
8329};
8330
8331
8332
8334{
8338
8340
8343
8344
8345
8346
8347
8356
8362
8367
8372
8393 protected bool m_IsResultOfSplit
8394
8396
8401
8402
8403
8405
8409
8410
8411
8413
8416
8417
8418
8424
8425
8433
8436
8437
8439
8440
8442
8443
8448
8449
8454
8456
8457
8459
8460
8462 {
8467
8468 if (!
g_Game.IsDedicatedServer())
8469 {
8471 {
8473
8475 {
8477 }
8478 }
8479
8482 }
8483
8484 m_OldLocation = null;
8485
8487 {
8489 }
8490
8491 if (ConfigIsExisting("headSelectionsToHide"))
8492 {
8495 }
8496
8498 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8499 {
8501 }
8502
8504
8505 m_IsResultOfSplit = false;
8506
8508 }
8509
8511 {
8512 super.InitItemVariables();
8513
8519 m_Count = ConfigGetInt(
"count");
8520
8523
8528
8531
8536
8548
8552
8553
8556 if (ConfigIsExisting("canBeSplit"))
8557 {
8560 }
8561
8563 if (ConfigIsExisting("itemBehaviour"))
8565
8566
8569 RegisterNetSyncVariableInt("m_VarLiquidType");
8570 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8571
8572 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8573 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8574 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8575
8576 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8577 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8578 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8579 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8580
8581 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8582 RegisterNetSyncVariableBool("m_IsTakeable");
8583 RegisterNetSyncVariableBool("m_IsHologram");
8584
8587 {
8590 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8591 }
8592
8594
8596 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8598
8600 }
8601
8603 {
8605 }
8606
8608 {
8611 {
8616 }
8617 }
8618
8619 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8620 {
8622 {
8625 }
8626
8628 }
8629
8631 {
8637 }
8638
8640
8642 {
8644
8645 if (!action)
8646 {
8647 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8648 return;
8649 }
8650
8652 if (!ai)
8653 {
8655 return;
8656 }
8657
8659 if (!action_array)
8660 {
8661 action_array = new array<ActionBase_Basic>;
8663 }
8664 if (LogManager.IsActionLogEnable())
8665 {
8666 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8667 }
8668
8669 if (action_array.Find(action) != -1)
8670 {
8671 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8672 }
8673 else
8674 {
8675 action_array.Insert(action);
8676 }
8677 }
8678
8680 {
8681 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8682 ActionBase action = player.GetActionManager().GetAction(actionName);
8685
8686 if (action_array)
8687 {
8688 action_array.RemoveItem(action);
8689 }
8690 }
8691
8692
8693
8695 {
8696 ActionOverrideData overrideData = new ActionOverrideData();
8700
8702 if (!actionMap)
8703 {
8706 }
8707
8708 actionMap.Insert(this.
Type(), overrideData);
8709
8710 }
8711
8713
8715
8716
8718 {
8721
8724
8725 string config_to_search = "CfgVehicles";
8726 string muzzle_owner_config;
8727
8729 {
8730 if (IsInherited(Weapon))
8731 config_to_search = "CfgWeapons";
8732
8733 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8734
8735 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8736
8737 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8738
8739 if (config_OnFire_subclass_count > 0)
8740 {
8741 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8742
8743 for (int i = 0; i < config_OnFire_subclass_count; i++)
8744 {
8745 string particle_class = "";
8746 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8747 string config_OnFire_entry = config_OnFire_class + particle_class;
8748 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8749 WPOF_array.Insert(WPOF);
8750 }
8751
8752
8754 }
8755 }
8756
8758 {
8759 config_to_search = "CfgWeapons";
8760 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8761
8762 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8763
8764 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8765
8766 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8767 {
8768 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8769
8770 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8771 {
8772 string particle_class2 = "";
8773 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8774 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8775 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8776 WPOBE_array.Insert(WPOBE);
8777 }
8778
8779
8781 }
8782 }
8783 }
8784
8785
8787 {
8790
8792 {
8793 string config_to_search = "CfgVehicles";
8794
8795 if (IsInherited(Weapon))
8796 config_to_search = "CfgWeapons";
8797
8798 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8799 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8800
8801 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8802 {
8803
8805
8807 {
8809 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8811 return;
8812 }
8813
8816
8817
8818
8819 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8820 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8821
8822 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8823 {
8824 string particle_class = "";
8825 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8826 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8827 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8828
8829 if (entry_type == CT_CLASS)
8830 {
8831 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8832 WPOOH_array.Insert(WPOF);
8833 }
8834 }
8835
8836
8838 }
8839 }
8840 }
8841
8843 {
8845 }
8846
8848 {
8850 {
8852
8855
8858
8859 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8860 }
8861 }
8862
8864 {
8866 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8867
8869 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8870
8872 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8873
8875 {
8877 }
8878 }
8879
8881 {
8883 }
8884
8886 {
8889 else
8891
8893 {
8896 }
8897 else
8898 {
8901
8904 }
8905
8907 }
8908
8910 {
8912 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8913 }
8914
8916 {
8918 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8920 }
8921
8923 {
8925 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8926 }
8927
8929 {
8932
8933 OverheatingParticle OP = new OverheatingParticle();
8938
8940 }
8941
8943 {
8946
8947 return -1;
8948 }
8949
8951 {
8953 {
8956
8957 for (int i = count; i > 0; --i)
8958 {
8959 int id = i - 1;
8962
8965
8966 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8967 {
8968 if (p)
8969 {
8972 }
8973 }
8974 }
8975 }
8976 }
8977
8979 {
8981 {
8983 {
8984 int id = i - 1;
8986
8987 if (OP)
8988 {
8990
8991 if (p)
8992 {
8994 }
8995
8996 delete OP;
8997 }
8998 }
8999
9002 }
9003 }
9004
9007 {
9008 return 0.0;
9009 }
9010
9011
9013 {
9014 return 250;
9015 }
9016
9018 {
9019 return 0;
9020 }
9021
9024 {
9026 return true;
9027
9028 return false;
9029 }
9030
9033 {
9036
9038 {
9040 }
9041 else
9042 {
9043
9045 }
9046
9048 }
9049
9056 {
9057 return -1;
9058 }
9059
9060
9061
9062
9064 {
9066 {
9067 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9068 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9069
9070 if (r_index >= 0)
9071 {
9072 InventoryLocation r_il = new InventoryLocation;
9073 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9074
9075 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9078 {
9079 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9080 }
9082 {
9083 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9084 }
9085
9086 }
9087
9088 player.GetHumanInventory().ClearUserReservedLocation(this);
9089 }
9090
9093 }
9094
9095
9096
9097
9099 {
9100 return ItemBase.m_DebugActionsMask;
9101 }
9102
9104 {
9105 return ItemBase.m_DebugActionsMask & mask;
9106 }
9107
9109 {
9110 ItemBase.m_DebugActionsMask = mask;
9111 }
9112
9114 {
9115 ItemBase.m_DebugActionsMask |= mask;
9116 }
9117
9119 {
9120 ItemBase.m_DebugActionsMask &= ~mask;
9121 }
9122
9124 {
9126 {
9128 }
9129 else
9130 {
9132 }
9133 }
9134
9135
9137 {
9138 if (GetEconomyProfile())
9139 {
9140 float q_max = GetEconomyProfile().GetQuantityMax();
9141 if (q_max > 0)
9142 {
9143 float q_min = GetEconomyProfile().GetQuantityMin();
9144 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9145
9147 {
9148 ComponentEnergyManager comp = GetCompEM();
9150 {
9152 }
9153 }
9155 {
9157
9158 }
9159
9160 }
9161 }
9162 }
9163
9166 {
9167 EntityAI parent = GetHierarchyParent();
9168
9169 if (parent)
9170 {
9171 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9172 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9173 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9174 }
9175 }
9176
9179 {
9180 EntityAI parent = GetHierarchyParent();
9181
9182 if (parent)
9183 {
9184 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9185 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9186 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9187 }
9188 }
9189
9191 {
9192
9193
9194
9195
9197
9199 {
9200 if (ScriptInputUserData.CanStoreInputUserData())
9201 {
9202 ScriptInputUserData ctx = new ScriptInputUserData;
9208 ctx.
Write(use_stack_max);
9211
9213 {
9214 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9215 }
9216 }
9217 }
9218 else if (!
g_Game.IsMultiplayer())
9219 {
9221 }
9222 }
9223
9225 {
9227 }
9228
9230 {
9232 }
9233
9235 {
9237 }
9238
9240 {
9241
9242 return false;
9243 }
9244
9246 {
9247 return false;
9248 }
9249
9253 {
9254 return false;
9255 }
9256
9258 {
9259 return "";
9260 }
9261
9263
9265 {
9266 return false;
9267 }
9268
9270 {
9271 return true;
9272 }
9273
9274
9275
9277 {
9278 return true;
9279 }
9280
9282 {
9283 return true;
9284 }
9285
9287 {
9288 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9290 }
9291
9293 {
9295 }
9296
9298 {
9300 if (!is_being_placed)
9302 SetSynchDirty();
9303 }
9304
9305
9307
9309 {
9311 }
9312
9314 {
9316 }
9317
9319 {
9320 return 1;
9321 }
9322
9324 {
9325 return false;
9326 }
9327
9329 {
9331 SetSynchDirty();
9332 }
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9369 {
9370 super.OnMovedInsideCargo(container);
9371
9372 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9373 }
9374
9375 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9376 {
9377 super.EEItemLocationChanged(oldLoc, newLoc);
9378
9379 PlayerBase newPlayer = null;
9380 PlayerBase oldPlayer = null;
9381
9382 if (newLoc.GetParent())
9383 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9384
9385 if (oldLoc.GetParent())
9386 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9387
9389 {
9390 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9391
9392 if (rIndex >= 0)
9393 {
9394 InventoryLocation rIl = new InventoryLocation;
9395 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9396
9397 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9400 {
9401 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9402 }
9404 {
9406 }
9407
9408 }
9409 }
9410
9412 {
9413 if (newPlayer)
9414 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9415
9416 if (newPlayer == oldPlayer)
9417 {
9418 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9419 {
9421 {
9422 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9423 {
9424 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9425 }
9426 }
9427 else
9428 {
9429 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9430 }
9431 }
9432
9433 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9434 {
9435 int type = oldLoc.GetType();
9437 {
9438 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9439 }
9441 {
9442 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9443 }
9444 }
9445 if (!m_OldLocation)
9446 {
9447 m_OldLocation = new InventoryLocation;
9448 }
9449 m_OldLocation.Copy(oldLoc);
9450 }
9451 else
9452 {
9453 if (m_OldLocation)
9454 {
9455 m_OldLocation.Reset();
9456 }
9457 }
9458
9459 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9460 }
9461 else
9462 {
9463 if (newPlayer)
9464 {
9465 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9466 if (resIndex >= 0)
9467 {
9468 InventoryLocation il = new InventoryLocation;
9469 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9471 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9474 {
9475 il.
GetParent().GetOnReleaseLock().Invoke(it);
9476 }
9478 {
9480 }
9481
9482 }
9483 }
9485 {
9486
9488 }
9489
9490 if (m_OldLocation)
9491 {
9492 m_OldLocation.Reset();
9493 }
9494 }
9495
9497 {
9498 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9499 }
9500
9502 {
9503 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9504 }
9505 }
9506
9507 override void EOnContact(IEntity other, Contact extra)
9508 {
9510 {
9511 int liquidType = -1;
9513 if (impactSpeed > 0.0)
9514 {
9516 #ifndef SERVER
9518 #else
9520 SetSynchDirty();
9521 #endif
9523 }
9524 }
9525
9526 #ifdef SERVER
9527 if (GetCompEM() && GetCompEM().IsPlugged())
9528 {
9529 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9530 GetCompEM().UnplugThis();
9531 }
9532 #endif
9533 }
9534
9536
9538 {
9540 }
9541
9543 {
9544
9545 }
9546
9548 {
9549 super.OnItemLocationChanged(old_owner, new_owner);
9550
9551 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9552 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9553
9554 if (!relatedPlayer && playerNew)
9555 relatedPlayer = playerNew;
9556
9557 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9558 {
9560 if (actionMgr)
9561 {
9562 ActionBase currentAction = actionMgr.GetRunningAction();
9563 if (currentAction)
9565 }
9566 }
9567
9568 Man ownerPlayerOld = null;
9569 Man ownerPlayerNew = null;
9570
9571 if (old_owner)
9572 {
9573 if (old_owner.
IsMan())
9574 {
9575 ownerPlayerOld = Man.Cast(old_owner);
9576 }
9577 else
9578 {
9579 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9580 }
9581 }
9582 else
9583 {
9585 {
9587
9588 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9589 {
9590 GetCompEM().UnplugThis();
9591 }
9592 }
9593 }
9594
9595 if (new_owner)
9596 {
9597 if (new_owner.
IsMan())
9598 {
9599 ownerPlayerNew = Man.Cast(new_owner);
9600 }
9601 else
9602 {
9603 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9604 }
9605 }
9606
9607 if (ownerPlayerOld != ownerPlayerNew)
9608 {
9609 if (ownerPlayerOld)
9610 {
9611 array<EntityAI> subItemsExit = new array<EntityAI>;
9613 for (int i = 0; i < subItemsExit.Count(); i++)
9614 {
9617 }
9618 }
9619
9620 if (ownerPlayerNew)
9621 {
9622 array<EntityAI> subItemsEnter = new array<EntityAI>;
9624 for (int j = 0; j < subItemsEnter.Count(); j++)
9625 {
9628 }
9629 }
9630 }
9631 else if (ownerPlayerNew != null)
9632 {
9633 PlayerBase nplayer;
9634 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9635 {
9636 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9638 for (int k = 0; k < subItemsUpdate.Count(); k++)
9639 {
9641 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9642 }
9643 }
9644 }
9645
9646 if (old_owner)
9647 old_owner.OnChildItemRemoved(this);
9648 if (new_owner)
9649 new_owner.OnChildItemReceived(this);
9650 }
9651
9652
9654 {
9655 super.EEDelete(parent);
9656 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9657 if (player)
9658 {
9660
9661 if (player.IsAlive())
9662 {
9663 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9664 if (r_index >= 0)
9665 {
9666 InventoryLocation r_il = new InventoryLocation;
9667 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9668
9669 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9672 {
9673 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9674 }
9676 {
9677 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9678 }
9679
9680 }
9681
9682 player.RemoveQuickBarEntityShortcut(this);
9683 }
9684 }
9685 }
9686
9688 {
9689 super.EEKilled(killer);
9690
9693 {
9694 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9695 {
9696 if (IsMagazine())
9697 {
9698 if (Magazine.Cast(this).GetAmmoCount() > 0)
9699 {
9701 }
9702 }
9703 else
9704 {
9706 }
9707 }
9708 }
9709 }
9710
9712 {
9713 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9714
9715 super.OnWasAttached(parent, slot_id);
9716
9719
9722 }
9723
9725 {
9726 super.OnWasDetached(parent, slot_id);
9727
9730
9733 }
9734
9736 {
9737 int idx;
9740
9741 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9742 if (inventory_slots.Count() < 1)
9743 {
9744 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9745 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9746 }
9747 else
9748 {
9749 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9750 }
9751
9752 idx = inventory_slots.Find(slot);
9753 if (idx < 0)
9754 return "";
9755
9756 return attach_types.Get(idx);
9757 }
9758
9760 {
9761 int idx = -1;
9762 string slot;
9763
9766
9767 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9768 if (inventory_slots.Count() < 1)
9769 {
9770 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9771 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9772 }
9773 else
9774 {
9775 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9776 if (detach_types.Count() < 1)
9777 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9778 }
9779
9780 for (int i = 0; i < inventory_slots.Count(); i++)
9781 {
9782 slot = inventory_slots.Get(i);
9783 }
9784
9785 if (slot != "")
9786 {
9787 if (detach_types.Count() == 1)
9788 idx = 0;
9789 else
9790 idx = inventory_slots.Find(slot);
9791 }
9792 if (idx < 0)
9793 return "";
9794
9795 return detach_types.Get(idx);
9796 }
9797
9799 {
9800
9802
9803
9804 float min_time = 1;
9805 float max_time = 3;
9806 float delay = Math.RandomFloat(min_time, max_time);
9807
9808 explode_timer.Run(delay, this, "DoAmmoExplosion");
9809 }
9810
9812 {
9813 Magazine magazine = Magazine.Cast(this);
9814 int pop_sounds_count = 6;
9815 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9816
9817
9818 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9819 string sound_name = pop_sounds[ sound_idx ];
9820 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9821
9822
9823 magazine.ServerAddAmmoCount(-1);
9824
9825
9826 float min_temp_to_explode = 100;
9827
9828 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9829 {
9831 }
9832 }
9833
9834
9835 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9836 {
9837 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9838
9839 const int CHANCE_DAMAGE_CARGO = 4;
9840 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9841 const int CHANCE_DAMAGE_NOTHING = 2;
9842
9844 {
9845 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9846 int chances;
9847 int rnd;
9848
9849 if (GetInventory().GetCargo())
9850 {
9851 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9852 rnd = Math.RandomInt(0,chances);
9853
9854 if (rnd < CHANCE_DAMAGE_CARGO)
9855 {
9857 }
9858 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9859 {
9861 }
9862 }
9863 else
9864 {
9865 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9866 rnd = Math.RandomInt(0,chances);
9867
9868 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9869 {
9871 }
9872 }
9873 }
9874 }
9875
9877 {
9878 CargoBase cargo = GetInventory().GetCargo();
9879 if (cargo)
9880 {
9882 if (item_count > 0)
9883 {
9884 int random_pick = Math.RandomInt(0, item_count);
9886 if (!item.IsExplosive())
9887 {
9888 item.AddHealth("","",damage);
9889 return true;
9890 }
9891 }
9892 }
9893 return false;
9894 }
9895
9897 {
9898 GameInventory inventory = GetInventory();
9900 if (attachment_count > 0)
9901 {
9902 int random_pick = Math.RandomInt(0, attachment_count);
9904 if (!attachment.IsExplosive())
9905 {
9906 attachment.AddHealth("","",damage);
9907 return true;
9908 }
9909 }
9910 return false;
9911 }
9912
9914 {
9916 }
9917
9919 {
9921 return GetInventory().CanRemoveEntity();
9922
9923 return false;
9924 }
9925
9927 {
9928
9930 return false;
9931
9932
9934 return false;
9935
9936
9937
9939 if (delta == 0)
9940 return false;
9941
9942
9943 return true;
9944 }
9945
9947 {
9949 {
9950 if (ScriptInputUserData.CanStoreInputUserData())
9951 {
9952 ScriptInputUserData ctx = new ScriptInputUserData;
9957 ctx.
Write(destination_entity);
9961 }
9962 }
9963 else if (!
g_Game.IsMultiplayer())
9964 {
9966 }
9967 }
9968
9970 {
9971 float split_quantity_new;
9975 InventoryLocation loc = new InventoryLocation;
9976
9977 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9978 {
9980 split_quantity_new = stack_max;
9981 else
9983
9985 {
9986 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9987 if (new_item)
9988 {
9989 new_item.SetResultOfSplit(true);
9990 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9992 new_item.
SetQuantity(split_quantity_new,
false,
true);
9993 }
9994 }
9995 }
9996 else if (destination_entity && slot_id == -1)
9997 {
9998 if (quantity > stack_max)
9999 split_quantity_new = stack_max;
10000 else
10001 split_quantity_new = quantity;
10002
10004 {
10005 GameInventory destinationInventory = destination_entity.GetInventory();
10007 {
10010 }
10011
10012 if (new_item)
10013 {
10014 new_item.SetResultOfSplit(true);
10015 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10017 new_item.
SetQuantity(split_quantity_new,
false,
true);
10018 }
10019 }
10020 }
10021 else
10022 {
10023 if (stack_max != 0)
10024 {
10026 {
10028 }
10029
10030 if (split_quantity_new == 0)
10031 {
10032 if (!
g_Game.IsMultiplayer())
10033 player.PhysicalPredictiveDropItem(this);
10034 else
10035 player.ServerDropEntity(this);
10036 return;
10037 }
10038
10040 {
10042
10043 if (new_item)
10044 {
10045 new_item.SetResultOfSplit(true);
10046 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10049 new_item.PlaceOnSurface();
10050 }
10051 }
10052 }
10053 }
10054 }
10055
10057 {
10058 float split_quantity_new;
10062 InventoryLocation loc = new InventoryLocation;
10063
10064 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10065 {
10067 split_quantity_new = stack_max;
10068 else
10070
10072 {
10073 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10074 if (new_item)
10075 {
10076 new_item.SetResultOfSplit(true);
10077 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10079 new_item.
SetQuantity(split_quantity_new,
false,
true);
10080 }
10081 }
10082 }
10083 else if (destination_entity && slot_id == -1)
10084 {
10085 if (quantity > stack_max)
10086 split_quantity_new = stack_max;
10087 else
10088 split_quantity_new = quantity;
10089
10091 {
10092 GameInventory destinationInventory = destination_entity.GetInventory();
10094 {
10097 }
10098
10099 if (new_item)
10100 {
10101 new_item.SetResultOfSplit(true);
10102 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10104 new_item.
SetQuantity(split_quantity_new,
false,
true);
10105 }
10106 }
10107 }
10108 else
10109 {
10110 if (stack_max != 0)
10111 {
10113 {
10115 }
10116
10118 {
10120
10121 if (new_item)
10122 {
10123 new_item.SetResultOfSplit(true);
10124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10127 new_item.PlaceOnSurface();
10128 }
10129 }
10130 }
10131 }
10132 }
10133
10135 {
10137 {
10138 if (ScriptInputUserData.CanStoreInputUserData())
10139 {
10140 ScriptInputUserData ctx = new ScriptInputUserData;
10145 dst.WriteToContext(ctx);
10147 }
10148 }
10149 else if (!
g_Game.IsMultiplayer())
10150 {
10152 }
10153 }
10154
10156 {
10158 {
10159 if (ScriptInputUserData.CanStoreInputUserData())
10160 {
10161 ScriptInputUserData ctx = new ScriptInputUserData;
10166 ctx.
Write(destination_entity);
10172 }
10173 }
10174 else if (!
g_Game.IsMultiplayer())
10175 {
10177 }
10178 }
10179
10181 {
10183 }
10184
10186 {
10188 float split_quantity_new;
10190 if (dst.IsValid())
10191 {
10192 int slot_id = dst.GetSlot();
10194
10195 if (quantity > stack_max)
10196 split_quantity_new = stack_max;
10197 else
10198 split_quantity_new = quantity;
10199
10201 {
10203
10204 if (new_item)
10205 {
10206 new_item.SetResultOfSplit(true);
10207 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10209 new_item.
SetQuantity(split_quantity_new,
false,
true);
10210 }
10211
10212 return new_item;
10213 }
10214 }
10215
10216 return null;
10217 }
10218
10220 {
10222 float split_quantity_new;
10224 if (destination_entity)
10225 {
10227 if (quantity > stackable)
10228 split_quantity_new = stackable;
10229 else
10230 split_quantity_new = quantity;
10231
10233 {
10234 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10235 if (new_item)
10236 {
10237 new_item.SetResultOfSplit(true);
10238 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10240 new_item.
SetQuantity(split_quantity_new,
false,
true);
10241 }
10242 }
10243 }
10244 }
10245
10247 {
10249 {
10250 if (ScriptInputUserData.CanStoreInputUserData())
10251 {
10252 ScriptInputUserData ctx = new ScriptInputUserData;
10257 ItemBase destination_entity =
this;
10258 ctx.
Write(destination_entity);
10262 }
10263 }
10264 else if (!
g_Game.IsMultiplayer())
10265 {
10267 }
10268 }
10269
10271 {
10273 float split_quantity_new;
10275 if (player)
10276 {
10278 if (quantity > stackable)
10279 split_quantity_new = stackable;
10280 else
10281 split_quantity_new = quantity;
10282
10284 {
10285 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10286 new_item =
ItemBase.Cast(in_hands);
10287 if (new_item)
10288 {
10289 new_item.SetResultOfSplit(true);
10290 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10292 new_item.SetQuantity(split_quantity_new, false, true);
10293 }
10294 }
10295 }
10296 }
10297
10299 {
10301 float split_quantity_new = Math.Floor(quantity * 0.5);
10302
10304 return;
10305
10307
10308 if (new_item)
10309 {
10310 if (new_item.GetQuantityMax() < split_quantity_new)
10311 {
10312 split_quantity_new = new_item.GetQuantityMax();
10313 }
10314
10315 new_item.SetResultOfSplit(true);
10316 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10317
10319 {
10322 }
10323 else
10324 {
10326 new_item.
SetQuantity(split_quantity_new,
false,
true);
10327 }
10328 }
10329 }
10330
10332 {
10334 float split_quantity_new = Math.Floor(quantity / 2);
10335
10337 return;
10338
10339 InventoryLocation invloc = new InventoryLocation;
10341
10343 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10344
10345 if (new_item)
10346 {
10347 if (new_item.GetQuantityMax() < split_quantity_new)
10348 {
10349 split_quantity_new = new_item.GetQuantityMax();
10350 }
10352 {
10355 }
10356 else if (split_quantity_new > 1)
10357 {
10359 new_item.
SetQuantity(split_quantity_new,
false,
true);
10360 }
10361 }
10362 }
10363
10366 {
10367 SetWeightDirty();
10369
10370 if (parent)
10371 parent.OnAttachmentQuantityChangedEx(this, delta);
10372
10374 {
10376 {
10378 }
10380 {
10381 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10383 }
10384 }
10385 }
10386
10389 {
10390
10391 }
10392
10395 {
10397 }
10398
10400 {
10401 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10402
10404 {
10405 if (newLevel == GameConstants.STATE_RUINED)
10406 {
10408 EntityAI parent = GetHierarchyParent();
10409 if (parent && parent.IsFireplace())
10410 {
10411 CargoBase cargo = GetInventory().GetCargo();
10412 if (cargo)
10413 {
10415 {
10417 }
10418 }
10419 }
10420 }
10421
10423 {
10424
10426 return;
10427 }
10428
10429 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10430 {
10432 }
10433 }
10434 }
10435
10436
10438 {
10439 super.OnRightClick();
10440
10442 {
10444 {
10445 if (ScriptInputUserData.CanStoreInputUserData())
10446 {
10447 EntityAI root = GetHierarchyRoot();
10448 Man playerOwner = GetHierarchyRootPlayer();
10449 InventoryLocation dst = new InventoryLocation;
10450
10451
10452 if (!playerOwner && root && root == this)
10453 {
10455 }
10456 else
10457 {
10458
10459 GetInventory().GetCurrentInventoryLocation(dst);
10461 {
10462 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10464 {
10466 }
10467 else
10468 {
10470
10471
10472 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10473 {
10475 }
10476 else
10477 {
10478 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10479 }
10480 }
10481 }
10482 }
10483
10484 ScriptInputUserData ctx = new ScriptInputUserData;
10492 }
10493 }
10494 else if (!
g_Game.IsMultiplayer())
10495 {
10497 }
10498 }
10499 }
10500
10502 {
10503 if (root)
10504 {
10505 vector m4[4];
10506 root.GetTransform(m4);
10507 dst.SetGround(this, m4);
10508 }
10509 else
10510 {
10511 GetInventory().GetCurrentInventoryLocation(dst);
10512 }
10513 }
10514
10515 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10516 {
10517
10518 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10519 return false;
10520
10521 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10522 return false;
10523
10524
10526 return false;
10527
10528
10529 Magazine mag = Magazine.Cast(this);
10530 if (mag)
10531 {
10532 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10533 return false;
10534
10535 if (stack_max_limit)
10536 {
10537 Magazine other_mag = Magazine.Cast(other_item);
10538 if (other_item)
10539 {
10540 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10541 return false;
10542 }
10543
10544 }
10545 }
10546 else
10547 {
10548
10550 return false;
10551
10553 return false;
10554 }
10555
10556 PlayerBase player = null;
10557 if (CastTo(player, GetHierarchyRootPlayer()))
10558 {
10559 if (player.GetInventory().HasAttachment(this))
10560 return false;
10561
10562 if (player.IsItemsToDelete())
10563 return false;
10564 }
10565
10566 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10567 return false;
10568
10569 int slotID;
10571 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10572 return false;
10573
10574 return true;
10575 }
10576
10578 {
10580 }
10581
10583 {
10584 return m_IsResultOfSplit;
10585 }
10586
10588 {
10589 m_IsResultOfSplit = value;
10590 }
10591
10593 {
10595 }
10596
10598 {
10599 float other_item_quantity = other_item.GetQuantity();
10600 float this_free_space;
10601
10603
10605
10606 if (other_item_quantity > this_free_space)
10607 {
10608 return this_free_space;
10609 }
10610 else
10611 {
10612 return other_item_quantity;
10613 }
10614 }
10615
10617 {
10619 }
10620
10622 {
10624 return;
10625
10626 if (!IsMagazine() && other_item)
10627 {
10629 if (quantity_used != 0)
10630 {
10631 float hp1 = GetHealth01("","");
10632 float hp2 = other_item.GetHealth01("","");
10633 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10634 hpResult = hpResult / (
GetQuantity() + quantity_used);
10635
10636 hpResult *= GetMaxHealth();
10637 Math.Round(hpResult);
10638 SetHealth("", "Health", hpResult);
10639
10641 other_item.AddQuantity(-quantity_used);
10642 }
10643 }
10645 }
10646
10648 {
10649 #ifdef SERVER
10650 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10651 GetHierarchyParent().IncreaseLifetimeUp();
10652 #endif
10653 };
10654
10656 {
10657 PlayerBase p = PlayerBase.Cast(player);
10658
10659 array<int> recipesIds = p.m_Recipes;
10660 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10661 if (moduleRecipesManager)
10662 {
10663 EntityAI itemInHands = player.GetEntityInHands();
10664 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10665 }
10666
10667 for (int i = 0;i < recipesIds.Count(); i++)
10668 {
10669 int key = recipesIds.Get(i);
10670 string recipeName = moduleRecipesManager.GetRecipeName(key);
10672 }
10673 }
10674
10675
10676 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10677 {
10678 super.GetDebugActions(outputList);
10679
10680
10686
10687
10692
10697
10698
10702
10703
10705 {
10709 }
10710
10713
10714
10718
10720
10721 InventoryLocation loc = new InventoryLocation();
10722 GetInventory().GetCurrentInventoryLocation(loc);
10724 {
10725 if (Gizmo_IsSupported())
10728 }
10729
10731 }
10732
10733
10734
10735
10737 {
10738 super.OnAction(action_id, player, ctx);
10739
10741 {
10742 switch (action_id)
10743 {
10747 return true;
10751 return true;
10752 }
10753 }
10754
10756 {
10757 switch (action_id)
10758 {
10760 Delete();
10761 return true;
10762 }
10763 }
10764
10765 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10766 {
10767 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10768 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10769 PlayerBase p = PlayerBase.Cast(player);
10770 if (
EActions.RECIPES_RANGE_START < 1000)
10771 {
10772 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10773 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10774 }
10775 }
10776 #ifndef SERVER
10777 else if (action_id ==
EActions.WATCH_PLAYER)
10778 {
10779 PluginDeveloper.SetDeveloperItemClientEx(player);
10780 }
10781 #endif
10783 {
10784 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10785 {
10786 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10787 OnDebugButtonPressServer(id + 1);
10788 }
10789
10790 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10791 {
10792 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10794 }
10795
10796 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10797 {
10798 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10800 }
10801
10802 else if (action_id ==
EActions.ADD_QUANTITY)
10803 {
10804 if (IsMagazine())
10805 {
10806 Magazine mag = Magazine.Cast(this);
10807 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10808 }
10809 else
10810 {
10812 }
10813
10814 if (m_EM)
10815 {
10816 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10817 }
10818
10819 }
10820
10821 else if (action_id ==
EActions.REMOVE_QUANTITY)
10822 {
10823 if (IsMagazine())
10824 {
10825 Magazine mag2 = Magazine.Cast(this);
10826 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10827 }
10828 else
10829 {
10831 }
10832 if (m_EM)
10833 {
10834 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10835 }
10836
10837 }
10838
10839 else if (action_id ==
EActions.SET_QUANTITY_0)
10840 {
10842
10843 if (m_EM)
10844 {
10845 m_EM.SetEnergy(0);
10846 }
10847 }
10848
10849 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10850 {
10852
10853 if (m_EM)
10854 {
10855 m_EM.SetEnergy(m_EM.GetEnergyMax());
10856 }
10857 }
10858
10859 else if (action_id ==
EActions.ADD_HEALTH)
10860 {
10861 AddHealth("","",GetMaxHealth("","Health")/5);
10862 }
10863 else if (action_id ==
EActions.REMOVE_HEALTH)
10864 {
10865 AddHealth("","",-GetMaxHealth("","Health")/5);
10866 }
10867 else if (action_id ==
EActions.DESTROY_HEALTH)
10868 {
10869 SetHealth01("","",0);
10870 }
10871 else if (action_id ==
EActions.WATCH_ITEM)
10872 {
10874 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10875 #ifdef DEVELOPER
10876 SetDebugDeveloper_item(this);
10877 #endif
10878 }
10879
10880 else if (action_id ==
EActions.ADD_TEMPERATURE)
10881 {
10882 AddTemperature(20);
10883
10884 }
10885
10886 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10887 {
10888 AddTemperature(-20);
10889
10890 }
10891
10892 else if (action_id ==
EActions.FLIP_FROZEN)
10893 {
10894 SetFrozen(!GetIsFrozen());
10895
10896 }
10897
10898 else if (action_id ==
EActions.ADD_WETNESS)
10899 {
10901
10902 }
10903
10904 else if (action_id ==
EActions.REMOVE_WETNESS)
10905 {
10907
10908 }
10909
10910 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10911 {
10914
10915
10916 }
10917
10918 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10919 {
10922 }
10923
10924 else if (action_id ==
EActions.MAKE_SPECIAL)
10925 {
10926 auto debugParams = DebugSpawnParams.WithPlayer(player);
10927 OnDebugSpawnEx(debugParams);
10928 }
10929
10930 }
10931
10932
10933 return false;
10934 }
10935
10936
10937
10938
10942
10945
10946
10947
10949 {
10950 return false;
10951 }
10952
10953
10955 {
10956 return true;
10957 }
10958
10959
10961 {
10962 return true;
10963 }
10964
10965
10966
10968 {
10969 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10970 return g_Game.ConfigIsExisting(config_path);
10971 }
10972
10975 {
10976 return null;
10977 }
10978
10980 {
10981 return false;
10982 }
10983
10985 {
10986 return false;
10987 }
10988
10992
10993
10995 {
10996 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10997 return module_repairing.CanRepair(this, item_repair_kit);
10998 }
10999
11000
11001 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11002 {
11003 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11004 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11005 }
11006
11007
11009 {
11010
11011
11012
11013
11014
11015
11016
11017
11018 return 1;
11019 }
11020
11021
11022
11024 {
11026 }
11027
11028
11029
11031 {
11033 }
11034
11035
11044 {
11045 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11046
11047 if (player)
11048 {
11049 player.MessageStatus(text);
11050 }
11051 }
11052
11053
11062 {
11063 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11064
11065 if (player)
11066 {
11067 player.MessageAction(text);
11068 }
11069 }
11070
11071
11080 {
11081 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11082
11083 if (player)
11084 {
11085 player.MessageFriendly(text);
11086 }
11087 }
11088
11089
11098 {
11099 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11100
11101 if (player)
11102 {
11103 player.MessageImportant(text);
11104 }
11105 }
11106
11108 {
11109 return true;
11110 }
11111
11112
11113 override bool KindOf(
string tag)
11114 {
11115 bool found = false;
11116 string item_name = this.
GetType();
11118 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11119
11120 int array_size = item_tag_array.Count();
11121 for (int i = 0; i < array_size; i++)
11122 {
11123 if (item_tag_array.Get(i) == tag)
11124 {
11125 found = true;
11126 break;
11127 }
11128 }
11129 return found;
11130 }
11131
11132
11134 {
11135
11136 super.OnRPC(sender, rpc_type,ctx);
11137
11138
11139 switch (rpc_type)
11140 {
11141 #ifndef SERVER
11142 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11143 Param2<bool, string> p = new Param2<bool, string>(false, "");
11144
11146 return;
11147
11148 bool play = p.param1;
11149 string soundSet = p.param2;
11150
11151 if (play)
11152 {
11154 {
11156 {
11158 }
11159 }
11160 else
11161 {
11163 }
11164 }
11165 else
11166 {
11168 }
11169
11170 break;
11171 #endif
11172
11173 }
11174
11176 {
11178 }
11179 }
11180
11181
11182
11183
11185 {
11186 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11187 return plugin.GetID(
name);
11188 }
11189
11191 {
11192 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11193 return plugin.GetName(id);
11194 }
11195
11198 {
11199
11200
11201 int varFlags;
11202 if (!ctx.
Read(varFlags))
11203 return;
11204
11205 if (varFlags & ItemVariableFlags.FLOAT)
11206 {
11208 }
11209 }
11210
11212 {
11213
11214 super.SerializeNumericalVars(floats_out);
11215
11216
11217
11219 {
11221 }
11222
11224 {
11226 }
11227
11229 {
11231 }
11232
11234 {
11239 }
11240
11242 {
11244 }
11245 }
11246
11248 {
11249
11250 super.DeSerializeNumericalVars(floats);
11251
11252
11253 int index = 0;
11254 int mask = Math.Round(floats.Get(index));
11255
11256 index++;
11257
11259 {
11261 {
11263 }
11264 else
11265 {
11266 float quantity = floats.Get(index);
11267 SetQuantity(quantity,
true,
false,
false,
false);
11268 }
11269 index++;
11270 }
11271
11273 {
11274 float wet = floats.Get(index);
11276 index++;
11277 }
11278
11280 {
11281 int liquidtype = Math.Round(floats.Get(index));
11283 index++;
11284 }
11285
11287 {
11289 index++;
11291 index++;
11293 index++;
11295 index++;
11296 }
11297
11299 {
11300 int cleanness = Math.Round(floats.Get(index));
11302 index++;
11303 }
11304 }
11305
11307 {
11308 super.WriteVarsToCTX(ctx);
11309
11310
11312 {
11314 }
11315
11317 {
11319 }
11320
11322 {
11324 }
11325
11327 {
11328 int r,g,b,a;
11334 }
11335
11337 {
11339 }
11340 }
11341
11343 {
11344 if (!super.ReadVarsFromCTX(ctx,version))
11345 return false;
11346
11347 int intValue;
11348 float value;
11349
11350 if (version < 140)
11351 {
11352 if (!ctx.
Read(intValue))
11353 return false;
11354
11355 m_VariablesMask = intValue;
11356 }
11357
11359 {
11360 if (!ctx.
Read(value))
11361 return false;
11362
11364 {
11366 }
11367 else
11368 {
11370 }
11371 }
11372
11373 if (version < 140)
11374 {
11376 {
11377 if (!ctx.
Read(value))
11378 return false;
11379 SetTemperatureDirect(value);
11380 }
11381 }
11382
11384 {
11385 if (!ctx.
Read(value))
11386 return false;
11388 }
11389
11391 {
11392 if (!ctx.
Read(intValue))
11393 return false;
11395 }
11396
11398 {
11399 int r,g,b,a;
11401 return false;
11403 return false;
11405 return false;
11407 return false;
11408
11410 }
11411
11413 {
11414 if (!ctx.
Read(intValue))
11415 return false;
11417 }
11418
11419 if (version >= 138 && version < 140)
11420 {
11422 {
11423 if (!ctx.
Read(intValue))
11424 return false;
11425 SetFrozen(intValue);
11426 }
11427 }
11428
11429 return true;
11430 }
11431
11432
11434 {
11437 {
11439 }
11440
11441 if (!super.OnStoreLoad(ctx, version))
11442 {
11444 return false;
11445 }
11446
11447 if (version >= 114)
11448 {
11449 bool hasQuickBarIndexSaved;
11450
11451 if (!ctx.
Read(hasQuickBarIndexSaved))
11452 {
11454 return false;
11455 }
11456
11457 if (hasQuickBarIndexSaved)
11458 {
11459 int itmQBIndex;
11460
11461
11462 if (!ctx.
Read(itmQBIndex))
11463 {
11465 return false;
11466 }
11467
11468 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11469 if (itmQBIndex != -1 && parentPlayer)
11470 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11471 }
11472 }
11473 else
11474 {
11475
11476 PlayerBase player;
11477 int itemQBIndex;
11478 if (version ==
int.
MAX)
11479 {
11480 if (!ctx.
Read(itemQBIndex))
11481 {
11483 return false;
11484 }
11485 }
11486 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11487 {
11488
11489 if (!ctx.
Read(itemQBIndex))
11490 {
11492 return false;
11493 }
11494 if (itemQBIndex != -1 && player)
11495 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11496 }
11497 }
11498
11499 if (version < 140)
11500 {
11501
11502 if (!LoadVariables(ctx, version))
11503 {
11505 return false;
11506 }
11507 }
11508
11509
11511 {
11513 return false;
11514 }
11515 if (version >= 132)
11516 {
11518 if (raib)
11519 {
11521 {
11523 return false;
11524 }
11525 }
11526 }
11527
11529 return true;
11530 }
11531
11532
11533
11535 {
11536 super.OnStoreSave(ctx);
11537
11538 PlayerBase player;
11539 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11540 {
11542
11543 int itemQBIndex = -1;
11544 itemQBIndex = player.FindQuickBarEntityIndex(this);
11545 ctx.
Write(itemQBIndex);
11546 }
11547 else
11548 {
11550 }
11551
11553
11555 if (raib)
11556 {
11558 }
11559 }
11560
11561
11563 {
11564 super.AfterStoreLoad();
11565
11567 {
11569 }
11570
11572 {
11575 }
11576 }
11577
11579 {
11580 super.EEOnAfterLoad();
11581
11583 {
11585 }
11586
11589 }
11590
11592 {
11593 return false;
11594 }
11595
11596
11597
11599 {
11601 {
11602 #ifdef PLATFORM_CONSOLE
11603
11605 {
11607 if (menu)
11608 {
11610 }
11611 }
11612 #endif
11613 }
11614
11616 {
11619 }
11620
11622 {
11623 SetWeightDirty();
11625 }
11627 {
11630 }
11631
11633 {
11636
11639 }
11641 {
11645 }
11646
11647 super.OnVariablesSynchronized();
11648 }
11649
11650
11651
11653 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11654 {
11655 if (!IsServerCheck(allow_client))
11656 return false;
11657
11659 return false;
11660
11663
11664 if (value <= (min + 0.001))
11665 value = min;
11666
11667 if (value == min)
11668 {
11669 if (destroy_config)
11670 {
11671 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11672 if (dstr)
11673 {
11675 this.Delete();
11676 return true;
11677 }
11678 }
11679 else if (destroy_forced)
11680 {
11682 this.Delete();
11683 return true;
11684 }
11685
11687 }
11688
11691
11693 {
11694 EntityAI parent = GetHierarchyRoot();
11695 InventoryLocation iLoc = new InventoryLocation();
11696 GetInventory().GetCurrentInventoryLocation(iLoc);
11698 {
11699 int iLocSlot = iLoc.
GetSlot();
11701 {
11703 }
11705 {
11707 }
11708 }
11709 }
11710
11712 {
11714
11715 if (delta)
11717 }
11718
11720
11721 return false;
11722 }
11723
11724
11726 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11727 {
11729 }
11730
11732 {
11735 }
11736
11738 {
11741 }
11742
11744 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11745 {
11746 float value_clamped = Math.Clamp(value, 0, 1);
11748 SetQuantity(result, destroy_config, destroy_forced);
11749 }
11750
11751
11754 {
11756 }
11757
11759 {
11761 }
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11773 {
11774 int slot = -1;
11775 GameInventory inventory = GetInventory();
11776 if (inventory)
11777 {
11778 InventoryLocation il = new InventoryLocation;
11781 }
11782
11784 }
11785
11787 {
11788 float quantity_max = 0;
11789
11791 {
11792 if (attSlotID != -1)
11793 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11794
11795 if (quantity_max <= 0)
11797 }
11798
11799 if (quantity_max <= 0)
11801
11802 return quantity_max;
11803 }
11804
11806 {
11808 }
11809
11811 {
11813 }
11814
11815
11817 {
11819 }
11820
11822 {
11824 }
11825
11827 {
11829 }
11830
11831
11833 {
11834
11835 float weightEx = GetWeightEx();
11836 float special = GetInventoryAndCargoWeight();
11837 return weightEx - special;
11838 }
11839
11840
11842 {
11844 }
11845
11847 {
11849 {
11850 #ifdef DEVELOPER
11851 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11852 {
11853 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11855 }
11856 #endif
11857
11858 return GetQuantity() * GetConfigWeightModified();
11859 }
11860 else if (HasEnergyManager())
11861 {
11862 #ifdef DEVELOPER
11863 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11864 {
11865 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11866 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11867 }
11868 #endif
11869 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11870 }
11871 else
11872 {
11873 #ifdef DEVELOPER
11874 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11875 {
11876 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11877 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11878 }
11879 #endif
11880 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11881 }
11882 }
11883
11886 {
11887 int item_count = 0;
11889
11890 GameInventory inventory = GetInventory();
11891 CargoBase cargo = inventory.
GetCargo();
11892 if (cargo != NULL)
11893 {
11895 }
11896
11898 for (int i = 0; i < nAttachments; ++i)
11899 {
11901 if (item)
11902 item_count += item.GetNumberOfItems();
11903 }
11904 return item_count;
11905 }
11906
11909 {
11910 float weight = 0;
11911 float wetness = 1;
11912 if (include_wetness)
11915 {
11916 weight = wetness * m_ConfigWeight;
11917 }
11919 {
11920 weight = 1;
11921 }
11922 return weight;
11923 }
11924
11925
11926
11928 {
11929 GameInventory inventory = GetInventory();
11930 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11931 {
11932 array<EntityAI> items = new array<EntityAI>;
11934 for (int i = 0; i < items.Count(); ++i)
11935 {
11937 if (item)
11938 {
11939 g_Game.ObjectDelete(item);
11940 }
11941 }
11942 }
11943 }
11944
11945
11946
11947
11949 {
11950 float energy = 0;
11951 if (HasEnergyManager())
11952 {
11953 energy = GetCompEM().GetEnergy();
11954 }
11955 return energy;
11956 }
11957
11958
11960 {
11961 super.OnEnergyConsumed();
11962
11964 }
11965
11967 {
11968 super.OnEnergyAdded();
11969
11971 }
11972
11973
11975 {
11976 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11977 {
11979 {
11980 float energy_0to1 = GetCompEM().GetEnergy0To1();
11982 }
11983 }
11984 }
11985
11986
11988 {
11989 return ConfigGetFloat("heatIsolation");
11990 }
11991
11993 {
11995 }
11996
11998 {
11999 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12000 if (
g_Game.ConfigIsExisting(paramPath))
12001 return g_Game.ConfigGetFloat(paramPath);
12002
12003 return 0.0;
12004 }
12005
12007 {
12008 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12009 if (
g_Game.ConfigIsExisting(paramPath))
12010 return g_Game.ConfigGetFloat(paramPath);
12011
12012 return 0.0;
12013 }
12014
12015 override void SetWet(
float value,
bool allow_client =
false)
12016 {
12017 if (!IsServerCheck(allow_client))
12018 return;
12019
12022
12024
12025 m_VarWet = Math.Clamp(value, min, max);
12026
12028 {
12031 }
12032 }
12033
12034 override void AddWet(
float value)
12035 {
12037 }
12038
12040 {
12042 }
12043
12045 {
12047 }
12048
12050 {
12052 }
12053
12055 {
12057 }
12058
12060 {
12062 }
12063
12064 override void OnWetChanged(
float newVal,
float oldVal)
12065 {
12068 if (newLevel != oldLevel)
12069 {
12071 }
12072 }
12073
12075 {
12076 SetWeightDirty();
12077 }
12078
12080 {
12081 return GetWetLevelInternal(
m_VarWet);
12082 }
12083
12084
12085
12087 {
12089 }
12090
12092 {
12094 }
12095
12097 {
12099 }
12100
12102 {
12104 }
12105
12106
12107
12109 {
12110 if (ConfigIsExisting("itemModelLength"))
12111 {
12112 return ConfigGetFloat("itemModelLength");
12113 }
12114 return 0;
12115 }
12116
12118 {
12119 if (ConfigIsExisting("itemAttachOffset"))
12120 {
12121 return ConfigGetFloat("itemAttachOffset");
12122 }
12123 return 0;
12124 }
12125
12126 override void SetCleanness(
int value,
bool allow_client =
false)
12127 {
12128 if (!IsServerCheck(allow_client))
12129 return;
12130
12132
12134
12137 }
12138
12140 {
12142 }
12143
12145 {
12146 return true;
12147 }
12148
12149
12150
12151
12153 {
12155 }
12156
12158 {
12160 }
12161
12162
12163
12164
12165 override void SetColor(
int r,
int g,
int b,
int a)
12166 {
12172 }
12174 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12175 {
12180 }
12181
12183 {
12185 }
12186
12189 {
12190 int r,g,b,a;
12192 r = r/255;
12193 g = g/255;
12194 b = b/255;
12195 a = a/255;
12196 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12197 }
12198
12199
12200
12201 override void SetLiquidType(
int value,
bool allow_client =
false)
12202 {
12203 if (!IsServerCheck(allow_client))
12204 return;
12205
12210 }
12211
12213 {
12214 return ConfigGetInt("varLiquidTypeInit");
12215 }
12216
12218 {
12220 }
12221
12223 {
12225 SetFrozen(false);
12226 }
12227
12230 {
12231 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12232 }
12233
12234
12237 {
12238 PlayerBase nplayer;
12239 if (PlayerBase.CastTo(nplayer, player))
12240 {
12242 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12243 }
12244 }
12245
12246
12249 {
12250 PlayerBase nplayer;
12251 if (PlayerBase.CastTo(nplayer,player))
12252 {
12253 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12254 }
12255
12256 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12257
12258 if (HasEnergyManager())
12259 {
12260 GetCompEM().UpdatePlugState();
12261 }
12262 }
12263
12264
12266 {
12267 super.OnPlacementStarted(player);
12268
12270 }
12271
12272 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12273 {
12275 {
12276 m_AdminLog.OnPlacementComplete(player,
this);
12277 }
12278
12279 super.OnPlacementComplete(player, position, orientation);
12280 }
12281
12282
12283
12284
12285
12287 {
12289 {
12290 return true;
12291 }
12292 else
12293 {
12294 return false;
12295 }
12296 }
12297
12298
12300 {
12302 {
12304 }
12305 }
12306
12307
12309 {
12311 }
12312
12314 {
12316 }
12317
12318 override void InsertAgent(
int agent,
float count = 1)
12319 {
12320 if (count < 1)
12321 return;
12322
12324 }
12325
12328 {
12330 }
12331
12332
12334 {
12336 }
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12380 {
12382 return false;
12383 return true;
12384 }
12385
12387 {
12388
12390 }
12391
12392
12395 {
12396 super.CheckForRoofLimited(timeTresholdMS);
12397
12398 float time =
g_Game.GetTime();
12399 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12400 {
12401 m_PreviousRoofTestTime = time;
12402 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12403 }
12404 }
12405
12406
12408 {
12410 {
12411 return 0;
12412 }
12413
12414 if (GetInventory().GetAttachmentSlotsCount() != 0)
12415 {
12416 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12417 if (filter)
12418 return filter.GetProtectionLevel(type, false, system);
12419 else
12420 return 0;
12421 }
12422
12423 string subclassPath, entryName;
12424
12425 switch (type)
12426 {
12428 entryName = "biological";
12429 break;
12431 entryName = "chemical";
12432 break;
12433 default:
12434 entryName = "biological";
12435 break;
12436 }
12437
12438 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12439
12440 return g_Game.ConfigGetFloat(subclassPath + entryName);
12441 }
12442
12443
12444
12447 {
12448 if (!IsMagazine())
12450
12452 }
12453
12454
12455
12456
12457
12462 {
12463 return true;
12464 }
12465
12467 {
12469 }
12470
12471
12472
12473
12474
12476 {
12477 if (parent)
12478 {
12479 if (parent.IsInherited(DayZInfected))
12480 return true;
12481
12482 if (!parent.IsRuined())
12483 return true;
12484 }
12485
12486 return true;
12487 }
12488
12490 {
12491 if (!super.CanPutAsAttachment(parent))
12492 {
12493 return false;
12494 }
12495
12496 if (!IsRuined() && !parent.IsRuined())
12497 {
12498 return true;
12499 }
12500
12501 return false;
12502 }
12503
12505 {
12506
12507
12508
12509
12510 return super.CanReceiveItemIntoCargo(item);
12511 }
12512
12514 {
12515
12516
12517
12518
12519 GameInventory attachmentInv = attachment.GetInventory();
12521 {
12522 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12523 return false;
12524 }
12525
12526 InventoryLocation loc = new InventoryLocation();
12527 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12528 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12529 return false;
12530
12531 return super.CanReceiveAttachment(attachment, slotId);
12532 }
12533
12535 {
12536 if (!super.CanReleaseAttachment(attachment))
12537 return false;
12538
12539 return GetInventory().AreChildrenAccessible();
12540 }
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12563 {
12564 int id = muzzle_owner.GetMuzzleID();
12565 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12566
12567 if (WPOF_array)
12568 {
12569 for (int i = 0; i < WPOF_array.Count(); i++)
12570 {
12571 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12572
12573 if (WPOF)
12574 {
12575 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12576 }
12577 }
12578 }
12579 }
12580
12581
12583 {
12584 int id = muzzle_owner.GetMuzzleID();
12586
12587 if (WPOBE_array)
12588 {
12589 for (int i = 0; i < WPOBE_array.Count(); i++)
12590 {
12591 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12592
12593 if (WPOBE)
12594 {
12595 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12596 }
12597 }
12598 }
12599 }
12600
12601
12603 {
12604 int id = muzzle_owner.GetMuzzleID();
12605 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12606
12607 if (WPOOH_array)
12608 {
12609 for (int i = 0; i < WPOOH_array.Count(); i++)
12610 {
12611 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12612
12613 if (WPOOH)
12614 {
12615 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12616 }
12617 }
12618 }
12619 }
12620
12621
12623 {
12624 int id = muzzle_owner.GetMuzzleID();
12625 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12626
12627 if (WPOOH_array)
12628 {
12629 for (int i = 0; i < WPOOH_array.Count(); i++)
12630 {
12631 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12632
12633 if (WPOOH)
12634 {
12635 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12636 }
12637 }
12638 }
12639 }
12640
12641
12643 {
12644 int id = muzzle_owner.GetMuzzleID();
12645 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12646
12647 if (WPOOH_array)
12648 {
12649 for (int i = 0; i < WPOOH_array.Count(); i++)
12650 {
12651 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12652
12653 if (WPOOH)
12654 {
12655 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12656 }
12657 }
12658 }
12659 }
12660
12661
12662
12664 {
12666 {
12667 return true;
12668 }
12669
12670 return false;
12671 }
12672
12674 {
12676 {
12677 return true;
12678 }
12679
12680 return false;
12681 }
12682
12684 {
12686 {
12687 return true;
12688 }
12689
12690 return false;
12691 }
12692
12694 {
12695 return false;
12696 }
12697
12700 {
12701 return UATimeSpent.DEFAULT_DEPLOY;
12702 }
12703
12704
12705
12706
12708 {
12710 SetSynchDirty();
12711 }
12712
12714 {
12716 }
12717
12718
12720 {
12721 return false;
12722 }
12723
12726 {
12727 string att_type = "None";
12728
12729 if (ConfigIsExisting("soundAttType"))
12730 {
12731 att_type = ConfigGetString("soundAttType");
12732 }
12733
12735 }
12736
12738 {
12740 }
12741
12742
12743
12744
12745
12751
12753 {
12756
12758 }
12759
12760
12762 {
12764 return;
12765
12767
12770
12773
12774 SoundParameters params = new SoundParameters();
12778 }
12779
12780
12782 {
12784 {
12787
12788 SetSynchDirty();
12789
12792 }
12793 }
12794
12796 {
12798 }
12799
12800
12802 {
12804 return;
12805
12807 SetSynchDirty();
12808
12811 }
12812
12814 {
12817 }
12818
12820 {
12822 }
12823
12824 void OnApply(PlayerBase player);
12825
12827 {
12828 return 1.0;
12829 };
12830
12832 {
12834 }
12835
12837 {
12839 }
12840
12842
12844 {
12845 SetDynamicPhysicsLifeTime(0.01);
12847 }
12848
12850 {
12851 array<string> zone_names = new array<string>;
12852 GetDamageZones(zone_names);
12853 for (int i = 0; i < zone_names.Count(); i++)
12854 {
12855 SetHealthMax(zone_names.Get(i),"Health");
12856 }
12857 SetHealthMax("","Health");
12858 }
12859
12862 {
12863 float global_health = GetHealth01("","Health");
12864 array<string> zones = new array<string>;
12865 GetDamageZones(zones);
12866
12867 for (int i = 0; i < zones.Count(); i++)
12868 {
12869 SetHealth01(zones.Get(i),"Health",global_health);
12870 }
12871 }
12872
12875 {
12876 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12877 }
12878
12880 {
12881 if (!hasRootAsPlayer)
12882 {
12883 if (refParentIB)
12884 {
12885
12886 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12887 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12888
12889 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12890 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12891
12894 }
12895 else
12896 {
12897
12900 }
12901 }
12902 }
12903
12905 {
12907 {
12908 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12909 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12910 {
12911 float heatPermCoef = 1.0;
12913 while (ent)
12914 {
12915 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12916 ent = ent.GetHierarchyParent();
12917 }
12918
12919 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12920 }
12921 }
12922 }
12923
12925 {
12926
12927 EntityAI parent = GetHierarchyParent();
12928 if (!parent)
12929 {
12930 hasParent = false;
12931 hasRootAsPlayer = false;
12932 }
12933 else
12934 {
12935 hasParent = true;
12936 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12937 refParentIB =
ItemBase.Cast(parent);
12938 }
12939 }
12940
12941 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12942 {
12943
12944 }
12945
12947 {
12948
12949 return false;
12950 }
12951
12953 {
12954
12955
12956 return false;
12957 }
12958
12960 {
12961
12962 return false;
12963 }
12964
12967 {
12968 return !GetIsFrozen() &&
IsOpen();
12969 }
12970
12972 {
12973 bool hasParent = false, hasRootAsPlayer = false;
12975
12976 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12977 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12978
12979 if (wwtu || foodDecay)
12980 {
12984
12985 if (processWetness || processTemperature || processDecay)
12986 {
12988
12989 if (processWetness)
12990 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12991
12992 if (processTemperature)
12994
12995 if (processDecay)
12996 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12997 }
12998 }
12999 }
13000
13003 {
13005 }
13006
13008 {
13011
13012 return super.GetTemperatureFreezeThreshold();
13013 }
13014
13016 {
13019
13020 return super.GetTemperatureThawThreshold();
13021 }
13022
13024 {
13027
13028 return super.GetItemOverheatThreshold();
13029 }
13030
13032 {
13034 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13035
13036 return super.GetTemperatureFreezeTime();
13037 }
13038
13040 {
13042 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13043
13044 return super.GetTemperatureThawTime();
13045 }
13046
13051
13053 {
13054 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13055 }
13056
13058 {
13059 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13060 }
13061
13064 {
13066 }
13067
13069 {
13071 }
13072
13074 {
13076 }
13077
13080 {
13081 return null;
13082 }
13083
13086 {
13087 return false;
13088 }
13089
13091 {
13093 {
13096 if (!trg)
13097 {
13099 explosive = this;
13100 }
13101
13102 explosive.PairRemote(trg);
13104
13105 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13106 trg.SetPersistentPairID(persistentID);
13107 explosive.SetPersistentPairID(persistentID);
13108
13109 return true;
13110 }
13111 return false;
13112 }
13113
13116 {
13117 float ret = 1.0;
13120 ret *= GetHealth01();
13121
13122 return ret;
13123 }
13124
13125 #ifdef DEVELOPER
13126 override void SetDebugItem()
13127 {
13128 super.SetDebugItem();
13129 _itemBase = this;
13130 }
13131
13133 {
13134 string text = super.GetDebugText();
13135
13137 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13138
13139 return text;
13140 }
13141 #endif
13142
13144 {
13145 return true;
13146 }
13147
13149
13151
13153 {
13156 }
13157
13158
13166
13182
13183 [
Obsolete(
"Use ItemSoundHandler instead")]
13186 {
13187 if (!
g_Game.IsDedicatedServer())
13188 {
13189 if (ConfigIsExisting("attachSoundSet"))
13190 {
13191 string cfg_path = "";
13192 string soundset = "";
13193 string type_name =
GetType();
13194
13197 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13198 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13199
13200 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13201 {
13202 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13203 {
13204 if (cfg_slot_array[i] == slot_type)
13205 {
13206 soundset = cfg_soundset_array[i];
13207 break;
13208 }
13209 }
13210 }
13211
13212 if (soundset != "")
13213 {
13214 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13216 }
13217 }
13218 }
13219 }
13220
13222}
13223
13225{
13227 if (entity)
13228 {
13229 bool is_item = entity.IsInherited(
ItemBase);
13230 if (is_item && full_quantity)
13231 {
13234 }
13235 }
13236 else
13237 {
13239 return NULL;
13240 }
13241 return entity;
13242}
13243
13245{
13246 if (item)
13247 {
13248 if (health > 0)
13249 item.SetHealth("", "", health);
13250
13251 if (item.CanHaveTemperature())
13252 {
13254 if (item.CanFreeze())
13255 item.SetFrozen(false);
13256 }
13257
13258 if (item.HasEnergyManager())
13259 {
13260 if (quantity >= 0)
13261 {
13262 item.GetCompEM().SetEnergy0To1(quantity);
13263 }
13264 else
13265 {
13267 }
13268 }
13269 else if (item.IsMagazine())
13270 {
13271 Magazine mag = Magazine.Cast(item);
13272 if (quantity >= 0)
13273 {
13274 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13275 }
13276 else
13277 {
13279 }
13280
13281 }
13282 else
13283 {
13284 if (quantity >= 0)
13285 {
13286 item.SetQuantityNormalized(quantity, false);
13287 }
13288 else
13289 {
13291 }
13292
13293 }
13294 }
13295}
13296
13297#ifdef DEVELOPER
13299#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.