7924{
7926 {
7927 return true;
7928 }
7929};
7930
7932{
7933
7934};
7935
7936
7937
7939{
7943
7945
7948
7949
7950
7951
7952
7961
7967
7972
7977
7998 protected bool m_IsResultOfSplit
7999
8001
8006
8007
8008
8010
8014
8015
8016
8018
8021
8022
8023
8029
8030
8038
8041
8042
8044
8045
8047
8048
8053
8054
8059
8061
8062
8064
8065
8067 {
8072
8073 if (!
g_Game.IsDedicatedServer())
8074 {
8076 {
8078
8080 {
8082 }
8083 }
8084
8087 }
8088
8089 m_OldLocation = null;
8090
8092 {
8094 }
8095
8096 if (ConfigIsExisting("headSelectionsToHide"))
8097 {
8100 }
8101
8103 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8104 {
8106 }
8107
8109
8110 m_IsResultOfSplit = false;
8111
8113 }
8114
8116 {
8117 super.InitItemVariables();
8118
8124 m_Count = ConfigGetInt(
"count");
8125
8128
8133
8136
8141
8153
8157
8158
8161 if (ConfigIsExisting("canBeSplit"))
8162 {
8165 }
8166
8168 if (ConfigIsExisting("itemBehaviour"))
8170
8171
8174 RegisterNetSyncVariableInt("m_VarLiquidType");
8175 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8176
8177 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8178 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8179 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8180
8181 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8182 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8183 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8184 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8185
8186 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8187 RegisterNetSyncVariableBool("m_IsTakeable");
8188 RegisterNetSyncVariableBool("m_IsHologram");
8189
8192 {
8195 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8196 }
8197
8199
8201 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8203
8205 }
8206
8208 {
8210 }
8211
8213 {
8216 {
8221 }
8222 }
8223
8224 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8225 {
8227 {
8230 }
8231
8233 }
8234
8236 {
8242 }
8243
8245
8247 {
8249
8250 if (!action)
8251 {
8252 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8253 return;
8254 }
8255
8257 if (!ai)
8258 {
8260 return;
8261 }
8262
8264 if (!action_array)
8265 {
8266 action_array = new array<ActionBase_Basic>;
8268 }
8269 if (LogManager.IsActionLogEnable())
8270 {
8271 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8272 }
8273
8274 if (action_array.Find(action) != -1)
8275 {
8276 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8277 }
8278 else
8279 {
8280 action_array.Insert(action);
8281 }
8282 }
8283
8285 {
8286 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8287 ActionBase action = player.GetActionManager().GetAction(actionName);
8290
8291 if (action_array)
8292 {
8293 action_array.RemoveItem(action);
8294 }
8295 }
8296
8297
8298
8300 {
8301 ActionOverrideData overrideData = new ActionOverrideData();
8305
8307 if (!actionMap)
8308 {
8311 }
8312
8313 actionMap.Insert(this.
Type(), overrideData);
8314
8315 }
8316
8318
8320
8321
8323 {
8326
8329
8330 string config_to_search = "CfgVehicles";
8331 string muzzle_owner_config;
8332
8334 {
8335 if (IsInherited(Weapon))
8336 config_to_search = "CfgWeapons";
8337
8338 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8339
8340 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8341
8342 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8343
8344 if (config_OnFire_subclass_count > 0)
8345 {
8346 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8347
8348 for (int i = 0; i < config_OnFire_subclass_count; i++)
8349 {
8350 string particle_class = "";
8351 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8352 string config_OnFire_entry = config_OnFire_class + particle_class;
8353 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8354 WPOF_array.Insert(WPOF);
8355 }
8356
8357
8359 }
8360 }
8361
8363 {
8364 config_to_search = "CfgWeapons";
8365 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8366
8367 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8368
8369 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8370
8371 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8372 {
8373 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8374
8375 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8376 {
8377 string particle_class2 = "";
8378 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8379 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8380 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8381 WPOBE_array.Insert(WPOBE);
8382 }
8383
8384
8386 }
8387 }
8388 }
8389
8390
8392 {
8395
8397 {
8398 string config_to_search = "CfgVehicles";
8399
8400 if (IsInherited(Weapon))
8401 config_to_search = "CfgWeapons";
8402
8403 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8404 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8405
8406 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8407 {
8408
8410
8412 {
8414 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8416 return;
8417 }
8418
8421
8422
8423
8424 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8425 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8426
8427 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8428 {
8429 string particle_class = "";
8430 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8431 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8432 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8433
8434 if (entry_type == CT_CLASS)
8435 {
8436 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8437 WPOOH_array.Insert(WPOF);
8438 }
8439 }
8440
8441
8443 }
8444 }
8445 }
8446
8448 {
8450 }
8451
8453 {
8455 {
8457
8460
8463
8464 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8465 }
8466 }
8467
8469 {
8471 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8472
8474 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8475
8477 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8478
8480 {
8482 }
8483 }
8484
8486 {
8488 }
8489
8491 {
8494 else
8496
8498 {
8501 }
8502 else
8503 {
8506
8509 }
8510
8512 }
8513
8515 {
8517 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8518 }
8519
8521 {
8523 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8525 }
8526
8528 {
8530 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8531 }
8532
8534 {
8537
8538 OverheatingParticle OP = new OverheatingParticle();
8543
8545 }
8546
8548 {
8551
8552 return -1;
8553 }
8554
8556 {
8558 {
8561
8562 for (int i = count; i > 0; --i)
8563 {
8564 int id = i - 1;
8567
8570
8571 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8572 {
8573 if (p)
8574 {
8577 }
8578 }
8579 }
8580 }
8581 }
8582
8584 {
8586 {
8588 {
8589 int id = i - 1;
8591
8592 if (OP)
8593 {
8595
8596 if (p)
8597 {
8599 }
8600
8601 delete OP;
8602 }
8603 }
8604
8607 }
8608 }
8609
8612 {
8613 return 0.0;
8614 }
8615
8616
8618 {
8619 return 250;
8620 }
8621
8623 {
8624 return 0;
8625 }
8626
8629 {
8631 return true;
8632
8633 return false;
8634 }
8635
8638 {
8641
8643 {
8645 }
8646 else
8647 {
8648
8650 }
8651
8653 }
8654
8661 {
8662 return -1;
8663 }
8664
8665
8666
8667
8669 {
8671 {
8672 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8673 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8674
8675 if (r_index >= 0)
8676 {
8677 InventoryLocation r_il = new InventoryLocation;
8678 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8679
8680 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8683 {
8684 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8685 }
8687 {
8688 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8689 }
8690
8691 }
8692
8693 player.GetHumanInventory().ClearUserReservedLocation(this);
8694 }
8695
8698 }
8699
8700
8701
8702
8704 {
8705 return ItemBase.m_DebugActionsMask;
8706 }
8707
8709 {
8710 return ItemBase.m_DebugActionsMask & mask;
8711 }
8712
8714 {
8715 ItemBase.m_DebugActionsMask = mask;
8716 }
8717
8719 {
8720 ItemBase.m_DebugActionsMask |= mask;
8721 }
8722
8724 {
8725 ItemBase.m_DebugActionsMask &= ~mask;
8726 }
8727
8729 {
8731 {
8733 }
8734 else
8735 {
8737 }
8738 }
8739
8740
8742 {
8743 if (GetEconomyProfile())
8744 {
8745 float q_max = GetEconomyProfile().GetQuantityMax();
8746 if (q_max > 0)
8747 {
8748 float q_min = GetEconomyProfile().GetQuantityMin();
8749 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8750
8752 {
8753 ComponentEnergyManager comp = GetCompEM();
8755 {
8757 }
8758 }
8760 {
8762
8763 }
8764
8765 }
8766 }
8767 }
8768
8771 {
8772 EntityAI parent = GetHierarchyParent();
8773
8774 if (parent)
8775 {
8776 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8777 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8778 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8779 }
8780 }
8781
8784 {
8785 EntityAI parent = GetHierarchyParent();
8786
8787 if (parent)
8788 {
8789 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8790 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8791 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8792 }
8793 }
8794
8796 {
8797
8798
8799
8800
8802
8804 {
8805 if (ScriptInputUserData.CanStoreInputUserData())
8806 {
8807 ScriptInputUserData ctx = new ScriptInputUserData;
8813 ctx.
Write(use_stack_max);
8816
8818 {
8819 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8820 }
8821 }
8822 }
8823 else if (!
g_Game.IsMultiplayer())
8824 {
8826 }
8827 }
8828
8830 {
8832 }
8833
8835 {
8837 }
8838
8840 {
8842 }
8843
8845 {
8846
8847 return false;
8848 }
8849
8851 {
8852 return false;
8853 }
8854
8858 {
8859 return false;
8860 }
8861
8863 {
8864 return "";
8865 }
8866
8868
8870 {
8871 return false;
8872 }
8873
8875 {
8876 return true;
8877 }
8878
8879
8880
8882 {
8883 return true;
8884 }
8885
8887 {
8888 return true;
8889 }
8890
8892 {
8893 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8895 }
8896
8898 {
8900 }
8901
8903 {
8905 if (!is_being_placed)
8907 SetSynchDirty();
8908 }
8909
8910
8912
8914 {
8916 }
8917
8919 {
8921 }
8922
8924 {
8925 return 1;
8926 }
8927
8929 {
8930 return false;
8931 }
8932
8934 {
8936 SetSynchDirty();
8937 }
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8974 {
8975 super.OnMovedInsideCargo(container);
8976
8977 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8978 }
8979
8980 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8981 {
8982 super.EEItemLocationChanged(oldLoc, newLoc);
8983
8984 PlayerBase newPlayer = null;
8985 PlayerBase oldPlayer = null;
8986
8987 if (newLoc.GetParent())
8988 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8989
8990 if (oldLoc.GetParent())
8991 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8992
8994 {
8995 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8996
8997 if (rIndex >= 0)
8998 {
8999 InventoryLocation rIl = new InventoryLocation;
9000 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9001
9002 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9005 {
9006 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9007 }
9009 {
9011 }
9012
9013 }
9014 }
9015
9017 {
9018 if (newPlayer)
9019 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9020
9021 if (newPlayer == oldPlayer)
9022 {
9023 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9024 {
9026 {
9027 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9028 {
9029 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9030 }
9031 }
9032 else
9033 {
9034 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9035 }
9036 }
9037
9038 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9039 {
9040 int type = oldLoc.GetType();
9042 {
9043 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9044 }
9046 {
9047 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9048 }
9049 }
9050 if (!m_OldLocation)
9051 {
9052 m_OldLocation = new InventoryLocation;
9053 }
9054 m_OldLocation.Copy(oldLoc);
9055 }
9056 else
9057 {
9058 if (m_OldLocation)
9059 {
9060 m_OldLocation.Reset();
9061 }
9062 }
9063
9064 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9065 }
9066 else
9067 {
9068 if (newPlayer)
9069 {
9070 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9071 if (resIndex >= 0)
9072 {
9073 InventoryLocation il = new InventoryLocation;
9074 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9076 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9079 {
9080 il.
GetParent().GetOnReleaseLock().Invoke(it);
9081 }
9083 {
9085 }
9086
9087 }
9088 }
9090 {
9091
9093 }
9094
9095 if (m_OldLocation)
9096 {
9097 m_OldLocation.Reset();
9098 }
9099 }
9100
9102 {
9103 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9104 }
9105
9107 {
9108 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9109 }
9110 }
9111
9112 override void EOnContact(IEntity other, Contact extra)
9113 {
9115 {
9116 int liquidType = -1;
9118 if (impactSpeed > 0.0)
9119 {
9121 #ifndef SERVER
9123 #else
9125 SetSynchDirty();
9126 #endif
9128 }
9129 }
9130
9131 #ifdef SERVER
9132 if (GetCompEM() && GetCompEM().IsPlugged())
9133 {
9134 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9135 GetCompEM().UnplugThis();
9136 }
9137 #endif
9138 }
9139
9141
9143 {
9145 }
9146
9148 {
9149
9150 }
9151
9153 {
9154 super.OnItemLocationChanged(old_owner, new_owner);
9155
9156 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9157 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9158
9159 if (!relatedPlayer && playerNew)
9160 relatedPlayer = playerNew;
9161
9162 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9163 {
9165 if (actionMgr)
9166 {
9167 ActionBase currentAction = actionMgr.GetRunningAction();
9168 if (currentAction)
9170 }
9171 }
9172
9173 Man ownerPlayerOld = null;
9174 Man ownerPlayerNew = null;
9175
9176 if (old_owner)
9177 {
9178 if (old_owner.
IsMan())
9179 {
9180 ownerPlayerOld = Man.Cast(old_owner);
9181 }
9182 else
9183 {
9184 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9185 }
9186 }
9187 else
9188 {
9190 {
9192
9193 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9194 {
9195 GetCompEM().UnplugThis();
9196 }
9197 }
9198 }
9199
9200 if (new_owner)
9201 {
9202 if (new_owner.
IsMan())
9203 {
9204 ownerPlayerNew = Man.Cast(new_owner);
9205 }
9206 else
9207 {
9208 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9209 }
9210 }
9211
9212 if (ownerPlayerOld != ownerPlayerNew)
9213 {
9214 if (ownerPlayerOld)
9215 {
9216 array<EntityAI> subItemsExit = new array<EntityAI>;
9218 for (int i = 0; i < subItemsExit.Count(); i++)
9219 {
9222 }
9223 }
9224
9225 if (ownerPlayerNew)
9226 {
9227 array<EntityAI> subItemsEnter = new array<EntityAI>;
9229 for (int j = 0; j < subItemsEnter.Count(); j++)
9230 {
9233 }
9234 }
9235 }
9236 else if (ownerPlayerNew != null)
9237 {
9238 PlayerBase nplayer;
9239 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9240 {
9241 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9243 for (int k = 0; k < subItemsUpdate.Count(); k++)
9244 {
9246 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9247 }
9248 }
9249 }
9250
9251 if (old_owner)
9252 old_owner.OnChildItemRemoved(this);
9253 if (new_owner)
9254 new_owner.OnChildItemReceived(this);
9255 }
9256
9257
9259 {
9260 super.EEDelete(parent);
9261 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9262 if (player)
9263 {
9265
9266 if (player.IsAlive())
9267 {
9268 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9269 if (r_index >= 0)
9270 {
9271 InventoryLocation r_il = new InventoryLocation;
9272 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9273
9274 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9277 {
9278 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9279 }
9281 {
9282 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9283 }
9284
9285 }
9286
9287 player.RemoveQuickBarEntityShortcut(this);
9288 }
9289 }
9290 }
9291
9293 {
9294 super.EEKilled(killer);
9295
9298 {
9299 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9300 {
9301 if (IsMagazine())
9302 {
9303 if (Magazine.Cast(this).GetAmmoCount() > 0)
9304 {
9306 }
9307 }
9308 else
9309 {
9311 }
9312 }
9313 }
9314 }
9315
9317 {
9318 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9319
9320 super.OnWasAttached(parent, slot_id);
9321
9324
9327 }
9328
9330 {
9331 super.OnWasDetached(parent, slot_id);
9332
9335
9338 }
9339
9341 {
9342 int idx;
9345
9346 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9347 if (inventory_slots.Count() < 1)
9348 {
9349 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9350 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9351 }
9352 else
9353 {
9354 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9355 }
9356
9357 idx = inventory_slots.Find(slot);
9358 if (idx < 0)
9359 return "";
9360
9361 return attach_types.Get(idx);
9362 }
9363
9365 {
9366 int idx = -1;
9367 string slot;
9368
9371
9372 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9373 if (inventory_slots.Count() < 1)
9374 {
9375 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9376 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9377 }
9378 else
9379 {
9380 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9381 if (detach_types.Count() < 1)
9382 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9383 }
9384
9385 for (int i = 0; i < inventory_slots.Count(); i++)
9386 {
9387 slot = inventory_slots.Get(i);
9388 }
9389
9390 if (slot != "")
9391 {
9392 if (detach_types.Count() == 1)
9393 idx = 0;
9394 else
9395 idx = inventory_slots.Find(slot);
9396 }
9397 if (idx < 0)
9398 return "";
9399
9400 return detach_types.Get(idx);
9401 }
9402
9404 {
9405
9407
9408
9409 float min_time = 1;
9410 float max_time = 3;
9411 float delay = Math.RandomFloat(min_time, max_time);
9412
9413 explode_timer.Run(delay, this, "DoAmmoExplosion");
9414 }
9415
9417 {
9418 Magazine magazine = Magazine.Cast(this);
9419 int pop_sounds_count = 6;
9420 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9421
9422
9423 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9424 string sound_name = pop_sounds[ sound_idx ];
9425 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9426
9427
9428 magazine.ServerAddAmmoCount(-1);
9429
9430
9431 float min_temp_to_explode = 100;
9432
9433 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9434 {
9436 }
9437 }
9438
9439
9440 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9441 {
9442 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9443
9444 const int CHANCE_DAMAGE_CARGO = 4;
9445 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9446 const int CHANCE_DAMAGE_NOTHING = 2;
9447
9449 {
9450 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9451 int chances;
9452 int rnd;
9453
9454 if (GetInventory().GetCargo())
9455 {
9456 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9457 rnd = Math.RandomInt(0,chances);
9458
9459 if (rnd < CHANCE_DAMAGE_CARGO)
9460 {
9462 }
9463 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9464 {
9466 }
9467 }
9468 else
9469 {
9470 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9471 rnd = Math.RandomInt(0,chances);
9472
9473 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9474 {
9476 }
9477 }
9478 }
9479 }
9480
9482 {
9483 CargoBase cargo = GetInventory().GetCargo();
9484 if (cargo)
9485 {
9487 if (item_count > 0)
9488 {
9489 int random_pick = Math.RandomInt(0, item_count);
9491 if (!item.IsExplosive())
9492 {
9493 item.AddHealth("","",damage);
9494 return true;
9495 }
9496 }
9497 }
9498 return false;
9499 }
9500
9502 {
9503 GameInventory inventory = GetInventory();
9505 if (attachment_count > 0)
9506 {
9507 int random_pick = Math.RandomInt(0, attachment_count);
9509 if (!attachment.IsExplosive())
9510 {
9511 attachment.AddHealth("","",damage);
9512 return true;
9513 }
9514 }
9515 return false;
9516 }
9517
9519 {
9521 }
9522
9524 {
9526 return GetInventory().CanRemoveEntity();
9527
9528 return false;
9529 }
9530
9532 {
9533
9535 return false;
9536
9537
9539 return false;
9540
9541
9542
9544 if (delta == 0)
9545 return false;
9546
9547
9548 return true;
9549 }
9550
9552 {
9554 {
9555 if (ScriptInputUserData.CanStoreInputUserData())
9556 {
9557 ScriptInputUserData ctx = new ScriptInputUserData;
9562 ctx.
Write(destination_entity);
9566 }
9567 }
9568 else if (!
g_Game.IsMultiplayer())
9569 {
9571 }
9572 }
9573
9575 {
9576 float split_quantity_new;
9580 InventoryLocation loc = new InventoryLocation;
9581
9582 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9583 {
9585 split_quantity_new = stack_max;
9586 else
9588
9590 {
9591 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9592 if (new_item)
9593 {
9594 new_item.SetResultOfSplit(true);
9595 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9597 new_item.
SetQuantity(split_quantity_new,
false,
true);
9598 }
9599 }
9600 }
9601 else if (destination_entity && slot_id == -1)
9602 {
9603 if (quantity > stack_max)
9604 split_quantity_new = stack_max;
9605 else
9606 split_quantity_new = quantity;
9607
9609 {
9610 GameInventory destinationInventory = destination_entity.GetInventory();
9612 {
9615 }
9616
9617 if (new_item)
9618 {
9619 new_item.SetResultOfSplit(true);
9620 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9622 new_item.
SetQuantity(split_quantity_new,
false,
true);
9623 }
9624 }
9625 }
9626 else
9627 {
9628 if (stack_max != 0)
9629 {
9631 {
9633 }
9634
9635 if (split_quantity_new == 0)
9636 {
9637 if (!
g_Game.IsMultiplayer())
9638 player.PhysicalPredictiveDropItem(this);
9639 else
9640 player.ServerDropEntity(this);
9641 return;
9642 }
9643
9645 {
9647
9648 if (new_item)
9649 {
9650 new_item.SetResultOfSplit(true);
9651 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9654 new_item.PlaceOnSurface();
9655 }
9656 }
9657 }
9658 }
9659 }
9660
9662 {
9663 float split_quantity_new;
9667 InventoryLocation loc = new InventoryLocation;
9668
9669 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9670 {
9672 split_quantity_new = stack_max;
9673 else
9675
9677 {
9678 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9679 if (new_item)
9680 {
9681 new_item.SetResultOfSplit(true);
9682 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9684 new_item.
SetQuantity(split_quantity_new,
false,
true);
9685 }
9686 }
9687 }
9688 else if (destination_entity && slot_id == -1)
9689 {
9690 if (quantity > stack_max)
9691 split_quantity_new = stack_max;
9692 else
9693 split_quantity_new = quantity;
9694
9696 {
9697 GameInventory destinationInventory = destination_entity.GetInventory();
9699 {
9702 }
9703
9704 if (new_item)
9705 {
9706 new_item.SetResultOfSplit(true);
9707 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9709 new_item.
SetQuantity(split_quantity_new,
false,
true);
9710 }
9711 }
9712 }
9713 else
9714 {
9715 if (stack_max != 0)
9716 {
9718 {
9720 }
9721
9723 {
9725
9726 if (new_item)
9727 {
9728 new_item.SetResultOfSplit(true);
9729 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9732 new_item.PlaceOnSurface();
9733 }
9734 }
9735 }
9736 }
9737 }
9738
9740 {
9742 {
9743 if (ScriptInputUserData.CanStoreInputUserData())
9744 {
9745 ScriptInputUserData ctx = new ScriptInputUserData;
9750 dst.WriteToContext(ctx);
9752 }
9753 }
9754 else if (!
g_Game.IsMultiplayer())
9755 {
9757 }
9758 }
9759
9761 {
9763 {
9764 if (ScriptInputUserData.CanStoreInputUserData())
9765 {
9766 ScriptInputUserData ctx = new ScriptInputUserData;
9771 ctx.
Write(destination_entity);
9777 }
9778 }
9779 else if (!
g_Game.IsMultiplayer())
9780 {
9782 }
9783 }
9784
9786 {
9788 }
9789
9791 {
9793 float split_quantity_new;
9795 if (dst.IsValid())
9796 {
9797 int slot_id = dst.GetSlot();
9799
9800 if (quantity > stack_max)
9801 split_quantity_new = stack_max;
9802 else
9803 split_quantity_new = quantity;
9804
9806 {
9808
9809 if (new_item)
9810 {
9811 new_item.SetResultOfSplit(true);
9812 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9814 new_item.
SetQuantity(split_quantity_new,
false,
true);
9815 }
9816
9817 return new_item;
9818 }
9819 }
9820
9821 return null;
9822 }
9823
9825 {
9827 float split_quantity_new;
9829 if (destination_entity)
9830 {
9832 if (quantity > stackable)
9833 split_quantity_new = stackable;
9834 else
9835 split_quantity_new = quantity;
9836
9838 {
9839 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9840 if (new_item)
9841 {
9842 new_item.SetResultOfSplit(true);
9843 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9845 new_item.
SetQuantity(split_quantity_new,
false,
true);
9846 }
9847 }
9848 }
9849 }
9850
9852 {
9854 {
9855 if (ScriptInputUserData.CanStoreInputUserData())
9856 {
9857 ScriptInputUserData ctx = new ScriptInputUserData;
9862 ItemBase destination_entity =
this;
9863 ctx.
Write(destination_entity);
9867 }
9868 }
9869 else if (!
g_Game.IsMultiplayer())
9870 {
9872 }
9873 }
9874
9876 {
9878 float split_quantity_new;
9880 if (player)
9881 {
9883 if (quantity > stackable)
9884 split_quantity_new = stackable;
9885 else
9886 split_quantity_new = quantity;
9887
9889 {
9890 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9891 new_item =
ItemBase.Cast(in_hands);
9892 if (new_item)
9893 {
9894 new_item.SetResultOfSplit(true);
9895 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9897 new_item.SetQuantity(split_quantity_new, false, true);
9898 }
9899 }
9900 }
9901 }
9902
9904 {
9906 float split_quantity_new = Math.Floor(quantity * 0.5);
9907
9909 return;
9910
9912
9913 if (new_item)
9914 {
9915 if (new_item.GetQuantityMax() < split_quantity_new)
9916 {
9917 split_quantity_new = new_item.GetQuantityMax();
9918 }
9919
9920 new_item.SetResultOfSplit(true);
9921 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9922
9924 {
9927 }
9928 else
9929 {
9931 new_item.
SetQuantity(split_quantity_new,
false,
true);
9932 }
9933 }
9934 }
9935
9937 {
9939 float split_quantity_new = Math.Floor(quantity / 2);
9940
9942 return;
9943
9944 InventoryLocation invloc = new InventoryLocation;
9946
9948 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9949
9950 if (new_item)
9951 {
9952 if (new_item.GetQuantityMax() < split_quantity_new)
9953 {
9954 split_quantity_new = new_item.GetQuantityMax();
9955 }
9957 {
9960 }
9961 else if (split_quantity_new > 1)
9962 {
9964 new_item.
SetQuantity(split_quantity_new,
false,
true);
9965 }
9966 }
9967 }
9968
9971 {
9972 SetWeightDirty();
9974
9975 if (parent)
9976 parent.OnAttachmentQuantityChangedEx(this, delta);
9977
9979 {
9981 {
9983 }
9985 {
9986 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9988 }
9989 }
9990 }
9991
9994 {
9995
9996 }
9997
10000 {
10002 }
10003
10005 {
10006 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10007
10009 {
10010 if (newLevel == GameConstants.STATE_RUINED)
10011 {
10013 EntityAI parent = GetHierarchyParent();
10014 if (parent && parent.IsFireplace())
10015 {
10016 CargoBase cargo = GetInventory().GetCargo();
10017 if (cargo)
10018 {
10020 {
10022 }
10023 }
10024 }
10025 }
10026
10028 {
10029
10031 return;
10032 }
10033
10034 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10035 {
10037 }
10038 }
10039 }
10040
10041
10043 {
10044 super.OnRightClick();
10045
10047 {
10049 {
10050 if (ScriptInputUserData.CanStoreInputUserData())
10051 {
10052 EntityAI root = GetHierarchyRoot();
10053 Man playerOwner = GetHierarchyRootPlayer();
10054 InventoryLocation dst = new InventoryLocation;
10055
10056
10057 if (!playerOwner && root && root == this)
10058 {
10060 }
10061 else
10062 {
10063
10064 GetInventory().GetCurrentInventoryLocation(dst);
10066 {
10067 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10069 {
10071 }
10072 else
10073 {
10075
10076
10077 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10078 {
10080 }
10081 else
10082 {
10083 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10084 }
10085 }
10086 }
10087 }
10088
10089 ScriptInputUserData ctx = new ScriptInputUserData;
10097 }
10098 }
10099 else if (!
g_Game.IsMultiplayer())
10100 {
10102 }
10103 }
10104 }
10105
10107 {
10108 if (root)
10109 {
10110 vector m4[4];
10111 root.GetTransform(m4);
10112 dst.SetGround(this, m4);
10113 }
10114 else
10115 {
10116 GetInventory().GetCurrentInventoryLocation(dst);
10117 }
10118 }
10119
10120 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10121 {
10122
10123 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10124 return false;
10125
10126 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10127 return false;
10128
10129
10131 return false;
10132
10133
10134 Magazine mag = Magazine.Cast(this);
10135 if (mag)
10136 {
10137 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10138 return false;
10139
10140 if (stack_max_limit)
10141 {
10142 Magazine other_mag = Magazine.Cast(other_item);
10143 if (other_item)
10144 {
10145 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10146 return false;
10147 }
10148
10149 }
10150 }
10151 else
10152 {
10153
10155 return false;
10156
10158 return false;
10159 }
10160
10161 PlayerBase player = null;
10162 if (CastTo(player, GetHierarchyRootPlayer()))
10163 {
10164 if (player.GetInventory().HasAttachment(this))
10165 return false;
10166
10167 if (player.IsItemsToDelete())
10168 return false;
10169 }
10170
10171 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10172 return false;
10173
10174 int slotID;
10176 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10177 return false;
10178
10179 return true;
10180 }
10181
10183 {
10185 }
10186
10188 {
10189 return m_IsResultOfSplit;
10190 }
10191
10193 {
10194 m_IsResultOfSplit = value;
10195 }
10196
10198 {
10200 }
10201
10203 {
10204 float other_item_quantity = other_item.GetQuantity();
10205 float this_free_space;
10206
10208
10210
10211 if (other_item_quantity > this_free_space)
10212 {
10213 return this_free_space;
10214 }
10215 else
10216 {
10217 return other_item_quantity;
10218 }
10219 }
10220
10222 {
10224 }
10225
10227 {
10229 return;
10230
10231 if (!IsMagazine() && other_item)
10232 {
10234 if (quantity_used != 0)
10235 {
10236 float hp1 = GetHealth01("","");
10237 float hp2 = other_item.GetHealth01("","");
10238 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10239 hpResult = hpResult / (
GetQuantity() + quantity_used);
10240
10241 hpResult *= GetMaxHealth();
10242 Math.Round(hpResult);
10243 SetHealth("", "Health", hpResult);
10244
10246 other_item.AddQuantity(-quantity_used);
10247 }
10248 }
10250 }
10251
10253 {
10254 #ifdef SERVER
10255 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10256 GetHierarchyParent().IncreaseLifetimeUp();
10257 #endif
10258 };
10259
10261 {
10262 PlayerBase p = PlayerBase.Cast(player);
10263
10264 array<int> recipesIds = p.m_Recipes;
10265 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10266 if (moduleRecipesManager)
10267 {
10268 EntityAI itemInHands = player.GetEntityInHands();
10269 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10270 }
10271
10272 for (int i = 0;i < recipesIds.Count(); i++)
10273 {
10274 int key = recipesIds.Get(i);
10275 string recipeName = moduleRecipesManager.GetRecipeName(key);
10277 }
10278 }
10279
10280
10281 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10282 {
10283 super.GetDebugActions(outputList);
10284
10285
10291
10292
10297
10302
10303
10307
10308
10310 {
10314 }
10315
10318
10319
10323
10325
10326 InventoryLocation loc = new InventoryLocation();
10327 GetInventory().GetCurrentInventoryLocation(loc);
10329 {
10330 if (Gizmo_IsSupported())
10333 }
10334
10336 }
10337
10338
10339
10340
10342 {
10343 super.OnAction(action_id, player, ctx);
10344
10346 {
10347 switch (action_id)
10348 {
10352 return true;
10356 return true;
10357 }
10358 }
10359
10361 {
10362 switch (action_id)
10363 {
10365 Delete();
10366 return true;
10367 }
10368 }
10369
10370 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10371 {
10372 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10373 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10374 PlayerBase p = PlayerBase.Cast(player);
10375 if (
EActions.RECIPES_RANGE_START < 1000)
10376 {
10377 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10378 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10379 }
10380 }
10381 #ifndef SERVER
10382 else if (action_id ==
EActions.WATCH_PLAYER)
10383 {
10384 PluginDeveloper.SetDeveloperItemClientEx(player);
10385 }
10386 #endif
10388 {
10389 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10390 {
10391 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10392 OnDebugButtonPressServer(id + 1);
10393 }
10394
10395 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10396 {
10397 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10399 }
10400
10401 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10402 {
10403 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10405 }
10406
10407 else if (action_id ==
EActions.ADD_QUANTITY)
10408 {
10409 if (IsMagazine())
10410 {
10411 Magazine mag = Magazine.Cast(this);
10412 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10413 }
10414 else
10415 {
10417 }
10418
10419 if (m_EM)
10420 {
10421 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10422 }
10423
10424 }
10425
10426 else if (action_id ==
EActions.REMOVE_QUANTITY)
10427 {
10428 if (IsMagazine())
10429 {
10430 Magazine mag2 = Magazine.Cast(this);
10431 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10432 }
10433 else
10434 {
10436 }
10437 if (m_EM)
10438 {
10439 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10440 }
10441
10442 }
10443
10444 else if (action_id ==
EActions.SET_QUANTITY_0)
10445 {
10447
10448 if (m_EM)
10449 {
10450 m_EM.SetEnergy(0);
10451 }
10452 }
10453
10454 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10455 {
10457
10458 if (m_EM)
10459 {
10460 m_EM.SetEnergy(m_EM.GetEnergyMax());
10461 }
10462 }
10463
10464 else if (action_id ==
EActions.ADD_HEALTH)
10465 {
10466 AddHealth("","",GetMaxHealth("","Health")/5);
10467 }
10468 else if (action_id ==
EActions.REMOVE_HEALTH)
10469 {
10470 AddHealth("","",-GetMaxHealth("","Health")/5);
10471 }
10472 else if (action_id ==
EActions.DESTROY_HEALTH)
10473 {
10474 SetHealth01("","",0);
10475 }
10476 else if (action_id ==
EActions.WATCH_ITEM)
10477 {
10479 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10480 #ifdef DEVELOPER
10481 SetDebugDeveloper_item(this);
10482 #endif
10483 }
10484
10485 else if (action_id ==
EActions.ADD_TEMPERATURE)
10486 {
10487 AddTemperature(20);
10488
10489 }
10490
10491 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10492 {
10493 AddTemperature(-20);
10494
10495 }
10496
10497 else if (action_id ==
EActions.FLIP_FROZEN)
10498 {
10499 SetFrozen(!GetIsFrozen());
10500
10501 }
10502
10503 else if (action_id ==
EActions.ADD_WETNESS)
10504 {
10506
10507 }
10508
10509 else if (action_id ==
EActions.REMOVE_WETNESS)
10510 {
10512
10513 }
10514
10515 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10516 {
10519
10520
10521 }
10522
10523 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10524 {
10527 }
10528
10529 else if (action_id ==
EActions.MAKE_SPECIAL)
10530 {
10531 auto debugParams = DebugSpawnParams.WithPlayer(player);
10532 OnDebugSpawnEx(debugParams);
10533 }
10534
10535 }
10536
10537
10538 return false;
10539 }
10540
10541
10542
10543
10547
10550
10551
10552
10554 {
10555 return false;
10556 }
10557
10558
10560 {
10561 return true;
10562 }
10563
10564
10566 {
10567 return true;
10568 }
10569
10570
10571
10573 {
10574 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10575 return g_Game.ConfigIsExisting(config_path);
10576 }
10577
10580 {
10581 return null;
10582 }
10583
10585 {
10586 return false;
10587 }
10588
10590 {
10591 return false;
10592 }
10593
10597
10598
10600 {
10601 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10602 return module_repairing.CanRepair(this, item_repair_kit);
10603 }
10604
10605
10606 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10607 {
10608 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10609 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10610 }
10611
10612
10614 {
10615
10616
10617
10618
10619
10620
10621
10622
10623 return 1;
10624 }
10625
10626
10627
10629 {
10631 }
10632
10633
10634
10636 {
10638 }
10639
10640
10649 {
10650 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10651
10652 if (player)
10653 {
10654 player.MessageStatus(text);
10655 }
10656 }
10657
10658
10667 {
10668 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10669
10670 if (player)
10671 {
10672 player.MessageAction(text);
10673 }
10674 }
10675
10676
10685 {
10686 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10687
10688 if (player)
10689 {
10690 player.MessageFriendly(text);
10691 }
10692 }
10693
10694
10703 {
10704 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10705
10706 if (player)
10707 {
10708 player.MessageImportant(text);
10709 }
10710 }
10711
10713 {
10714 return true;
10715 }
10716
10717
10718 override bool KindOf(
string tag)
10719 {
10720 bool found = false;
10721 string item_name = this.
GetType();
10723 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10724
10725 int array_size = item_tag_array.Count();
10726 for (int i = 0; i < array_size; i++)
10727 {
10728 if (item_tag_array.Get(i) == tag)
10729 {
10730 found = true;
10731 break;
10732 }
10733 }
10734 return found;
10735 }
10736
10737
10739 {
10740
10741 super.OnRPC(sender, rpc_type,ctx);
10742
10743
10744 switch (rpc_type)
10745 {
10746 #ifndef SERVER
10747 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10748 Param2<bool, string> p = new Param2<bool, string>(false, "");
10749
10751 return;
10752
10753 bool play = p.param1;
10754 string soundSet = p.param2;
10755
10756 if (play)
10757 {
10759 {
10761 {
10763 }
10764 }
10765 else
10766 {
10768 }
10769 }
10770 else
10771 {
10773 }
10774
10775 break;
10776 #endif
10777
10778 }
10779
10781 {
10783 }
10784 }
10785
10786
10787
10788
10790 {
10791 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10792 return plugin.GetID(
name);
10793 }
10794
10796 {
10797 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10798 return plugin.GetName(id);
10799 }
10800
10803 {
10804
10805
10806 int varFlags;
10807 if (!ctx.
Read(varFlags))
10808 return;
10809
10810 if (varFlags & ItemVariableFlags.FLOAT)
10811 {
10813 }
10814 }
10815
10817 {
10818
10819 super.SerializeNumericalVars(floats_out);
10820
10821
10822
10824 {
10826 }
10827
10829 {
10831 }
10832
10834 {
10836 }
10837
10839 {
10844 }
10845
10847 {
10849 }
10850 }
10851
10853 {
10854
10855 super.DeSerializeNumericalVars(floats);
10856
10857
10858 int index = 0;
10859 int mask = Math.Round(floats.Get(index));
10860
10861 index++;
10862
10864 {
10866 {
10868 }
10869 else
10870 {
10871 float quantity = floats.Get(index);
10872 SetQuantity(quantity,
true,
false,
false,
false);
10873 }
10874 index++;
10875 }
10876
10878 {
10879 float wet = floats.Get(index);
10881 index++;
10882 }
10883
10885 {
10886 int liquidtype = Math.Round(floats.Get(index));
10888 index++;
10889 }
10890
10892 {
10894 index++;
10896 index++;
10898 index++;
10900 index++;
10901 }
10902
10904 {
10905 int cleanness = Math.Round(floats.Get(index));
10907 index++;
10908 }
10909 }
10910
10912 {
10913 super.WriteVarsToCTX(ctx);
10914
10915
10917 {
10919 }
10920
10922 {
10924 }
10925
10927 {
10929 }
10930
10932 {
10933 int r,g,b,a;
10939 }
10940
10942 {
10944 }
10945 }
10946
10948 {
10949 if (!super.ReadVarsFromCTX(ctx,version))
10950 return false;
10951
10952 int intValue;
10953 float value;
10954
10955 if (version < 140)
10956 {
10957 if (!ctx.
Read(intValue))
10958 return false;
10959
10960 m_VariablesMask = intValue;
10961 }
10962
10964 {
10965 if (!ctx.
Read(value))
10966 return false;
10967
10969 {
10971 }
10972 else
10973 {
10975 }
10976 }
10977
10978 if (version < 140)
10979 {
10981 {
10982 if (!ctx.
Read(value))
10983 return false;
10984 SetTemperatureDirect(value);
10985 }
10986 }
10987
10989 {
10990 if (!ctx.
Read(value))
10991 return false;
10993 }
10994
10996 {
10997 if (!ctx.
Read(intValue))
10998 return false;
11000 }
11001
11003 {
11004 int r,g,b,a;
11006 return false;
11008 return false;
11010 return false;
11012 return false;
11013
11015 }
11016
11018 {
11019 if (!ctx.
Read(intValue))
11020 return false;
11022 }
11023
11024 if (version >= 138 && version < 140)
11025 {
11027 {
11028 if (!ctx.
Read(intValue))
11029 return false;
11030 SetFrozen(intValue);
11031 }
11032 }
11033
11034 return true;
11035 }
11036
11037
11039 {
11042 {
11044 }
11045
11046 if (!super.OnStoreLoad(ctx, version))
11047 {
11049 return false;
11050 }
11051
11052 if (version >= 114)
11053 {
11054 bool hasQuickBarIndexSaved;
11055
11056 if (!ctx.
Read(hasQuickBarIndexSaved))
11057 {
11059 return false;
11060 }
11061
11062 if (hasQuickBarIndexSaved)
11063 {
11064 int itmQBIndex;
11065
11066
11067 if (!ctx.
Read(itmQBIndex))
11068 {
11070 return false;
11071 }
11072
11073 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11074 if (itmQBIndex != -1 && parentPlayer)
11075 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11076 }
11077 }
11078 else
11079 {
11080
11081 PlayerBase player;
11082 int itemQBIndex;
11083 if (version ==
int.
MAX)
11084 {
11085 if (!ctx.
Read(itemQBIndex))
11086 {
11088 return false;
11089 }
11090 }
11091 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11092 {
11093
11094 if (!ctx.
Read(itemQBIndex))
11095 {
11097 return false;
11098 }
11099 if (itemQBIndex != -1 && player)
11100 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11101 }
11102 }
11103
11104 if (version < 140)
11105 {
11106
11107 if (!LoadVariables(ctx, version))
11108 {
11110 return false;
11111 }
11112 }
11113
11114
11116 {
11118 return false;
11119 }
11120 if (version >= 132)
11121 {
11123 if (raib)
11124 {
11126 {
11128 return false;
11129 }
11130 }
11131 }
11132
11134 return true;
11135 }
11136
11137
11138
11140 {
11141 super.OnStoreSave(ctx);
11142
11143 PlayerBase player;
11144 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11145 {
11147
11148 int itemQBIndex = -1;
11149 itemQBIndex = player.FindQuickBarEntityIndex(this);
11150 ctx.
Write(itemQBIndex);
11151 }
11152 else
11153 {
11155 }
11156
11158
11160 if (raib)
11161 {
11163 }
11164 }
11165
11166
11168 {
11169 super.AfterStoreLoad();
11170
11172 {
11174 }
11175
11177 {
11180 }
11181 }
11182
11184 {
11185 super.EEOnAfterLoad();
11186
11188 {
11190 }
11191
11194 }
11195
11197 {
11198 return false;
11199 }
11200
11201
11202
11204 {
11206 {
11207 #ifdef PLATFORM_CONSOLE
11208
11210 {
11212 if (menu)
11213 {
11215 }
11216 }
11217 #endif
11218 }
11219
11221 {
11224 }
11225
11227 {
11228 SetWeightDirty();
11230 }
11232 {
11235 }
11236
11238 {
11241
11244 }
11246 {
11250 }
11251
11252 super.OnVariablesSynchronized();
11253 }
11254
11255
11256
11258 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11259 {
11260 if (!IsServerCheck(allow_client))
11261 return false;
11262
11264 return false;
11265
11268
11269 if (value <= (min + 0.001))
11270 value = min;
11271
11272 if (value == min)
11273 {
11274 if (destroy_config)
11275 {
11276 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11277 if (dstr)
11278 {
11280 this.Delete();
11281 return true;
11282 }
11283 }
11284 else if (destroy_forced)
11285 {
11287 this.Delete();
11288 return true;
11289 }
11290
11292 }
11293
11296
11298 {
11299 EntityAI parent = GetHierarchyRoot();
11300 InventoryLocation iLoc = new InventoryLocation();
11301 GetInventory().GetCurrentInventoryLocation(iLoc);
11303 {
11304 int iLocSlot = iLoc.
GetSlot();
11306 {
11308 }
11310 {
11312 }
11313 }
11314 }
11315
11317 {
11319
11320 if (delta)
11322 }
11323
11325
11326 return false;
11327 }
11328
11329
11331 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11332 {
11334 }
11335
11337 {
11340 }
11341
11343 {
11346 }
11347
11349 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11350 {
11351 float value_clamped = Math.Clamp(value, 0, 1);
11353 SetQuantity(result, destroy_config, destroy_forced);
11354 }
11355
11356
11359 {
11361 }
11362
11364 {
11366 }
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11378 {
11379 int slot = -1;
11380 GameInventory inventory = GetInventory();
11381 if (inventory)
11382 {
11383 InventoryLocation il = new InventoryLocation;
11386 }
11387
11389 }
11390
11392 {
11393 float quantity_max = 0;
11394
11396 {
11397 if (attSlotID != -1)
11398 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11399
11400 if (quantity_max <= 0)
11402 }
11403
11404 if (quantity_max <= 0)
11406
11407 return quantity_max;
11408 }
11409
11411 {
11413 }
11414
11416 {
11418 }
11419
11420
11422 {
11424 }
11425
11427 {
11429 }
11430
11432 {
11434 }
11435
11436
11438 {
11439
11440 float weightEx = GetWeightEx();
11441 float special = GetInventoryAndCargoWeight();
11442 return weightEx - special;
11443 }
11444
11445
11447 {
11449 }
11450
11452 {
11454 {
11455 #ifdef DEVELOPER
11456 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11457 {
11458 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11460 }
11461 #endif
11462
11463 return GetQuantity() * GetConfigWeightModified();
11464 }
11465 else if (HasEnergyManager())
11466 {
11467 #ifdef DEVELOPER
11468 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11469 {
11470 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11471 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11472 }
11473 #endif
11474 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11475 }
11476 else
11477 {
11478 #ifdef DEVELOPER
11479 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11480 {
11481 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11482 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11483 }
11484 #endif
11485 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11486 }
11487 }
11488
11491 {
11492 int item_count = 0;
11494
11495 GameInventory inventory = GetInventory();
11496 CargoBase cargo = inventory.
GetCargo();
11497 if (cargo != NULL)
11498 {
11500 }
11501
11503 for (int i = 0; i < nAttachments; ++i)
11504 {
11506 if (item)
11507 item_count += item.GetNumberOfItems();
11508 }
11509 return item_count;
11510 }
11511
11514 {
11515 float weight = 0;
11516 float wetness = 1;
11517 if (include_wetness)
11520 {
11521 weight = wetness * m_ConfigWeight;
11522 }
11524 {
11525 weight = 1;
11526 }
11527 return weight;
11528 }
11529
11530
11531
11533 {
11534 GameInventory inventory = GetInventory();
11535 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11536 {
11537 array<EntityAI> items = new array<EntityAI>;
11539 for (int i = 0; i < items.Count(); ++i)
11540 {
11542 if (item)
11543 {
11544 g_Game.ObjectDelete(item);
11545 }
11546 }
11547 }
11548 }
11549
11550
11551
11552
11554 {
11555 float energy = 0;
11556 if (HasEnergyManager())
11557 {
11558 energy = GetCompEM().GetEnergy();
11559 }
11560 return energy;
11561 }
11562
11563
11565 {
11566 super.OnEnergyConsumed();
11567
11569 }
11570
11572 {
11573 super.OnEnergyAdded();
11574
11576 }
11577
11578
11580 {
11581 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11582 {
11584 {
11585 float energy_0to1 = GetCompEM().GetEnergy0To1();
11587 }
11588 }
11589 }
11590
11591
11593 {
11594 return ConfigGetFloat("heatIsolation");
11595 }
11596
11598 {
11600 }
11601
11603 {
11604 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11605 if (
g_Game.ConfigIsExisting(paramPath))
11606 return g_Game.ConfigGetFloat(paramPath);
11607
11608 return 0.0;
11609 }
11610
11612 {
11613 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11614 if (
g_Game.ConfigIsExisting(paramPath))
11615 return g_Game.ConfigGetFloat(paramPath);
11616
11617 return 0.0;
11618 }
11619
11620 override void SetWet(
float value,
bool allow_client =
false)
11621 {
11622 if (!IsServerCheck(allow_client))
11623 return;
11624
11627
11629
11630 m_VarWet = Math.Clamp(value, min, max);
11631
11633 {
11636 }
11637 }
11638
11639 override void AddWet(
float value)
11640 {
11642 }
11643
11645 {
11647 }
11648
11650 {
11652 }
11653
11655 {
11657 }
11658
11660 {
11662 }
11663
11665 {
11667 }
11668
11669 override void OnWetChanged(
float newVal,
float oldVal)
11670 {
11673 if (newLevel != oldLevel)
11674 {
11676 }
11677 }
11678
11680 {
11681 SetWeightDirty();
11682 }
11683
11685 {
11686 return GetWetLevelInternal(
m_VarWet);
11687 }
11688
11689
11690
11692 {
11694 }
11695
11697 {
11699 }
11700
11702 {
11704 }
11705
11707 {
11709 }
11710
11711
11712
11714 {
11715 if (ConfigIsExisting("itemModelLength"))
11716 {
11717 return ConfigGetFloat("itemModelLength");
11718 }
11719 return 0;
11720 }
11721
11723 {
11724 if (ConfigIsExisting("itemAttachOffset"))
11725 {
11726 return ConfigGetFloat("itemAttachOffset");
11727 }
11728 return 0;
11729 }
11730
11731 override void SetCleanness(
int value,
bool allow_client =
false)
11732 {
11733 if (!IsServerCheck(allow_client))
11734 return;
11735
11737
11739
11742 }
11743
11745 {
11747 }
11748
11750 {
11751 return true;
11752 }
11753
11754
11755
11756
11758 {
11760 }
11761
11763 {
11765 }
11766
11767
11768
11769
11770 override void SetColor(
int r,
int g,
int b,
int a)
11771 {
11777 }
11779 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11780 {
11785 }
11786
11788 {
11790 }
11791
11794 {
11795 int r,g,b,a;
11797 r = r/255;
11798 g = g/255;
11799 b = b/255;
11800 a = a/255;
11801 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11802 }
11803
11804
11805
11806 override void SetLiquidType(
int value,
bool allow_client =
false)
11807 {
11808 if (!IsServerCheck(allow_client))
11809 return;
11810
11815 }
11816
11818 {
11819 return ConfigGetInt("varLiquidTypeInit");
11820 }
11821
11823 {
11825 }
11826
11828 {
11830 SetFrozen(false);
11831 }
11832
11835 {
11836 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11837 }
11838
11839
11842 {
11843 PlayerBase nplayer;
11844 if (PlayerBase.CastTo(nplayer, player))
11845 {
11847 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11848 }
11849 }
11850
11851
11854 {
11855 PlayerBase nplayer;
11856 if (PlayerBase.CastTo(nplayer,player))
11857 {
11858 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11859 }
11860
11861 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11862
11863 if (HasEnergyManager())
11864 {
11865 GetCompEM().UpdatePlugState();
11866 }
11867 }
11868
11869
11871 {
11872 super.OnPlacementStarted(player);
11873
11875 }
11876
11877 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11878 {
11880 {
11881 m_AdminLog.OnPlacementComplete(player,
this);
11882 }
11883
11884 super.OnPlacementComplete(player, position, orientation);
11885 }
11886
11887
11888
11889
11890
11892 {
11894 {
11895 return true;
11896 }
11897 else
11898 {
11899 return false;
11900 }
11901 }
11902
11903
11905 {
11907 {
11909 }
11910 }
11911
11912
11914 {
11916 }
11917
11919 {
11921 }
11922
11923 override void InsertAgent(
int agent,
float count = 1)
11924 {
11925 if (count < 1)
11926 return;
11927
11929 }
11930
11933 {
11935 }
11936
11937
11939 {
11941 }
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11985 {
11987 return false;
11988 return true;
11989 }
11990
11992 {
11993
11995 }
11996
11997
12000 {
12001 super.CheckForRoofLimited(timeTresholdMS);
12002
12003 float time =
g_Game.GetTime();
12004 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12005 {
12006 m_PreviousRoofTestTime = time;
12007 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12008 }
12009 }
12010
12011
12013 {
12015 {
12016 return 0;
12017 }
12018
12019 if (GetInventory().GetAttachmentSlotsCount() != 0)
12020 {
12021 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12022 if (filter)
12023 return filter.GetProtectionLevel(type, false, system);
12024 else
12025 return 0;
12026 }
12027
12028 string subclassPath, entryName;
12029
12030 switch (type)
12031 {
12033 entryName = "biological";
12034 break;
12036 entryName = "chemical";
12037 break;
12038 default:
12039 entryName = "biological";
12040 break;
12041 }
12042
12043 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12044
12045 return g_Game.ConfigGetFloat(subclassPath + entryName);
12046 }
12047
12048
12049
12052 {
12053 if (!IsMagazine())
12055
12057 }
12058
12059
12060
12061
12062
12067 {
12068 return true;
12069 }
12070
12072 {
12074 }
12075
12076
12077
12078
12079
12081 {
12082 if (parent)
12083 {
12084 if (parent.IsInherited(DayZInfected))
12085 return true;
12086
12087 if (!parent.IsRuined())
12088 return true;
12089 }
12090
12091 return true;
12092 }
12093
12095 {
12096 if (!super.CanPutAsAttachment(parent))
12097 {
12098 return false;
12099 }
12100
12101 if (!IsRuined() && !parent.IsRuined())
12102 {
12103 return true;
12104 }
12105
12106 return false;
12107 }
12108
12110 {
12111
12112
12113
12114
12115 return super.CanReceiveItemIntoCargo(item);
12116 }
12117
12119 {
12120
12121
12122
12123
12124 GameInventory attachmentInv = attachment.GetInventory();
12126 {
12127 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12128 return false;
12129 }
12130
12131 InventoryLocation loc = new InventoryLocation();
12132 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12133 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12134 return false;
12135
12136 return super.CanReceiveAttachment(attachment, slotId);
12137 }
12138
12140 {
12141 if (!super.CanReleaseAttachment(attachment))
12142 return false;
12143
12144 return GetInventory().AreChildrenAccessible();
12145 }
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12168 {
12169 int id = muzzle_owner.GetMuzzleID();
12170 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12171
12172 if (WPOF_array)
12173 {
12174 for (int i = 0; i < WPOF_array.Count(); i++)
12175 {
12176 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12177
12178 if (WPOF)
12179 {
12180 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12181 }
12182 }
12183 }
12184 }
12185
12186
12188 {
12189 int id = muzzle_owner.GetMuzzleID();
12191
12192 if (WPOBE_array)
12193 {
12194 for (int i = 0; i < WPOBE_array.Count(); i++)
12195 {
12196 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12197
12198 if (WPOBE)
12199 {
12200 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12201 }
12202 }
12203 }
12204 }
12205
12206
12208 {
12209 int id = muzzle_owner.GetMuzzleID();
12210 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12211
12212 if (WPOOH_array)
12213 {
12214 for (int i = 0; i < WPOOH_array.Count(); i++)
12215 {
12216 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12217
12218 if (WPOOH)
12219 {
12220 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12221 }
12222 }
12223 }
12224 }
12225
12226
12228 {
12229 int id = muzzle_owner.GetMuzzleID();
12230 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12231
12232 if (WPOOH_array)
12233 {
12234 for (int i = 0; i < WPOOH_array.Count(); i++)
12235 {
12236 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12237
12238 if (WPOOH)
12239 {
12240 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12241 }
12242 }
12243 }
12244 }
12245
12246
12248 {
12249 int id = muzzle_owner.GetMuzzleID();
12250 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12251
12252 if (WPOOH_array)
12253 {
12254 for (int i = 0; i < WPOOH_array.Count(); i++)
12255 {
12256 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12257
12258 if (WPOOH)
12259 {
12260 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12261 }
12262 }
12263 }
12264 }
12265
12266
12267
12269 {
12271 {
12272 return true;
12273 }
12274
12275 return false;
12276 }
12277
12279 {
12281 {
12282 return true;
12283 }
12284
12285 return false;
12286 }
12287
12289 {
12291 {
12292 return true;
12293 }
12294
12295 return false;
12296 }
12297
12299 {
12300 return false;
12301 }
12302
12305 {
12306 return UATimeSpent.DEFAULT_DEPLOY;
12307 }
12308
12309
12310
12311
12313 {
12315 SetSynchDirty();
12316 }
12317
12319 {
12321 }
12322
12323
12325 {
12326 return false;
12327 }
12328
12331 {
12332 string att_type = "None";
12333
12334 if (ConfigIsExisting("soundAttType"))
12335 {
12336 att_type = ConfigGetString("soundAttType");
12337 }
12338
12340 }
12341
12343 {
12345 }
12346
12347
12348
12349
12350
12356
12358 {
12361
12363 }
12364
12365
12367 {
12369 return;
12370
12372
12375
12378
12379 SoundParameters params = new SoundParameters();
12383 }
12384
12385
12387 {
12389 {
12392
12393 SetSynchDirty();
12394
12397 }
12398 }
12399
12401 {
12403 }
12404
12405
12407 {
12409 return;
12410
12412 SetSynchDirty();
12413
12416 }
12417
12419 {
12422 }
12423
12425 {
12427 }
12428
12429 void OnApply(PlayerBase player);
12430
12432 {
12433 return 1.0;
12434 };
12435
12437 {
12439 }
12440
12442 {
12444 }
12445
12447
12449 {
12450 SetDynamicPhysicsLifeTime(0.01);
12452 }
12453
12455 {
12456 array<string> zone_names = new array<string>;
12457 GetDamageZones(zone_names);
12458 for (int i = 0; i < zone_names.Count(); i++)
12459 {
12460 SetHealthMax(zone_names.Get(i),"Health");
12461 }
12462 SetHealthMax("","Health");
12463 }
12464
12467 {
12468 float global_health = GetHealth01("","Health");
12469 array<string> zones = new array<string>;
12470 GetDamageZones(zones);
12471
12472 for (int i = 0; i < zones.Count(); i++)
12473 {
12474 SetHealth01(zones.Get(i),"Health",global_health);
12475 }
12476 }
12477
12480 {
12481 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12482 }
12483
12485 {
12486 if (!hasRootAsPlayer)
12487 {
12488 if (refParentIB)
12489 {
12490
12491 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12492 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12493
12494 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12495 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12496
12499 }
12500 else
12501 {
12502
12505 }
12506 }
12507 }
12508
12510 {
12512 {
12513 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12514 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12515 {
12516 float heatPermCoef = 1.0;
12518 while (ent)
12519 {
12520 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12521 ent = ent.GetHierarchyParent();
12522 }
12523
12524 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12525 }
12526 }
12527 }
12528
12530 {
12531
12532 EntityAI parent = GetHierarchyParent();
12533 if (!parent)
12534 {
12535 hasParent = false;
12536 hasRootAsPlayer = false;
12537 }
12538 else
12539 {
12540 hasParent = true;
12541 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12542 refParentIB =
ItemBase.Cast(parent);
12543 }
12544 }
12545
12546 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12547 {
12548
12549 }
12550
12552 {
12553
12554 return false;
12555 }
12556
12558 {
12559
12560
12561 return false;
12562 }
12563
12565 {
12566
12567 return false;
12568 }
12569
12572 {
12573 return !GetIsFrozen() &&
IsOpen();
12574 }
12575
12577 {
12578 bool hasParent = false, hasRootAsPlayer = false;
12580
12581 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12582 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12583
12584 if (wwtu || foodDecay)
12585 {
12589
12590 if (processWetness || processTemperature || processDecay)
12591 {
12593
12594 if (processWetness)
12595 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12596
12597 if (processTemperature)
12599
12600 if (processDecay)
12601 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12602 }
12603 }
12604 }
12605
12608 {
12610 }
12611
12613 {
12616
12617 return super.GetTemperatureFreezeThreshold();
12618 }
12619
12621 {
12624
12625 return super.GetTemperatureThawThreshold();
12626 }
12627
12629 {
12632
12633 return super.GetItemOverheatThreshold();
12634 }
12635
12637 {
12639 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12640
12641 return super.GetTemperatureFreezeTime();
12642 }
12643
12645 {
12647 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12648
12649 return super.GetTemperatureThawTime();
12650 }
12651
12656
12658 {
12659 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12660 }
12661
12663 {
12664 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12665 }
12666
12669 {
12671 }
12672
12674 {
12676 }
12677
12679 {
12681 }
12682
12685 {
12686 return null;
12687 }
12688
12691 {
12692 return false;
12693 }
12694
12696 {
12698 {
12701 if (!trg)
12702 {
12704 explosive = this;
12705 }
12706
12707 explosive.PairRemote(trg);
12709
12710 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12711 trg.SetPersistentPairID(persistentID);
12712 explosive.SetPersistentPairID(persistentID);
12713
12714 return true;
12715 }
12716 return false;
12717 }
12718
12721 {
12722 float ret = 1.0;
12725 ret *= GetHealth01();
12726
12727 return ret;
12728 }
12729
12730 #ifdef DEVELOPER
12731 override void SetDebugItem()
12732 {
12733 super.SetDebugItem();
12734 _itemBase = this;
12735 }
12736
12738 {
12739 string text = super.GetDebugText();
12740
12742 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12743
12744 return text;
12745 }
12746 #endif
12747
12749 {
12750 return true;
12751 }
12752
12754
12756
12758 {
12761 }
12762
12763
12771
12787
12788 [
Obsolete(
"Use ItemSoundHandler instead")]
12791 {
12792 if (!
g_Game.IsDedicatedServer())
12793 {
12794 if (ConfigIsExisting("attachSoundSet"))
12795 {
12796 string cfg_path = "";
12797 string soundset = "";
12798 string type_name =
GetType();
12799
12802 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12803 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12804
12805 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12806 {
12807 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12808 {
12809 if (cfg_slot_array[i] == slot_type)
12810 {
12811 soundset = cfg_soundset_array[i];
12812 break;
12813 }
12814 }
12815 }
12816
12817 if (soundset != "")
12818 {
12819 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12821 }
12822 }
12823 }
12824 }
12825
12827}
12828
12830{
12832 if (entity)
12833 {
12834 bool is_item = entity.IsInherited(
ItemBase);
12835 if (is_item && full_quantity)
12836 {
12839 }
12840 }
12841 else
12842 {
12844 return NULL;
12845 }
12846 return entity;
12847}
12848
12850{
12851 if (item)
12852 {
12853 if (health > 0)
12854 item.SetHealth("", "", health);
12855
12856 if (item.CanHaveTemperature())
12857 {
12859 if (item.CanFreeze())
12860 item.SetFrozen(false);
12861 }
12862
12863 if (item.HasEnergyManager())
12864 {
12865 if (quantity >= 0)
12866 {
12867 item.GetCompEM().SetEnergy0To1(quantity);
12868 }
12869 else
12870 {
12872 }
12873 }
12874 else if (item.IsMagazine())
12875 {
12876 Magazine mag = Magazine.Cast(item);
12877 if (quantity >= 0)
12878 {
12879 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12880 }
12881 else
12882 {
12884 }
12885
12886 }
12887 else
12888 {
12889 if (quantity >= 0)
12890 {
12891 item.SetQuantityNormalized(quantity, false);
12892 }
12893 else
12894 {
12896 }
12897
12898 }
12899 }
12900}
12901
12902#ifdef DEVELOPER
12904#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.