8015{
8017 {
8018 return true;
8019 }
8020};
8021
8023{
8024
8025};
8026
8027
8028
8030{
8034
8036
8039
8040
8041
8042
8043
8052
8058
8063
8068
8089 protected bool m_IsResultOfSplit
8090
8092
8097
8098
8099
8101
8105
8106
8107
8109
8112
8113
8114
8120
8121
8129
8132
8133
8135
8136
8138
8139
8144
8145
8150
8152
8153
8155
8156
8158 {
8163
8164 if (!
g_Game.IsDedicatedServer())
8165 {
8167 {
8169
8171 {
8173 }
8174 }
8175
8178 }
8179
8180 m_OldLocation = null;
8181
8183 {
8185 }
8186
8187 if (ConfigIsExisting("headSelectionsToHide"))
8188 {
8191 }
8192
8194 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8195 {
8197 }
8198
8200
8201 m_IsResultOfSplit = false;
8202
8204 }
8205
8207 {
8208 super.InitItemVariables();
8209
8215 m_Count = ConfigGetInt(
"count");
8216
8219
8224
8227
8232
8244
8248
8249
8252 if (ConfigIsExisting("canBeSplit"))
8253 {
8256 }
8257
8259 if (ConfigIsExisting("itemBehaviour"))
8261
8262
8265 RegisterNetSyncVariableInt("m_VarLiquidType");
8266 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8267
8268 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8269 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8270 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8271
8272 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8273 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8274 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8275 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8276
8277 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8278 RegisterNetSyncVariableBool("m_IsTakeable");
8279 RegisterNetSyncVariableBool("m_IsHologram");
8280
8283 {
8286 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8287 }
8288
8290
8292 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8294
8296 }
8297
8299 {
8301 }
8302
8304 {
8307 {
8312 }
8313 }
8314
8315 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8316 {
8318 {
8321 }
8322
8324 }
8325
8327 {
8333 }
8334
8336
8338 {
8340
8341 if (!action)
8342 {
8343 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8344 return;
8345 }
8346
8348 if (!ai)
8349 {
8351 return;
8352 }
8353
8355 if (!action_array)
8356 {
8357 action_array = new array<ActionBase_Basic>;
8359 }
8360 if (LogManager.IsActionLogEnable())
8361 {
8362 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8363 }
8364
8365 if (action_array.Find(action) != -1)
8366 {
8367 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8368 }
8369 else
8370 {
8371 action_array.Insert(action);
8372 }
8373 }
8374
8376 {
8377 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8378 ActionBase action = player.GetActionManager().GetAction(actionName);
8381
8382 if (action_array)
8383 {
8384 action_array.RemoveItem(action);
8385 }
8386 }
8387
8388
8389
8391 {
8392 ActionOverrideData overrideData = new ActionOverrideData();
8396
8398 if (!actionMap)
8399 {
8402 }
8403
8404 actionMap.Insert(this.
Type(), overrideData);
8405
8406 }
8407
8409
8411
8412
8414 {
8417
8420
8421 string config_to_search = "CfgVehicles";
8422 string muzzle_owner_config;
8423
8425 {
8426 if (IsInherited(Weapon))
8427 config_to_search = "CfgWeapons";
8428
8429 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8430
8431 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8432
8433 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8434
8435 if (config_OnFire_subclass_count > 0)
8436 {
8437 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8438
8439 for (int i = 0; i < config_OnFire_subclass_count; i++)
8440 {
8441 string particle_class = "";
8442 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8443 string config_OnFire_entry = config_OnFire_class + particle_class;
8444 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8445 WPOF_array.Insert(WPOF);
8446 }
8447
8448
8450 }
8451 }
8452
8454 {
8455 config_to_search = "CfgWeapons";
8456 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8457
8458 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8459
8460 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8461
8462 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8463 {
8464 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8465
8466 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8467 {
8468 string particle_class2 = "";
8469 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8470 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8471 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8472 WPOBE_array.Insert(WPOBE);
8473 }
8474
8475
8477 }
8478 }
8479 }
8480
8481
8483 {
8486
8488 {
8489 string config_to_search = "CfgVehicles";
8490
8491 if (IsInherited(Weapon))
8492 config_to_search = "CfgWeapons";
8493
8494 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8495 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8496
8497 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8498 {
8499
8501
8503 {
8505 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8507 return;
8508 }
8509
8512
8513
8514
8515 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8516 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8517
8518 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8519 {
8520 string particle_class = "";
8521 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8522 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8523 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8524
8525 if (entry_type == CT_CLASS)
8526 {
8527 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8528 WPOOH_array.Insert(WPOF);
8529 }
8530 }
8531
8532
8534 }
8535 }
8536 }
8537
8539 {
8541 }
8542
8544 {
8546 {
8548
8551
8554
8555 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8556 }
8557 }
8558
8560 {
8562 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8563
8565 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8566
8568 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8569
8571 {
8573 }
8574 }
8575
8577 {
8579 }
8580
8582 {
8585 else
8587
8589 {
8592 }
8593 else
8594 {
8597
8600 }
8601
8603 }
8604
8606 {
8608 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8609 }
8610
8612 {
8614 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8616 }
8617
8619 {
8621 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8622 }
8623
8625 {
8628
8629 OverheatingParticle OP = new OverheatingParticle();
8634
8636 }
8637
8639 {
8642
8643 return -1;
8644 }
8645
8647 {
8649 {
8652
8653 for (int i = count; i > 0; --i)
8654 {
8655 int id = i - 1;
8658
8661
8662 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8663 {
8664 if (p)
8665 {
8668 }
8669 }
8670 }
8671 }
8672 }
8673
8675 {
8677 {
8679 {
8680 int id = i - 1;
8682
8683 if (OP)
8684 {
8686
8687 if (p)
8688 {
8690 }
8691
8692 delete OP;
8693 }
8694 }
8695
8698 }
8699 }
8700
8703 {
8704 return 0.0;
8705 }
8706
8707
8709 {
8710 return 250;
8711 }
8712
8714 {
8715 return 0;
8716 }
8717
8720 {
8722 return true;
8723
8724 return false;
8725 }
8726
8729 {
8732
8734 {
8736 }
8737 else
8738 {
8739
8741 }
8742
8744 }
8745
8752 {
8753 return -1;
8754 }
8755
8756
8757
8758
8760 {
8762 {
8763 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8764 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8765
8766 if (r_index >= 0)
8767 {
8768 InventoryLocation r_il = new InventoryLocation;
8769 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8770
8771 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8774 {
8775 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8776 }
8778 {
8779 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8780 }
8781
8782 }
8783
8784 player.GetHumanInventory().ClearUserReservedLocation(this);
8785 }
8786
8789 }
8790
8791
8792
8793
8795 {
8796 return ItemBase.m_DebugActionsMask;
8797 }
8798
8800 {
8801 return ItemBase.m_DebugActionsMask & mask;
8802 }
8803
8805 {
8806 ItemBase.m_DebugActionsMask = mask;
8807 }
8808
8810 {
8811 ItemBase.m_DebugActionsMask |= mask;
8812 }
8813
8815 {
8816 ItemBase.m_DebugActionsMask &= ~mask;
8817 }
8818
8820 {
8822 {
8824 }
8825 else
8826 {
8828 }
8829 }
8830
8831
8833 {
8834 if (GetEconomyProfile())
8835 {
8836 float q_max = GetEconomyProfile().GetQuantityMax();
8837 if (q_max > 0)
8838 {
8839 float q_min = GetEconomyProfile().GetQuantityMin();
8840 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8841
8843 {
8844 ComponentEnergyManager comp = GetCompEM();
8846 {
8848 }
8849 }
8851 {
8853
8854 }
8855
8856 }
8857 }
8858 }
8859
8862 {
8863 EntityAI parent = GetHierarchyParent();
8864
8865 if (parent)
8866 {
8867 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8868 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8869 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8870 }
8871 }
8872
8875 {
8876 EntityAI parent = GetHierarchyParent();
8877
8878 if (parent)
8879 {
8880 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8881 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8882 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8883 }
8884 }
8885
8887 {
8888
8889
8890
8891
8893
8895 {
8896 if (ScriptInputUserData.CanStoreInputUserData())
8897 {
8898 ScriptInputUserData ctx = new ScriptInputUserData;
8904 ctx.
Write(use_stack_max);
8907
8909 {
8910 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8911 }
8912 }
8913 }
8914 else if (!
g_Game.IsMultiplayer())
8915 {
8917 }
8918 }
8919
8921 {
8923 }
8924
8926 {
8928 }
8929
8931 {
8933 }
8934
8936 {
8937
8938 return false;
8939 }
8940
8942 {
8943 return false;
8944 }
8945
8949 {
8950 return false;
8951 }
8952
8954 {
8955 return "";
8956 }
8957
8959
8961 {
8962 return false;
8963 }
8964
8966 {
8967 return true;
8968 }
8969
8970
8971
8973 {
8974 return true;
8975 }
8976
8978 {
8979 return true;
8980 }
8981
8983 {
8984 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8986 }
8987
8989 {
8991 }
8992
8994 {
8996 if (!is_being_placed)
8998 SetSynchDirty();
8999 }
9000
9001
9003
9005 {
9007 }
9008
9010 {
9012 }
9013
9015 {
9016 return 1;
9017 }
9018
9020 {
9021 return false;
9022 }
9023
9025 {
9027 SetSynchDirty();
9028 }
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9065 {
9066 super.OnMovedInsideCargo(container);
9067
9068 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9069 }
9070
9071 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9072 {
9073 super.EEItemLocationChanged(oldLoc, newLoc);
9074
9075 PlayerBase newPlayer = null;
9076 PlayerBase oldPlayer = null;
9077
9078 if (newLoc.GetParent())
9079 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9080
9081 if (oldLoc.GetParent())
9082 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9083
9085 {
9086 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9087
9088 if (rIndex >= 0)
9089 {
9090 InventoryLocation rIl = new InventoryLocation;
9091 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9092
9093 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9096 {
9097 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9098 }
9100 {
9102 }
9103
9104 }
9105 }
9106
9108 {
9109 if (newPlayer)
9110 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9111
9112 if (newPlayer == oldPlayer)
9113 {
9114 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9115 {
9117 {
9118 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9119 {
9120 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9121 }
9122 }
9123 else
9124 {
9125 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9126 }
9127 }
9128
9129 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9130 {
9131 int type = oldLoc.GetType();
9133 {
9134 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9135 }
9137 {
9138 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9139 }
9140 }
9141 if (!m_OldLocation)
9142 {
9143 m_OldLocation = new InventoryLocation;
9144 }
9145 m_OldLocation.Copy(oldLoc);
9146 }
9147 else
9148 {
9149 if (m_OldLocation)
9150 {
9151 m_OldLocation.Reset();
9152 }
9153 }
9154
9155 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9156 }
9157 else
9158 {
9159 if (newPlayer)
9160 {
9161 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9162 if (resIndex >= 0)
9163 {
9164 InventoryLocation il = new InventoryLocation;
9165 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9167 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9170 {
9171 il.
GetParent().GetOnReleaseLock().Invoke(it);
9172 }
9174 {
9176 }
9177
9178 }
9179 }
9181 {
9182
9184 }
9185
9186 if (m_OldLocation)
9187 {
9188 m_OldLocation.Reset();
9189 }
9190 }
9191
9193 {
9194 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9195 }
9196
9198 {
9199 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9200 }
9201 }
9202
9203 override void EOnContact(IEntity other, Contact extra)
9204 {
9206 {
9207 int liquidType = -1;
9209 if (impactSpeed > 0.0)
9210 {
9212 #ifndef SERVER
9214 #else
9216 SetSynchDirty();
9217 #endif
9219 }
9220 }
9221
9222 #ifdef SERVER
9223 if (GetCompEM() && GetCompEM().IsPlugged())
9224 {
9225 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9226 GetCompEM().UnplugThis();
9227 }
9228 #endif
9229 }
9230
9232
9234 {
9236 }
9237
9239 {
9240
9241 }
9242
9244 {
9245 super.OnItemLocationChanged(old_owner, new_owner);
9246
9247 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9248 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9249
9250 if (!relatedPlayer && playerNew)
9251 relatedPlayer = playerNew;
9252
9253 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9254 {
9256 if (actionMgr)
9257 {
9258 ActionBase currentAction = actionMgr.GetRunningAction();
9259 if (currentAction)
9261 }
9262 }
9263
9264 Man ownerPlayerOld = null;
9265 Man ownerPlayerNew = null;
9266
9267 if (old_owner)
9268 {
9269 if (old_owner.
IsMan())
9270 {
9271 ownerPlayerOld = Man.Cast(old_owner);
9272 }
9273 else
9274 {
9275 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9276 }
9277 }
9278 else
9279 {
9281 {
9283
9284 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9285 {
9286 GetCompEM().UnplugThis();
9287 }
9288 }
9289 }
9290
9291 if (new_owner)
9292 {
9293 if (new_owner.
IsMan())
9294 {
9295 ownerPlayerNew = Man.Cast(new_owner);
9296 }
9297 else
9298 {
9299 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9300 }
9301 }
9302
9303 if (ownerPlayerOld != ownerPlayerNew)
9304 {
9305 if (ownerPlayerOld)
9306 {
9307 array<EntityAI> subItemsExit = new array<EntityAI>;
9309 for (int i = 0; i < subItemsExit.Count(); i++)
9310 {
9313 }
9314 }
9315
9316 if (ownerPlayerNew)
9317 {
9318 array<EntityAI> subItemsEnter = new array<EntityAI>;
9320 for (int j = 0; j < subItemsEnter.Count(); j++)
9321 {
9324 }
9325 }
9326 }
9327 else if (ownerPlayerNew != null)
9328 {
9329 PlayerBase nplayer;
9330 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9331 {
9332 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9334 for (int k = 0; k < subItemsUpdate.Count(); k++)
9335 {
9337 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9338 }
9339 }
9340 }
9341
9342 if (old_owner)
9343 old_owner.OnChildItemRemoved(this);
9344 if (new_owner)
9345 new_owner.OnChildItemReceived(this);
9346 }
9347
9348
9350 {
9351 super.EEDelete(parent);
9352 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9353 if (player)
9354 {
9356
9357 if (player.IsAlive())
9358 {
9359 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9360 if (r_index >= 0)
9361 {
9362 InventoryLocation r_il = new InventoryLocation;
9363 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9364
9365 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9368 {
9369 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9370 }
9372 {
9373 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9374 }
9375
9376 }
9377
9378 player.RemoveQuickBarEntityShortcut(this);
9379 }
9380 }
9381 }
9382
9384 {
9385 super.EEKilled(killer);
9386
9389 {
9390 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9391 {
9392 if (IsMagazine())
9393 {
9394 if (Magazine.Cast(this).GetAmmoCount() > 0)
9395 {
9397 }
9398 }
9399 else
9400 {
9402 }
9403 }
9404 }
9405 }
9406
9408 {
9409 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9410
9411 super.OnWasAttached(parent, slot_id);
9412
9415
9418 }
9419
9421 {
9422 super.OnWasDetached(parent, slot_id);
9423
9426
9429 }
9430
9432 {
9433 int idx;
9436
9437 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9438 if (inventory_slots.Count() < 1)
9439 {
9440 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9441 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9442 }
9443 else
9444 {
9445 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9446 }
9447
9448 idx = inventory_slots.Find(slot);
9449 if (idx < 0)
9450 return "";
9451
9452 return attach_types.Get(idx);
9453 }
9454
9456 {
9457 int idx = -1;
9458 string slot;
9459
9462
9463 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9464 if (inventory_slots.Count() < 1)
9465 {
9466 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9467 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9468 }
9469 else
9470 {
9471 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9472 if (detach_types.Count() < 1)
9473 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9474 }
9475
9476 for (int i = 0; i < inventory_slots.Count(); i++)
9477 {
9478 slot = inventory_slots.Get(i);
9479 }
9480
9481 if (slot != "")
9482 {
9483 if (detach_types.Count() == 1)
9484 idx = 0;
9485 else
9486 idx = inventory_slots.Find(slot);
9487 }
9488 if (idx < 0)
9489 return "";
9490
9491 return detach_types.Get(idx);
9492 }
9493
9495 {
9496
9498
9499
9500 float min_time = 1;
9501 float max_time = 3;
9502 float delay = Math.RandomFloat(min_time, max_time);
9503
9504 explode_timer.Run(delay, this, "DoAmmoExplosion");
9505 }
9506
9508 {
9509 Magazine magazine = Magazine.Cast(this);
9510 int pop_sounds_count = 6;
9511 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9512
9513
9514 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9515 string sound_name = pop_sounds[ sound_idx ];
9516 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9517
9518
9519 magazine.ServerAddAmmoCount(-1);
9520
9521
9522 float min_temp_to_explode = 100;
9523
9524 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9525 {
9527 }
9528 }
9529
9530
9531 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9532 {
9533 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9534
9535 const int CHANCE_DAMAGE_CARGO = 4;
9536 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9537 const int CHANCE_DAMAGE_NOTHING = 2;
9538
9540 {
9541 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9542 int chances;
9543 int rnd;
9544
9545 if (GetInventory().GetCargo())
9546 {
9547 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9548 rnd = Math.RandomInt(0,chances);
9549
9550 if (rnd < CHANCE_DAMAGE_CARGO)
9551 {
9553 }
9554 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9555 {
9557 }
9558 }
9559 else
9560 {
9561 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9562 rnd = Math.RandomInt(0,chances);
9563
9564 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9565 {
9567 }
9568 }
9569 }
9570 }
9571
9573 {
9574 CargoBase cargo = GetInventory().GetCargo();
9575 if (cargo)
9576 {
9578 if (item_count > 0)
9579 {
9580 int random_pick = Math.RandomInt(0, item_count);
9582 if (!item.IsExplosive())
9583 {
9584 item.AddHealth("","",damage);
9585 return true;
9586 }
9587 }
9588 }
9589 return false;
9590 }
9591
9593 {
9594 GameInventory inventory = GetInventory();
9596 if (attachment_count > 0)
9597 {
9598 int random_pick = Math.RandomInt(0, attachment_count);
9600 if (!attachment.IsExplosive())
9601 {
9602 attachment.AddHealth("","",damage);
9603 return true;
9604 }
9605 }
9606 return false;
9607 }
9608
9610 {
9612 }
9613
9615 {
9617 return GetInventory().CanRemoveEntity();
9618
9619 return false;
9620 }
9621
9623 {
9624
9626 return false;
9627
9628
9630 return false;
9631
9632
9633
9635 if (delta == 0)
9636 return false;
9637
9638
9639 return true;
9640 }
9641
9643 {
9645 {
9646 if (ScriptInputUserData.CanStoreInputUserData())
9647 {
9648 ScriptInputUserData ctx = new ScriptInputUserData;
9653 ctx.
Write(destination_entity);
9657 }
9658 }
9659 else if (!
g_Game.IsMultiplayer())
9660 {
9662 }
9663 }
9664
9666 {
9667 float split_quantity_new;
9671 InventoryLocation loc = new InventoryLocation;
9672
9673 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9674 {
9676 split_quantity_new = stack_max;
9677 else
9679
9681 {
9682 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9683 if (new_item)
9684 {
9685 new_item.SetResultOfSplit(true);
9686 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9688 new_item.
SetQuantity(split_quantity_new,
false,
true);
9689 }
9690 }
9691 }
9692 else if (destination_entity && slot_id == -1)
9693 {
9694 if (quantity > stack_max)
9695 split_quantity_new = stack_max;
9696 else
9697 split_quantity_new = quantity;
9698
9700 {
9701 GameInventory destinationInventory = destination_entity.GetInventory();
9703 {
9706 }
9707
9708 if (new_item)
9709 {
9710 new_item.SetResultOfSplit(true);
9711 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9713 new_item.
SetQuantity(split_quantity_new,
false,
true);
9714 }
9715 }
9716 }
9717 else
9718 {
9719 if (stack_max != 0)
9720 {
9722 {
9724 }
9725
9726 if (split_quantity_new == 0)
9727 {
9728 if (!
g_Game.IsMultiplayer())
9729 player.PhysicalPredictiveDropItem(this);
9730 else
9731 player.ServerDropEntity(this);
9732 return;
9733 }
9734
9736 {
9738
9739 if (new_item)
9740 {
9741 new_item.SetResultOfSplit(true);
9742 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9745 new_item.PlaceOnSurface();
9746 }
9747 }
9748 }
9749 }
9750 }
9751
9753 {
9754 float split_quantity_new;
9758 InventoryLocation loc = new InventoryLocation;
9759
9760 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9761 {
9763 split_quantity_new = stack_max;
9764 else
9766
9768 {
9769 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9770 if (new_item)
9771 {
9772 new_item.SetResultOfSplit(true);
9773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9775 new_item.
SetQuantity(split_quantity_new,
false,
true);
9776 }
9777 }
9778 }
9779 else if (destination_entity && slot_id == -1)
9780 {
9781 if (quantity > stack_max)
9782 split_quantity_new = stack_max;
9783 else
9784 split_quantity_new = quantity;
9785
9787 {
9788 GameInventory destinationInventory = destination_entity.GetInventory();
9790 {
9793 }
9794
9795 if (new_item)
9796 {
9797 new_item.SetResultOfSplit(true);
9798 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9800 new_item.
SetQuantity(split_quantity_new,
false,
true);
9801 }
9802 }
9803 }
9804 else
9805 {
9806 if (stack_max != 0)
9807 {
9809 {
9811 }
9812
9814 {
9816
9817 if (new_item)
9818 {
9819 new_item.SetResultOfSplit(true);
9820 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9823 new_item.PlaceOnSurface();
9824 }
9825 }
9826 }
9827 }
9828 }
9829
9831 {
9833 {
9834 if (ScriptInputUserData.CanStoreInputUserData())
9835 {
9836 ScriptInputUserData ctx = new ScriptInputUserData;
9841 dst.WriteToContext(ctx);
9843 }
9844 }
9845 else if (!
g_Game.IsMultiplayer())
9846 {
9848 }
9849 }
9850
9852 {
9854 {
9855 if (ScriptInputUserData.CanStoreInputUserData())
9856 {
9857 ScriptInputUserData ctx = new ScriptInputUserData;
9862 ctx.
Write(destination_entity);
9868 }
9869 }
9870 else if (!
g_Game.IsMultiplayer())
9871 {
9873 }
9874 }
9875
9877 {
9879 }
9880
9882 {
9884 float split_quantity_new;
9886 if (dst.IsValid())
9887 {
9888 int slot_id = dst.GetSlot();
9890
9891 if (quantity > stack_max)
9892 split_quantity_new = stack_max;
9893 else
9894 split_quantity_new = quantity;
9895
9897 {
9899
9900 if (new_item)
9901 {
9902 new_item.SetResultOfSplit(true);
9903 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9905 new_item.
SetQuantity(split_quantity_new,
false,
true);
9906 }
9907
9908 return new_item;
9909 }
9910 }
9911
9912 return null;
9913 }
9914
9916 {
9918 float split_quantity_new;
9920 if (destination_entity)
9921 {
9923 if (quantity > stackable)
9924 split_quantity_new = stackable;
9925 else
9926 split_quantity_new = quantity;
9927
9929 {
9930 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9931 if (new_item)
9932 {
9933 new_item.SetResultOfSplit(true);
9934 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9936 new_item.
SetQuantity(split_quantity_new,
false,
true);
9937 }
9938 }
9939 }
9940 }
9941
9943 {
9945 {
9946 if (ScriptInputUserData.CanStoreInputUserData())
9947 {
9948 ScriptInputUserData ctx = new ScriptInputUserData;
9953 ItemBase destination_entity =
this;
9954 ctx.
Write(destination_entity);
9958 }
9959 }
9960 else if (!
g_Game.IsMultiplayer())
9961 {
9963 }
9964 }
9965
9967 {
9969 float split_quantity_new;
9971 if (player)
9972 {
9974 if (quantity > stackable)
9975 split_quantity_new = stackable;
9976 else
9977 split_quantity_new = quantity;
9978
9980 {
9981 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9982 new_item =
ItemBase.Cast(in_hands);
9983 if (new_item)
9984 {
9985 new_item.SetResultOfSplit(true);
9986 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9988 new_item.SetQuantity(split_quantity_new, false, true);
9989 }
9990 }
9991 }
9992 }
9993
9995 {
9997 float split_quantity_new = Math.Floor(quantity * 0.5);
9998
10000 return;
10001
10003
10004 if (new_item)
10005 {
10006 if (new_item.GetQuantityMax() < split_quantity_new)
10007 {
10008 split_quantity_new = new_item.GetQuantityMax();
10009 }
10010
10011 new_item.SetResultOfSplit(true);
10012 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10013
10015 {
10018 }
10019 else
10020 {
10022 new_item.
SetQuantity(split_quantity_new,
false,
true);
10023 }
10024 }
10025 }
10026
10028 {
10030 float split_quantity_new = Math.Floor(quantity / 2);
10031
10033 return;
10034
10035 InventoryLocation invloc = new InventoryLocation;
10037
10039 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10040
10041 if (new_item)
10042 {
10043 if (new_item.GetQuantityMax() < split_quantity_new)
10044 {
10045 split_quantity_new = new_item.GetQuantityMax();
10046 }
10048 {
10051 }
10052 else if (split_quantity_new > 1)
10053 {
10055 new_item.
SetQuantity(split_quantity_new,
false,
true);
10056 }
10057 }
10058 }
10059
10062 {
10063 SetWeightDirty();
10065
10066 if (parent)
10067 parent.OnAttachmentQuantityChangedEx(this, delta);
10068
10070 {
10072 {
10074 }
10076 {
10077 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10079 }
10080 }
10081 }
10082
10085 {
10086
10087 }
10088
10091 {
10093 }
10094
10096 {
10097 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10098
10100 {
10101 if (newLevel == GameConstants.STATE_RUINED)
10102 {
10104 EntityAI parent = GetHierarchyParent();
10105 if (parent && parent.IsFireplace())
10106 {
10107 CargoBase cargo = GetInventory().GetCargo();
10108 if (cargo)
10109 {
10111 {
10113 }
10114 }
10115 }
10116 }
10117
10119 {
10120
10122 return;
10123 }
10124
10125 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10126 {
10128 }
10129 }
10130 }
10131
10132
10134 {
10135 super.OnRightClick();
10136
10138 {
10140 {
10141 if (ScriptInputUserData.CanStoreInputUserData())
10142 {
10143 EntityAI root = GetHierarchyRoot();
10144 Man playerOwner = GetHierarchyRootPlayer();
10145 InventoryLocation dst = new InventoryLocation;
10146
10147
10148 if (!playerOwner && root && root == this)
10149 {
10151 }
10152 else
10153 {
10154
10155 GetInventory().GetCurrentInventoryLocation(dst);
10157 {
10158 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10160 {
10162 }
10163 else
10164 {
10166
10167
10168 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10169 {
10171 }
10172 else
10173 {
10174 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10175 }
10176 }
10177 }
10178 }
10179
10180 ScriptInputUserData ctx = new ScriptInputUserData;
10188 }
10189 }
10190 else if (!
g_Game.IsMultiplayer())
10191 {
10193 }
10194 }
10195 }
10196
10198 {
10199 if (root)
10200 {
10201 vector m4[4];
10202 root.GetTransform(m4);
10203 dst.SetGround(this, m4);
10204 }
10205 else
10206 {
10207 GetInventory().GetCurrentInventoryLocation(dst);
10208 }
10209 }
10210
10211 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10212 {
10213
10214 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10215 return false;
10216
10217 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10218 return false;
10219
10220
10222 return false;
10223
10224
10225 Magazine mag = Magazine.Cast(this);
10226 if (mag)
10227 {
10228 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10229 return false;
10230
10231 if (stack_max_limit)
10232 {
10233 Magazine other_mag = Magazine.Cast(other_item);
10234 if (other_item)
10235 {
10236 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10237 return false;
10238 }
10239
10240 }
10241 }
10242 else
10243 {
10244
10246 return false;
10247
10249 return false;
10250 }
10251
10252 PlayerBase player = null;
10253 if (CastTo(player, GetHierarchyRootPlayer()))
10254 {
10255 if (player.GetInventory().HasAttachment(this))
10256 return false;
10257
10258 if (player.IsItemsToDelete())
10259 return false;
10260 }
10261
10262 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10263 return false;
10264
10265 int slotID;
10267 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10268 return false;
10269
10270 return true;
10271 }
10272
10274 {
10276 }
10277
10279 {
10280 return m_IsResultOfSplit;
10281 }
10282
10284 {
10285 m_IsResultOfSplit = value;
10286 }
10287
10289 {
10291 }
10292
10294 {
10295 float other_item_quantity = other_item.GetQuantity();
10296 float this_free_space;
10297
10299
10301
10302 if (other_item_quantity > this_free_space)
10303 {
10304 return this_free_space;
10305 }
10306 else
10307 {
10308 return other_item_quantity;
10309 }
10310 }
10311
10313 {
10315 }
10316
10318 {
10320 return;
10321
10322 if (!IsMagazine() && other_item)
10323 {
10325 if (quantity_used != 0)
10326 {
10327 float hp1 = GetHealth01("","");
10328 float hp2 = other_item.GetHealth01("","");
10329 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10330 hpResult = hpResult / (
GetQuantity() + quantity_used);
10331
10332 hpResult *= GetMaxHealth();
10333 Math.Round(hpResult);
10334 SetHealth("", "Health", hpResult);
10335
10337 other_item.AddQuantity(-quantity_used);
10338 }
10339 }
10341 }
10342
10344 {
10345 #ifdef SERVER
10346 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10347 GetHierarchyParent().IncreaseLifetimeUp();
10348 #endif
10349 };
10350
10352 {
10353 PlayerBase p = PlayerBase.Cast(player);
10354
10355 array<int> recipesIds = p.m_Recipes;
10356 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10357 if (moduleRecipesManager)
10358 {
10359 EntityAI itemInHands = player.GetEntityInHands();
10360 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10361 }
10362
10363 for (int i = 0;i < recipesIds.Count(); i++)
10364 {
10365 int key = recipesIds.Get(i);
10366 string recipeName = moduleRecipesManager.GetRecipeName(key);
10368 }
10369 }
10370
10371
10372 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10373 {
10374 super.GetDebugActions(outputList);
10375
10376
10382
10383
10388
10393
10394
10398
10399
10401 {
10405 }
10406
10409
10410
10414
10416
10417 InventoryLocation loc = new InventoryLocation();
10418 GetInventory().GetCurrentInventoryLocation(loc);
10420 {
10421 if (Gizmo_IsSupported())
10424 }
10425
10427 }
10428
10429
10430
10431
10433 {
10434 super.OnAction(action_id, player, ctx);
10435
10437 {
10438 switch (action_id)
10439 {
10443 return true;
10447 return true;
10448 }
10449 }
10450
10452 {
10453 switch (action_id)
10454 {
10456 Delete();
10457 return true;
10458 }
10459 }
10460
10461 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10462 {
10463 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10464 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10465 PlayerBase p = PlayerBase.Cast(player);
10466 if (
EActions.RECIPES_RANGE_START < 1000)
10467 {
10468 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10469 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10470 }
10471 }
10472 #ifndef SERVER
10473 else if (action_id ==
EActions.WATCH_PLAYER)
10474 {
10475 PluginDeveloper.SetDeveloperItemClientEx(player);
10476 }
10477 #endif
10479 {
10480 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10481 {
10482 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10483 OnDebugButtonPressServer(id + 1);
10484 }
10485
10486 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10487 {
10488 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10490 }
10491
10492 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10493 {
10494 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10496 }
10497
10498 else if (action_id ==
EActions.ADD_QUANTITY)
10499 {
10500 if (IsMagazine())
10501 {
10502 Magazine mag = Magazine.Cast(this);
10503 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10504 }
10505 else
10506 {
10508 }
10509
10510 if (m_EM)
10511 {
10512 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10513 }
10514
10515 }
10516
10517 else if (action_id ==
EActions.REMOVE_QUANTITY)
10518 {
10519 if (IsMagazine())
10520 {
10521 Magazine mag2 = Magazine.Cast(this);
10522 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10523 }
10524 else
10525 {
10527 }
10528 if (m_EM)
10529 {
10530 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10531 }
10532
10533 }
10534
10535 else if (action_id ==
EActions.SET_QUANTITY_0)
10536 {
10538
10539 if (m_EM)
10540 {
10541 m_EM.SetEnergy(0);
10542 }
10543 }
10544
10545 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10546 {
10548
10549 if (m_EM)
10550 {
10551 m_EM.SetEnergy(m_EM.GetEnergyMax());
10552 }
10553 }
10554
10555 else if (action_id ==
EActions.ADD_HEALTH)
10556 {
10557 AddHealth("","",GetMaxHealth("","Health")/5);
10558 }
10559 else if (action_id ==
EActions.REMOVE_HEALTH)
10560 {
10561 AddHealth("","",-GetMaxHealth("","Health")/5);
10562 }
10563 else if (action_id ==
EActions.DESTROY_HEALTH)
10564 {
10565 SetHealth01("","",0);
10566 }
10567 else if (action_id ==
EActions.WATCH_ITEM)
10568 {
10570 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10571 #ifdef DEVELOPER
10572 SetDebugDeveloper_item(this);
10573 #endif
10574 }
10575
10576 else if (action_id ==
EActions.ADD_TEMPERATURE)
10577 {
10578 AddTemperature(20);
10579
10580 }
10581
10582 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10583 {
10584 AddTemperature(-20);
10585
10586 }
10587
10588 else if (action_id ==
EActions.FLIP_FROZEN)
10589 {
10590 SetFrozen(!GetIsFrozen());
10591
10592 }
10593
10594 else if (action_id ==
EActions.ADD_WETNESS)
10595 {
10597
10598 }
10599
10600 else if (action_id ==
EActions.REMOVE_WETNESS)
10601 {
10603
10604 }
10605
10606 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10607 {
10610
10611
10612 }
10613
10614 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10615 {
10618 }
10619
10620 else if (action_id ==
EActions.MAKE_SPECIAL)
10621 {
10622 auto debugParams = DebugSpawnParams.WithPlayer(player);
10623 OnDebugSpawnEx(debugParams);
10624 }
10625
10626 }
10627
10628
10629 return false;
10630 }
10631
10632
10633
10634
10638
10641
10642
10643
10645 {
10646 return false;
10647 }
10648
10649
10651 {
10652 return true;
10653 }
10654
10655
10657 {
10658 return true;
10659 }
10660
10661
10662
10664 {
10665 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10666 return g_Game.ConfigIsExisting(config_path);
10667 }
10668
10671 {
10672 return null;
10673 }
10674
10676 {
10677 return false;
10678 }
10679
10681 {
10682 return false;
10683 }
10684
10688
10689
10691 {
10692 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10693 return module_repairing.CanRepair(this, item_repair_kit);
10694 }
10695
10696
10697 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10698 {
10699 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10700 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10701 }
10702
10703
10705 {
10706
10707
10708
10709
10710
10711
10712
10713
10714 return 1;
10715 }
10716
10717
10718
10720 {
10722 }
10723
10724
10725
10727 {
10729 }
10730
10731
10740 {
10741 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10742
10743 if (player)
10744 {
10745 player.MessageStatus(text);
10746 }
10747 }
10748
10749
10758 {
10759 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10760
10761 if (player)
10762 {
10763 player.MessageAction(text);
10764 }
10765 }
10766
10767
10776 {
10777 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10778
10779 if (player)
10780 {
10781 player.MessageFriendly(text);
10782 }
10783 }
10784
10785
10794 {
10795 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10796
10797 if (player)
10798 {
10799 player.MessageImportant(text);
10800 }
10801 }
10802
10804 {
10805 return true;
10806 }
10807
10808
10809 override bool KindOf(
string tag)
10810 {
10811 bool found = false;
10812 string item_name = this.
GetType();
10814 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10815
10816 int array_size = item_tag_array.Count();
10817 for (int i = 0; i < array_size; i++)
10818 {
10819 if (item_tag_array.Get(i) == tag)
10820 {
10821 found = true;
10822 break;
10823 }
10824 }
10825 return found;
10826 }
10827
10828
10830 {
10831
10832 super.OnRPC(sender, rpc_type,ctx);
10833
10834
10835 switch (rpc_type)
10836 {
10837 #ifndef SERVER
10838 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10839 Param2<bool, string> p = new Param2<bool, string>(false, "");
10840
10842 return;
10843
10844 bool play = p.param1;
10845 string soundSet = p.param2;
10846
10847 if (play)
10848 {
10850 {
10852 {
10854 }
10855 }
10856 else
10857 {
10859 }
10860 }
10861 else
10862 {
10864 }
10865
10866 break;
10867 #endif
10868
10869 }
10870
10872 {
10874 }
10875 }
10876
10877
10878
10879
10881 {
10882 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10883 return plugin.GetID(
name);
10884 }
10885
10887 {
10888 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10889 return plugin.GetName(id);
10890 }
10891
10894 {
10895
10896
10897 int varFlags;
10898 if (!ctx.
Read(varFlags))
10899 return;
10900
10901 if (varFlags & ItemVariableFlags.FLOAT)
10902 {
10904 }
10905 }
10906
10908 {
10909
10910 super.SerializeNumericalVars(floats_out);
10911
10912
10913
10915 {
10917 }
10918
10920 {
10922 }
10923
10925 {
10927 }
10928
10930 {
10935 }
10936
10938 {
10940 }
10941 }
10942
10944 {
10945
10946 super.DeSerializeNumericalVars(floats);
10947
10948
10949 int index = 0;
10950 int mask = Math.Round(floats.Get(index));
10951
10952 index++;
10953
10955 {
10957 {
10959 }
10960 else
10961 {
10962 float quantity = floats.Get(index);
10963 SetQuantity(quantity,
true,
false,
false,
false);
10964 }
10965 index++;
10966 }
10967
10969 {
10970 float wet = floats.Get(index);
10972 index++;
10973 }
10974
10976 {
10977 int liquidtype = Math.Round(floats.Get(index));
10979 index++;
10980 }
10981
10983 {
10985 index++;
10987 index++;
10989 index++;
10991 index++;
10992 }
10993
10995 {
10996 int cleanness = Math.Round(floats.Get(index));
10998 index++;
10999 }
11000 }
11001
11003 {
11004 super.WriteVarsToCTX(ctx);
11005
11006
11008 {
11010 }
11011
11013 {
11015 }
11016
11018 {
11020 }
11021
11023 {
11024 int r,g,b,a;
11030 }
11031
11033 {
11035 }
11036 }
11037
11039 {
11040 if (!super.ReadVarsFromCTX(ctx,version))
11041 return false;
11042
11043 int intValue;
11044 float value;
11045
11046 if (version < 140)
11047 {
11048 if (!ctx.
Read(intValue))
11049 return false;
11050
11051 m_VariablesMask = intValue;
11052 }
11053
11055 {
11056 if (!ctx.
Read(value))
11057 return false;
11058
11060 {
11062 }
11063 else
11064 {
11066 }
11067 }
11068
11069 if (version < 140)
11070 {
11072 {
11073 if (!ctx.
Read(value))
11074 return false;
11075 SetTemperatureDirect(value);
11076 }
11077 }
11078
11080 {
11081 if (!ctx.
Read(value))
11082 return false;
11084 }
11085
11087 {
11088 if (!ctx.
Read(intValue))
11089 return false;
11091 }
11092
11094 {
11095 int r,g,b,a;
11097 return false;
11099 return false;
11101 return false;
11103 return false;
11104
11106 }
11107
11109 {
11110 if (!ctx.
Read(intValue))
11111 return false;
11113 }
11114
11115 if (version >= 138 && version < 140)
11116 {
11118 {
11119 if (!ctx.
Read(intValue))
11120 return false;
11121 SetFrozen(intValue);
11122 }
11123 }
11124
11125 return true;
11126 }
11127
11128
11130 {
11133 {
11135 }
11136
11137 if (!super.OnStoreLoad(ctx, version))
11138 {
11140 return false;
11141 }
11142
11143 if (version >= 114)
11144 {
11145 bool hasQuickBarIndexSaved;
11146
11147 if (!ctx.
Read(hasQuickBarIndexSaved))
11148 {
11150 return false;
11151 }
11152
11153 if (hasQuickBarIndexSaved)
11154 {
11155 int itmQBIndex;
11156
11157
11158 if (!ctx.
Read(itmQBIndex))
11159 {
11161 return false;
11162 }
11163
11164 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11165 if (itmQBIndex != -1 && parentPlayer)
11166 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11167 }
11168 }
11169 else
11170 {
11171
11172 PlayerBase player;
11173 int itemQBIndex;
11174 if (version ==
int.
MAX)
11175 {
11176 if (!ctx.
Read(itemQBIndex))
11177 {
11179 return false;
11180 }
11181 }
11182 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11183 {
11184
11185 if (!ctx.
Read(itemQBIndex))
11186 {
11188 return false;
11189 }
11190 if (itemQBIndex != -1 && player)
11191 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11192 }
11193 }
11194
11195 if (version < 140)
11196 {
11197
11198 if (!LoadVariables(ctx, version))
11199 {
11201 return false;
11202 }
11203 }
11204
11205
11207 {
11209 return false;
11210 }
11211 if (version >= 132)
11212 {
11214 if (raib)
11215 {
11217 {
11219 return false;
11220 }
11221 }
11222 }
11223
11225 return true;
11226 }
11227
11228
11229
11231 {
11232 super.OnStoreSave(ctx);
11233
11234 PlayerBase player;
11235 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11236 {
11238
11239 int itemQBIndex = -1;
11240 itemQBIndex = player.FindQuickBarEntityIndex(this);
11241 ctx.
Write(itemQBIndex);
11242 }
11243 else
11244 {
11246 }
11247
11249
11251 if (raib)
11252 {
11254 }
11255 }
11256
11257
11259 {
11260 super.AfterStoreLoad();
11261
11263 {
11265 }
11266
11268 {
11271 }
11272 }
11273
11275 {
11276 super.EEOnAfterLoad();
11277
11279 {
11281 }
11282
11285 }
11286
11288 {
11289 return false;
11290 }
11291
11292
11293
11295 {
11297 {
11298 #ifdef PLATFORM_CONSOLE
11299
11301 {
11303 if (menu)
11304 {
11306 }
11307 }
11308 #endif
11309 }
11310
11312 {
11315 }
11316
11318 {
11319 SetWeightDirty();
11321 }
11323 {
11326 }
11327
11329 {
11332
11335 }
11337 {
11341 }
11342
11343 super.OnVariablesSynchronized();
11344 }
11345
11346
11347
11349 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11350 {
11351 if (!IsServerCheck(allow_client))
11352 return false;
11353
11355 return false;
11356
11359
11360 if (value <= (min + 0.001))
11361 value = min;
11362
11363 if (value == min)
11364 {
11365 if (destroy_config)
11366 {
11367 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11368 if (dstr)
11369 {
11371 this.Delete();
11372 return true;
11373 }
11374 }
11375 else if (destroy_forced)
11376 {
11378 this.Delete();
11379 return true;
11380 }
11381
11383 }
11384
11387
11389 {
11390 EntityAI parent = GetHierarchyRoot();
11391 InventoryLocation iLoc = new InventoryLocation();
11392 GetInventory().GetCurrentInventoryLocation(iLoc);
11394 {
11395 int iLocSlot = iLoc.
GetSlot();
11397 {
11399 }
11401 {
11403 }
11404 }
11405 }
11406
11408 {
11410
11411 if (delta)
11413 }
11414
11416
11417 return false;
11418 }
11419
11420
11422 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11423 {
11425 }
11426
11428 {
11431 }
11432
11434 {
11437 }
11438
11440 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11441 {
11442 float value_clamped = Math.Clamp(value, 0, 1);
11444 SetQuantity(result, destroy_config, destroy_forced);
11445 }
11446
11447
11450 {
11452 }
11453
11455 {
11457 }
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11469 {
11470 int slot = -1;
11471 GameInventory inventory = GetInventory();
11472 if (inventory)
11473 {
11474 InventoryLocation il = new InventoryLocation;
11477 }
11478
11480 }
11481
11483 {
11484 float quantity_max = 0;
11485
11487 {
11488 if (attSlotID != -1)
11489 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11490
11491 if (quantity_max <= 0)
11493 }
11494
11495 if (quantity_max <= 0)
11497
11498 return quantity_max;
11499 }
11500
11502 {
11504 }
11505
11507 {
11509 }
11510
11511
11513 {
11515 }
11516
11518 {
11520 }
11521
11523 {
11525 }
11526
11527
11529 {
11530
11531 float weightEx = GetWeightEx();
11532 float special = GetInventoryAndCargoWeight();
11533 return weightEx - special;
11534 }
11535
11536
11538 {
11540 }
11541
11543 {
11545 {
11546 #ifdef DEVELOPER
11547 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11548 {
11549 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11551 }
11552 #endif
11553
11554 return GetQuantity() * GetConfigWeightModified();
11555 }
11556 else if (HasEnergyManager())
11557 {
11558 #ifdef DEVELOPER
11559 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11560 {
11561 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11562 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11563 }
11564 #endif
11565 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11566 }
11567 else
11568 {
11569 #ifdef DEVELOPER
11570 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11571 {
11572 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11573 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11574 }
11575 #endif
11576 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11577 }
11578 }
11579
11582 {
11583 int item_count = 0;
11585
11586 GameInventory inventory = GetInventory();
11587 CargoBase cargo = inventory.
GetCargo();
11588 if (cargo != NULL)
11589 {
11591 }
11592
11594 for (int i = 0; i < nAttachments; ++i)
11595 {
11597 if (item)
11598 item_count += item.GetNumberOfItems();
11599 }
11600 return item_count;
11601 }
11602
11605 {
11606 float weight = 0;
11607 float wetness = 1;
11608 if (include_wetness)
11611 {
11612 weight = wetness * m_ConfigWeight;
11613 }
11615 {
11616 weight = 1;
11617 }
11618 return weight;
11619 }
11620
11621
11622
11624 {
11625 GameInventory inventory = GetInventory();
11626 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11627 {
11628 array<EntityAI> items = new array<EntityAI>;
11630 for (int i = 0; i < items.Count(); ++i)
11631 {
11633 if (item)
11634 {
11635 g_Game.ObjectDelete(item);
11636 }
11637 }
11638 }
11639 }
11640
11641
11642
11643
11645 {
11646 float energy = 0;
11647 if (HasEnergyManager())
11648 {
11649 energy = GetCompEM().GetEnergy();
11650 }
11651 return energy;
11652 }
11653
11654
11656 {
11657 super.OnEnergyConsumed();
11658
11660 }
11661
11663 {
11664 super.OnEnergyAdded();
11665
11667 }
11668
11669
11671 {
11672 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11673 {
11675 {
11676 float energy_0to1 = GetCompEM().GetEnergy0To1();
11678 }
11679 }
11680 }
11681
11682
11684 {
11685 return ConfigGetFloat("heatIsolation");
11686 }
11687
11689 {
11691 }
11692
11694 {
11695 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11696 if (
g_Game.ConfigIsExisting(paramPath))
11697 return g_Game.ConfigGetFloat(paramPath);
11698
11699 return 0.0;
11700 }
11701
11703 {
11704 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11705 if (
g_Game.ConfigIsExisting(paramPath))
11706 return g_Game.ConfigGetFloat(paramPath);
11707
11708 return 0.0;
11709 }
11710
11711 override void SetWet(
float value,
bool allow_client =
false)
11712 {
11713 if (!IsServerCheck(allow_client))
11714 return;
11715
11718
11720
11721 m_VarWet = Math.Clamp(value, min, max);
11722
11724 {
11727 }
11728 }
11729
11730 override void AddWet(
float value)
11731 {
11733 }
11734
11736 {
11738 }
11739
11741 {
11743 }
11744
11746 {
11748 }
11749
11751 {
11753 }
11754
11756 {
11758 }
11759
11760 override void OnWetChanged(
float newVal,
float oldVal)
11761 {
11764 if (newLevel != oldLevel)
11765 {
11767 }
11768 }
11769
11771 {
11772 SetWeightDirty();
11773 }
11774
11776 {
11777 return GetWetLevelInternal(
m_VarWet);
11778 }
11779
11780
11781
11783 {
11785 }
11786
11788 {
11790 }
11791
11793 {
11795 }
11796
11798 {
11800 }
11801
11802
11803
11805 {
11806 if (ConfigIsExisting("itemModelLength"))
11807 {
11808 return ConfigGetFloat("itemModelLength");
11809 }
11810 return 0;
11811 }
11812
11814 {
11815 if (ConfigIsExisting("itemAttachOffset"))
11816 {
11817 return ConfigGetFloat("itemAttachOffset");
11818 }
11819 return 0;
11820 }
11821
11822 override void SetCleanness(
int value,
bool allow_client =
false)
11823 {
11824 if (!IsServerCheck(allow_client))
11825 return;
11826
11828
11830
11833 }
11834
11836 {
11838 }
11839
11841 {
11842 return true;
11843 }
11844
11845
11846
11847
11849 {
11851 }
11852
11854 {
11856 }
11857
11858
11859
11860
11861 override void SetColor(
int r,
int g,
int b,
int a)
11862 {
11868 }
11870 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11871 {
11876 }
11877
11879 {
11881 }
11882
11885 {
11886 int r,g,b,a;
11888 r = r/255;
11889 g = g/255;
11890 b = b/255;
11891 a = a/255;
11892 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11893 }
11894
11895
11896
11897 override void SetLiquidType(
int value,
bool allow_client =
false)
11898 {
11899 if (!IsServerCheck(allow_client))
11900 return;
11901
11906 }
11907
11909 {
11910 return ConfigGetInt("varLiquidTypeInit");
11911 }
11912
11914 {
11916 }
11917
11919 {
11921 SetFrozen(false);
11922 }
11923
11926 {
11927 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11928 }
11929
11930
11933 {
11934 PlayerBase nplayer;
11935 if (PlayerBase.CastTo(nplayer, player))
11936 {
11938 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11939 }
11940 }
11941
11942
11945 {
11946 PlayerBase nplayer;
11947 if (PlayerBase.CastTo(nplayer,player))
11948 {
11949 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11950 }
11951
11952 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11953
11954 if (HasEnergyManager())
11955 {
11956 GetCompEM().UpdatePlugState();
11957 }
11958 }
11959
11960
11962 {
11963 super.OnPlacementStarted(player);
11964
11966 }
11967
11968 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11969 {
11971 {
11972 m_AdminLog.OnPlacementComplete(player,
this);
11973 }
11974
11975 super.OnPlacementComplete(player, position, orientation);
11976 }
11977
11978
11979
11980
11981
11983 {
11985 {
11986 return true;
11987 }
11988 else
11989 {
11990 return false;
11991 }
11992 }
11993
11994
11996 {
11998 {
12000 }
12001 }
12002
12003
12005 {
12007 }
12008
12010 {
12012 }
12013
12014 override void InsertAgent(
int agent,
float count = 1)
12015 {
12016 if (count < 1)
12017 return;
12018
12020 }
12021
12024 {
12026 }
12027
12028
12030 {
12032 }
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12076 {
12078 return false;
12079 return true;
12080 }
12081
12083 {
12084
12086 }
12087
12088
12091 {
12092 super.CheckForRoofLimited(timeTresholdMS);
12093
12094 float time =
g_Game.GetTime();
12095 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12096 {
12097 m_PreviousRoofTestTime = time;
12098 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12099 }
12100 }
12101
12102
12104 {
12106 {
12107 return 0;
12108 }
12109
12110 if (GetInventory().GetAttachmentSlotsCount() != 0)
12111 {
12112 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12113 if (filter)
12114 return filter.GetProtectionLevel(type, false, system);
12115 else
12116 return 0;
12117 }
12118
12119 string subclassPath, entryName;
12120
12121 switch (type)
12122 {
12124 entryName = "biological";
12125 break;
12127 entryName = "chemical";
12128 break;
12129 default:
12130 entryName = "biological";
12131 break;
12132 }
12133
12134 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12135
12136 return g_Game.ConfigGetFloat(subclassPath + entryName);
12137 }
12138
12139
12140
12143 {
12144 if (!IsMagazine())
12146
12148 }
12149
12150
12151
12152
12153
12158 {
12159 return true;
12160 }
12161
12163 {
12165 }
12166
12167
12168
12169
12170
12172 {
12173 if (parent)
12174 {
12175 if (parent.IsInherited(DayZInfected))
12176 return true;
12177
12178 if (!parent.IsRuined())
12179 return true;
12180 }
12181
12182 return true;
12183 }
12184
12186 {
12187 if (!super.CanPutAsAttachment(parent))
12188 {
12189 return false;
12190 }
12191
12192 if (!IsRuined() && !parent.IsRuined())
12193 {
12194 return true;
12195 }
12196
12197 return false;
12198 }
12199
12201 {
12202
12203
12204
12205
12206 return super.CanReceiveItemIntoCargo(item);
12207 }
12208
12210 {
12211
12212
12213
12214
12215 GameInventory attachmentInv = attachment.GetInventory();
12217 {
12218 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12219 return false;
12220 }
12221
12222 InventoryLocation loc = new InventoryLocation();
12223 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12224 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12225 return false;
12226
12227 return super.CanReceiveAttachment(attachment, slotId);
12228 }
12229
12231 {
12232 if (!super.CanReleaseAttachment(attachment))
12233 return false;
12234
12235 return GetInventory().AreChildrenAccessible();
12236 }
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12259 {
12260 int id = muzzle_owner.GetMuzzleID();
12261 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12262
12263 if (WPOF_array)
12264 {
12265 for (int i = 0; i < WPOF_array.Count(); i++)
12266 {
12267 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12268
12269 if (WPOF)
12270 {
12271 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12272 }
12273 }
12274 }
12275 }
12276
12277
12279 {
12280 int id = muzzle_owner.GetMuzzleID();
12282
12283 if (WPOBE_array)
12284 {
12285 for (int i = 0; i < WPOBE_array.Count(); i++)
12286 {
12287 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12288
12289 if (WPOBE)
12290 {
12291 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12292 }
12293 }
12294 }
12295 }
12296
12297
12299 {
12300 int id = muzzle_owner.GetMuzzleID();
12301 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12302
12303 if (WPOOH_array)
12304 {
12305 for (int i = 0; i < WPOOH_array.Count(); i++)
12306 {
12307 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12308
12309 if (WPOOH)
12310 {
12311 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12312 }
12313 }
12314 }
12315 }
12316
12317
12319 {
12320 int id = muzzle_owner.GetMuzzleID();
12321 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12322
12323 if (WPOOH_array)
12324 {
12325 for (int i = 0; i < WPOOH_array.Count(); i++)
12326 {
12327 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12328
12329 if (WPOOH)
12330 {
12331 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12332 }
12333 }
12334 }
12335 }
12336
12337
12339 {
12340 int id = muzzle_owner.GetMuzzleID();
12341 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12342
12343 if (WPOOH_array)
12344 {
12345 for (int i = 0; i < WPOOH_array.Count(); i++)
12346 {
12347 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12348
12349 if (WPOOH)
12350 {
12351 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12352 }
12353 }
12354 }
12355 }
12356
12357
12358
12360 {
12362 {
12363 return true;
12364 }
12365
12366 return false;
12367 }
12368
12370 {
12372 {
12373 return true;
12374 }
12375
12376 return false;
12377 }
12378
12380 {
12382 {
12383 return true;
12384 }
12385
12386 return false;
12387 }
12388
12390 {
12391 return false;
12392 }
12393
12396 {
12397 return UATimeSpent.DEFAULT_DEPLOY;
12398 }
12399
12400
12401
12402
12404 {
12406 SetSynchDirty();
12407 }
12408
12410 {
12412 }
12413
12414
12416 {
12417 return false;
12418 }
12419
12422 {
12423 string att_type = "None";
12424
12425 if (ConfigIsExisting("soundAttType"))
12426 {
12427 att_type = ConfigGetString("soundAttType");
12428 }
12429
12431 }
12432
12434 {
12436 }
12437
12438
12439
12440
12441
12447
12449 {
12452
12454 }
12455
12456
12458 {
12460 return;
12461
12463
12466
12469
12470 SoundParameters params = new SoundParameters();
12474 }
12475
12476
12478 {
12480 {
12483
12484 SetSynchDirty();
12485
12488 }
12489 }
12490
12492 {
12494 }
12495
12496
12498 {
12500 return;
12501
12503 SetSynchDirty();
12504
12507 }
12508
12510 {
12513 }
12514
12516 {
12518 }
12519
12520 void OnApply(PlayerBase player);
12521
12523 {
12524 return 1.0;
12525 };
12526
12528 {
12530 }
12531
12533 {
12535 }
12536
12538
12540 {
12541 SetDynamicPhysicsLifeTime(0.01);
12543 }
12544
12546 {
12547 array<string> zone_names = new array<string>;
12548 GetDamageZones(zone_names);
12549 for (int i = 0; i < zone_names.Count(); i++)
12550 {
12551 SetHealthMax(zone_names.Get(i),"Health");
12552 }
12553 SetHealthMax("","Health");
12554 }
12555
12558 {
12559 float global_health = GetHealth01("","Health");
12560 array<string> zones = new array<string>;
12561 GetDamageZones(zones);
12562
12563 for (int i = 0; i < zones.Count(); i++)
12564 {
12565 SetHealth01(zones.Get(i),"Health",global_health);
12566 }
12567 }
12568
12571 {
12572 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12573 }
12574
12576 {
12577 if (!hasRootAsPlayer)
12578 {
12579 if (refParentIB)
12580 {
12581
12582 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12583 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12584
12585 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12586 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12587
12590 }
12591 else
12592 {
12593
12596 }
12597 }
12598 }
12599
12601 {
12603 {
12604 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12605 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12606 {
12607 float heatPermCoef = 1.0;
12609 while (ent)
12610 {
12611 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12612 ent = ent.GetHierarchyParent();
12613 }
12614
12615 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12616 }
12617 }
12618 }
12619
12621 {
12622
12623 EntityAI parent = GetHierarchyParent();
12624 if (!parent)
12625 {
12626 hasParent = false;
12627 hasRootAsPlayer = false;
12628 }
12629 else
12630 {
12631 hasParent = true;
12632 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12633 refParentIB =
ItemBase.Cast(parent);
12634 }
12635 }
12636
12637 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12638 {
12639
12640 }
12641
12643 {
12644
12645 return false;
12646 }
12647
12649 {
12650
12651
12652 return false;
12653 }
12654
12656 {
12657
12658 return false;
12659 }
12660
12663 {
12664 return !GetIsFrozen() &&
IsOpen();
12665 }
12666
12668 {
12669 bool hasParent = false, hasRootAsPlayer = false;
12671
12672 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12673 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12674
12675 if (wwtu || foodDecay)
12676 {
12680
12681 if (processWetness || processTemperature || processDecay)
12682 {
12684
12685 if (processWetness)
12686 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12687
12688 if (processTemperature)
12690
12691 if (processDecay)
12692 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12693 }
12694 }
12695 }
12696
12699 {
12701 }
12702
12704 {
12707
12708 return super.GetTemperatureFreezeThreshold();
12709 }
12710
12712 {
12715
12716 return super.GetTemperatureThawThreshold();
12717 }
12718
12720 {
12723
12724 return super.GetItemOverheatThreshold();
12725 }
12726
12728 {
12730 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12731
12732 return super.GetTemperatureFreezeTime();
12733 }
12734
12736 {
12738 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12739
12740 return super.GetTemperatureThawTime();
12741 }
12742
12747
12749 {
12750 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12751 }
12752
12754 {
12755 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12756 }
12757
12760 {
12762 }
12763
12765 {
12767 }
12768
12770 {
12772 }
12773
12776 {
12777 return null;
12778 }
12779
12782 {
12783 return false;
12784 }
12785
12787 {
12789 {
12792 if (!trg)
12793 {
12795 explosive = this;
12796 }
12797
12798 explosive.PairRemote(trg);
12800
12801 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12802 trg.SetPersistentPairID(persistentID);
12803 explosive.SetPersistentPairID(persistentID);
12804
12805 return true;
12806 }
12807 return false;
12808 }
12809
12812 {
12813 float ret = 1.0;
12816 ret *= GetHealth01();
12817
12818 return ret;
12819 }
12820
12821 #ifdef DEVELOPER
12822 override void SetDebugItem()
12823 {
12824 super.SetDebugItem();
12825 _itemBase = this;
12826 }
12827
12829 {
12830 string text = super.GetDebugText();
12831
12833 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12834
12835 return text;
12836 }
12837 #endif
12838
12840 {
12841 return true;
12842 }
12843
12845
12847
12849 {
12852 }
12853
12854
12862
12878
12879 [
Obsolete(
"Use ItemSoundHandler instead")]
12882 {
12883 if (!
g_Game.IsDedicatedServer())
12884 {
12885 if (ConfigIsExisting("attachSoundSet"))
12886 {
12887 string cfg_path = "";
12888 string soundset = "";
12889 string type_name =
GetType();
12890
12893 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12894 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12895
12896 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12897 {
12898 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12899 {
12900 if (cfg_slot_array[i] == slot_type)
12901 {
12902 soundset = cfg_soundset_array[i];
12903 break;
12904 }
12905 }
12906 }
12907
12908 if (soundset != "")
12909 {
12910 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12912 }
12913 }
12914 }
12915 }
12916
12918}
12919
12921{
12923 if (entity)
12924 {
12925 bool is_item = entity.IsInherited(
ItemBase);
12926 if (is_item && full_quantity)
12927 {
12930 }
12931 }
12932 else
12933 {
12935 return NULL;
12936 }
12937 return entity;
12938}
12939
12941{
12942 if (item)
12943 {
12944 if (health > 0)
12945 item.SetHealth("", "", health);
12946
12947 if (item.CanHaveTemperature())
12948 {
12950 if (item.CanFreeze())
12951 item.SetFrozen(false);
12952 }
12953
12954 if (item.HasEnergyManager())
12955 {
12956 if (quantity >= 0)
12957 {
12958 item.GetCompEM().SetEnergy0To1(quantity);
12959 }
12960 else
12961 {
12963 }
12964 }
12965 else if (item.IsMagazine())
12966 {
12967 Magazine mag = Magazine.Cast(item);
12968 if (quantity >= 0)
12969 {
12970 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12971 }
12972 else
12973 {
12975 }
12976
12977 }
12978 else
12979 {
12980 if (quantity >= 0)
12981 {
12982 item.SetQuantityNormalized(quantity, false);
12983 }
12984 else
12985 {
12987 }
12988
12989 }
12990 }
12991}
12992
12993#ifdef DEVELOPER
12995#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.