7829{
7831 {
7832 return true;
7833 }
7834};
7835
7837{
7838
7839};
7840
7841
7842
7844{
7848
7850
7853
7854
7855
7856
7857
7866
7872
7877
7882
7903 protected bool m_IsResultOfSplit
7904
7906
7911
7912
7913
7915
7919
7920
7921
7923
7926
7927
7928
7934
7935
7943
7946
7947
7949
7950
7952
7953
7958
7959
7964
7966
7967
7969
7970
7972 {
7977
7978 if (!
g_Game.IsDedicatedServer())
7979 {
7981 {
7983
7985 {
7987 }
7988 }
7989
7992 }
7993
7994 m_OldLocation = null;
7995
7997 {
7999 }
8000
8001 if (ConfigIsExisting("headSelectionsToHide"))
8002 {
8005 }
8006
8008 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8009 {
8011 }
8012
8014
8015 m_IsResultOfSplit = false;
8016
8018 }
8019
8021 {
8022 super.InitItemVariables();
8023
8029 m_Count = ConfigGetInt(
"count");
8030
8033
8038
8041
8046
8058
8062
8063
8066 if (ConfigIsExisting("canBeSplit"))
8067 {
8070 }
8071
8073 if (ConfigIsExisting("itemBehaviour"))
8075
8076
8079 RegisterNetSyncVariableInt("m_VarLiquidType");
8080 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8081
8082 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8083 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8084 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8085
8086 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8087 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8088 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8089 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8090
8091 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8092 RegisterNetSyncVariableBool("m_IsTakeable");
8093 RegisterNetSyncVariableBool("m_IsHologram");
8094
8097 {
8100 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8101 }
8102
8104
8106 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8108
8110 }
8111
8113 {
8115 }
8116
8118 {
8121 {
8126 }
8127 }
8128
8129 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8130 {
8132 {
8135 }
8136
8138 }
8139
8141 {
8147 }
8148
8150
8152 {
8154
8155 if (!action)
8156 {
8157 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8158 return;
8159 }
8160
8162 if (!ai)
8163 {
8165 return;
8166 }
8167
8169 if (!action_array)
8170 {
8171 action_array = new array<ActionBase_Basic>;
8173 }
8174 if (LogManager.IsActionLogEnable())
8175 {
8176 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8177 }
8178
8179 if (action_array.Find(action) != -1)
8180 {
8181 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8182 }
8183 else
8184 {
8185 action_array.Insert(action);
8186 }
8187 }
8188
8190 {
8191 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8192 ActionBase action = player.GetActionManager().GetAction(actionName);
8195
8196 if (action_array)
8197 {
8198 action_array.RemoveItem(action);
8199 }
8200 }
8201
8202
8203
8205 {
8206 ActionOverrideData overrideData = new ActionOverrideData();
8210
8212 if (!actionMap)
8213 {
8216 }
8217
8218 actionMap.Insert(this.
Type(), overrideData);
8219
8220 }
8221
8223
8225
8226
8228 {
8231
8234
8235 string config_to_search = "CfgVehicles";
8236 string muzzle_owner_config;
8237
8239 {
8240 if (IsInherited(Weapon))
8241 config_to_search = "CfgWeapons";
8242
8243 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8244
8245 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8246
8247 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8248
8249 if (config_OnFire_subclass_count > 0)
8250 {
8251 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8252
8253 for (int i = 0; i < config_OnFire_subclass_count; i++)
8254 {
8255 string particle_class = "";
8256 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8257 string config_OnFire_entry = config_OnFire_class + particle_class;
8258 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8259 WPOF_array.Insert(WPOF);
8260 }
8261
8262
8264 }
8265 }
8266
8268 {
8269 config_to_search = "CfgWeapons";
8270 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8271
8272 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8273
8274 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8275
8276 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8277 {
8278 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8279
8280 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8281 {
8282 string particle_class2 = "";
8283 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8284 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8285 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8286 WPOBE_array.Insert(WPOBE);
8287 }
8288
8289
8291 }
8292 }
8293 }
8294
8295
8297 {
8300
8302 {
8303 string config_to_search = "CfgVehicles";
8304
8305 if (IsInherited(Weapon))
8306 config_to_search = "CfgWeapons";
8307
8308 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8309 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8310
8311 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8312 {
8313
8315
8317 {
8319 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8321 return;
8322 }
8323
8326
8327
8328
8329 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8330 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8331
8332 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8333 {
8334 string particle_class = "";
8335 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8336 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8337 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8338
8339 if (entry_type == CT_CLASS)
8340 {
8341 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8342 WPOOH_array.Insert(WPOF);
8343 }
8344 }
8345
8346
8348 }
8349 }
8350 }
8351
8353 {
8355 }
8356
8358 {
8360 {
8362
8365
8368
8369 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8370 }
8371 }
8372
8374 {
8376 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8377
8379 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8380
8382 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8383
8385 {
8387 }
8388 }
8389
8391 {
8393 }
8394
8396 {
8399 else
8401
8403 {
8406 }
8407 else
8408 {
8411
8414 }
8415
8417 }
8418
8420 {
8422 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8423 }
8424
8426 {
8428 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8430 }
8431
8433 {
8435 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8436 }
8437
8439 {
8442
8443 OverheatingParticle OP = new OverheatingParticle();
8448
8450 }
8451
8453 {
8456
8457 return -1;
8458 }
8459
8461 {
8463 {
8466
8467 for (int i = count; i > 0; --i)
8468 {
8469 int id = i - 1;
8472
8475
8476 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8477 {
8478 if (p)
8479 {
8482 }
8483 }
8484 }
8485 }
8486 }
8487
8489 {
8491 {
8493 {
8494 int id = i - 1;
8496
8497 if (OP)
8498 {
8500
8501 if (p)
8502 {
8504 }
8505
8506 delete OP;
8507 }
8508 }
8509
8512 }
8513 }
8514
8517 {
8518 return 0.0;
8519 }
8520
8521
8523 {
8524 return 250;
8525 }
8526
8528 {
8529 return 0;
8530 }
8531
8534 {
8536 return true;
8537
8538 return false;
8539 }
8540
8543 {
8546
8548 {
8550 }
8551 else
8552 {
8553
8555 }
8556
8558 }
8559
8566 {
8567 return -1;
8568 }
8569
8570
8571
8572
8574 {
8576 {
8577 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8578 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8579
8580 if (r_index >= 0)
8581 {
8582 InventoryLocation r_il = new InventoryLocation;
8583 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8584
8585 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8588 {
8589 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8590 }
8592 {
8593 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8594 }
8595
8596 }
8597
8598 player.GetHumanInventory().ClearUserReservedLocation(this);
8599 }
8600
8603 }
8604
8605
8606
8607
8609 {
8610 return ItemBase.m_DebugActionsMask;
8611 }
8612
8614 {
8615 return ItemBase.m_DebugActionsMask & mask;
8616 }
8617
8619 {
8620 ItemBase.m_DebugActionsMask = mask;
8621 }
8622
8624 {
8625 ItemBase.m_DebugActionsMask |= mask;
8626 }
8627
8629 {
8630 ItemBase.m_DebugActionsMask &= ~mask;
8631 }
8632
8634 {
8636 {
8638 }
8639 else
8640 {
8642 }
8643 }
8644
8645
8647 {
8648 if (GetEconomyProfile())
8649 {
8650 float q_max = GetEconomyProfile().GetQuantityMax();
8651 if (q_max > 0)
8652 {
8653 float q_min = GetEconomyProfile().GetQuantityMin();
8654 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8655
8657 {
8658 ComponentEnergyManager comp = GetCompEM();
8660 {
8662 }
8663 }
8665 {
8667
8668 }
8669
8670 }
8671 }
8672 }
8673
8676 {
8677 EntityAI parent = GetHierarchyParent();
8678
8679 if (parent)
8680 {
8681 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8682 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8683 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8684 }
8685 }
8686
8689 {
8690 EntityAI parent = GetHierarchyParent();
8691
8692 if (parent)
8693 {
8694 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8695 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8696 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8697 }
8698 }
8699
8701 {
8702
8703
8704
8705
8707
8709 {
8710 if (ScriptInputUserData.CanStoreInputUserData())
8711 {
8712 ScriptInputUserData ctx = new ScriptInputUserData;
8718 ctx.
Write(use_stack_max);
8721
8723 {
8724 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8725 }
8726 }
8727 }
8728 else if (!
g_Game.IsMultiplayer())
8729 {
8731 }
8732 }
8733
8735 {
8737 }
8738
8740 {
8742 }
8743
8745 {
8747 }
8748
8750 {
8751
8752 return false;
8753 }
8754
8756 {
8757 return false;
8758 }
8759
8763 {
8764 return false;
8765 }
8766
8768 {
8769 return "";
8770 }
8771
8773
8775 {
8776 return false;
8777 }
8778
8780 {
8781 return true;
8782 }
8783
8784
8785
8787 {
8788 return true;
8789 }
8790
8792 {
8793 return true;
8794 }
8795
8797 {
8798 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8800 }
8801
8803 {
8805 }
8806
8808 {
8810 if (!is_being_placed)
8812 SetSynchDirty();
8813 }
8814
8815
8817
8819 {
8821 }
8822
8824 {
8826 }
8827
8829 {
8830 return 1;
8831 }
8832
8834 {
8835 return false;
8836 }
8837
8839 {
8841 SetSynchDirty();
8842 }
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8879 {
8880 super.OnMovedInsideCargo(container);
8881
8882 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8883 }
8884
8885 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8886 {
8887 super.EEItemLocationChanged(oldLoc, newLoc);
8888
8889 PlayerBase newPlayer = null;
8890 PlayerBase oldPlayer = null;
8891
8892 if (newLoc.GetParent())
8893 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8894
8895 if (oldLoc.GetParent())
8896 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8897
8899 {
8900 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8901
8902 if (rIndex >= 0)
8903 {
8904 InventoryLocation rIl = new InventoryLocation;
8905 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8906
8907 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8910 {
8911 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8912 }
8914 {
8916 }
8917
8918 }
8919 }
8920
8922 {
8923 if (newPlayer)
8924 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8925
8926 if (newPlayer == oldPlayer)
8927 {
8928 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8929 {
8931 {
8932 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8933 {
8934 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8935 }
8936 }
8937 else
8938 {
8939 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8940 }
8941 }
8942
8943 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8944 {
8945 int type = oldLoc.GetType();
8947 {
8948 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8949 }
8951 {
8952 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8953 }
8954 }
8955 if (!m_OldLocation)
8956 {
8957 m_OldLocation = new InventoryLocation;
8958 }
8959 m_OldLocation.Copy(oldLoc);
8960 }
8961 else
8962 {
8963 if (m_OldLocation)
8964 {
8965 m_OldLocation.Reset();
8966 }
8967 }
8968
8969 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8970 }
8971 else
8972 {
8973 if (newPlayer)
8974 {
8975 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8976 if (resIndex >= 0)
8977 {
8978 InventoryLocation il = new InventoryLocation;
8979 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8981 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8984 {
8985 il.
GetParent().GetOnReleaseLock().Invoke(it);
8986 }
8988 {
8990 }
8991
8992 }
8993 }
8995 {
8996
8998 }
8999
9000 if (m_OldLocation)
9001 {
9002 m_OldLocation.Reset();
9003 }
9004 }
9005
9007 {
9008 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9009 }
9010
9012 {
9013 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9014 }
9015 }
9016
9017 override void EOnContact(IEntity other, Contact extra)
9018 {
9020 {
9021 int liquidType = -1;
9023 if (impactSpeed > 0.0)
9024 {
9026 #ifndef SERVER
9028 #else
9030 SetSynchDirty();
9031 #endif
9033 }
9034 }
9035
9036 #ifdef SERVER
9037 if (GetCompEM() && GetCompEM().IsPlugged())
9038 {
9039 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9040 GetCompEM().UnplugThis();
9041 }
9042 #endif
9043 }
9044
9046
9048 {
9050 }
9051
9053 {
9054
9055 }
9056
9058 {
9059 super.OnItemLocationChanged(old_owner, new_owner);
9060
9061 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9062 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9063
9064 if (!relatedPlayer && playerNew)
9065 relatedPlayer = playerNew;
9066
9067 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9068 {
9070 if (actionMgr)
9071 {
9072 ActionBase currentAction = actionMgr.GetRunningAction();
9073 if (currentAction)
9075 }
9076 }
9077
9078 Man ownerPlayerOld = null;
9079 Man ownerPlayerNew = null;
9080
9081 if (old_owner)
9082 {
9083 if (old_owner.
IsMan())
9084 {
9085 ownerPlayerOld = Man.Cast(old_owner);
9086 }
9087 else
9088 {
9089 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9090 }
9091 }
9092 else
9093 {
9095 {
9097
9098 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9099 {
9100 GetCompEM().UnplugThis();
9101 }
9102 }
9103 }
9104
9105 if (new_owner)
9106 {
9107 if (new_owner.
IsMan())
9108 {
9109 ownerPlayerNew = Man.Cast(new_owner);
9110 }
9111 else
9112 {
9113 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9114 }
9115 }
9116
9117 if (ownerPlayerOld != ownerPlayerNew)
9118 {
9119 if (ownerPlayerOld)
9120 {
9121 array<EntityAI> subItemsExit = new array<EntityAI>;
9123 for (int i = 0; i < subItemsExit.Count(); i++)
9124 {
9127 }
9128 }
9129
9130 if (ownerPlayerNew)
9131 {
9132 array<EntityAI> subItemsEnter = new array<EntityAI>;
9134 for (int j = 0; j < subItemsEnter.Count(); j++)
9135 {
9138 }
9139 }
9140 }
9141 else if (ownerPlayerNew != null)
9142 {
9143 PlayerBase nplayer;
9144 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9145 {
9146 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9148 for (int k = 0; k < subItemsUpdate.Count(); k++)
9149 {
9151 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9152 }
9153 }
9154 }
9155
9156 if (old_owner)
9157 old_owner.OnChildItemRemoved(this);
9158 if (new_owner)
9159 new_owner.OnChildItemReceived(this);
9160 }
9161
9162
9164 {
9165 super.EEDelete(parent);
9166 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9167 if (player)
9168 {
9170
9171 if (player.IsAlive())
9172 {
9173 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9174 if (r_index >= 0)
9175 {
9176 InventoryLocation r_il = new InventoryLocation;
9177 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9178
9179 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9182 {
9183 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9184 }
9186 {
9187 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9188 }
9189
9190 }
9191
9192 player.RemoveQuickBarEntityShortcut(this);
9193 }
9194 }
9195 }
9196
9198 {
9199 super.EEKilled(killer);
9200
9203 {
9204 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9205 {
9206 if (IsMagazine())
9207 {
9208 if (Magazine.Cast(this).GetAmmoCount() > 0)
9209 {
9211 }
9212 }
9213 else
9214 {
9216 }
9217 }
9218 }
9219 }
9220
9222 {
9223 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9224
9225 super.OnWasAttached(parent, slot_id);
9226
9229
9232 }
9233
9235 {
9236 super.OnWasDetached(parent, slot_id);
9237
9240
9243 }
9244
9246 {
9247 int idx;
9250
9251 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9252 if (inventory_slots.Count() < 1)
9253 {
9254 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9255 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9256 }
9257 else
9258 {
9259 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9260 }
9261
9262 idx = inventory_slots.Find(slot);
9263 if (idx < 0)
9264 return "";
9265
9266 return attach_types.Get(idx);
9267 }
9268
9270 {
9271 int idx = -1;
9272 string slot;
9273
9276
9277 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9278 if (inventory_slots.Count() < 1)
9279 {
9280 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9281 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9282 }
9283 else
9284 {
9285 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9286 if (detach_types.Count() < 1)
9287 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9288 }
9289
9290 for (int i = 0; i < inventory_slots.Count(); i++)
9291 {
9292 slot = inventory_slots.Get(i);
9293 }
9294
9295 if (slot != "")
9296 {
9297 if (detach_types.Count() == 1)
9298 idx = 0;
9299 else
9300 idx = inventory_slots.Find(slot);
9301 }
9302 if (idx < 0)
9303 return "";
9304
9305 return detach_types.Get(idx);
9306 }
9307
9309 {
9310
9312
9313
9314 float min_time = 1;
9315 float max_time = 3;
9316 float delay = Math.RandomFloat(min_time, max_time);
9317
9318 explode_timer.Run(delay, this, "DoAmmoExplosion");
9319 }
9320
9322 {
9323 Magazine magazine = Magazine.Cast(this);
9324 int pop_sounds_count = 6;
9325 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9326
9327
9328 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9329 string sound_name = pop_sounds[ sound_idx ];
9330 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9331
9332
9333 magazine.ServerAddAmmoCount(-1);
9334
9335
9336 float min_temp_to_explode = 100;
9337
9338 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9339 {
9341 }
9342 }
9343
9344
9345 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9346 {
9347 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9348
9349 const int CHANCE_DAMAGE_CARGO = 4;
9350 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9351 const int CHANCE_DAMAGE_NOTHING = 2;
9352
9354 {
9355 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9356 int chances;
9357 int rnd;
9358
9359 if (GetInventory().GetCargo())
9360 {
9361 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9362 rnd = Math.RandomInt(0,chances);
9363
9364 if (rnd < CHANCE_DAMAGE_CARGO)
9365 {
9367 }
9368 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9369 {
9371 }
9372 }
9373 else
9374 {
9375 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9376 rnd = Math.RandomInt(0,chances);
9377
9378 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9379 {
9381 }
9382 }
9383 }
9384 }
9385
9387 {
9388 CargoBase cargo = GetInventory().GetCargo();
9389 if (cargo)
9390 {
9392 if (item_count > 0)
9393 {
9394 int random_pick = Math.RandomInt(0, item_count);
9396 if (!item.IsExplosive())
9397 {
9398 item.AddHealth("","",damage);
9399 return true;
9400 }
9401 }
9402 }
9403 return false;
9404 }
9405
9407 {
9408 GameInventory inventory = GetInventory();
9410 if (attachment_count > 0)
9411 {
9412 int random_pick = Math.RandomInt(0, attachment_count);
9414 if (!attachment.IsExplosive())
9415 {
9416 attachment.AddHealth("","",damage);
9417 return true;
9418 }
9419 }
9420 return false;
9421 }
9422
9424 {
9426 }
9427
9429 {
9431 return GetInventory().CanRemoveEntity();
9432
9433 return false;
9434 }
9435
9437 {
9438
9440 return false;
9441
9442
9444 return false;
9445
9446
9447
9449 if (delta == 0)
9450 return false;
9451
9452
9453 return true;
9454 }
9455
9457 {
9459 {
9460 if (ScriptInputUserData.CanStoreInputUserData())
9461 {
9462 ScriptInputUserData ctx = new ScriptInputUserData;
9467 ctx.
Write(destination_entity);
9471 }
9472 }
9473 else if (!
g_Game.IsMultiplayer())
9474 {
9476 }
9477 }
9478
9480 {
9481 float split_quantity_new;
9485 InventoryLocation loc = new InventoryLocation;
9486
9487 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9488 {
9490 split_quantity_new = stack_max;
9491 else
9493
9495 {
9496 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9497 if (new_item)
9498 {
9499 new_item.SetResultOfSplit(true);
9500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9502 new_item.
SetQuantity(split_quantity_new,
false,
true);
9503 }
9504 }
9505 }
9506 else if (destination_entity && slot_id == -1)
9507 {
9508 if (quantity > stack_max)
9509 split_quantity_new = stack_max;
9510 else
9511 split_quantity_new = quantity;
9512
9514 {
9515 GameInventory destinationInventory = destination_entity.GetInventory();
9517 {
9520 }
9521
9522 if (new_item)
9523 {
9524 new_item.SetResultOfSplit(true);
9525 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9527 new_item.
SetQuantity(split_quantity_new,
false,
true);
9528 }
9529 }
9530 }
9531 else
9532 {
9533 if (stack_max != 0)
9534 {
9536 {
9538 }
9539
9540 if (split_quantity_new == 0)
9541 {
9542 if (!
g_Game.IsMultiplayer())
9543 player.PhysicalPredictiveDropItem(this);
9544 else
9545 player.ServerDropEntity(this);
9546 return;
9547 }
9548
9550 {
9552
9553 if (new_item)
9554 {
9555 new_item.SetResultOfSplit(true);
9556 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9559 new_item.PlaceOnSurface();
9560 }
9561 }
9562 }
9563 }
9564 }
9565
9567 {
9568 float split_quantity_new;
9572 InventoryLocation loc = new InventoryLocation;
9573
9574 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9575 {
9577 split_quantity_new = stack_max;
9578 else
9580
9582 {
9583 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9584 if (new_item)
9585 {
9586 new_item.SetResultOfSplit(true);
9587 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9589 new_item.
SetQuantity(split_quantity_new,
false,
true);
9590 }
9591 }
9592 }
9593 else if (destination_entity && slot_id == -1)
9594 {
9595 if (quantity > stack_max)
9596 split_quantity_new = stack_max;
9597 else
9598 split_quantity_new = quantity;
9599
9601 {
9602 GameInventory destinationInventory = destination_entity.GetInventory();
9604 {
9607 }
9608
9609 if (new_item)
9610 {
9611 new_item.SetResultOfSplit(true);
9612 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9614 new_item.
SetQuantity(split_quantity_new,
false,
true);
9615 }
9616 }
9617 }
9618 else
9619 {
9620 if (stack_max != 0)
9621 {
9623 {
9625 }
9626
9628 {
9630
9631 if (new_item)
9632 {
9633 new_item.SetResultOfSplit(true);
9634 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9637 new_item.PlaceOnSurface();
9638 }
9639 }
9640 }
9641 }
9642 }
9643
9645 {
9647 {
9648 if (ScriptInputUserData.CanStoreInputUserData())
9649 {
9650 ScriptInputUserData ctx = new ScriptInputUserData;
9655 dst.WriteToContext(ctx);
9657 }
9658 }
9659 else if (!
g_Game.IsMultiplayer())
9660 {
9662 }
9663 }
9664
9666 {
9668 {
9669 if (ScriptInputUserData.CanStoreInputUserData())
9670 {
9671 ScriptInputUserData ctx = new ScriptInputUserData;
9676 ctx.
Write(destination_entity);
9682 }
9683 }
9684 else if (!
g_Game.IsMultiplayer())
9685 {
9687 }
9688 }
9689
9691 {
9693 }
9694
9696 {
9698 float split_quantity_new;
9700 if (dst.IsValid())
9701 {
9702 int slot_id = dst.GetSlot();
9704
9705 if (quantity > stack_max)
9706 split_quantity_new = stack_max;
9707 else
9708 split_quantity_new = quantity;
9709
9711 {
9713
9714 if (new_item)
9715 {
9716 new_item.SetResultOfSplit(true);
9717 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9719 new_item.
SetQuantity(split_quantity_new,
false,
true);
9720 }
9721
9722 return new_item;
9723 }
9724 }
9725
9726 return null;
9727 }
9728
9730 {
9732 float split_quantity_new;
9734 if (destination_entity)
9735 {
9737 if (quantity > stackable)
9738 split_quantity_new = stackable;
9739 else
9740 split_quantity_new = quantity;
9741
9743 {
9744 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9745 if (new_item)
9746 {
9747 new_item.SetResultOfSplit(true);
9748 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9750 new_item.
SetQuantity(split_quantity_new,
false,
true);
9751 }
9752 }
9753 }
9754 }
9755
9757 {
9759 {
9760 if (ScriptInputUserData.CanStoreInputUserData())
9761 {
9762 ScriptInputUserData ctx = new ScriptInputUserData;
9767 ItemBase destination_entity =
this;
9768 ctx.
Write(destination_entity);
9772 }
9773 }
9774 else if (!
g_Game.IsMultiplayer())
9775 {
9777 }
9778 }
9779
9781 {
9783 float split_quantity_new;
9785 if (player)
9786 {
9788 if (quantity > stackable)
9789 split_quantity_new = stackable;
9790 else
9791 split_quantity_new = quantity;
9792
9794 {
9795 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9796 new_item =
ItemBase.Cast(in_hands);
9797 if (new_item)
9798 {
9799 new_item.SetResultOfSplit(true);
9800 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9802 new_item.SetQuantity(split_quantity_new, false, true);
9803 }
9804 }
9805 }
9806 }
9807
9809 {
9811 float split_quantity_new = Math.Floor(quantity * 0.5);
9812
9814 return;
9815
9817
9818 if (new_item)
9819 {
9820 if (new_item.GetQuantityMax() < split_quantity_new)
9821 {
9822 split_quantity_new = new_item.GetQuantityMax();
9823 }
9824
9825 new_item.SetResultOfSplit(true);
9826 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9827
9829 {
9832 }
9833 else
9834 {
9836 new_item.
SetQuantity(split_quantity_new,
false,
true);
9837 }
9838 }
9839 }
9840
9842 {
9844 float split_quantity_new = Math.Floor(quantity / 2);
9845
9847 return;
9848
9849 InventoryLocation invloc = new InventoryLocation;
9851
9853 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9854
9855 if (new_item)
9856 {
9857 if (new_item.GetQuantityMax() < split_quantity_new)
9858 {
9859 split_quantity_new = new_item.GetQuantityMax();
9860 }
9862 {
9865 }
9866 else if (split_quantity_new > 1)
9867 {
9869 new_item.
SetQuantity(split_quantity_new,
false,
true);
9870 }
9871 }
9872 }
9873
9876 {
9877 SetWeightDirty();
9879
9880 if (parent)
9881 parent.OnAttachmentQuantityChangedEx(this, delta);
9882
9884 {
9886 {
9888 }
9890 {
9891 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9893 }
9894 }
9895 }
9896
9899 {
9900
9901 }
9902
9905 {
9907 }
9908
9910 {
9911 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9912
9914 {
9915 if (newLevel == GameConstants.STATE_RUINED)
9916 {
9918 EntityAI parent = GetHierarchyParent();
9919 if (parent && parent.IsFireplace())
9920 {
9921 CargoBase cargo = GetInventory().GetCargo();
9922 if (cargo)
9923 {
9925 {
9927 }
9928 }
9929 }
9930 }
9931
9933 {
9934
9936 return;
9937 }
9938
9939 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9940 {
9942 }
9943 }
9944 }
9945
9946
9948 {
9949 super.OnRightClick();
9950
9952 {
9954 {
9955 if (ScriptInputUserData.CanStoreInputUserData())
9956 {
9957 EntityAI root = GetHierarchyRoot();
9958 Man playerOwner = GetHierarchyRootPlayer();
9959 InventoryLocation dst = new InventoryLocation;
9960
9961
9962 if (!playerOwner && root && root == this)
9963 {
9965 }
9966 else
9967 {
9968
9969 GetInventory().GetCurrentInventoryLocation(dst);
9971 {
9972 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9974 {
9976 }
9977 else
9978 {
9980
9981
9982 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9983 {
9985 }
9986 else
9987 {
9988 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9989 }
9990 }
9991 }
9992 }
9993
9994 ScriptInputUserData ctx = new ScriptInputUserData;
10002 }
10003 }
10004 else if (!
g_Game.IsMultiplayer())
10005 {
10007 }
10008 }
10009 }
10010
10012 {
10013 if (root)
10014 {
10015 vector m4[4];
10016 root.GetTransform(m4);
10017 dst.SetGround(this, m4);
10018 }
10019 else
10020 {
10021 GetInventory().GetCurrentInventoryLocation(dst);
10022 }
10023 }
10024
10025 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10026 {
10027
10028 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10029 return false;
10030
10031 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10032 return false;
10033
10034
10036 return false;
10037
10038
10039 Magazine mag = Magazine.Cast(this);
10040 if (mag)
10041 {
10042 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10043 return false;
10044
10045 if (stack_max_limit)
10046 {
10047 Magazine other_mag = Magazine.Cast(other_item);
10048 if (other_item)
10049 {
10050 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10051 return false;
10052 }
10053
10054 }
10055 }
10056 else
10057 {
10058
10060 return false;
10061
10063 return false;
10064 }
10065
10066 PlayerBase player = null;
10067 if (CastTo(player, GetHierarchyRootPlayer()))
10068 {
10069 if (player.GetInventory().HasAttachment(this))
10070 return false;
10071
10072 if (player.IsItemsToDelete())
10073 return false;
10074 }
10075
10076 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10077 return false;
10078
10079 int slotID;
10081 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10082 return false;
10083
10084 return true;
10085 }
10086
10088 {
10090 }
10091
10093 {
10094 return m_IsResultOfSplit;
10095 }
10096
10098 {
10099 m_IsResultOfSplit = value;
10100 }
10101
10103 {
10105 }
10106
10108 {
10109 float other_item_quantity = other_item.GetQuantity();
10110 float this_free_space;
10111
10113
10115
10116 if (other_item_quantity > this_free_space)
10117 {
10118 return this_free_space;
10119 }
10120 else
10121 {
10122 return other_item_quantity;
10123 }
10124 }
10125
10127 {
10129 }
10130
10132 {
10134 return;
10135
10136 if (!IsMagazine() && other_item)
10137 {
10139 if (quantity_used != 0)
10140 {
10141 float hp1 = GetHealth01("","");
10142 float hp2 = other_item.GetHealth01("","");
10143 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10144 hpResult = hpResult / (
GetQuantity() + quantity_used);
10145
10146 hpResult *= GetMaxHealth();
10147 Math.Round(hpResult);
10148 SetHealth("", "Health", hpResult);
10149
10151 other_item.AddQuantity(-quantity_used);
10152 }
10153 }
10155 }
10156
10158 {
10159 #ifdef SERVER
10160 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10161 GetHierarchyParent().IncreaseLifetimeUp();
10162 #endif
10163 };
10164
10166 {
10167 PlayerBase p = PlayerBase.Cast(player);
10168
10169 array<int> recipesIds = p.m_Recipes;
10170 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10171 if (moduleRecipesManager)
10172 {
10173 EntityAI itemInHands = player.GetEntityInHands();
10174 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10175 }
10176
10177 for (int i = 0;i < recipesIds.Count(); i++)
10178 {
10179 int key = recipesIds.Get(i);
10180 string recipeName = moduleRecipesManager.GetRecipeName(key);
10182 }
10183 }
10184
10185
10186 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10187 {
10188 super.GetDebugActions(outputList);
10189
10190
10196
10197
10202
10207
10208
10212
10213
10215 {
10219 }
10220
10223
10224
10228
10230
10231 InventoryLocation loc = new InventoryLocation();
10232 GetInventory().GetCurrentInventoryLocation(loc);
10234 {
10235 if (Gizmo_IsSupported())
10238 }
10239
10241 }
10242
10243
10244
10245
10247 {
10248 super.OnAction(action_id, player, ctx);
10249
10251 {
10252 switch (action_id)
10253 {
10257 return true;
10261 return true;
10262 }
10263 }
10264
10266 {
10267 switch (action_id)
10268 {
10270 Delete();
10271 return true;
10272 }
10273 }
10274
10275 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10276 {
10277 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10278 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10279 PlayerBase p = PlayerBase.Cast(player);
10280 if (
EActions.RECIPES_RANGE_START < 1000)
10281 {
10282 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10283 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10284 }
10285 }
10286 #ifndef SERVER
10287 else if (action_id ==
EActions.WATCH_PLAYER)
10288 {
10289 PluginDeveloper.SetDeveloperItemClientEx(player);
10290 }
10291 #endif
10293 {
10294 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10295 {
10296 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10297 OnDebugButtonPressServer(id + 1);
10298 }
10299
10300 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10301 {
10302 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10304 }
10305
10306 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10307 {
10308 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10310 }
10311
10312 else if (action_id ==
EActions.ADD_QUANTITY)
10313 {
10314 if (IsMagazine())
10315 {
10316 Magazine mag = Magazine.Cast(this);
10317 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10318 }
10319 else
10320 {
10322 }
10323
10324 if (m_EM)
10325 {
10326 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10327 }
10328
10329 }
10330
10331 else if (action_id ==
EActions.REMOVE_QUANTITY)
10332 {
10333 if (IsMagazine())
10334 {
10335 Magazine mag2 = Magazine.Cast(this);
10336 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10337 }
10338 else
10339 {
10341 }
10342 if (m_EM)
10343 {
10344 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10345 }
10346
10347 }
10348
10349 else if (action_id ==
EActions.SET_QUANTITY_0)
10350 {
10352
10353 if (m_EM)
10354 {
10355 m_EM.SetEnergy(0);
10356 }
10357 }
10358
10359 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10360 {
10362
10363 if (m_EM)
10364 {
10365 m_EM.SetEnergy(m_EM.GetEnergyMax());
10366 }
10367 }
10368
10369 else if (action_id ==
EActions.ADD_HEALTH)
10370 {
10371 AddHealth("","",GetMaxHealth("","Health")/5);
10372 }
10373 else if (action_id ==
EActions.REMOVE_HEALTH)
10374 {
10375 AddHealth("","",-GetMaxHealth("","Health")/5);
10376 }
10377 else if (action_id ==
EActions.DESTROY_HEALTH)
10378 {
10379 SetHealth01("","",0);
10380 }
10381 else if (action_id ==
EActions.WATCH_ITEM)
10382 {
10384 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10385 #ifdef DEVELOPER
10386 SetDebugDeveloper_item(this);
10387 #endif
10388 }
10389
10390 else if (action_id ==
EActions.ADD_TEMPERATURE)
10391 {
10392 AddTemperature(20);
10393
10394 }
10395
10396 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10397 {
10398 AddTemperature(-20);
10399
10400 }
10401
10402 else if (action_id ==
EActions.FLIP_FROZEN)
10403 {
10404 SetFrozen(!GetIsFrozen());
10405
10406 }
10407
10408 else if (action_id ==
EActions.ADD_WETNESS)
10409 {
10411
10412 }
10413
10414 else if (action_id ==
EActions.REMOVE_WETNESS)
10415 {
10417
10418 }
10419
10420 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10421 {
10424
10425
10426 }
10427
10428 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10429 {
10432 }
10433
10434 else if (action_id ==
EActions.MAKE_SPECIAL)
10435 {
10436 auto debugParams = DebugSpawnParams.WithPlayer(player);
10437 OnDebugSpawnEx(debugParams);
10438 }
10439
10440 }
10441
10442
10443 return false;
10444 }
10445
10446
10447
10448
10452
10455
10456
10457
10459 {
10460 return false;
10461 }
10462
10463
10465 {
10466 return true;
10467 }
10468
10469
10471 {
10472 return true;
10473 }
10474
10475
10476
10478 {
10479 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10480 return g_Game.ConfigIsExisting(config_path);
10481 }
10482
10485 {
10486 return null;
10487 }
10488
10490 {
10491 return false;
10492 }
10493
10495 {
10496 return false;
10497 }
10498
10502
10503
10505 {
10506 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10507 return module_repairing.CanRepair(this, item_repair_kit);
10508 }
10509
10510
10511 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10512 {
10513 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10514 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10515 }
10516
10517
10519 {
10520
10521
10522
10523
10524
10525
10526
10527
10528 return 1;
10529 }
10530
10531
10532
10534 {
10536 }
10537
10538
10539
10541 {
10543 }
10544
10545
10554 {
10555 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10556
10557 if (player)
10558 {
10559 player.MessageStatus(text);
10560 }
10561 }
10562
10563
10572 {
10573 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10574
10575 if (player)
10576 {
10577 player.MessageAction(text);
10578 }
10579 }
10580
10581
10590 {
10591 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10592
10593 if (player)
10594 {
10595 player.MessageFriendly(text);
10596 }
10597 }
10598
10599
10608 {
10609 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10610
10611 if (player)
10612 {
10613 player.MessageImportant(text);
10614 }
10615 }
10616
10618 {
10619 return true;
10620 }
10621
10622
10623 override bool KindOf(
string tag)
10624 {
10625 bool found = false;
10626 string item_name = this.
GetType();
10628 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10629
10630 int array_size = item_tag_array.Count();
10631 for (int i = 0; i < array_size; i++)
10632 {
10633 if (item_tag_array.Get(i) == tag)
10634 {
10635 found = true;
10636 break;
10637 }
10638 }
10639 return found;
10640 }
10641
10642
10644 {
10645
10646 super.OnRPC(sender, rpc_type,ctx);
10647
10648
10649 switch (rpc_type)
10650 {
10651 #ifndef SERVER
10652 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10653 Param2<bool, string> p = new Param2<bool, string>(false, "");
10654
10656 return;
10657
10658 bool play = p.param1;
10659 string soundSet = p.param2;
10660
10661 if (play)
10662 {
10664 {
10666 {
10668 }
10669 }
10670 else
10671 {
10673 }
10674 }
10675 else
10676 {
10678 }
10679
10680 break;
10681 #endif
10682
10683 }
10684
10686 {
10688 }
10689 }
10690
10691
10692
10693
10695 {
10696 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10697 return plugin.GetID(
name);
10698 }
10699
10701 {
10702 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10703 return plugin.GetName(id);
10704 }
10705
10708 {
10709
10710
10711 int varFlags;
10712 if (!ctx.
Read(varFlags))
10713 return;
10714
10715 if (varFlags & ItemVariableFlags.FLOAT)
10716 {
10718 }
10719 }
10720
10722 {
10723
10724 super.SerializeNumericalVars(floats_out);
10725
10726
10727
10729 {
10731 }
10732
10734 {
10736 }
10737
10739 {
10741 }
10742
10744 {
10749 }
10750
10752 {
10754 }
10755 }
10756
10758 {
10759
10760 super.DeSerializeNumericalVars(floats);
10761
10762
10763 int index = 0;
10764 int mask = Math.Round(floats.Get(index));
10765
10766 index++;
10767
10769 {
10771 {
10773 }
10774 else
10775 {
10776 float quantity = floats.Get(index);
10777 SetQuantity(quantity,
true,
false,
false,
false);
10778 }
10779 index++;
10780 }
10781
10783 {
10784 float wet = floats.Get(index);
10786 index++;
10787 }
10788
10790 {
10791 int liquidtype = Math.Round(floats.Get(index));
10793 index++;
10794 }
10795
10797 {
10799 index++;
10801 index++;
10803 index++;
10805 index++;
10806 }
10807
10809 {
10810 int cleanness = Math.Round(floats.Get(index));
10812 index++;
10813 }
10814 }
10815
10817 {
10818 super.WriteVarsToCTX(ctx);
10819
10820
10822 {
10824 }
10825
10827 {
10829 }
10830
10832 {
10834 }
10835
10837 {
10838 int r,g,b,a;
10844 }
10845
10847 {
10849 }
10850 }
10851
10853 {
10854 if (!super.ReadVarsFromCTX(ctx,version))
10855 return false;
10856
10857 int intValue;
10858 float value;
10859
10860 if (version < 140)
10861 {
10862 if (!ctx.
Read(intValue))
10863 return false;
10864
10865 m_VariablesMask = intValue;
10866 }
10867
10869 {
10870 if (!ctx.
Read(value))
10871 return false;
10872
10874 {
10876 }
10877 else
10878 {
10880 }
10881 }
10882
10883 if (version < 140)
10884 {
10886 {
10887 if (!ctx.
Read(value))
10888 return false;
10889 SetTemperatureDirect(value);
10890 }
10891 }
10892
10894 {
10895 if (!ctx.
Read(value))
10896 return false;
10898 }
10899
10901 {
10902 if (!ctx.
Read(intValue))
10903 return false;
10905 }
10906
10908 {
10909 int r,g,b,a;
10911 return false;
10913 return false;
10915 return false;
10917 return false;
10918
10920 }
10921
10923 {
10924 if (!ctx.
Read(intValue))
10925 return false;
10927 }
10928
10929 if (version >= 138 && version < 140)
10930 {
10932 {
10933 if (!ctx.
Read(intValue))
10934 return false;
10935 SetFrozen(intValue);
10936 }
10937 }
10938
10939 return true;
10940 }
10941
10942
10944 {
10947 {
10949 }
10950
10951 if (!super.OnStoreLoad(ctx, version))
10952 {
10954 return false;
10955 }
10956
10957 if (version >= 114)
10958 {
10959 bool hasQuickBarIndexSaved;
10960
10961 if (!ctx.
Read(hasQuickBarIndexSaved))
10962 {
10964 return false;
10965 }
10966
10967 if (hasQuickBarIndexSaved)
10968 {
10969 int itmQBIndex;
10970
10971
10972 if (!ctx.
Read(itmQBIndex))
10973 {
10975 return false;
10976 }
10977
10978 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10979 if (itmQBIndex != -1 && parentPlayer)
10980 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10981 }
10982 }
10983 else
10984 {
10985
10986 PlayerBase player;
10987 int itemQBIndex;
10988 if (version ==
int.
MAX)
10989 {
10990 if (!ctx.
Read(itemQBIndex))
10991 {
10993 return false;
10994 }
10995 }
10996 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10997 {
10998
10999 if (!ctx.
Read(itemQBIndex))
11000 {
11002 return false;
11003 }
11004 if (itemQBIndex != -1 && player)
11005 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11006 }
11007 }
11008
11009 if (version < 140)
11010 {
11011
11012 if (!LoadVariables(ctx, version))
11013 {
11015 return false;
11016 }
11017 }
11018
11019
11021 {
11023 return false;
11024 }
11025 if (version >= 132)
11026 {
11028 if (raib)
11029 {
11031 {
11033 return false;
11034 }
11035 }
11036 }
11037
11039 return true;
11040 }
11041
11042
11043
11045 {
11046 super.OnStoreSave(ctx);
11047
11048 PlayerBase player;
11049 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11050 {
11052
11053 int itemQBIndex = -1;
11054 itemQBIndex = player.FindQuickBarEntityIndex(this);
11055 ctx.
Write(itemQBIndex);
11056 }
11057 else
11058 {
11060 }
11061
11063
11065 if (raib)
11066 {
11068 }
11069 }
11070
11071
11073 {
11074 super.AfterStoreLoad();
11075
11077 {
11079 }
11080
11082 {
11085 }
11086 }
11087
11089 {
11090 super.EEOnAfterLoad();
11091
11093 {
11095 }
11096
11099 }
11100
11102 {
11103 return false;
11104 }
11105
11106
11107
11109 {
11111 {
11112 #ifdef PLATFORM_CONSOLE
11113
11115 {
11117 if (menu)
11118 {
11120 }
11121 }
11122 #endif
11123 }
11124
11126 {
11129 }
11130
11132 {
11133 SetWeightDirty();
11135 }
11137 {
11140 }
11141
11143 {
11146
11149 }
11151 {
11155 }
11156
11157 super.OnVariablesSynchronized();
11158 }
11159
11160
11161
11163 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11164 {
11165 if (!IsServerCheck(allow_client))
11166 return false;
11167
11169 return false;
11170
11173
11174 if (value <= (min + 0.001))
11175 value = min;
11176
11177 if (value == min)
11178 {
11179 if (destroy_config)
11180 {
11181 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11182 if (dstr)
11183 {
11185 this.Delete();
11186 return true;
11187 }
11188 }
11189 else if (destroy_forced)
11190 {
11192 this.Delete();
11193 return true;
11194 }
11195
11197 }
11198
11201
11203 {
11204 EntityAI parent = GetHierarchyRoot();
11205 InventoryLocation iLoc = new InventoryLocation();
11206 GetInventory().GetCurrentInventoryLocation(iLoc);
11208 {
11209 int iLocSlot = iLoc.
GetSlot();
11211 {
11213 }
11215 {
11217 }
11218 }
11219 }
11220
11222 {
11224
11225 if (delta)
11227 }
11228
11230
11231 return false;
11232 }
11233
11234
11236 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11237 {
11239 }
11240
11242 {
11245 }
11246
11248 {
11251 }
11252
11254 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11255 {
11256 float value_clamped = Math.Clamp(value, 0, 1);
11258 SetQuantity(result, destroy_config, destroy_forced);
11259 }
11260
11261
11264 {
11266 }
11267
11269 {
11271 }
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11283 {
11284 int slot = -1;
11285 GameInventory inventory = GetInventory();
11286 if (inventory)
11287 {
11288 InventoryLocation il = new InventoryLocation;
11291 }
11292
11294 }
11295
11297 {
11298 float quantity_max = 0;
11299
11301 {
11302 if (attSlotID != -1)
11303 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11304
11305 if (quantity_max <= 0)
11307 }
11308
11309 if (quantity_max <= 0)
11311
11312 return quantity_max;
11313 }
11314
11316 {
11318 }
11319
11321 {
11323 }
11324
11325
11327 {
11329 }
11330
11332 {
11334 }
11335
11337 {
11339 }
11340
11341
11343 {
11344
11345 float weightEx = GetWeightEx();
11346 float special = GetInventoryAndCargoWeight();
11347 return weightEx - special;
11348 }
11349
11350
11352 {
11354 }
11355
11357 {
11359 {
11360 #ifdef DEVELOPER
11361 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11362 {
11363 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11365 }
11366 #endif
11367
11368 return GetQuantity() * GetConfigWeightModified();
11369 }
11370 else if (HasEnergyManager())
11371 {
11372 #ifdef DEVELOPER
11373 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11374 {
11375 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11376 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11377 }
11378 #endif
11379 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11380 }
11381 else
11382 {
11383 #ifdef DEVELOPER
11384 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11385 {
11386 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11387 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11388 }
11389 #endif
11390 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11391 }
11392 }
11393
11396 {
11397 int item_count = 0;
11399
11400 GameInventory inventory = GetInventory();
11401 CargoBase cargo = inventory.
GetCargo();
11402 if (cargo != NULL)
11403 {
11405 }
11406
11408 for (int i = 0; i < nAttachments; ++i)
11409 {
11411 if (item)
11412 item_count += item.GetNumberOfItems();
11413 }
11414 return item_count;
11415 }
11416
11419 {
11420 float weight = 0;
11421 float wetness = 1;
11422 if (include_wetness)
11425 {
11426 weight = wetness * m_ConfigWeight;
11427 }
11429 {
11430 weight = 1;
11431 }
11432 return weight;
11433 }
11434
11435
11436
11438 {
11439 GameInventory inventory = GetInventory();
11440 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11441 {
11442 array<EntityAI> items = new array<EntityAI>;
11444 for (int i = 0; i < items.Count(); ++i)
11445 {
11447 if (item)
11448 {
11449 g_Game.ObjectDelete(item);
11450 }
11451 }
11452 }
11453 }
11454
11455
11456
11457
11459 {
11460 float energy = 0;
11461 if (HasEnergyManager())
11462 {
11463 energy = GetCompEM().GetEnergy();
11464 }
11465 return energy;
11466 }
11467
11468
11470 {
11471 super.OnEnergyConsumed();
11472
11474 }
11475
11477 {
11478 super.OnEnergyAdded();
11479
11481 }
11482
11483
11485 {
11486 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11487 {
11489 {
11490 float energy_0to1 = GetCompEM().GetEnergy0To1();
11492 }
11493 }
11494 }
11495
11496
11498 {
11499 return ConfigGetFloat("heatIsolation");
11500 }
11501
11503 {
11505 }
11506
11508 {
11509 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11510 if (
g_Game.ConfigIsExisting(paramPath))
11511 return g_Game.ConfigGetFloat(paramPath);
11512
11513 return 0.0;
11514 }
11515
11517 {
11518 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11519 if (
g_Game.ConfigIsExisting(paramPath))
11520 return g_Game.ConfigGetFloat(paramPath);
11521
11522 return 0.0;
11523 }
11524
11525 override void SetWet(
float value,
bool allow_client =
false)
11526 {
11527 if (!IsServerCheck(allow_client))
11528 return;
11529
11532
11534
11535 m_VarWet = Math.Clamp(value, min, max);
11536
11538 {
11541 }
11542 }
11543
11544 override void AddWet(
float value)
11545 {
11547 }
11548
11550 {
11552 }
11553
11555 {
11557 }
11558
11560 {
11562 }
11563
11565 {
11567 }
11568
11570 {
11572 }
11573
11574 override void OnWetChanged(
float newVal,
float oldVal)
11575 {
11578 if (newLevel != oldLevel)
11579 {
11581 }
11582 }
11583
11585 {
11586 SetWeightDirty();
11587 }
11588
11590 {
11591 return GetWetLevelInternal(
m_VarWet);
11592 }
11593
11594
11595
11597 {
11599 }
11600
11602 {
11604 }
11605
11607 {
11609 }
11610
11612 {
11614 }
11615
11616
11617
11619 {
11620 if (ConfigIsExisting("itemModelLength"))
11621 {
11622 return ConfigGetFloat("itemModelLength");
11623 }
11624 return 0;
11625 }
11626
11628 {
11629 if (ConfigIsExisting("itemAttachOffset"))
11630 {
11631 return ConfigGetFloat("itemAttachOffset");
11632 }
11633 return 0;
11634 }
11635
11636 override void SetCleanness(
int value,
bool allow_client =
false)
11637 {
11638 if (!IsServerCheck(allow_client))
11639 return;
11640
11642
11644
11647 }
11648
11650 {
11652 }
11653
11655 {
11656 return true;
11657 }
11658
11659
11660
11661
11663 {
11665 }
11666
11668 {
11670 }
11671
11672
11673
11674
11675 override void SetColor(
int r,
int g,
int b,
int a)
11676 {
11682 }
11684 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11685 {
11690 }
11691
11693 {
11695 }
11696
11699 {
11700 int r,g,b,a;
11702 r = r/255;
11703 g = g/255;
11704 b = b/255;
11705 a = a/255;
11706 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11707 }
11708
11709
11710
11711 override void SetLiquidType(
int value,
bool allow_client =
false)
11712 {
11713 if (!IsServerCheck(allow_client))
11714 return;
11715
11720 }
11721
11723 {
11724 return ConfigGetInt("varLiquidTypeInit");
11725 }
11726
11728 {
11730 }
11731
11733 {
11735 SetFrozen(false);
11736 }
11737
11740 {
11741 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11742 }
11743
11744
11747 {
11748 PlayerBase nplayer;
11749 if (PlayerBase.CastTo(nplayer, player))
11750 {
11752 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11753 }
11754 }
11755
11756
11759 {
11760 PlayerBase nplayer;
11761 if (PlayerBase.CastTo(nplayer,player))
11762 {
11763 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11764 }
11765
11766 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11767
11768 if (HasEnergyManager())
11769 {
11770 GetCompEM().UpdatePlugState();
11771 }
11772 }
11773
11774
11776 {
11777 super.OnPlacementStarted(player);
11778
11780 }
11781
11782 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11783 {
11785 {
11786 m_AdminLog.OnPlacementComplete(player,
this);
11787 }
11788
11789 super.OnPlacementComplete(player, position, orientation);
11790 }
11791
11792
11793
11794
11795
11797 {
11799 {
11800 return true;
11801 }
11802 else
11803 {
11804 return false;
11805 }
11806 }
11807
11808
11810 {
11812 {
11814 }
11815 }
11816
11817
11819 {
11821 }
11822
11824 {
11826 }
11827
11828 override void InsertAgent(
int agent,
float count = 1)
11829 {
11830 if (count < 1)
11831 return;
11832
11834 }
11835
11838 {
11840 }
11841
11842
11844 {
11846 }
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11890 {
11892 return false;
11893 return true;
11894 }
11895
11897 {
11898
11900 }
11901
11902
11905 {
11906 super.CheckForRoofLimited(timeTresholdMS);
11907
11908 float time =
g_Game.GetTime();
11909 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11910 {
11911 m_PreviousRoofTestTime = time;
11912 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11913 }
11914 }
11915
11916
11918 {
11920 {
11921 return 0;
11922 }
11923
11924 if (GetInventory().GetAttachmentSlotsCount() != 0)
11925 {
11926 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11927 if (filter)
11928 return filter.GetProtectionLevel(type, false, system);
11929 else
11930 return 0;
11931 }
11932
11933 string subclassPath, entryName;
11934
11935 switch (type)
11936 {
11938 entryName = "biological";
11939 break;
11941 entryName = "chemical";
11942 break;
11943 default:
11944 entryName = "biological";
11945 break;
11946 }
11947
11948 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11949
11950 return g_Game.ConfigGetFloat(subclassPath + entryName);
11951 }
11952
11953
11954
11957 {
11958 if (!IsMagazine())
11960
11962 }
11963
11964
11965
11966
11967
11972 {
11973 return true;
11974 }
11975
11977 {
11979 }
11980
11981
11982
11983
11984
11986 {
11987 if (parent)
11988 {
11989 if (parent.IsInherited(DayZInfected))
11990 return true;
11991
11992 if (!parent.IsRuined())
11993 return true;
11994 }
11995
11996 return true;
11997 }
11998
12000 {
12001 if (!super.CanPutAsAttachment(parent))
12002 {
12003 return false;
12004 }
12005
12006 if (!IsRuined() && !parent.IsRuined())
12007 {
12008 return true;
12009 }
12010
12011 return false;
12012 }
12013
12015 {
12016
12017
12018
12019
12020 return super.CanReceiveItemIntoCargo(item);
12021 }
12022
12024 {
12025
12026
12027
12028
12029 GameInventory attachmentInv = attachment.GetInventory();
12031 {
12032 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12033 return false;
12034 }
12035
12036 InventoryLocation loc = new InventoryLocation();
12037 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12038 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12039 return false;
12040
12041 return super.CanReceiveAttachment(attachment, slotId);
12042 }
12043
12045 {
12046 if (!super.CanReleaseAttachment(attachment))
12047 return false;
12048
12049 return GetInventory().AreChildrenAccessible();
12050 }
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12073 {
12074 int id = muzzle_owner.GetMuzzleID();
12075 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12076
12077 if (WPOF_array)
12078 {
12079 for (int i = 0; i < WPOF_array.Count(); i++)
12080 {
12081 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12082
12083 if (WPOF)
12084 {
12085 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12086 }
12087 }
12088 }
12089 }
12090
12091
12093 {
12094 int id = muzzle_owner.GetMuzzleID();
12096
12097 if (WPOBE_array)
12098 {
12099 for (int i = 0; i < WPOBE_array.Count(); i++)
12100 {
12101 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12102
12103 if (WPOBE)
12104 {
12105 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12106 }
12107 }
12108 }
12109 }
12110
12111
12113 {
12114 int id = muzzle_owner.GetMuzzleID();
12115 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12116
12117 if (WPOOH_array)
12118 {
12119 for (int i = 0; i < WPOOH_array.Count(); i++)
12120 {
12121 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12122
12123 if (WPOOH)
12124 {
12125 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12126 }
12127 }
12128 }
12129 }
12130
12131
12133 {
12134 int id = muzzle_owner.GetMuzzleID();
12135 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12136
12137 if (WPOOH_array)
12138 {
12139 for (int i = 0; i < WPOOH_array.Count(); i++)
12140 {
12141 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12142
12143 if (WPOOH)
12144 {
12145 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12146 }
12147 }
12148 }
12149 }
12150
12151
12153 {
12154 int id = muzzle_owner.GetMuzzleID();
12155 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12156
12157 if (WPOOH_array)
12158 {
12159 for (int i = 0; i < WPOOH_array.Count(); i++)
12160 {
12161 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12162
12163 if (WPOOH)
12164 {
12165 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12166 }
12167 }
12168 }
12169 }
12170
12171
12172
12174 {
12176 {
12177 return true;
12178 }
12179
12180 return false;
12181 }
12182
12184 {
12186 {
12187 return true;
12188 }
12189
12190 return false;
12191 }
12192
12194 {
12196 {
12197 return true;
12198 }
12199
12200 return false;
12201 }
12202
12204 {
12205 return false;
12206 }
12207
12210 {
12211 return UATimeSpent.DEFAULT_DEPLOY;
12212 }
12213
12214
12215
12216
12218 {
12220 SetSynchDirty();
12221 }
12222
12224 {
12226 }
12227
12228
12230 {
12231 return false;
12232 }
12233
12236 {
12237 string att_type = "None";
12238
12239 if (ConfigIsExisting("soundAttType"))
12240 {
12241 att_type = ConfigGetString("soundAttType");
12242 }
12243
12245 }
12246
12248 {
12250 }
12251
12252
12253
12254
12255
12261
12263 {
12266
12268 }
12269
12270
12272 {
12274 return;
12275
12277
12280
12283
12284 SoundParameters params = new SoundParameters();
12288 }
12289
12290
12292 {
12294 {
12297
12298 SetSynchDirty();
12299
12302 }
12303 }
12304
12306 {
12308 }
12309
12310
12312 {
12314 return;
12315
12317 SetSynchDirty();
12318
12321 }
12322
12324 {
12327 }
12328
12330 {
12332 }
12333
12334 void OnApply(PlayerBase player);
12335
12337 {
12338 return 1.0;
12339 };
12340
12342 {
12344 }
12345
12347 {
12349 }
12350
12352
12354 {
12355 SetDynamicPhysicsLifeTime(0.01);
12357 }
12358
12360 {
12361 array<string> zone_names = new array<string>;
12362 GetDamageZones(zone_names);
12363 for (int i = 0; i < zone_names.Count(); i++)
12364 {
12365 SetHealthMax(zone_names.Get(i),"Health");
12366 }
12367 SetHealthMax("","Health");
12368 }
12369
12372 {
12373 float global_health = GetHealth01("","Health");
12374 array<string> zones = new array<string>;
12375 GetDamageZones(zones);
12376
12377 for (int i = 0; i < zones.Count(); i++)
12378 {
12379 SetHealth01(zones.Get(i),"Health",global_health);
12380 }
12381 }
12382
12385 {
12386 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12387 }
12388
12390 {
12391 if (!hasRootAsPlayer)
12392 {
12393 if (refParentIB)
12394 {
12395
12396 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12397 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12398
12399 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12400 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12401
12404 }
12405 else
12406 {
12407
12410 }
12411 }
12412 }
12413
12415 {
12417 {
12418 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12419 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12420 {
12421 float heatPermCoef = 1.0;
12423 while (ent)
12424 {
12425 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12426 ent = ent.GetHierarchyParent();
12427 }
12428
12429 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12430 }
12431 }
12432 }
12433
12435 {
12436
12437 EntityAI parent = GetHierarchyParent();
12438 if (!parent)
12439 {
12440 hasParent = false;
12441 hasRootAsPlayer = false;
12442 }
12443 else
12444 {
12445 hasParent = true;
12446 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12447 refParentIB =
ItemBase.Cast(parent);
12448 }
12449 }
12450
12451 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12452 {
12453
12454 }
12455
12457 {
12458
12459 return false;
12460 }
12461
12463 {
12464
12465
12466 return false;
12467 }
12468
12470 {
12471
12472 return false;
12473 }
12474
12477 {
12478 return !GetIsFrozen() &&
IsOpen();
12479 }
12480
12482 {
12483 bool hasParent = false, hasRootAsPlayer = false;
12485
12486 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12487 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12488
12489 if (wwtu || foodDecay)
12490 {
12494
12495 if (processWetness || processTemperature || processDecay)
12496 {
12498
12499 if (processWetness)
12500 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12501
12502 if (processTemperature)
12504
12505 if (processDecay)
12506 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12507 }
12508 }
12509 }
12510
12513 {
12515 }
12516
12518 {
12521
12522 return super.GetTemperatureFreezeThreshold();
12523 }
12524
12526 {
12529
12530 return super.GetTemperatureThawThreshold();
12531 }
12532
12534 {
12537
12538 return super.GetItemOverheatThreshold();
12539 }
12540
12542 {
12544 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12545
12546 return super.GetTemperatureFreezeTime();
12547 }
12548
12550 {
12552 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12553
12554 return super.GetTemperatureThawTime();
12555 }
12556
12561
12563 {
12564 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12565 }
12566
12568 {
12569 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12570 }
12571
12574 {
12576 }
12577
12579 {
12581 }
12582
12584 {
12586 }
12587
12590 {
12591 return null;
12592 }
12593
12596 {
12597 return false;
12598 }
12599
12601 {
12603 {
12606 if (!trg)
12607 {
12609 explosive = this;
12610 }
12611
12612 explosive.PairRemote(trg);
12614
12615 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12616 trg.SetPersistentPairID(persistentID);
12617 explosive.SetPersistentPairID(persistentID);
12618
12619 return true;
12620 }
12621 return false;
12622 }
12623
12626 {
12627 float ret = 1.0;
12630 ret *= GetHealth01();
12631
12632 return ret;
12633 }
12634
12635 #ifdef DEVELOPER
12636 override void SetDebugItem()
12637 {
12638 super.SetDebugItem();
12639 _itemBase = this;
12640 }
12641
12643 {
12644 string text = super.GetDebugText();
12645
12647 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12648
12649 return text;
12650 }
12651 #endif
12652
12654 {
12655 return true;
12656 }
12657
12659
12661
12663 {
12666 }
12667
12668
12676
12692
12693 [
Obsolete(
"Use ItemSoundHandler instead")]
12696 {
12697 if (!
g_Game.IsDedicatedServer())
12698 {
12699 if (ConfigIsExisting("attachSoundSet"))
12700 {
12701 string cfg_path = "";
12702 string soundset = "";
12703 string type_name =
GetType();
12704
12707 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12708 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12709
12710 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12711 {
12712 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12713 {
12714 if (cfg_slot_array[i] == slot_type)
12715 {
12716 soundset = cfg_soundset_array[i];
12717 break;
12718 }
12719 }
12720 }
12721
12722 if (soundset != "")
12723 {
12724 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12726 }
12727 }
12728 }
12729 }
12730
12732}
12733
12735{
12737 if (entity)
12738 {
12739 bool is_item = entity.IsInherited(
ItemBase);
12740 if (is_item && full_quantity)
12741 {
12744 }
12745 }
12746 else
12747 {
12749 return NULL;
12750 }
12751 return entity;
12752}
12753
12755{
12756 if (item)
12757 {
12758 if (health > 0)
12759 item.SetHealth("", "", health);
12760
12761 if (item.CanHaveTemperature())
12762 {
12764 if (item.CanFreeze())
12765 item.SetFrozen(false);
12766 }
12767
12768 if (item.HasEnergyManager())
12769 {
12770 if (quantity >= 0)
12771 {
12772 item.GetCompEM().SetEnergy0To1(quantity);
12773 }
12774 else
12775 {
12777 }
12778 }
12779 else if (item.IsMagazine())
12780 {
12781 Magazine mag = Magazine.Cast(item);
12782 if (quantity >= 0)
12783 {
12784 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12785 }
12786 else
12787 {
12789 }
12790
12791 }
12792 else
12793 {
12794 if (quantity >= 0)
12795 {
12796 item.SetQuantityNormalized(quantity, false);
12797 }
12798 else
12799 {
12801 }
12802
12803 }
12804 }
12805}
12806
12807#ifdef DEVELOPER
12809#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.