7888{
7890 {
7891 return true;
7892 }
7893};
7894
7896{
7897
7898};
7899
7900
7901
7903{
7907
7909
7912
7913
7914
7915
7916
7925
7931
7936
7941
7962 protected bool m_IsResultOfSplit
7963
7965
7970
7971
7972
7974
7978
7979
7980
7982
7985
7986
7987
7993
7994
8002
8005
8006
8008
8009
8011
8012
8017
8018
8023
8025
8026
8028
8029
8031 {
8036
8037 if (!
g_Game.IsDedicatedServer())
8038 {
8040 {
8042
8044 {
8046 }
8047 }
8048
8051 }
8052
8053 m_OldLocation = null;
8054
8056 {
8058 }
8059
8060 if (ConfigIsExisting("headSelectionsToHide"))
8061 {
8064 }
8065
8067 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8068 {
8070 }
8071
8073
8074 m_IsResultOfSplit = false;
8075
8077 }
8078
8080 {
8081 super.InitItemVariables();
8082
8088 m_Count = ConfigGetInt(
"count");
8089
8092
8097
8100
8105
8117
8121
8122
8125 if (ConfigIsExisting("canBeSplit"))
8126 {
8129 }
8130
8132 if (ConfigIsExisting("itemBehaviour"))
8134
8135
8138 RegisterNetSyncVariableInt("m_VarLiquidType");
8139 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8140
8141 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8142 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8143 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8144
8145 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8146 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8147 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8148 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8149
8150 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8151 RegisterNetSyncVariableBool("m_IsTakeable");
8152 RegisterNetSyncVariableBool("m_IsHologram");
8153
8156 {
8159 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8160 }
8161
8163
8165 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8167
8169 }
8170
8172 {
8174 }
8175
8177 {
8180 {
8185 }
8186 }
8187
8188 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8189 {
8191 {
8194 }
8195
8197 }
8198
8200 {
8206 }
8207
8209
8211 {
8213
8214 if (!action)
8215 {
8216 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8217 return;
8218 }
8219
8221 if (!ai)
8222 {
8224 return;
8225 }
8226
8228 if (!action_array)
8229 {
8230 action_array = new array<ActionBase_Basic>;
8232 }
8233 if (LogManager.IsActionLogEnable())
8234 {
8235 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8236 }
8237
8238 if (action_array.Find(action) != -1)
8239 {
8240 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8241 }
8242 else
8243 {
8244 action_array.Insert(action);
8245 }
8246 }
8247
8249 {
8250 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8251 ActionBase action = player.GetActionManager().GetAction(actionName);
8254
8255 if (action_array)
8256 {
8257 action_array.RemoveItem(action);
8258 }
8259 }
8260
8261
8262
8264 {
8265 ActionOverrideData overrideData = new ActionOverrideData();
8269
8271 if (!actionMap)
8272 {
8275 }
8276
8277 actionMap.Insert(this.
Type(), overrideData);
8278
8279 }
8280
8282
8284
8285
8287 {
8290
8293
8294 string config_to_search = "CfgVehicles";
8295 string muzzle_owner_config;
8296
8298 {
8299 if (IsInherited(Weapon))
8300 config_to_search = "CfgWeapons";
8301
8302 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8303
8304 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8305
8306 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8307
8308 if (config_OnFire_subclass_count > 0)
8309 {
8310 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8311
8312 for (int i = 0; i < config_OnFire_subclass_count; i++)
8313 {
8314 string particle_class = "";
8315 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8316 string config_OnFire_entry = config_OnFire_class + particle_class;
8317 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8318 WPOF_array.Insert(WPOF);
8319 }
8320
8321
8323 }
8324 }
8325
8327 {
8328 config_to_search = "CfgWeapons";
8329 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8330
8331 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8332
8333 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8334
8335 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8336 {
8337 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8338
8339 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8340 {
8341 string particle_class2 = "";
8342 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8343 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8344 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8345 WPOBE_array.Insert(WPOBE);
8346 }
8347
8348
8350 }
8351 }
8352 }
8353
8354
8356 {
8359
8361 {
8362 string config_to_search = "CfgVehicles";
8363
8364 if (IsInherited(Weapon))
8365 config_to_search = "CfgWeapons";
8366
8367 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8368 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8369
8370 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8371 {
8372
8374
8376 {
8378 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8380 return;
8381 }
8382
8385
8386
8387
8388 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8389 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8390
8391 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8392 {
8393 string particle_class = "";
8394 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8395 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8396 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8397
8398 if (entry_type == CT_CLASS)
8399 {
8400 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8401 WPOOH_array.Insert(WPOF);
8402 }
8403 }
8404
8405
8407 }
8408 }
8409 }
8410
8412 {
8414 }
8415
8417 {
8419 {
8421
8424
8427
8428 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8429 }
8430 }
8431
8433 {
8435 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8436
8438 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8439
8441 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8442
8444 {
8446 }
8447 }
8448
8450 {
8452 }
8453
8455 {
8458 else
8460
8462 {
8465 }
8466 else
8467 {
8470
8473 }
8474
8476 }
8477
8479 {
8481 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8482 }
8483
8485 {
8487 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8489 }
8490
8492 {
8494 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8495 }
8496
8498 {
8501
8502 OverheatingParticle OP = new OverheatingParticle();
8507
8509 }
8510
8512 {
8515
8516 return -1;
8517 }
8518
8520 {
8522 {
8525
8526 for (int i = count; i > 0; --i)
8527 {
8528 int id = i - 1;
8531
8534
8535 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8536 {
8537 if (p)
8538 {
8541 }
8542 }
8543 }
8544 }
8545 }
8546
8548 {
8550 {
8552 {
8553 int id = i - 1;
8555
8556 if (OP)
8557 {
8559
8560 if (p)
8561 {
8563 }
8564
8565 delete OP;
8566 }
8567 }
8568
8571 }
8572 }
8573
8576 {
8577 return 0.0;
8578 }
8579
8580
8582 {
8583 return 250;
8584 }
8585
8587 {
8588 return 0;
8589 }
8590
8593 {
8595 return true;
8596
8597 return false;
8598 }
8599
8602 {
8605
8607 {
8609 }
8610 else
8611 {
8612
8614 }
8615
8617 }
8618
8625 {
8626 return -1;
8627 }
8628
8629
8630
8631
8633 {
8635 {
8636 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8637 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8638
8639 if (r_index >= 0)
8640 {
8641 InventoryLocation r_il = new InventoryLocation;
8642 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8643
8644 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8647 {
8648 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8649 }
8651 {
8652 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8653 }
8654
8655 }
8656
8657 player.GetHumanInventory().ClearUserReservedLocation(this);
8658 }
8659
8662 }
8663
8664
8665
8666
8668 {
8669 return ItemBase.m_DebugActionsMask;
8670 }
8671
8673 {
8674 return ItemBase.m_DebugActionsMask & mask;
8675 }
8676
8678 {
8679 ItemBase.m_DebugActionsMask = mask;
8680 }
8681
8683 {
8684 ItemBase.m_DebugActionsMask |= mask;
8685 }
8686
8688 {
8689 ItemBase.m_DebugActionsMask &= ~mask;
8690 }
8691
8693 {
8695 {
8697 }
8698 else
8699 {
8701 }
8702 }
8703
8704
8706 {
8707 if (GetEconomyProfile())
8708 {
8709 float q_max = GetEconomyProfile().GetQuantityMax();
8710 if (q_max > 0)
8711 {
8712 float q_min = GetEconomyProfile().GetQuantityMin();
8713 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8714
8716 {
8717 ComponentEnergyManager comp = GetCompEM();
8719 {
8721 }
8722 }
8724 {
8726
8727 }
8728
8729 }
8730 }
8731 }
8732
8735 {
8736 EntityAI parent = GetHierarchyParent();
8737
8738 if (parent)
8739 {
8740 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8741 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8742 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8743 }
8744 }
8745
8748 {
8749 EntityAI parent = GetHierarchyParent();
8750
8751 if (parent)
8752 {
8753 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8754 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8755 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8756 }
8757 }
8758
8760 {
8761
8762
8763
8764
8766
8768 {
8769 if (ScriptInputUserData.CanStoreInputUserData())
8770 {
8771 ScriptInputUserData ctx = new ScriptInputUserData;
8777 ctx.
Write(use_stack_max);
8780
8782 {
8783 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8784 }
8785 }
8786 }
8787 else if (!
g_Game.IsMultiplayer())
8788 {
8790 }
8791 }
8792
8794 {
8796 }
8797
8799 {
8801 }
8802
8804 {
8806 }
8807
8809 {
8810
8811 return false;
8812 }
8813
8815 {
8816 return false;
8817 }
8818
8822 {
8823 return false;
8824 }
8825
8827 {
8828 return "";
8829 }
8830
8832
8834 {
8835 return false;
8836 }
8837
8839 {
8840 return true;
8841 }
8842
8843
8844
8846 {
8847 return true;
8848 }
8849
8851 {
8852 return true;
8853 }
8854
8856 {
8857 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8859 }
8860
8862 {
8864 }
8865
8867 {
8869 if (!is_being_placed)
8871 SetSynchDirty();
8872 }
8873
8874
8876
8878 {
8880 }
8881
8883 {
8885 }
8886
8888 {
8889 return 1;
8890 }
8891
8893 {
8894 return false;
8895 }
8896
8898 {
8900 SetSynchDirty();
8901 }
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8938 {
8939 super.OnMovedInsideCargo(container);
8940
8941 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8942 }
8943
8944 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8945 {
8946 super.EEItemLocationChanged(oldLoc, newLoc);
8947
8948 PlayerBase newPlayer = null;
8949 PlayerBase oldPlayer = null;
8950
8951 if (newLoc.GetParent())
8952 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8953
8954 if (oldLoc.GetParent())
8955 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8956
8958 {
8959 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8960
8961 if (rIndex >= 0)
8962 {
8963 InventoryLocation rIl = new InventoryLocation;
8964 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8965
8966 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8969 {
8970 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8971 }
8973 {
8975 }
8976
8977 }
8978 }
8979
8981 {
8982 if (newPlayer)
8983 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8984
8985 if (newPlayer == oldPlayer)
8986 {
8987 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8988 {
8990 {
8991 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8992 {
8993 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8994 }
8995 }
8996 else
8997 {
8998 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8999 }
9000 }
9001
9002 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9003 {
9004 int type = oldLoc.GetType();
9006 {
9007 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9008 }
9010 {
9011 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9012 }
9013 }
9014 if (!m_OldLocation)
9015 {
9016 m_OldLocation = new InventoryLocation;
9017 }
9018 m_OldLocation.Copy(oldLoc);
9019 }
9020 else
9021 {
9022 if (m_OldLocation)
9023 {
9024 m_OldLocation.Reset();
9025 }
9026 }
9027
9028 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9029 }
9030 else
9031 {
9032 if (newPlayer)
9033 {
9034 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9035 if (resIndex >= 0)
9036 {
9037 InventoryLocation il = new InventoryLocation;
9038 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9040 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9043 {
9044 il.
GetParent().GetOnReleaseLock().Invoke(it);
9045 }
9047 {
9049 }
9050
9051 }
9052 }
9054 {
9055
9057 }
9058
9059 if (m_OldLocation)
9060 {
9061 m_OldLocation.Reset();
9062 }
9063 }
9064
9066 {
9067 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9068 }
9069
9071 {
9072 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9073 }
9074 }
9075
9076 override void EOnContact(IEntity other, Contact extra)
9077 {
9079 {
9080 int liquidType = -1;
9082 if (impactSpeed > 0.0)
9083 {
9085 #ifndef SERVER
9087 #else
9089 SetSynchDirty();
9090 #endif
9092 }
9093 }
9094
9095 #ifdef SERVER
9096 if (GetCompEM() && GetCompEM().IsPlugged())
9097 {
9098 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9099 GetCompEM().UnplugThis();
9100 }
9101 #endif
9102 }
9103
9105
9107 {
9109 }
9110
9112 {
9113
9114 }
9115
9117 {
9118 super.OnItemLocationChanged(old_owner, new_owner);
9119
9120 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9121 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9122
9123 if (!relatedPlayer && playerNew)
9124 relatedPlayer = playerNew;
9125
9126 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9127 {
9129 if (actionMgr)
9130 {
9131 ActionBase currentAction = actionMgr.GetRunningAction();
9132 if (currentAction)
9134 }
9135 }
9136
9137 Man ownerPlayerOld = null;
9138 Man ownerPlayerNew = null;
9139
9140 if (old_owner)
9141 {
9142 if (old_owner.
IsMan())
9143 {
9144 ownerPlayerOld = Man.Cast(old_owner);
9145 }
9146 else
9147 {
9148 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9149 }
9150 }
9151 else
9152 {
9154 {
9156
9157 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9158 {
9159 GetCompEM().UnplugThis();
9160 }
9161 }
9162 }
9163
9164 if (new_owner)
9165 {
9166 if (new_owner.
IsMan())
9167 {
9168 ownerPlayerNew = Man.Cast(new_owner);
9169 }
9170 else
9171 {
9172 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9173 }
9174 }
9175
9176 if (ownerPlayerOld != ownerPlayerNew)
9177 {
9178 if (ownerPlayerOld)
9179 {
9180 array<EntityAI> subItemsExit = new array<EntityAI>;
9182 for (int i = 0; i < subItemsExit.Count(); i++)
9183 {
9186 }
9187 }
9188
9189 if (ownerPlayerNew)
9190 {
9191 array<EntityAI> subItemsEnter = new array<EntityAI>;
9193 for (int j = 0; j < subItemsEnter.Count(); j++)
9194 {
9197 }
9198 }
9199 }
9200 else if (ownerPlayerNew != null)
9201 {
9202 PlayerBase nplayer;
9203 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9204 {
9205 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9207 for (int k = 0; k < subItemsUpdate.Count(); k++)
9208 {
9210 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9211 }
9212 }
9213 }
9214
9215 if (old_owner)
9216 old_owner.OnChildItemRemoved(this);
9217 if (new_owner)
9218 new_owner.OnChildItemReceived(this);
9219 }
9220
9221
9223 {
9224 super.EEDelete(parent);
9225 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9226 if (player)
9227 {
9229
9230 if (player.IsAlive())
9231 {
9232 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9233 if (r_index >= 0)
9234 {
9235 InventoryLocation r_il = new InventoryLocation;
9236 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9237
9238 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9241 {
9242 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9243 }
9245 {
9246 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9247 }
9248
9249 }
9250
9251 player.RemoveQuickBarEntityShortcut(this);
9252 }
9253 }
9254 }
9255
9257 {
9258 super.EEKilled(killer);
9259
9262 {
9263 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9264 {
9265 if (IsMagazine())
9266 {
9267 if (Magazine.Cast(this).GetAmmoCount() > 0)
9268 {
9270 }
9271 }
9272 else
9273 {
9275 }
9276 }
9277 }
9278 }
9279
9281 {
9282 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9283
9284 super.OnWasAttached(parent, slot_id);
9285
9288
9291 }
9292
9294 {
9295 super.OnWasDetached(parent, slot_id);
9296
9299
9302 }
9303
9305 {
9306 int idx;
9309
9310 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9311 if (inventory_slots.Count() < 1)
9312 {
9313 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9314 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9315 }
9316 else
9317 {
9318 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9319 }
9320
9321 idx = inventory_slots.Find(slot);
9322 if (idx < 0)
9323 return "";
9324
9325 return attach_types.Get(idx);
9326 }
9327
9329 {
9330 int idx = -1;
9331 string slot;
9332
9335
9336 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9337 if (inventory_slots.Count() < 1)
9338 {
9339 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9340 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9341 }
9342 else
9343 {
9344 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9345 if (detach_types.Count() < 1)
9346 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9347 }
9348
9349 for (int i = 0; i < inventory_slots.Count(); i++)
9350 {
9351 slot = inventory_slots.Get(i);
9352 }
9353
9354 if (slot != "")
9355 {
9356 if (detach_types.Count() == 1)
9357 idx = 0;
9358 else
9359 idx = inventory_slots.Find(slot);
9360 }
9361 if (idx < 0)
9362 return "";
9363
9364 return detach_types.Get(idx);
9365 }
9366
9368 {
9369
9371
9372
9373 float min_time = 1;
9374 float max_time = 3;
9375 float delay = Math.RandomFloat(min_time, max_time);
9376
9377 explode_timer.Run(delay, this, "DoAmmoExplosion");
9378 }
9379
9381 {
9382 Magazine magazine = Magazine.Cast(this);
9383 int pop_sounds_count = 6;
9384 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9385
9386
9387 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9388 string sound_name = pop_sounds[ sound_idx ];
9389 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9390
9391
9392 magazine.ServerAddAmmoCount(-1);
9393
9394
9395 float min_temp_to_explode = 100;
9396
9397 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9398 {
9400 }
9401 }
9402
9403
9404 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9405 {
9406 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9407
9408 const int CHANCE_DAMAGE_CARGO = 4;
9409 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9410 const int CHANCE_DAMAGE_NOTHING = 2;
9411
9413 {
9414 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9415 int chances;
9416 int rnd;
9417
9418 if (GetInventory().GetCargo())
9419 {
9420 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9421 rnd = Math.RandomInt(0,chances);
9422
9423 if (rnd < CHANCE_DAMAGE_CARGO)
9424 {
9426 }
9427 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9428 {
9430 }
9431 }
9432 else
9433 {
9434 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9435 rnd = Math.RandomInt(0,chances);
9436
9437 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9438 {
9440 }
9441 }
9442 }
9443 }
9444
9446 {
9447 CargoBase cargo = GetInventory().GetCargo();
9448 if (cargo)
9449 {
9451 if (item_count > 0)
9452 {
9453 int random_pick = Math.RandomInt(0, item_count);
9455 if (!item.IsExplosive())
9456 {
9457 item.AddHealth("","",damage);
9458 return true;
9459 }
9460 }
9461 }
9462 return false;
9463 }
9464
9466 {
9467 GameInventory inventory = GetInventory();
9469 if (attachment_count > 0)
9470 {
9471 int random_pick = Math.RandomInt(0, attachment_count);
9473 if (!attachment.IsExplosive())
9474 {
9475 attachment.AddHealth("","",damage);
9476 return true;
9477 }
9478 }
9479 return false;
9480 }
9481
9483 {
9485 }
9486
9488 {
9490 return GetInventory().CanRemoveEntity();
9491
9492 return false;
9493 }
9494
9496 {
9497
9499 return false;
9500
9501
9503 return false;
9504
9505
9506
9508 if (delta == 0)
9509 return false;
9510
9511
9512 return true;
9513 }
9514
9516 {
9518 {
9519 if (ScriptInputUserData.CanStoreInputUserData())
9520 {
9521 ScriptInputUserData ctx = new ScriptInputUserData;
9526 ctx.
Write(destination_entity);
9530 }
9531 }
9532 else if (!
g_Game.IsMultiplayer())
9533 {
9535 }
9536 }
9537
9539 {
9540 float split_quantity_new;
9544 InventoryLocation loc = new InventoryLocation;
9545
9546 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9547 {
9549 split_quantity_new = stack_max;
9550 else
9552
9554 {
9555 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9556 if (new_item)
9557 {
9558 new_item.SetResultOfSplit(true);
9559 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9561 new_item.
SetQuantity(split_quantity_new,
false,
true);
9562 }
9563 }
9564 }
9565 else if (destination_entity && slot_id == -1)
9566 {
9567 if (quantity > stack_max)
9568 split_quantity_new = stack_max;
9569 else
9570 split_quantity_new = quantity;
9571
9573 {
9574 GameInventory destinationInventory = destination_entity.GetInventory();
9576 {
9579 }
9580
9581 if (new_item)
9582 {
9583 new_item.SetResultOfSplit(true);
9584 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9586 new_item.
SetQuantity(split_quantity_new,
false,
true);
9587 }
9588 }
9589 }
9590 else
9591 {
9592 if (stack_max != 0)
9593 {
9595 {
9597 }
9598
9599 if (split_quantity_new == 0)
9600 {
9601 if (!
g_Game.IsMultiplayer())
9602 player.PhysicalPredictiveDropItem(this);
9603 else
9604 player.ServerDropEntity(this);
9605 return;
9606 }
9607
9609 {
9611
9612 if (new_item)
9613 {
9614 new_item.SetResultOfSplit(true);
9615 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9618 new_item.PlaceOnSurface();
9619 }
9620 }
9621 }
9622 }
9623 }
9624
9626 {
9627 float split_quantity_new;
9631 InventoryLocation loc = new InventoryLocation;
9632
9633 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9634 {
9636 split_quantity_new = stack_max;
9637 else
9639
9641 {
9642 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9643 if (new_item)
9644 {
9645 new_item.SetResultOfSplit(true);
9646 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9648 new_item.
SetQuantity(split_quantity_new,
false,
true);
9649 }
9650 }
9651 }
9652 else if (destination_entity && slot_id == -1)
9653 {
9654 if (quantity > stack_max)
9655 split_quantity_new = stack_max;
9656 else
9657 split_quantity_new = quantity;
9658
9660 {
9661 GameInventory destinationInventory = destination_entity.GetInventory();
9663 {
9666 }
9667
9668 if (new_item)
9669 {
9670 new_item.SetResultOfSplit(true);
9671 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9673 new_item.
SetQuantity(split_quantity_new,
false,
true);
9674 }
9675 }
9676 }
9677 else
9678 {
9679 if (stack_max != 0)
9680 {
9682 {
9684 }
9685
9687 {
9689
9690 if (new_item)
9691 {
9692 new_item.SetResultOfSplit(true);
9693 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9696 new_item.PlaceOnSurface();
9697 }
9698 }
9699 }
9700 }
9701 }
9702
9704 {
9706 {
9707 if (ScriptInputUserData.CanStoreInputUserData())
9708 {
9709 ScriptInputUserData ctx = new ScriptInputUserData;
9714 dst.WriteToContext(ctx);
9716 }
9717 }
9718 else if (!
g_Game.IsMultiplayer())
9719 {
9721 }
9722 }
9723
9725 {
9727 {
9728 if (ScriptInputUserData.CanStoreInputUserData())
9729 {
9730 ScriptInputUserData ctx = new ScriptInputUserData;
9735 ctx.
Write(destination_entity);
9741 }
9742 }
9743 else if (!
g_Game.IsMultiplayer())
9744 {
9746 }
9747 }
9748
9750 {
9752 }
9753
9755 {
9757 float split_quantity_new;
9759 if (dst.IsValid())
9760 {
9761 int slot_id = dst.GetSlot();
9763
9764 if (quantity > stack_max)
9765 split_quantity_new = stack_max;
9766 else
9767 split_quantity_new = quantity;
9768
9770 {
9772
9773 if (new_item)
9774 {
9775 new_item.SetResultOfSplit(true);
9776 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9778 new_item.
SetQuantity(split_quantity_new,
false,
true);
9779 }
9780
9781 return new_item;
9782 }
9783 }
9784
9785 return null;
9786 }
9787
9789 {
9791 float split_quantity_new;
9793 if (destination_entity)
9794 {
9796 if (quantity > stackable)
9797 split_quantity_new = stackable;
9798 else
9799 split_quantity_new = quantity;
9800
9802 {
9803 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9804 if (new_item)
9805 {
9806 new_item.SetResultOfSplit(true);
9807 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9809 new_item.
SetQuantity(split_quantity_new,
false,
true);
9810 }
9811 }
9812 }
9813 }
9814
9816 {
9818 {
9819 if (ScriptInputUserData.CanStoreInputUserData())
9820 {
9821 ScriptInputUserData ctx = new ScriptInputUserData;
9826 ItemBase destination_entity =
this;
9827 ctx.
Write(destination_entity);
9831 }
9832 }
9833 else if (!
g_Game.IsMultiplayer())
9834 {
9836 }
9837 }
9838
9840 {
9842 float split_quantity_new;
9844 if (player)
9845 {
9847 if (quantity > stackable)
9848 split_quantity_new = stackable;
9849 else
9850 split_quantity_new = quantity;
9851
9853 {
9854 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9855 new_item =
ItemBase.Cast(in_hands);
9856 if (new_item)
9857 {
9858 new_item.SetResultOfSplit(true);
9859 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9861 new_item.SetQuantity(split_quantity_new, false, true);
9862 }
9863 }
9864 }
9865 }
9866
9868 {
9870 float split_quantity_new = Math.Floor(quantity * 0.5);
9871
9873 return;
9874
9876
9877 if (new_item)
9878 {
9879 if (new_item.GetQuantityMax() < split_quantity_new)
9880 {
9881 split_quantity_new = new_item.GetQuantityMax();
9882 }
9883
9884 new_item.SetResultOfSplit(true);
9885 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9886
9888 {
9891 }
9892 else
9893 {
9895 new_item.
SetQuantity(split_quantity_new,
false,
true);
9896 }
9897 }
9898 }
9899
9901 {
9903 float split_quantity_new = Math.Floor(quantity / 2);
9904
9906 return;
9907
9908 InventoryLocation invloc = new InventoryLocation;
9910
9912 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9913
9914 if (new_item)
9915 {
9916 if (new_item.GetQuantityMax() < split_quantity_new)
9917 {
9918 split_quantity_new = new_item.GetQuantityMax();
9919 }
9921 {
9924 }
9925 else if (split_quantity_new > 1)
9926 {
9928 new_item.
SetQuantity(split_quantity_new,
false,
true);
9929 }
9930 }
9931 }
9932
9935 {
9936 SetWeightDirty();
9938
9939 if (parent)
9940 parent.OnAttachmentQuantityChangedEx(this, delta);
9941
9943 {
9945 {
9947 }
9949 {
9950 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9952 }
9953 }
9954 }
9955
9958 {
9959
9960 }
9961
9964 {
9966 }
9967
9969 {
9970 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9971
9973 {
9974 if (newLevel == GameConstants.STATE_RUINED)
9975 {
9977 EntityAI parent = GetHierarchyParent();
9978 if (parent && parent.IsFireplace())
9979 {
9980 CargoBase cargo = GetInventory().GetCargo();
9981 if (cargo)
9982 {
9984 {
9986 }
9987 }
9988 }
9989 }
9990
9992 {
9993
9995 return;
9996 }
9997
9998 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9999 {
10001 }
10002 }
10003 }
10004
10005
10007 {
10008 super.OnRightClick();
10009
10011 {
10013 {
10014 if (ScriptInputUserData.CanStoreInputUserData())
10015 {
10016 EntityAI root = GetHierarchyRoot();
10017 Man playerOwner = GetHierarchyRootPlayer();
10018 InventoryLocation dst = new InventoryLocation;
10019
10020
10021 if (!playerOwner && root && root == this)
10022 {
10024 }
10025 else
10026 {
10027
10028 GetInventory().GetCurrentInventoryLocation(dst);
10030 {
10031 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10033 {
10035 }
10036 else
10037 {
10039
10040
10041 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10042 {
10044 }
10045 else
10046 {
10047 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10048 }
10049 }
10050 }
10051 }
10052
10053 ScriptInputUserData ctx = new ScriptInputUserData;
10061 }
10062 }
10063 else if (!
g_Game.IsMultiplayer())
10064 {
10066 }
10067 }
10068 }
10069
10071 {
10072 if (root)
10073 {
10074 vector m4[4];
10075 root.GetTransform(m4);
10076 dst.SetGround(this, m4);
10077 }
10078 else
10079 {
10080 GetInventory().GetCurrentInventoryLocation(dst);
10081 }
10082 }
10083
10084 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10085 {
10086
10087 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10088 return false;
10089
10090 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10091 return false;
10092
10093
10095 return false;
10096
10097
10098 Magazine mag = Magazine.Cast(this);
10099 if (mag)
10100 {
10101 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10102 return false;
10103
10104 if (stack_max_limit)
10105 {
10106 Magazine other_mag = Magazine.Cast(other_item);
10107 if (other_item)
10108 {
10109 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10110 return false;
10111 }
10112
10113 }
10114 }
10115 else
10116 {
10117
10119 return false;
10120
10122 return false;
10123 }
10124
10125 PlayerBase player = null;
10126 if (CastTo(player, GetHierarchyRootPlayer()))
10127 {
10128 if (player.GetInventory().HasAttachment(this))
10129 return false;
10130
10131 if (player.IsItemsToDelete())
10132 return false;
10133 }
10134
10135 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10136 return false;
10137
10138 int slotID;
10140 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10141 return false;
10142
10143 return true;
10144 }
10145
10147 {
10149 }
10150
10152 {
10153 return m_IsResultOfSplit;
10154 }
10155
10157 {
10158 m_IsResultOfSplit = value;
10159 }
10160
10162 {
10164 }
10165
10167 {
10168 float other_item_quantity = other_item.GetQuantity();
10169 float this_free_space;
10170
10172
10174
10175 if (other_item_quantity > this_free_space)
10176 {
10177 return this_free_space;
10178 }
10179 else
10180 {
10181 return other_item_quantity;
10182 }
10183 }
10184
10186 {
10188 }
10189
10191 {
10193 return;
10194
10195 if (!IsMagazine() && other_item)
10196 {
10198 if (quantity_used != 0)
10199 {
10200 float hp1 = GetHealth01("","");
10201 float hp2 = other_item.GetHealth01("","");
10202 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10203 hpResult = hpResult / (
GetQuantity() + quantity_used);
10204
10205 hpResult *= GetMaxHealth();
10206 Math.Round(hpResult);
10207 SetHealth("", "Health", hpResult);
10208
10210 other_item.AddQuantity(-quantity_used);
10211 }
10212 }
10214 }
10215
10217 {
10218 #ifdef SERVER
10219 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10220 GetHierarchyParent().IncreaseLifetimeUp();
10221 #endif
10222 };
10223
10225 {
10226 PlayerBase p = PlayerBase.Cast(player);
10227
10228 array<int> recipesIds = p.m_Recipes;
10229 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10230 if (moduleRecipesManager)
10231 {
10232 EntityAI itemInHands = player.GetEntityInHands();
10233 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10234 }
10235
10236 for (int i = 0;i < recipesIds.Count(); i++)
10237 {
10238 int key = recipesIds.Get(i);
10239 string recipeName = moduleRecipesManager.GetRecipeName(key);
10241 }
10242 }
10243
10244
10245 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10246 {
10247 super.GetDebugActions(outputList);
10248
10249
10255
10256
10261
10266
10267
10271
10272
10274 {
10278 }
10279
10282
10283
10287
10289
10290 InventoryLocation loc = new InventoryLocation();
10291 GetInventory().GetCurrentInventoryLocation(loc);
10293 {
10294 if (Gizmo_IsSupported())
10297 }
10298
10300 }
10301
10302
10303
10304
10306 {
10307 super.OnAction(action_id, player, ctx);
10308
10310 {
10311 switch (action_id)
10312 {
10316 return true;
10320 return true;
10321 }
10322 }
10323
10325 {
10326 switch (action_id)
10327 {
10329 Delete();
10330 return true;
10331 }
10332 }
10333
10334 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10335 {
10336 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10337 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10338 PlayerBase p = PlayerBase.Cast(player);
10339 if (
EActions.RECIPES_RANGE_START < 1000)
10340 {
10341 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10342 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10343 }
10344 }
10345 #ifndef SERVER
10346 else if (action_id ==
EActions.WATCH_PLAYER)
10347 {
10348 PluginDeveloper.SetDeveloperItemClientEx(player);
10349 }
10350 #endif
10352 {
10353 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10354 {
10355 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10356 OnDebugButtonPressServer(id + 1);
10357 }
10358
10359 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10360 {
10361 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10363 }
10364
10365 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10366 {
10367 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10369 }
10370
10371 else if (action_id ==
EActions.ADD_QUANTITY)
10372 {
10373 if (IsMagazine())
10374 {
10375 Magazine mag = Magazine.Cast(this);
10376 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10377 }
10378 else
10379 {
10381 }
10382
10383 if (m_EM)
10384 {
10385 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10386 }
10387
10388 }
10389
10390 else if (action_id ==
EActions.REMOVE_QUANTITY)
10391 {
10392 if (IsMagazine())
10393 {
10394 Magazine mag2 = Magazine.Cast(this);
10395 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10396 }
10397 else
10398 {
10400 }
10401 if (m_EM)
10402 {
10403 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10404 }
10405
10406 }
10407
10408 else if (action_id ==
EActions.SET_QUANTITY_0)
10409 {
10411
10412 if (m_EM)
10413 {
10414 m_EM.SetEnergy(0);
10415 }
10416 }
10417
10418 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10419 {
10421
10422 if (m_EM)
10423 {
10424 m_EM.SetEnergy(m_EM.GetEnergyMax());
10425 }
10426 }
10427
10428 else if (action_id ==
EActions.ADD_HEALTH)
10429 {
10430 AddHealth("","",GetMaxHealth("","Health")/5);
10431 }
10432 else if (action_id ==
EActions.REMOVE_HEALTH)
10433 {
10434 AddHealth("","",-GetMaxHealth("","Health")/5);
10435 }
10436 else if (action_id ==
EActions.DESTROY_HEALTH)
10437 {
10438 SetHealth01("","",0);
10439 }
10440 else if (action_id ==
EActions.WATCH_ITEM)
10441 {
10443 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10444 #ifdef DEVELOPER
10445 SetDebugDeveloper_item(this);
10446 #endif
10447 }
10448
10449 else if (action_id ==
EActions.ADD_TEMPERATURE)
10450 {
10451 AddTemperature(20);
10452
10453 }
10454
10455 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10456 {
10457 AddTemperature(-20);
10458
10459 }
10460
10461 else if (action_id ==
EActions.FLIP_FROZEN)
10462 {
10463 SetFrozen(!GetIsFrozen());
10464
10465 }
10466
10467 else if (action_id ==
EActions.ADD_WETNESS)
10468 {
10470
10471 }
10472
10473 else if (action_id ==
EActions.REMOVE_WETNESS)
10474 {
10476
10477 }
10478
10479 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10480 {
10483
10484
10485 }
10486
10487 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10488 {
10491 }
10492
10493 else if (action_id ==
EActions.MAKE_SPECIAL)
10494 {
10495 auto debugParams = DebugSpawnParams.WithPlayer(player);
10496 OnDebugSpawnEx(debugParams);
10497 }
10498
10499 }
10500
10501
10502 return false;
10503 }
10504
10505
10506
10507
10511
10514
10515
10516
10518 {
10519 return false;
10520 }
10521
10522
10524 {
10525 return true;
10526 }
10527
10528
10530 {
10531 return true;
10532 }
10533
10534
10535
10537 {
10538 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10539 return g_Game.ConfigIsExisting(config_path);
10540 }
10541
10544 {
10545 return null;
10546 }
10547
10549 {
10550 return false;
10551 }
10552
10554 {
10555 return false;
10556 }
10557
10561
10562
10564 {
10565 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10566 return module_repairing.CanRepair(this, item_repair_kit);
10567 }
10568
10569
10570 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10571 {
10572 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10573 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10574 }
10575
10576
10578 {
10579
10580
10581
10582
10583
10584
10585
10586
10587 return 1;
10588 }
10589
10590
10591
10593 {
10595 }
10596
10597
10598
10600 {
10602 }
10603
10604
10613 {
10614 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10615
10616 if (player)
10617 {
10618 player.MessageStatus(text);
10619 }
10620 }
10621
10622
10631 {
10632 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10633
10634 if (player)
10635 {
10636 player.MessageAction(text);
10637 }
10638 }
10639
10640
10649 {
10650 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10651
10652 if (player)
10653 {
10654 player.MessageFriendly(text);
10655 }
10656 }
10657
10658
10667 {
10668 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10669
10670 if (player)
10671 {
10672 player.MessageImportant(text);
10673 }
10674 }
10675
10677 {
10678 return true;
10679 }
10680
10681
10682 override bool KindOf(
string tag)
10683 {
10684 bool found = false;
10685 string item_name = this.
GetType();
10687 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10688
10689 int array_size = item_tag_array.Count();
10690 for (int i = 0; i < array_size; i++)
10691 {
10692 if (item_tag_array.Get(i) == tag)
10693 {
10694 found = true;
10695 break;
10696 }
10697 }
10698 return found;
10699 }
10700
10701
10703 {
10704
10705 super.OnRPC(sender, rpc_type,ctx);
10706
10707
10708 switch (rpc_type)
10709 {
10710 #ifndef SERVER
10711 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10712 Param2<bool, string> p = new Param2<bool, string>(false, "");
10713
10715 return;
10716
10717 bool play = p.param1;
10718 string soundSet = p.param2;
10719
10720 if (play)
10721 {
10723 {
10725 {
10727 }
10728 }
10729 else
10730 {
10732 }
10733 }
10734 else
10735 {
10737 }
10738
10739 break;
10740 #endif
10741
10742 }
10743
10745 {
10747 }
10748 }
10749
10750
10751
10752
10754 {
10755 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10756 return plugin.GetID(
name);
10757 }
10758
10760 {
10761 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10762 return plugin.GetName(id);
10763 }
10764
10767 {
10768
10769
10770 int varFlags;
10771 if (!ctx.
Read(varFlags))
10772 return;
10773
10774 if (varFlags & ItemVariableFlags.FLOAT)
10775 {
10777 }
10778 }
10779
10781 {
10782
10783 super.SerializeNumericalVars(floats_out);
10784
10785
10786
10788 {
10790 }
10791
10793 {
10795 }
10796
10798 {
10800 }
10801
10803 {
10808 }
10809
10811 {
10813 }
10814 }
10815
10817 {
10818
10819 super.DeSerializeNumericalVars(floats);
10820
10821
10822 int index = 0;
10823 int mask = Math.Round(floats.Get(index));
10824
10825 index++;
10826
10828 {
10830 {
10832 }
10833 else
10834 {
10835 float quantity = floats.Get(index);
10836 SetQuantity(quantity,
true,
false,
false,
false);
10837 }
10838 index++;
10839 }
10840
10842 {
10843 float wet = floats.Get(index);
10845 index++;
10846 }
10847
10849 {
10850 int liquidtype = Math.Round(floats.Get(index));
10852 index++;
10853 }
10854
10856 {
10858 index++;
10860 index++;
10862 index++;
10864 index++;
10865 }
10866
10868 {
10869 int cleanness = Math.Round(floats.Get(index));
10871 index++;
10872 }
10873 }
10874
10876 {
10877 super.WriteVarsToCTX(ctx);
10878
10879
10881 {
10883 }
10884
10886 {
10888 }
10889
10891 {
10893 }
10894
10896 {
10897 int r,g,b,a;
10903 }
10904
10906 {
10908 }
10909 }
10910
10912 {
10913 if (!super.ReadVarsFromCTX(ctx,version))
10914 return false;
10915
10916 int intValue;
10917 float value;
10918
10919 if (version < 140)
10920 {
10921 if (!ctx.
Read(intValue))
10922 return false;
10923
10924 m_VariablesMask = intValue;
10925 }
10926
10928 {
10929 if (!ctx.
Read(value))
10930 return false;
10931
10933 {
10935 }
10936 else
10937 {
10939 }
10940 }
10941
10942 if (version < 140)
10943 {
10945 {
10946 if (!ctx.
Read(value))
10947 return false;
10948 SetTemperatureDirect(value);
10949 }
10950 }
10951
10953 {
10954 if (!ctx.
Read(value))
10955 return false;
10957 }
10958
10960 {
10961 if (!ctx.
Read(intValue))
10962 return false;
10964 }
10965
10967 {
10968 int r,g,b,a;
10970 return false;
10972 return false;
10974 return false;
10976 return false;
10977
10979 }
10980
10982 {
10983 if (!ctx.
Read(intValue))
10984 return false;
10986 }
10987
10988 if (version >= 138 && version < 140)
10989 {
10991 {
10992 if (!ctx.
Read(intValue))
10993 return false;
10994 SetFrozen(intValue);
10995 }
10996 }
10997
10998 return true;
10999 }
11000
11001
11003 {
11006 {
11008 }
11009
11010 if (!super.OnStoreLoad(ctx, version))
11011 {
11013 return false;
11014 }
11015
11016 if (version >= 114)
11017 {
11018 bool hasQuickBarIndexSaved;
11019
11020 if (!ctx.
Read(hasQuickBarIndexSaved))
11021 {
11023 return false;
11024 }
11025
11026 if (hasQuickBarIndexSaved)
11027 {
11028 int itmQBIndex;
11029
11030
11031 if (!ctx.
Read(itmQBIndex))
11032 {
11034 return false;
11035 }
11036
11037 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11038 if (itmQBIndex != -1 && parentPlayer)
11039 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11040 }
11041 }
11042 else
11043 {
11044
11045 PlayerBase player;
11046 int itemQBIndex;
11047 if (version ==
int.
MAX)
11048 {
11049 if (!ctx.
Read(itemQBIndex))
11050 {
11052 return false;
11053 }
11054 }
11055 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11056 {
11057
11058 if (!ctx.
Read(itemQBIndex))
11059 {
11061 return false;
11062 }
11063 if (itemQBIndex != -1 && player)
11064 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11065 }
11066 }
11067
11068 if (version < 140)
11069 {
11070
11071 if (!LoadVariables(ctx, version))
11072 {
11074 return false;
11075 }
11076 }
11077
11078
11080 {
11082 return false;
11083 }
11084 if (version >= 132)
11085 {
11087 if (raib)
11088 {
11090 {
11092 return false;
11093 }
11094 }
11095 }
11096
11098 return true;
11099 }
11100
11101
11102
11104 {
11105 super.OnStoreSave(ctx);
11106
11107 PlayerBase player;
11108 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11109 {
11111
11112 int itemQBIndex = -1;
11113 itemQBIndex = player.FindQuickBarEntityIndex(this);
11114 ctx.
Write(itemQBIndex);
11115 }
11116 else
11117 {
11119 }
11120
11122
11124 if (raib)
11125 {
11127 }
11128 }
11129
11130
11132 {
11133 super.AfterStoreLoad();
11134
11136 {
11138 }
11139
11141 {
11144 }
11145 }
11146
11148 {
11149 super.EEOnAfterLoad();
11150
11152 {
11154 }
11155
11158 }
11159
11161 {
11162 return false;
11163 }
11164
11165
11166
11168 {
11170 {
11171 #ifdef PLATFORM_CONSOLE
11172
11174 {
11176 if (menu)
11177 {
11179 }
11180 }
11181 #endif
11182 }
11183
11185 {
11188 }
11189
11191 {
11192 SetWeightDirty();
11194 }
11196 {
11199 }
11200
11202 {
11205
11208 }
11210 {
11214 }
11215
11216 super.OnVariablesSynchronized();
11217 }
11218
11219
11220
11222 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11223 {
11224 if (!IsServerCheck(allow_client))
11225 return false;
11226
11228 return false;
11229
11232
11233 if (value <= (min + 0.001))
11234 value = min;
11235
11236 if (value == min)
11237 {
11238 if (destroy_config)
11239 {
11240 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11241 if (dstr)
11242 {
11244 this.Delete();
11245 return true;
11246 }
11247 }
11248 else if (destroy_forced)
11249 {
11251 this.Delete();
11252 return true;
11253 }
11254
11256 }
11257
11260
11262 {
11263 EntityAI parent = GetHierarchyRoot();
11264 InventoryLocation iLoc = new InventoryLocation();
11265 GetInventory().GetCurrentInventoryLocation(iLoc);
11267 {
11268 int iLocSlot = iLoc.
GetSlot();
11270 {
11272 }
11274 {
11276 }
11277 }
11278 }
11279
11281 {
11283
11284 if (delta)
11286 }
11287
11289
11290 return false;
11291 }
11292
11293
11295 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11296 {
11298 }
11299
11301 {
11304 }
11305
11307 {
11310 }
11311
11313 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11314 {
11315 float value_clamped = Math.Clamp(value, 0, 1);
11317 SetQuantity(result, destroy_config, destroy_forced);
11318 }
11319
11320
11323 {
11325 }
11326
11328 {
11330 }
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11342 {
11343 int slot = -1;
11344 GameInventory inventory = GetInventory();
11345 if (inventory)
11346 {
11347 InventoryLocation il = new InventoryLocation;
11350 }
11351
11353 }
11354
11356 {
11357 float quantity_max = 0;
11358
11360 {
11361 if (attSlotID != -1)
11362 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11363
11364 if (quantity_max <= 0)
11366 }
11367
11368 if (quantity_max <= 0)
11370
11371 return quantity_max;
11372 }
11373
11375 {
11377 }
11378
11380 {
11382 }
11383
11384
11386 {
11388 }
11389
11391 {
11393 }
11394
11396 {
11398 }
11399
11400
11402 {
11403
11404 float weightEx = GetWeightEx();
11405 float special = GetInventoryAndCargoWeight();
11406 return weightEx - special;
11407 }
11408
11409
11411 {
11413 }
11414
11416 {
11418 {
11419 #ifdef DEVELOPER
11420 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11421 {
11422 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11424 }
11425 #endif
11426
11427 return GetQuantity() * GetConfigWeightModified();
11428 }
11429 else if (HasEnergyManager())
11430 {
11431 #ifdef DEVELOPER
11432 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11433 {
11434 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11435 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11436 }
11437 #endif
11438 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11439 }
11440 else
11441 {
11442 #ifdef DEVELOPER
11443 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11444 {
11445 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11446 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11447 }
11448 #endif
11449 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11450 }
11451 }
11452
11455 {
11456 int item_count = 0;
11458
11459 GameInventory inventory = GetInventory();
11460 CargoBase cargo = inventory.
GetCargo();
11461 if (cargo != NULL)
11462 {
11464 }
11465
11467 for (int i = 0; i < nAttachments; ++i)
11468 {
11470 if (item)
11471 item_count += item.GetNumberOfItems();
11472 }
11473 return item_count;
11474 }
11475
11478 {
11479 float weight = 0;
11480 float wetness = 1;
11481 if (include_wetness)
11484 {
11485 weight = wetness * m_ConfigWeight;
11486 }
11488 {
11489 weight = 1;
11490 }
11491 return weight;
11492 }
11493
11494
11495
11497 {
11498 GameInventory inventory = GetInventory();
11499 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11500 {
11501 array<EntityAI> items = new array<EntityAI>;
11503 for (int i = 0; i < items.Count(); ++i)
11504 {
11506 if (item)
11507 {
11508 g_Game.ObjectDelete(item);
11509 }
11510 }
11511 }
11512 }
11513
11514
11515
11516
11518 {
11519 float energy = 0;
11520 if (HasEnergyManager())
11521 {
11522 energy = GetCompEM().GetEnergy();
11523 }
11524 return energy;
11525 }
11526
11527
11529 {
11530 super.OnEnergyConsumed();
11531
11533 }
11534
11536 {
11537 super.OnEnergyAdded();
11538
11540 }
11541
11542
11544 {
11545 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11546 {
11548 {
11549 float energy_0to1 = GetCompEM().GetEnergy0To1();
11551 }
11552 }
11553 }
11554
11555
11557 {
11558 return ConfigGetFloat("heatIsolation");
11559 }
11560
11562 {
11564 }
11565
11567 {
11568 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11569 if (
g_Game.ConfigIsExisting(paramPath))
11570 return g_Game.ConfigGetFloat(paramPath);
11571
11572 return 0.0;
11573 }
11574
11576 {
11577 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11578 if (
g_Game.ConfigIsExisting(paramPath))
11579 return g_Game.ConfigGetFloat(paramPath);
11580
11581 return 0.0;
11582 }
11583
11584 override void SetWet(
float value,
bool allow_client =
false)
11585 {
11586 if (!IsServerCheck(allow_client))
11587 return;
11588
11591
11593
11594 m_VarWet = Math.Clamp(value, min, max);
11595
11597 {
11600 }
11601 }
11602
11603 override void AddWet(
float value)
11604 {
11606 }
11607
11609 {
11611 }
11612
11614 {
11616 }
11617
11619 {
11621 }
11622
11624 {
11626 }
11627
11629 {
11631 }
11632
11633 override void OnWetChanged(
float newVal,
float oldVal)
11634 {
11637 if (newLevel != oldLevel)
11638 {
11640 }
11641 }
11642
11644 {
11645 SetWeightDirty();
11646 }
11647
11649 {
11650 return GetWetLevelInternal(
m_VarWet);
11651 }
11652
11653
11654
11656 {
11658 }
11659
11661 {
11663 }
11664
11666 {
11668 }
11669
11671 {
11673 }
11674
11675
11676
11678 {
11679 if (ConfigIsExisting("itemModelLength"))
11680 {
11681 return ConfigGetFloat("itemModelLength");
11682 }
11683 return 0;
11684 }
11685
11687 {
11688 if (ConfigIsExisting("itemAttachOffset"))
11689 {
11690 return ConfigGetFloat("itemAttachOffset");
11691 }
11692 return 0;
11693 }
11694
11695 override void SetCleanness(
int value,
bool allow_client =
false)
11696 {
11697 if (!IsServerCheck(allow_client))
11698 return;
11699
11701
11703
11706 }
11707
11709 {
11711 }
11712
11714 {
11715 return true;
11716 }
11717
11718
11719
11720
11722 {
11724 }
11725
11727 {
11729 }
11730
11731
11732
11733
11734 override void SetColor(
int r,
int g,
int b,
int a)
11735 {
11741 }
11743 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11744 {
11749 }
11750
11752 {
11754 }
11755
11758 {
11759 int r,g,b,a;
11761 r = r/255;
11762 g = g/255;
11763 b = b/255;
11764 a = a/255;
11765 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11766 }
11767
11768
11769
11770 override void SetLiquidType(
int value,
bool allow_client =
false)
11771 {
11772 if (!IsServerCheck(allow_client))
11773 return;
11774
11779 }
11780
11782 {
11783 return ConfigGetInt("varLiquidTypeInit");
11784 }
11785
11787 {
11789 }
11790
11792 {
11794 SetFrozen(false);
11795 }
11796
11799 {
11800 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11801 }
11802
11803
11806 {
11807 PlayerBase nplayer;
11808 if (PlayerBase.CastTo(nplayer, player))
11809 {
11811 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11812 }
11813 }
11814
11815
11818 {
11819 PlayerBase nplayer;
11820 if (PlayerBase.CastTo(nplayer,player))
11821 {
11822 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11823 }
11824
11825 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11826
11827 if (HasEnergyManager())
11828 {
11829 GetCompEM().UpdatePlugState();
11830 }
11831 }
11832
11833
11835 {
11836 super.OnPlacementStarted(player);
11837
11839 }
11840
11841 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11842 {
11844 {
11845 m_AdminLog.OnPlacementComplete(player,
this);
11846 }
11847
11848 super.OnPlacementComplete(player, position, orientation);
11849 }
11850
11851
11852
11853
11854
11856 {
11858 {
11859 return true;
11860 }
11861 else
11862 {
11863 return false;
11864 }
11865 }
11866
11867
11869 {
11871 {
11873 }
11874 }
11875
11876
11878 {
11880 }
11881
11883 {
11885 }
11886
11887 override void InsertAgent(
int agent,
float count = 1)
11888 {
11889 if (count < 1)
11890 return;
11891
11893 }
11894
11897 {
11899 }
11900
11901
11903 {
11905 }
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11949 {
11951 return false;
11952 return true;
11953 }
11954
11956 {
11957
11959 }
11960
11961
11964 {
11965 super.CheckForRoofLimited(timeTresholdMS);
11966
11967 float time =
g_Game.GetTime();
11968 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11969 {
11970 m_PreviousRoofTestTime = time;
11971 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11972 }
11973 }
11974
11975
11977 {
11979 {
11980 return 0;
11981 }
11982
11983 if (GetInventory().GetAttachmentSlotsCount() != 0)
11984 {
11985 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11986 if (filter)
11987 return filter.GetProtectionLevel(type, false, system);
11988 else
11989 return 0;
11990 }
11991
11992 string subclassPath, entryName;
11993
11994 switch (type)
11995 {
11997 entryName = "biological";
11998 break;
12000 entryName = "chemical";
12001 break;
12002 default:
12003 entryName = "biological";
12004 break;
12005 }
12006
12007 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12008
12009 return g_Game.ConfigGetFloat(subclassPath + entryName);
12010 }
12011
12012
12013
12016 {
12017 if (!IsMagazine())
12019
12021 }
12022
12023
12024
12025
12026
12031 {
12032 return true;
12033 }
12034
12036 {
12038 }
12039
12040
12041
12042
12043
12045 {
12046 if (parent)
12047 {
12048 if (parent.IsInherited(DayZInfected))
12049 return true;
12050
12051 if (!parent.IsRuined())
12052 return true;
12053 }
12054
12055 return true;
12056 }
12057
12059 {
12060 if (!super.CanPutAsAttachment(parent))
12061 {
12062 return false;
12063 }
12064
12065 if (!IsRuined() && !parent.IsRuined())
12066 {
12067 return true;
12068 }
12069
12070 return false;
12071 }
12072
12074 {
12075
12076
12077
12078
12079 return super.CanReceiveItemIntoCargo(item);
12080 }
12081
12083 {
12084
12085
12086
12087
12088 GameInventory attachmentInv = attachment.GetInventory();
12090 {
12091 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12092 return false;
12093 }
12094
12095 InventoryLocation loc = new InventoryLocation();
12096 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12097 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12098 return false;
12099
12100 return super.CanReceiveAttachment(attachment, slotId);
12101 }
12102
12104 {
12105 if (!super.CanReleaseAttachment(attachment))
12106 return false;
12107
12108 return GetInventory().AreChildrenAccessible();
12109 }
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12132 {
12133 int id = muzzle_owner.GetMuzzleID();
12134 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12135
12136 if (WPOF_array)
12137 {
12138 for (int i = 0; i < WPOF_array.Count(); i++)
12139 {
12140 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12141
12142 if (WPOF)
12143 {
12144 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12145 }
12146 }
12147 }
12148 }
12149
12150
12152 {
12153 int id = muzzle_owner.GetMuzzleID();
12155
12156 if (WPOBE_array)
12157 {
12158 for (int i = 0; i < WPOBE_array.Count(); i++)
12159 {
12160 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12161
12162 if (WPOBE)
12163 {
12164 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12165 }
12166 }
12167 }
12168 }
12169
12170
12172 {
12173 int id = muzzle_owner.GetMuzzleID();
12174 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12175
12176 if (WPOOH_array)
12177 {
12178 for (int i = 0; i < WPOOH_array.Count(); i++)
12179 {
12180 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12181
12182 if (WPOOH)
12183 {
12184 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12185 }
12186 }
12187 }
12188 }
12189
12190
12192 {
12193 int id = muzzle_owner.GetMuzzleID();
12194 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12195
12196 if (WPOOH_array)
12197 {
12198 for (int i = 0; i < WPOOH_array.Count(); i++)
12199 {
12200 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12201
12202 if (WPOOH)
12203 {
12204 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12205 }
12206 }
12207 }
12208 }
12209
12210
12212 {
12213 int id = muzzle_owner.GetMuzzleID();
12214 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12215
12216 if (WPOOH_array)
12217 {
12218 for (int i = 0; i < WPOOH_array.Count(); i++)
12219 {
12220 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12221
12222 if (WPOOH)
12223 {
12224 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12225 }
12226 }
12227 }
12228 }
12229
12230
12231
12233 {
12235 {
12236 return true;
12237 }
12238
12239 return false;
12240 }
12241
12243 {
12245 {
12246 return true;
12247 }
12248
12249 return false;
12250 }
12251
12253 {
12255 {
12256 return true;
12257 }
12258
12259 return false;
12260 }
12261
12263 {
12264 return false;
12265 }
12266
12269 {
12270 return UATimeSpent.DEFAULT_DEPLOY;
12271 }
12272
12273
12274
12275
12277 {
12279 SetSynchDirty();
12280 }
12281
12283 {
12285 }
12286
12287
12289 {
12290 return false;
12291 }
12292
12295 {
12296 string att_type = "None";
12297
12298 if (ConfigIsExisting("soundAttType"))
12299 {
12300 att_type = ConfigGetString("soundAttType");
12301 }
12302
12304 }
12305
12307 {
12309 }
12310
12311
12312
12313
12314
12320
12322 {
12325
12327 }
12328
12329
12331 {
12333 return;
12334
12336
12339
12342
12343 SoundParameters params = new SoundParameters();
12347 }
12348
12349
12351 {
12353 {
12356
12357 SetSynchDirty();
12358
12361 }
12362 }
12363
12365 {
12367 }
12368
12369
12371 {
12373 return;
12374
12376 SetSynchDirty();
12377
12380 }
12381
12383 {
12386 }
12387
12389 {
12391 }
12392
12393 void OnApply(PlayerBase player);
12394
12396 {
12397 return 1.0;
12398 };
12399
12401 {
12403 }
12404
12406 {
12408 }
12409
12411
12413 {
12414 SetDynamicPhysicsLifeTime(0.01);
12416 }
12417
12419 {
12420 array<string> zone_names = new array<string>;
12421 GetDamageZones(zone_names);
12422 for (int i = 0; i < zone_names.Count(); i++)
12423 {
12424 SetHealthMax(zone_names.Get(i),"Health");
12425 }
12426 SetHealthMax("","Health");
12427 }
12428
12431 {
12432 float global_health = GetHealth01("","Health");
12433 array<string> zones = new array<string>;
12434 GetDamageZones(zones);
12435
12436 for (int i = 0; i < zones.Count(); i++)
12437 {
12438 SetHealth01(zones.Get(i),"Health",global_health);
12439 }
12440 }
12441
12444 {
12445 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12446 }
12447
12449 {
12450 if (!hasRootAsPlayer)
12451 {
12452 if (refParentIB)
12453 {
12454
12455 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12456 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12457
12458 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12459 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12460
12463 }
12464 else
12465 {
12466
12469 }
12470 }
12471 }
12472
12474 {
12476 {
12477 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12478 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12479 {
12480 float heatPermCoef = 1.0;
12482 while (ent)
12483 {
12484 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12485 ent = ent.GetHierarchyParent();
12486 }
12487
12488 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12489 }
12490 }
12491 }
12492
12494 {
12495
12496 EntityAI parent = GetHierarchyParent();
12497 if (!parent)
12498 {
12499 hasParent = false;
12500 hasRootAsPlayer = false;
12501 }
12502 else
12503 {
12504 hasParent = true;
12505 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12506 refParentIB =
ItemBase.Cast(parent);
12507 }
12508 }
12509
12510 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12511 {
12512
12513 }
12514
12516 {
12517
12518 return false;
12519 }
12520
12522 {
12523
12524
12525 return false;
12526 }
12527
12529 {
12530
12531 return false;
12532 }
12533
12536 {
12537 return !GetIsFrozen() &&
IsOpen();
12538 }
12539
12541 {
12542 bool hasParent = false, hasRootAsPlayer = false;
12544
12545 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12546 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12547
12548 if (wwtu || foodDecay)
12549 {
12553
12554 if (processWetness || processTemperature || processDecay)
12555 {
12557
12558 if (processWetness)
12559 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12560
12561 if (processTemperature)
12563
12564 if (processDecay)
12565 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12566 }
12567 }
12568 }
12569
12572 {
12574 }
12575
12577 {
12580
12581 return super.GetTemperatureFreezeThreshold();
12582 }
12583
12585 {
12588
12589 return super.GetTemperatureThawThreshold();
12590 }
12591
12593 {
12596
12597 return super.GetItemOverheatThreshold();
12598 }
12599
12601 {
12603 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12604
12605 return super.GetTemperatureFreezeTime();
12606 }
12607
12609 {
12611 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12612
12613 return super.GetTemperatureThawTime();
12614 }
12615
12620
12622 {
12623 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12624 }
12625
12627 {
12628 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12629 }
12630
12633 {
12635 }
12636
12638 {
12640 }
12641
12643 {
12645 }
12646
12649 {
12650 return null;
12651 }
12652
12655 {
12656 return false;
12657 }
12658
12660 {
12662 {
12665 if (!trg)
12666 {
12668 explosive = this;
12669 }
12670
12671 explosive.PairRemote(trg);
12673
12674 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12675 trg.SetPersistentPairID(persistentID);
12676 explosive.SetPersistentPairID(persistentID);
12677
12678 return true;
12679 }
12680 return false;
12681 }
12682
12685 {
12686 float ret = 1.0;
12689 ret *= GetHealth01();
12690
12691 return ret;
12692 }
12693
12694 #ifdef DEVELOPER
12695 override void SetDebugItem()
12696 {
12697 super.SetDebugItem();
12698 _itemBase = this;
12699 }
12700
12702 {
12703 string text = super.GetDebugText();
12704
12706 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12707
12708 return text;
12709 }
12710 #endif
12711
12713 {
12714 return true;
12715 }
12716
12718
12720
12722 {
12725 }
12726
12727
12735
12751
12752 [
Obsolete(
"Use ItemSoundHandler instead")]
12755 {
12756 if (!
g_Game.IsDedicatedServer())
12757 {
12758 if (ConfigIsExisting("attachSoundSet"))
12759 {
12760 string cfg_path = "";
12761 string soundset = "";
12762 string type_name =
GetType();
12763
12766 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12767 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12768
12769 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12770 {
12771 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12772 {
12773 if (cfg_slot_array[i] == slot_type)
12774 {
12775 soundset = cfg_soundset_array[i];
12776 break;
12777 }
12778 }
12779 }
12780
12781 if (soundset != "")
12782 {
12783 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12785 }
12786 }
12787 }
12788 }
12789
12791}
12792
12794{
12796 if (entity)
12797 {
12798 bool is_item = entity.IsInherited(
ItemBase);
12799 if (is_item && full_quantity)
12800 {
12803 }
12804 }
12805 else
12806 {
12808 return NULL;
12809 }
12810 return entity;
12811}
12812
12814{
12815 if (item)
12816 {
12817 if (health > 0)
12818 item.SetHealth("", "", health);
12819
12820 if (item.CanHaveTemperature())
12821 {
12823 if (item.CanFreeze())
12824 item.SetFrozen(false);
12825 }
12826
12827 if (item.HasEnergyManager())
12828 {
12829 if (quantity >= 0)
12830 {
12831 item.GetCompEM().SetEnergy0To1(quantity);
12832 }
12833 else
12834 {
12836 }
12837 }
12838 else if (item.IsMagazine())
12839 {
12840 Magazine mag = Magazine.Cast(item);
12841 if (quantity >= 0)
12842 {
12843 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12844 }
12845 else
12846 {
12848 }
12849
12850 }
12851 else
12852 {
12853 if (quantity >= 0)
12854 {
12855 item.SetQuantityNormalized(quantity, false);
12856 }
12857 else
12858 {
12860 }
12861
12862 }
12863 }
12864}
12865
12866#ifdef DEVELOPER
12868#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.