8144{
8146 {
8147 return true;
8148 }
8149};
8150
8152{
8153
8154};
8155
8156
8157
8159{
8163
8165
8168
8169
8170
8171
8172
8181
8187
8192
8197
8218 protected bool m_IsResultOfSplit
8219
8221
8226
8227
8228
8230
8234
8235
8236
8238
8241
8242
8243
8249
8250
8258
8261
8262
8264
8265
8267
8268
8273
8274
8279
8281
8282
8284
8285
8287 {
8292
8293 if (!
g_Game.IsDedicatedServer())
8294 {
8296 {
8298
8300 {
8302 }
8303 }
8304
8307 }
8308
8309 m_OldLocation = null;
8310
8312 {
8314 }
8315
8316 if (ConfigIsExisting("headSelectionsToHide"))
8317 {
8320 }
8321
8323 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8324 {
8326 }
8327
8329
8330 m_IsResultOfSplit = false;
8331
8333 }
8334
8336 {
8337 super.InitItemVariables();
8338
8344 m_Count = ConfigGetInt(
"count");
8345
8348
8353
8356
8361
8373
8377
8378
8381 if (ConfigIsExisting("canBeSplit"))
8382 {
8385 }
8386
8388 if (ConfigIsExisting("itemBehaviour"))
8390
8391
8394 RegisterNetSyncVariableInt("m_VarLiquidType");
8395 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8396
8397 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8398 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8399 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8400
8401 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8402 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8403 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8404 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8405
8406 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8407 RegisterNetSyncVariableBool("m_IsTakeable");
8408 RegisterNetSyncVariableBool("m_IsHologram");
8409
8412 {
8415 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8416 }
8417
8419
8421 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8423
8425 }
8426
8428 {
8430 }
8431
8433 {
8436 {
8441 }
8442 }
8443
8444 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8445 {
8447 {
8450 }
8451
8453 }
8454
8456 {
8462 }
8463
8465
8467 {
8469
8470 if (!action)
8471 {
8472 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8473 return;
8474 }
8475
8477 if (!ai)
8478 {
8480 return;
8481 }
8482
8484 if (!action_array)
8485 {
8486 action_array = new array<ActionBase_Basic>;
8488 }
8489 if (LogManager.IsActionLogEnable())
8490 {
8491 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8492 }
8493
8494 if (action_array.Find(action) != -1)
8495 {
8496 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8497 }
8498 else
8499 {
8500 action_array.Insert(action);
8501 }
8502 }
8503
8505 {
8506 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8507 ActionBase action = player.GetActionManager().GetAction(actionName);
8510
8511 if (action_array)
8512 {
8513 action_array.RemoveItem(action);
8514 }
8515 }
8516
8517
8518
8520 {
8521 ActionOverrideData overrideData = new ActionOverrideData();
8525
8527 if (!actionMap)
8528 {
8531 }
8532
8533 actionMap.Insert(this.
Type(), overrideData);
8534
8535 }
8536
8538
8540
8541
8543 {
8546
8549
8550 string config_to_search = "CfgVehicles";
8551 string muzzle_owner_config;
8552
8554 {
8555 if (IsInherited(Weapon))
8556 config_to_search = "CfgWeapons";
8557
8558 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8559
8560 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8561
8562 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8563
8564 if (config_OnFire_subclass_count > 0)
8565 {
8566 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8567
8568 for (int i = 0; i < config_OnFire_subclass_count; i++)
8569 {
8570 string particle_class = "";
8571 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8572 string config_OnFire_entry = config_OnFire_class + particle_class;
8573 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8574 WPOF_array.Insert(WPOF);
8575 }
8576
8577
8579 }
8580 }
8581
8583 {
8584 config_to_search = "CfgWeapons";
8585 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8586
8587 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8588
8589 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8590
8591 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8592 {
8593 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8594
8595 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8596 {
8597 string particle_class2 = "";
8598 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8599 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8600 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8601 WPOBE_array.Insert(WPOBE);
8602 }
8603
8604
8606 }
8607 }
8608 }
8609
8610
8612 {
8615
8617 {
8618 string config_to_search = "CfgVehicles";
8619
8620 if (IsInherited(Weapon))
8621 config_to_search = "CfgWeapons";
8622
8623 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8624 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8625
8626 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8627 {
8628
8630
8632 {
8634 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8636 return;
8637 }
8638
8641
8642
8643
8644 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8645 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8646
8647 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8648 {
8649 string particle_class = "";
8650 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8651 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8652 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8653
8654 if (entry_type == CT_CLASS)
8655 {
8656 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8657 WPOOH_array.Insert(WPOF);
8658 }
8659 }
8660
8661
8663 }
8664 }
8665 }
8666
8668 {
8670 }
8671
8673 {
8675 {
8677
8680
8683
8684 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8685 }
8686 }
8687
8689 {
8691 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8692
8694 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8695
8697 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8698
8700 {
8702 }
8703 }
8704
8706 {
8708 }
8709
8711 {
8714 else
8716
8718 {
8721 }
8722 else
8723 {
8726
8729 }
8730
8732 }
8733
8735 {
8737 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8738 }
8739
8741 {
8743 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8745 }
8746
8748 {
8750 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8751 }
8752
8754 {
8757
8758 OverheatingParticle OP = new OverheatingParticle();
8763
8765 }
8766
8768 {
8771
8772 return -1;
8773 }
8774
8776 {
8778 {
8781
8782 for (int i = count; i > 0; --i)
8783 {
8784 int id = i - 1;
8787
8790
8791 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8792 {
8793 if (p)
8794 {
8797 }
8798 }
8799 }
8800 }
8801 }
8802
8804 {
8806 {
8808 {
8809 int id = i - 1;
8811
8812 if (OP)
8813 {
8815
8816 if (p)
8817 {
8819 }
8820
8821 delete OP;
8822 }
8823 }
8824
8827 }
8828 }
8829
8832 {
8833 return 0.0;
8834 }
8835
8836
8838 {
8839 return 250;
8840 }
8841
8843 {
8844 return 0;
8845 }
8846
8849 {
8851 return true;
8852
8853 return false;
8854 }
8855
8858 {
8861
8863 {
8865 }
8866 else
8867 {
8868
8870 }
8871
8873 }
8874
8881 {
8882 return -1;
8883 }
8884
8885
8886
8887
8889 {
8891 {
8892 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8893 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8894
8895 if (r_index >= 0)
8896 {
8897 InventoryLocation r_il = new InventoryLocation;
8898 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8899
8900 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8903 {
8904 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8905 }
8907 {
8908 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8909 }
8910
8911 }
8912
8913 player.GetHumanInventory().ClearUserReservedLocation(this);
8914 }
8915
8918 }
8919
8920
8921
8922
8924 {
8925 return ItemBase.m_DebugActionsMask;
8926 }
8927
8929 {
8930 return ItemBase.m_DebugActionsMask & mask;
8931 }
8932
8934 {
8935 ItemBase.m_DebugActionsMask = mask;
8936 }
8937
8939 {
8940 ItemBase.m_DebugActionsMask |= mask;
8941 }
8942
8944 {
8945 ItemBase.m_DebugActionsMask &= ~mask;
8946 }
8947
8949 {
8951 {
8953 }
8954 else
8955 {
8957 }
8958 }
8959
8960
8962 {
8963 if (GetEconomyProfile())
8964 {
8965 float q_max = GetEconomyProfile().GetQuantityMax();
8966 if (q_max > 0)
8967 {
8968 float q_min = GetEconomyProfile().GetQuantityMin();
8969 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8970
8972 {
8973 ComponentEnergyManager comp = GetCompEM();
8975 {
8977 }
8978 }
8980 {
8982
8983 }
8984
8985 }
8986 }
8987 }
8988
8991 {
8992 EntityAI parent = GetHierarchyParent();
8993
8994 if (parent)
8995 {
8996 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8997 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8998 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8999 }
9000 }
9001
9004 {
9005 EntityAI parent = GetHierarchyParent();
9006
9007 if (parent)
9008 {
9009 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9010 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9011 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9012 }
9013 }
9014
9016 {
9017
9018
9019
9020
9022
9024 {
9025 if (ScriptInputUserData.CanStoreInputUserData())
9026 {
9027 ScriptInputUserData ctx = new ScriptInputUserData;
9033 ctx.
Write(use_stack_max);
9036
9038 {
9039 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9040 }
9041 }
9042 }
9043 else if (!
g_Game.IsMultiplayer())
9044 {
9046 }
9047 }
9048
9050 {
9052 }
9053
9055 {
9057 }
9058
9060 {
9062 }
9063
9065 {
9066
9067 return false;
9068 }
9069
9071 {
9072 return false;
9073 }
9074
9078 {
9079 return false;
9080 }
9081
9083 {
9084 return "";
9085 }
9086
9088
9090 {
9091 return false;
9092 }
9093
9095 {
9096 return true;
9097 }
9098
9099
9100
9102 {
9103 return true;
9104 }
9105
9107 {
9108 return true;
9109 }
9110
9112 {
9113 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9115 }
9116
9118 {
9120 }
9121
9123 {
9125 if (!is_being_placed)
9127 SetSynchDirty();
9128 }
9129
9130
9132
9134 {
9136 }
9137
9139 {
9141 }
9142
9144 {
9145 return 1;
9146 }
9147
9149 {
9150 return false;
9151 }
9152
9154 {
9156 SetSynchDirty();
9157 }
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9194 {
9195 super.OnMovedInsideCargo(container);
9196
9197 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9198 }
9199
9200 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9201 {
9202 super.EEItemLocationChanged(oldLoc, newLoc);
9203
9204 PlayerBase newPlayer = null;
9205 PlayerBase oldPlayer = null;
9206
9207 if (newLoc.GetParent())
9208 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9209
9210 if (oldLoc.GetParent())
9211 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9212
9214 {
9215 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9216
9217 if (rIndex >= 0)
9218 {
9219 InventoryLocation rIl = new InventoryLocation;
9220 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9221
9222 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9225 {
9226 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9227 }
9229 {
9231 }
9232
9233 }
9234 }
9235
9237 {
9238 if (newPlayer)
9239 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9240
9241 if (newPlayer == oldPlayer)
9242 {
9243 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9244 {
9246 {
9247 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9248 {
9249 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9250 }
9251 }
9252 else
9253 {
9254 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9255 }
9256 }
9257
9258 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9259 {
9260 int type = oldLoc.GetType();
9262 {
9263 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9264 }
9266 {
9267 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9268 }
9269 }
9270 if (!m_OldLocation)
9271 {
9272 m_OldLocation = new InventoryLocation;
9273 }
9274 m_OldLocation.Copy(oldLoc);
9275 }
9276 else
9277 {
9278 if (m_OldLocation)
9279 {
9280 m_OldLocation.Reset();
9281 }
9282 }
9283
9284 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9285 }
9286 else
9287 {
9288 if (newPlayer)
9289 {
9290 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9291 if (resIndex >= 0)
9292 {
9293 InventoryLocation il = new InventoryLocation;
9294 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9296 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9299 {
9300 il.
GetParent().GetOnReleaseLock().Invoke(it);
9301 }
9303 {
9305 }
9306
9307 }
9308 }
9310 {
9311
9313 }
9314
9315 if (m_OldLocation)
9316 {
9317 m_OldLocation.Reset();
9318 }
9319 }
9320
9322 {
9323 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9324 }
9325
9327 {
9328 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9329 }
9330 }
9331
9332 override void EOnContact(IEntity other, Contact extra)
9333 {
9335 {
9336 int liquidType = -1;
9338 if (impactSpeed > 0.0)
9339 {
9341 #ifndef SERVER
9343 #else
9345 SetSynchDirty();
9346 #endif
9348 }
9349 }
9350
9351 #ifdef SERVER
9352 if (GetCompEM() && GetCompEM().IsPlugged())
9353 {
9354 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9355 GetCompEM().UnplugThis();
9356 }
9357 #endif
9358 }
9359
9361
9363 {
9365 }
9366
9368 {
9369
9370 }
9371
9373 {
9374 super.OnItemLocationChanged(old_owner, new_owner);
9375
9376 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9377 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9378
9379 if (!relatedPlayer && playerNew)
9380 relatedPlayer = playerNew;
9381
9382 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9383 {
9385 if (actionMgr)
9386 {
9387 ActionBase currentAction = actionMgr.GetRunningAction();
9388 if (currentAction)
9390 }
9391 }
9392
9393 Man ownerPlayerOld = null;
9394 Man ownerPlayerNew = null;
9395
9396 if (old_owner)
9397 {
9398 if (old_owner.
IsMan())
9399 {
9400 ownerPlayerOld = Man.Cast(old_owner);
9401 }
9402 else
9403 {
9404 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9405 }
9406 }
9407 else
9408 {
9410 {
9412
9413 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9414 {
9415 GetCompEM().UnplugThis();
9416 }
9417 }
9418 }
9419
9420 if (new_owner)
9421 {
9422 if (new_owner.
IsMan())
9423 {
9424 ownerPlayerNew = Man.Cast(new_owner);
9425 }
9426 else
9427 {
9428 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9429 }
9430 }
9431
9432 if (ownerPlayerOld != ownerPlayerNew)
9433 {
9434 if (ownerPlayerOld)
9435 {
9436 array<EntityAI> subItemsExit = new array<EntityAI>;
9438 for (int i = 0; i < subItemsExit.Count(); i++)
9439 {
9442 }
9443 }
9444
9445 if (ownerPlayerNew)
9446 {
9447 array<EntityAI> subItemsEnter = new array<EntityAI>;
9449 for (int j = 0; j < subItemsEnter.Count(); j++)
9450 {
9453 }
9454 }
9455 }
9456 else if (ownerPlayerNew != null)
9457 {
9458 PlayerBase nplayer;
9459 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9460 {
9461 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9463 for (int k = 0; k < subItemsUpdate.Count(); k++)
9464 {
9466 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9467 }
9468 }
9469 }
9470
9471 if (old_owner)
9472 old_owner.OnChildItemRemoved(this);
9473 if (new_owner)
9474 new_owner.OnChildItemReceived(this);
9475 }
9476
9477
9479 {
9480 super.EEDelete(parent);
9481 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9482 if (player)
9483 {
9485
9486 if (player.IsAlive())
9487 {
9488 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9489 if (r_index >= 0)
9490 {
9491 InventoryLocation r_il = new InventoryLocation;
9492 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9493
9494 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9497 {
9498 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9499 }
9501 {
9502 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9503 }
9504
9505 }
9506
9507 player.RemoveQuickBarEntityShortcut(this);
9508 }
9509 }
9510 }
9511
9513 {
9514 super.EEKilled(killer);
9515
9518 {
9519 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9520 {
9521 if (IsMagazine())
9522 {
9523 if (Magazine.Cast(this).GetAmmoCount() > 0)
9524 {
9526 }
9527 }
9528 else
9529 {
9531 }
9532 }
9533 }
9534 }
9535
9537 {
9538 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9539
9540 super.OnWasAttached(parent, slot_id);
9541
9544
9547 }
9548
9550 {
9551 super.OnWasDetached(parent, slot_id);
9552
9555
9558 }
9559
9561 {
9562 int idx;
9565
9566 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9567 if (inventory_slots.Count() < 1)
9568 {
9569 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9570 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9571 }
9572 else
9573 {
9574 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9575 }
9576
9577 idx = inventory_slots.Find(slot);
9578 if (idx < 0)
9579 return "";
9580
9581 return attach_types.Get(idx);
9582 }
9583
9585 {
9586 int idx = -1;
9587 string slot;
9588
9591
9592 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9593 if (inventory_slots.Count() < 1)
9594 {
9595 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9596 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9597 }
9598 else
9599 {
9600 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9601 if (detach_types.Count() < 1)
9602 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9603 }
9604
9605 for (int i = 0; i < inventory_slots.Count(); i++)
9606 {
9607 slot = inventory_slots.Get(i);
9608 }
9609
9610 if (slot != "")
9611 {
9612 if (detach_types.Count() == 1)
9613 idx = 0;
9614 else
9615 idx = inventory_slots.Find(slot);
9616 }
9617 if (idx < 0)
9618 return "";
9619
9620 return detach_types.Get(idx);
9621 }
9622
9624 {
9625
9627
9628
9629 float min_time = 1;
9630 float max_time = 3;
9631 float delay = Math.RandomFloat(min_time, max_time);
9632
9633 explode_timer.Run(delay, this, "DoAmmoExplosion");
9634 }
9635
9637 {
9638 Magazine magazine = Magazine.Cast(this);
9639 int pop_sounds_count = 6;
9640 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9641
9642
9643 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9644 string sound_name = pop_sounds[ sound_idx ];
9645 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9646
9647
9648 magazine.ServerAddAmmoCount(-1);
9649
9650
9651 float min_temp_to_explode = 100;
9652
9653 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9654 {
9656 }
9657 }
9658
9659
9660 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9661 {
9662 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9663
9664 const int CHANCE_DAMAGE_CARGO = 4;
9665 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9666 const int CHANCE_DAMAGE_NOTHING = 2;
9667
9669 {
9670 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9671 int chances;
9672 int rnd;
9673
9674 if (GetInventory().GetCargo())
9675 {
9676 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9677 rnd = Math.RandomInt(0,chances);
9678
9679 if (rnd < CHANCE_DAMAGE_CARGO)
9680 {
9682 }
9683 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9684 {
9686 }
9687 }
9688 else
9689 {
9690 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9691 rnd = Math.RandomInt(0,chances);
9692
9693 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9694 {
9696 }
9697 }
9698 }
9699 }
9700
9702 {
9703 CargoBase cargo = GetInventory().GetCargo();
9704 if (cargo)
9705 {
9707 if (item_count > 0)
9708 {
9709 int random_pick = Math.RandomInt(0, item_count);
9711 if (!item.IsExplosive())
9712 {
9713 item.AddHealth("","",damage);
9714 return true;
9715 }
9716 }
9717 }
9718 return false;
9719 }
9720
9722 {
9723 GameInventory inventory = GetInventory();
9725 if (attachment_count > 0)
9726 {
9727 int random_pick = Math.RandomInt(0, attachment_count);
9729 if (!attachment.IsExplosive())
9730 {
9731 attachment.AddHealth("","",damage);
9732 return true;
9733 }
9734 }
9735 return false;
9736 }
9737
9739 {
9741 }
9742
9744 {
9746 return GetInventory().CanRemoveEntity();
9747
9748 return false;
9749 }
9750
9752 {
9753
9755 return false;
9756
9757
9759 return false;
9760
9761
9762
9764 if (delta == 0)
9765 return false;
9766
9767
9768 return true;
9769 }
9770
9772 {
9774 {
9775 if (ScriptInputUserData.CanStoreInputUserData())
9776 {
9777 ScriptInputUserData ctx = new ScriptInputUserData;
9782 ctx.
Write(destination_entity);
9786 }
9787 }
9788 else if (!
g_Game.IsMultiplayer())
9789 {
9791 }
9792 }
9793
9795 {
9796 float split_quantity_new;
9800 InventoryLocation loc = new InventoryLocation;
9801
9802 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9803 {
9805 split_quantity_new = stack_max;
9806 else
9808
9810 {
9811 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9812 if (new_item)
9813 {
9814 new_item.SetResultOfSplit(true);
9815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9817 new_item.
SetQuantity(split_quantity_new,
false,
true);
9818 }
9819 }
9820 }
9821 else if (destination_entity && slot_id == -1)
9822 {
9823 if (quantity > stack_max)
9824 split_quantity_new = stack_max;
9825 else
9826 split_quantity_new = quantity;
9827
9829 {
9830 GameInventory destinationInventory = destination_entity.GetInventory();
9832 {
9835 }
9836
9837 if (new_item)
9838 {
9839 new_item.SetResultOfSplit(true);
9840 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9842 new_item.
SetQuantity(split_quantity_new,
false,
true);
9843 }
9844 }
9845 }
9846 else
9847 {
9848 if (stack_max != 0)
9849 {
9851 {
9853 }
9854
9855 if (split_quantity_new == 0)
9856 {
9857 if (!
g_Game.IsMultiplayer())
9858 player.PhysicalPredictiveDropItem(this);
9859 else
9860 player.ServerDropEntity(this);
9861 return;
9862 }
9863
9865 {
9867
9868 if (new_item)
9869 {
9870 new_item.SetResultOfSplit(true);
9871 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9874 new_item.PlaceOnSurface();
9875 }
9876 }
9877 }
9878 }
9879 }
9880
9882 {
9883 float split_quantity_new;
9887 InventoryLocation loc = new InventoryLocation;
9888
9889 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9890 {
9892 split_quantity_new = stack_max;
9893 else
9895
9897 {
9898 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9899 if (new_item)
9900 {
9901 new_item.SetResultOfSplit(true);
9902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9904 new_item.
SetQuantity(split_quantity_new,
false,
true);
9905 }
9906 }
9907 }
9908 else if (destination_entity && slot_id == -1)
9909 {
9910 if (quantity > stack_max)
9911 split_quantity_new = stack_max;
9912 else
9913 split_quantity_new = quantity;
9914
9916 {
9917 GameInventory destinationInventory = destination_entity.GetInventory();
9919 {
9922 }
9923
9924 if (new_item)
9925 {
9926 new_item.SetResultOfSplit(true);
9927 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9929 new_item.
SetQuantity(split_quantity_new,
false,
true);
9930 }
9931 }
9932 }
9933 else
9934 {
9935 if (stack_max != 0)
9936 {
9938 {
9940 }
9941
9943 {
9945
9946 if (new_item)
9947 {
9948 new_item.SetResultOfSplit(true);
9949 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9952 new_item.PlaceOnSurface();
9953 }
9954 }
9955 }
9956 }
9957 }
9958
9960 {
9962 {
9963 if (ScriptInputUserData.CanStoreInputUserData())
9964 {
9965 ScriptInputUserData ctx = new ScriptInputUserData;
9970 dst.WriteToContext(ctx);
9972 }
9973 }
9974 else if (!
g_Game.IsMultiplayer())
9975 {
9977 }
9978 }
9979
9981 {
9983 {
9984 if (ScriptInputUserData.CanStoreInputUserData())
9985 {
9986 ScriptInputUserData ctx = new ScriptInputUserData;
9991 ctx.
Write(destination_entity);
9997 }
9998 }
9999 else if (!
g_Game.IsMultiplayer())
10000 {
10002 }
10003 }
10004
10006 {
10008 }
10009
10011 {
10013 float split_quantity_new;
10015 if (dst.IsValid())
10016 {
10017 int slot_id = dst.GetSlot();
10019
10020 if (quantity > stack_max)
10021 split_quantity_new = stack_max;
10022 else
10023 split_quantity_new = quantity;
10024
10026 {
10028
10029 if (new_item)
10030 {
10031 new_item.SetResultOfSplit(true);
10032 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10034 new_item.
SetQuantity(split_quantity_new,
false,
true);
10035 }
10036
10037 return new_item;
10038 }
10039 }
10040
10041 return null;
10042 }
10043
10045 {
10047 float split_quantity_new;
10049 if (destination_entity)
10050 {
10052 if (quantity > stackable)
10053 split_quantity_new = stackable;
10054 else
10055 split_quantity_new = quantity;
10056
10058 {
10059 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10060 if (new_item)
10061 {
10062 new_item.SetResultOfSplit(true);
10063 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10065 new_item.
SetQuantity(split_quantity_new,
false,
true);
10066 }
10067 }
10068 }
10069 }
10070
10072 {
10074 {
10075 if (ScriptInputUserData.CanStoreInputUserData())
10076 {
10077 ScriptInputUserData ctx = new ScriptInputUserData;
10082 ItemBase destination_entity =
this;
10083 ctx.
Write(destination_entity);
10087 }
10088 }
10089 else if (!
g_Game.IsMultiplayer())
10090 {
10092 }
10093 }
10094
10096 {
10098 float split_quantity_new;
10100 if (player)
10101 {
10103 if (quantity > stackable)
10104 split_quantity_new = stackable;
10105 else
10106 split_quantity_new = quantity;
10107
10109 {
10110 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10111 new_item =
ItemBase.Cast(in_hands);
10112 if (new_item)
10113 {
10114 new_item.SetResultOfSplit(true);
10115 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10117 new_item.SetQuantity(split_quantity_new, false, true);
10118 }
10119 }
10120 }
10121 }
10122
10124 {
10126 float split_quantity_new = Math.Floor(quantity * 0.5);
10127
10129 return;
10130
10132
10133 if (new_item)
10134 {
10135 if (new_item.GetQuantityMax() < split_quantity_new)
10136 {
10137 split_quantity_new = new_item.GetQuantityMax();
10138 }
10139
10140 new_item.SetResultOfSplit(true);
10141 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10142
10144 {
10147 }
10148 else
10149 {
10151 new_item.
SetQuantity(split_quantity_new,
false,
true);
10152 }
10153 }
10154 }
10155
10157 {
10159 float split_quantity_new = Math.Floor(quantity / 2);
10160
10162 return;
10163
10164 InventoryLocation invloc = new InventoryLocation;
10166
10168 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10169
10170 if (new_item)
10171 {
10172 if (new_item.GetQuantityMax() < split_quantity_new)
10173 {
10174 split_quantity_new = new_item.GetQuantityMax();
10175 }
10177 {
10180 }
10181 else if (split_quantity_new > 1)
10182 {
10184 new_item.
SetQuantity(split_quantity_new,
false,
true);
10185 }
10186 }
10187 }
10188
10191 {
10192 SetWeightDirty();
10194
10195 if (parent)
10196 parent.OnAttachmentQuantityChangedEx(this, delta);
10197
10199 {
10201 {
10203 }
10205 {
10206 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10208 }
10209 }
10210 }
10211
10214 {
10215
10216 }
10217
10220 {
10222 }
10223
10225 {
10226 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10227
10229 {
10230 if (newLevel == GameConstants.STATE_RUINED)
10231 {
10233 EntityAI parent = GetHierarchyParent();
10234 if (parent && parent.IsFireplace())
10235 {
10236 CargoBase cargo = GetInventory().GetCargo();
10237 if (cargo)
10238 {
10240 {
10242 }
10243 }
10244 }
10245 }
10246
10248 {
10249
10251 return;
10252 }
10253
10254 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10255 {
10257 }
10258 }
10259 }
10260
10261
10263 {
10264 super.OnRightClick();
10265
10267 {
10269 {
10270 if (ScriptInputUserData.CanStoreInputUserData())
10271 {
10272 EntityAI root = GetHierarchyRoot();
10273 Man playerOwner = GetHierarchyRootPlayer();
10274 InventoryLocation dst = new InventoryLocation;
10275
10276
10277 if (!playerOwner && root && root == this)
10278 {
10280 }
10281 else
10282 {
10283
10284 GetInventory().GetCurrentInventoryLocation(dst);
10286 {
10287 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10289 {
10291 }
10292 else
10293 {
10295
10296
10297 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10298 {
10300 }
10301 else
10302 {
10303 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10304 }
10305 }
10306 }
10307 }
10308
10309 ScriptInputUserData ctx = new ScriptInputUserData;
10317 }
10318 }
10319 else if (!
g_Game.IsMultiplayer())
10320 {
10322 }
10323 }
10324 }
10325
10327 {
10328 if (root)
10329 {
10330 vector m4[4];
10331 root.GetTransform(m4);
10332 dst.SetGround(this, m4);
10333 }
10334 else
10335 {
10336 GetInventory().GetCurrentInventoryLocation(dst);
10337 }
10338 }
10339
10340 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10341 {
10342
10343 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10344 return false;
10345
10346 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10347 return false;
10348
10349
10351 return false;
10352
10353
10354 Magazine mag = Magazine.Cast(this);
10355 if (mag)
10356 {
10357 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10358 return false;
10359
10360 if (stack_max_limit)
10361 {
10362 Magazine other_mag = Magazine.Cast(other_item);
10363 if (other_item)
10364 {
10365 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10366 return false;
10367 }
10368
10369 }
10370 }
10371 else
10372 {
10373
10375 return false;
10376
10378 return false;
10379 }
10380
10381 PlayerBase player = null;
10382 if (CastTo(player, GetHierarchyRootPlayer()))
10383 {
10384 if (player.GetInventory().HasAttachment(this))
10385 return false;
10386
10387 if (player.IsItemsToDelete())
10388 return false;
10389 }
10390
10391 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10392 return false;
10393
10394 int slotID;
10396 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10397 return false;
10398
10399 return true;
10400 }
10401
10403 {
10405 }
10406
10408 {
10409 return m_IsResultOfSplit;
10410 }
10411
10413 {
10414 m_IsResultOfSplit = value;
10415 }
10416
10418 {
10420 }
10421
10423 {
10424 float other_item_quantity = other_item.GetQuantity();
10425 float this_free_space;
10426
10428
10430
10431 if (other_item_quantity > this_free_space)
10432 {
10433 return this_free_space;
10434 }
10435 else
10436 {
10437 return other_item_quantity;
10438 }
10439 }
10440
10442 {
10444 }
10445
10447 {
10449 return;
10450
10451 if (!IsMagazine() && other_item)
10452 {
10454 if (quantity_used != 0)
10455 {
10456 float hp1 = GetHealth01("","");
10457 float hp2 = other_item.GetHealth01("","");
10458 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10459 hpResult = hpResult / (
GetQuantity() + quantity_used);
10460
10461 hpResult *= GetMaxHealth();
10462 Math.Round(hpResult);
10463 SetHealth("", "Health", hpResult);
10464
10466 other_item.AddQuantity(-quantity_used);
10467 }
10468 }
10470 }
10471
10473 {
10474 #ifdef SERVER
10475 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10476 GetHierarchyParent().IncreaseLifetimeUp();
10477 #endif
10478 };
10479
10481 {
10482 PlayerBase p = PlayerBase.Cast(player);
10483
10484 array<int> recipesIds = p.m_Recipes;
10485 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10486 if (moduleRecipesManager)
10487 {
10488 EntityAI itemInHands = player.GetEntityInHands();
10489 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10490 }
10491
10492 for (int i = 0;i < recipesIds.Count(); i++)
10493 {
10494 int key = recipesIds.Get(i);
10495 string recipeName = moduleRecipesManager.GetRecipeName(key);
10497 }
10498 }
10499
10500
10501 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10502 {
10503 super.GetDebugActions(outputList);
10504
10505
10511
10512
10517
10522
10523
10527
10528
10530 {
10534 }
10535
10538
10539
10543
10545
10546 InventoryLocation loc = new InventoryLocation();
10547 GetInventory().GetCurrentInventoryLocation(loc);
10549 {
10550 if (Gizmo_IsSupported())
10553 }
10554
10556 }
10557
10558
10559
10560
10562 {
10563 super.OnAction(action_id, player, ctx);
10564
10566 {
10567 switch (action_id)
10568 {
10572 return true;
10576 return true;
10577 }
10578 }
10579
10581 {
10582 switch (action_id)
10583 {
10585 Delete();
10586 return true;
10587 }
10588 }
10589
10590 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10591 {
10592 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10593 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10594 PlayerBase p = PlayerBase.Cast(player);
10595 if (
EActions.RECIPES_RANGE_START < 1000)
10596 {
10597 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10598 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10599 }
10600 }
10601 #ifndef SERVER
10602 else if (action_id ==
EActions.WATCH_PLAYER)
10603 {
10604 PluginDeveloper.SetDeveloperItemClientEx(player);
10605 }
10606 #endif
10608 {
10609 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10610 {
10611 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10612 OnDebugButtonPressServer(id + 1);
10613 }
10614
10615 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10616 {
10617 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10619 }
10620
10621 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10622 {
10623 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10625 }
10626
10627 else if (action_id ==
EActions.ADD_QUANTITY)
10628 {
10629 if (IsMagazine())
10630 {
10631 Magazine mag = Magazine.Cast(this);
10632 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10633 }
10634 else
10635 {
10637 }
10638
10639 if (m_EM)
10640 {
10641 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10642 }
10643
10644 }
10645
10646 else if (action_id ==
EActions.REMOVE_QUANTITY)
10647 {
10648 if (IsMagazine())
10649 {
10650 Magazine mag2 = Magazine.Cast(this);
10651 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10652 }
10653 else
10654 {
10656 }
10657 if (m_EM)
10658 {
10659 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10660 }
10661
10662 }
10663
10664 else if (action_id ==
EActions.SET_QUANTITY_0)
10665 {
10667
10668 if (m_EM)
10669 {
10670 m_EM.SetEnergy(0);
10671 }
10672 }
10673
10674 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10675 {
10677
10678 if (m_EM)
10679 {
10680 m_EM.SetEnergy(m_EM.GetEnergyMax());
10681 }
10682 }
10683
10684 else if (action_id ==
EActions.ADD_HEALTH)
10685 {
10686 AddHealth("","",GetMaxHealth("","Health")/5);
10687 }
10688 else if (action_id ==
EActions.REMOVE_HEALTH)
10689 {
10690 AddHealth("","",-GetMaxHealth("","Health")/5);
10691 }
10692 else if (action_id ==
EActions.DESTROY_HEALTH)
10693 {
10694 SetHealth01("","",0);
10695 }
10696 else if (action_id ==
EActions.WATCH_ITEM)
10697 {
10699 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10700 #ifdef DEVELOPER
10701 SetDebugDeveloper_item(this);
10702 #endif
10703 }
10704
10705 else if (action_id ==
EActions.ADD_TEMPERATURE)
10706 {
10707 AddTemperature(20);
10708
10709 }
10710
10711 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10712 {
10713 AddTemperature(-20);
10714
10715 }
10716
10717 else if (action_id ==
EActions.FLIP_FROZEN)
10718 {
10719 SetFrozen(!GetIsFrozen());
10720
10721 }
10722
10723 else if (action_id ==
EActions.ADD_WETNESS)
10724 {
10726
10727 }
10728
10729 else if (action_id ==
EActions.REMOVE_WETNESS)
10730 {
10732
10733 }
10734
10735 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10736 {
10739
10740
10741 }
10742
10743 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10744 {
10747 }
10748
10749 else if (action_id ==
EActions.MAKE_SPECIAL)
10750 {
10751 auto debugParams = DebugSpawnParams.WithPlayer(player);
10752 OnDebugSpawnEx(debugParams);
10753 }
10754
10755 }
10756
10757
10758 return false;
10759 }
10760
10761
10762
10763
10767
10770
10771
10772
10774 {
10775 return false;
10776 }
10777
10778
10780 {
10781 return true;
10782 }
10783
10784
10786 {
10787 return true;
10788 }
10789
10790
10791
10793 {
10794 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10795 return g_Game.ConfigIsExisting(config_path);
10796 }
10797
10800 {
10801 return null;
10802 }
10803
10805 {
10806 return false;
10807 }
10808
10810 {
10811 return false;
10812 }
10813
10817
10818
10820 {
10821 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10822 return module_repairing.CanRepair(this, item_repair_kit);
10823 }
10824
10825
10826 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10827 {
10828 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10829 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10830 }
10831
10832
10834 {
10835
10836
10837
10838
10839
10840
10841
10842
10843 return 1;
10844 }
10845
10846
10847
10849 {
10851 }
10852
10853
10854
10856 {
10858 }
10859
10860
10869 {
10870 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10871
10872 if (player)
10873 {
10874 player.MessageStatus(text);
10875 }
10876 }
10877
10878
10887 {
10888 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10889
10890 if (player)
10891 {
10892 player.MessageAction(text);
10893 }
10894 }
10895
10896
10905 {
10906 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10907
10908 if (player)
10909 {
10910 player.MessageFriendly(text);
10911 }
10912 }
10913
10914
10923 {
10924 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10925
10926 if (player)
10927 {
10928 player.MessageImportant(text);
10929 }
10930 }
10931
10933 {
10934 return true;
10935 }
10936
10937
10938 override bool KindOf(
string tag)
10939 {
10940 bool found = false;
10941 string item_name = this.
GetType();
10943 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10944
10945 int array_size = item_tag_array.Count();
10946 for (int i = 0; i < array_size; i++)
10947 {
10948 if (item_tag_array.Get(i) == tag)
10949 {
10950 found = true;
10951 break;
10952 }
10953 }
10954 return found;
10955 }
10956
10957
10959 {
10960
10961 super.OnRPC(sender, rpc_type,ctx);
10962
10963
10964 switch (rpc_type)
10965 {
10966 #ifndef SERVER
10967 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10968 Param2<bool, string> p = new Param2<bool, string>(false, "");
10969
10971 return;
10972
10973 bool play = p.param1;
10974 string soundSet = p.param2;
10975
10976 if (play)
10977 {
10979 {
10981 {
10983 }
10984 }
10985 else
10986 {
10988 }
10989 }
10990 else
10991 {
10993 }
10994
10995 break;
10996 #endif
10997
10998 }
10999
11001 {
11003 }
11004 }
11005
11006
11007
11008
11010 {
11011 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11012 return plugin.GetID(
name);
11013 }
11014
11016 {
11017 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11018 return plugin.GetName(id);
11019 }
11020
11023 {
11024
11025
11026 int varFlags;
11027 if (!ctx.
Read(varFlags))
11028 return;
11029
11030 if (varFlags & ItemVariableFlags.FLOAT)
11031 {
11033 }
11034 }
11035
11037 {
11038
11039 super.SerializeNumericalVars(floats_out);
11040
11041
11042
11044 {
11046 }
11047
11049 {
11051 }
11052
11054 {
11056 }
11057
11059 {
11064 }
11065
11067 {
11069 }
11070 }
11071
11073 {
11074
11075 super.DeSerializeNumericalVars(floats);
11076
11077
11078 int index = 0;
11079 int mask = Math.Round(floats.Get(index));
11080
11081 index++;
11082
11084 {
11086 {
11088 }
11089 else
11090 {
11091 float quantity = floats.Get(index);
11092 SetQuantity(quantity,
true,
false,
false,
false);
11093 }
11094 index++;
11095 }
11096
11098 {
11099 float wet = floats.Get(index);
11101 index++;
11102 }
11103
11105 {
11106 int liquidtype = Math.Round(floats.Get(index));
11108 index++;
11109 }
11110
11112 {
11114 index++;
11116 index++;
11118 index++;
11120 index++;
11121 }
11122
11124 {
11125 int cleanness = Math.Round(floats.Get(index));
11127 index++;
11128 }
11129 }
11130
11132 {
11133 super.WriteVarsToCTX(ctx);
11134
11135
11137 {
11139 }
11140
11142 {
11144 }
11145
11147 {
11149 }
11150
11152 {
11153 int r,g,b,a;
11159 }
11160
11162 {
11164 }
11165 }
11166
11168 {
11169 if (!super.ReadVarsFromCTX(ctx,version))
11170 return false;
11171
11172 int intValue;
11173 float value;
11174
11175 if (version < 140)
11176 {
11177 if (!ctx.
Read(intValue))
11178 return false;
11179
11180 m_VariablesMask = intValue;
11181 }
11182
11184 {
11185 if (!ctx.
Read(value))
11186 return false;
11187
11189 {
11191 }
11192 else
11193 {
11195 }
11196 }
11197
11198 if (version < 140)
11199 {
11201 {
11202 if (!ctx.
Read(value))
11203 return false;
11204 SetTemperatureDirect(value);
11205 }
11206 }
11207
11209 {
11210 if (!ctx.
Read(value))
11211 return false;
11213 }
11214
11216 {
11217 if (!ctx.
Read(intValue))
11218 return false;
11220 }
11221
11223 {
11224 int r,g,b,a;
11226 return false;
11228 return false;
11230 return false;
11232 return false;
11233
11235 }
11236
11238 {
11239 if (!ctx.
Read(intValue))
11240 return false;
11242 }
11243
11244 if (version >= 138 && version < 140)
11245 {
11247 {
11248 if (!ctx.
Read(intValue))
11249 return false;
11250 SetFrozen(intValue);
11251 }
11252 }
11253
11254 return true;
11255 }
11256
11257
11259 {
11262 {
11264 }
11265
11266 if (!super.OnStoreLoad(ctx, version))
11267 {
11269 return false;
11270 }
11271
11272 if (version >= 114)
11273 {
11274 bool hasQuickBarIndexSaved;
11275
11276 if (!ctx.
Read(hasQuickBarIndexSaved))
11277 {
11279 return false;
11280 }
11281
11282 if (hasQuickBarIndexSaved)
11283 {
11284 int itmQBIndex;
11285
11286
11287 if (!ctx.
Read(itmQBIndex))
11288 {
11290 return false;
11291 }
11292
11293 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11294 if (itmQBIndex != -1 && parentPlayer)
11295 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11296 }
11297 }
11298 else
11299 {
11300
11301 PlayerBase player;
11302 int itemQBIndex;
11303 if (version ==
int.
MAX)
11304 {
11305 if (!ctx.
Read(itemQBIndex))
11306 {
11308 return false;
11309 }
11310 }
11311 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11312 {
11313
11314 if (!ctx.
Read(itemQBIndex))
11315 {
11317 return false;
11318 }
11319 if (itemQBIndex != -1 && player)
11320 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11321 }
11322 }
11323
11324 if (version < 140)
11325 {
11326
11327 if (!LoadVariables(ctx, version))
11328 {
11330 return false;
11331 }
11332 }
11333
11334
11336 {
11338 return false;
11339 }
11340 if (version >= 132)
11341 {
11343 if (raib)
11344 {
11346 {
11348 return false;
11349 }
11350 }
11351 }
11352
11354 return true;
11355 }
11356
11357
11358
11360 {
11361 super.OnStoreSave(ctx);
11362
11363 PlayerBase player;
11364 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11365 {
11367
11368 int itemQBIndex = -1;
11369 itemQBIndex = player.FindQuickBarEntityIndex(this);
11370 ctx.
Write(itemQBIndex);
11371 }
11372 else
11373 {
11375 }
11376
11378
11380 if (raib)
11381 {
11383 }
11384 }
11385
11386
11388 {
11389 super.AfterStoreLoad();
11390
11392 {
11394 }
11395
11397 {
11400 }
11401 }
11402
11404 {
11405 super.EEOnAfterLoad();
11406
11408 {
11410 }
11411
11414 }
11415
11417 {
11418 return false;
11419 }
11420
11421
11422
11424 {
11426 {
11427 #ifdef PLATFORM_CONSOLE
11428
11430 {
11432 if (menu)
11433 {
11435 }
11436 }
11437 #endif
11438 }
11439
11441 {
11444 }
11445
11447 {
11448 SetWeightDirty();
11450 }
11452 {
11455 }
11456
11458 {
11461
11464 }
11466 {
11470 }
11471
11472 super.OnVariablesSynchronized();
11473 }
11474
11475
11476
11478 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11479 {
11480 if (!IsServerCheck(allow_client))
11481 return false;
11482
11484 return false;
11485
11488
11489 if (value <= (min + 0.001))
11490 value = min;
11491
11492 if (value == min)
11493 {
11494 if (destroy_config)
11495 {
11496 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11497 if (dstr)
11498 {
11500 this.Delete();
11501 return true;
11502 }
11503 }
11504 else if (destroy_forced)
11505 {
11507 this.Delete();
11508 return true;
11509 }
11510
11512 }
11513
11516
11518 {
11519 EntityAI parent = GetHierarchyRoot();
11520 InventoryLocation iLoc = new InventoryLocation();
11521 GetInventory().GetCurrentInventoryLocation(iLoc);
11523 {
11524 int iLocSlot = iLoc.
GetSlot();
11526 {
11528 }
11530 {
11532 }
11533 }
11534 }
11535
11537 {
11539
11540 if (delta)
11542 }
11543
11545
11546 return false;
11547 }
11548
11549
11551 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11552 {
11554 }
11555
11557 {
11560 }
11561
11563 {
11566 }
11567
11569 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11570 {
11571 float value_clamped = Math.Clamp(value, 0, 1);
11573 SetQuantity(result, destroy_config, destroy_forced);
11574 }
11575
11576
11579 {
11581 }
11582
11584 {
11586 }
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11598 {
11599 int slot = -1;
11600 GameInventory inventory = GetInventory();
11601 if (inventory)
11602 {
11603 InventoryLocation il = new InventoryLocation;
11606 }
11607
11609 }
11610
11612 {
11613 float quantity_max = 0;
11614
11616 {
11617 if (attSlotID != -1)
11618 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11619
11620 if (quantity_max <= 0)
11622 }
11623
11624 if (quantity_max <= 0)
11626
11627 return quantity_max;
11628 }
11629
11631 {
11633 }
11634
11636 {
11638 }
11639
11640
11642 {
11644 }
11645
11647 {
11649 }
11650
11652 {
11654 }
11655
11656
11658 {
11659
11660 float weightEx = GetWeightEx();
11661 float special = GetInventoryAndCargoWeight();
11662 return weightEx - special;
11663 }
11664
11665
11667 {
11669 }
11670
11672 {
11674 {
11675 #ifdef DEVELOPER
11676 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11677 {
11678 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11680 }
11681 #endif
11682
11683 return GetQuantity() * GetConfigWeightModified();
11684 }
11685 else if (HasEnergyManager())
11686 {
11687 #ifdef DEVELOPER
11688 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11689 {
11690 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11691 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11692 }
11693 #endif
11694 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11695 }
11696 else
11697 {
11698 #ifdef DEVELOPER
11699 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11700 {
11701 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11702 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11703 }
11704 #endif
11705 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11706 }
11707 }
11708
11711 {
11712 int item_count = 0;
11714
11715 GameInventory inventory = GetInventory();
11716 CargoBase cargo = inventory.
GetCargo();
11717 if (cargo != NULL)
11718 {
11720 }
11721
11723 for (int i = 0; i < nAttachments; ++i)
11724 {
11726 if (item)
11727 item_count += item.GetNumberOfItems();
11728 }
11729 return item_count;
11730 }
11731
11734 {
11735 float weight = 0;
11736 float wetness = 1;
11737 if (include_wetness)
11740 {
11741 weight = wetness * m_ConfigWeight;
11742 }
11744 {
11745 weight = 1;
11746 }
11747 return weight;
11748 }
11749
11750
11751
11753 {
11754 GameInventory inventory = GetInventory();
11755 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11756 {
11757 array<EntityAI> items = new array<EntityAI>;
11759 for (int i = 0; i < items.Count(); ++i)
11760 {
11762 if (item)
11763 {
11764 g_Game.ObjectDelete(item);
11765 }
11766 }
11767 }
11768 }
11769
11770
11771
11772
11774 {
11775 float energy = 0;
11776 if (HasEnergyManager())
11777 {
11778 energy = GetCompEM().GetEnergy();
11779 }
11780 return energy;
11781 }
11782
11783
11785 {
11786 super.OnEnergyConsumed();
11787
11789 }
11790
11792 {
11793 super.OnEnergyAdded();
11794
11796 }
11797
11798
11800 {
11801 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11802 {
11804 {
11805 float energy_0to1 = GetCompEM().GetEnergy0To1();
11807 }
11808 }
11809 }
11810
11811
11813 {
11814 return ConfigGetFloat("heatIsolation");
11815 }
11816
11818 {
11820 }
11821
11823 {
11824 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11825 if (
g_Game.ConfigIsExisting(paramPath))
11826 return g_Game.ConfigGetFloat(paramPath);
11827
11828 return 0.0;
11829 }
11830
11832 {
11833 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11834 if (
g_Game.ConfigIsExisting(paramPath))
11835 return g_Game.ConfigGetFloat(paramPath);
11836
11837 return 0.0;
11838 }
11839
11840 override void SetWet(
float value,
bool allow_client =
false)
11841 {
11842 if (!IsServerCheck(allow_client))
11843 return;
11844
11847
11849
11850 m_VarWet = Math.Clamp(value, min, max);
11851
11853 {
11856 }
11857 }
11858
11859 override void AddWet(
float value)
11860 {
11862 }
11863
11865 {
11867 }
11868
11870 {
11872 }
11873
11875 {
11877 }
11878
11880 {
11882 }
11883
11885 {
11887 }
11888
11889 override void OnWetChanged(
float newVal,
float oldVal)
11890 {
11893 if (newLevel != oldLevel)
11894 {
11896 }
11897 }
11898
11900 {
11901 SetWeightDirty();
11902 }
11903
11905 {
11906 return GetWetLevelInternal(
m_VarWet);
11907 }
11908
11909
11910
11912 {
11914 }
11915
11917 {
11919 }
11920
11922 {
11924 }
11925
11927 {
11929 }
11930
11931
11932
11934 {
11935 if (ConfigIsExisting("itemModelLength"))
11936 {
11937 return ConfigGetFloat("itemModelLength");
11938 }
11939 return 0;
11940 }
11941
11943 {
11944 if (ConfigIsExisting("itemAttachOffset"))
11945 {
11946 return ConfigGetFloat("itemAttachOffset");
11947 }
11948 return 0;
11949 }
11950
11951 override void SetCleanness(
int value,
bool allow_client =
false)
11952 {
11953 if (!IsServerCheck(allow_client))
11954 return;
11955
11957
11959
11962 }
11963
11965 {
11967 }
11968
11970 {
11971 return true;
11972 }
11973
11974
11975
11976
11978 {
11980 }
11981
11983 {
11985 }
11986
11987
11988
11989
11990 override void SetColor(
int r,
int g,
int b,
int a)
11991 {
11997 }
11999 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12000 {
12005 }
12006
12008 {
12010 }
12011
12014 {
12015 int r,g,b,a;
12017 r = r/255;
12018 g = g/255;
12019 b = b/255;
12020 a = a/255;
12021 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12022 }
12023
12024
12025
12026 override void SetLiquidType(
int value,
bool allow_client =
false)
12027 {
12028 if (!IsServerCheck(allow_client))
12029 return;
12030
12035 }
12036
12038 {
12039 return ConfigGetInt("varLiquidTypeInit");
12040 }
12041
12043 {
12045 }
12046
12048 {
12050 SetFrozen(false);
12051 }
12052
12055 {
12056 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12057 }
12058
12059
12062 {
12063 PlayerBase nplayer;
12064 if (PlayerBase.CastTo(nplayer, player))
12065 {
12067 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12068 }
12069 }
12070
12071
12074 {
12075 PlayerBase nplayer;
12076 if (PlayerBase.CastTo(nplayer,player))
12077 {
12078 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12079 }
12080
12081 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12082
12083 if (HasEnergyManager())
12084 {
12085 GetCompEM().UpdatePlugState();
12086 }
12087 }
12088
12089
12091 {
12092 super.OnPlacementStarted(player);
12093
12095 }
12096
12097 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12098 {
12100 {
12101 m_AdminLog.OnPlacementComplete(player,
this);
12102 }
12103
12104 super.OnPlacementComplete(player, position, orientation);
12105 }
12106
12107
12108
12109
12110
12112 {
12114 {
12115 return true;
12116 }
12117 else
12118 {
12119 return false;
12120 }
12121 }
12122
12123
12125 {
12127 {
12129 }
12130 }
12131
12132
12134 {
12136 }
12137
12139 {
12141 }
12142
12143 override void InsertAgent(
int agent,
float count = 1)
12144 {
12145 if (count < 1)
12146 return;
12147
12149 }
12150
12153 {
12155 }
12156
12157
12159 {
12161 }
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12205 {
12207 return false;
12208 return true;
12209 }
12210
12212 {
12213
12215 }
12216
12217
12220 {
12221 super.CheckForRoofLimited(timeTresholdMS);
12222
12223 float time =
g_Game.GetTime();
12224 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12225 {
12226 m_PreviousRoofTestTime = time;
12227 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12228 }
12229 }
12230
12231
12233 {
12235 {
12236 return 0;
12237 }
12238
12239 if (GetInventory().GetAttachmentSlotsCount() != 0)
12240 {
12241 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12242 if (filter)
12243 return filter.GetProtectionLevel(type, false, system);
12244 else
12245 return 0;
12246 }
12247
12248 string subclassPath, entryName;
12249
12250 switch (type)
12251 {
12253 entryName = "biological";
12254 break;
12256 entryName = "chemical";
12257 break;
12258 default:
12259 entryName = "biological";
12260 break;
12261 }
12262
12263 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12264
12265 return g_Game.ConfigGetFloat(subclassPath + entryName);
12266 }
12267
12268
12269
12272 {
12273 if (!IsMagazine())
12275
12277 }
12278
12279
12280
12281
12282
12287 {
12288 return true;
12289 }
12290
12292 {
12294 }
12295
12296
12297
12298
12299
12301 {
12302 if (parent)
12303 {
12304 if (parent.IsInherited(DayZInfected))
12305 return true;
12306
12307 if (!parent.IsRuined())
12308 return true;
12309 }
12310
12311 return true;
12312 }
12313
12315 {
12316 if (!super.CanPutAsAttachment(parent))
12317 {
12318 return false;
12319 }
12320
12321 if (!IsRuined() && !parent.IsRuined())
12322 {
12323 return true;
12324 }
12325
12326 return false;
12327 }
12328
12330 {
12331
12332
12333
12334
12335 return super.CanReceiveItemIntoCargo(item);
12336 }
12337
12339 {
12340
12341
12342
12343
12344 GameInventory attachmentInv = attachment.GetInventory();
12346 {
12347 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12348 return false;
12349 }
12350
12351 InventoryLocation loc = new InventoryLocation();
12352 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12353 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12354 return false;
12355
12356 return super.CanReceiveAttachment(attachment, slotId);
12357 }
12358
12360 {
12361 if (!super.CanReleaseAttachment(attachment))
12362 return false;
12363
12364 return GetInventory().AreChildrenAccessible();
12365 }
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12388 {
12389 int id = muzzle_owner.GetMuzzleID();
12390 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12391
12392 if (WPOF_array)
12393 {
12394 for (int i = 0; i < WPOF_array.Count(); i++)
12395 {
12396 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12397
12398 if (WPOF)
12399 {
12400 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12401 }
12402 }
12403 }
12404 }
12405
12406
12408 {
12409 int id = muzzle_owner.GetMuzzleID();
12411
12412 if (WPOBE_array)
12413 {
12414 for (int i = 0; i < WPOBE_array.Count(); i++)
12415 {
12416 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12417
12418 if (WPOBE)
12419 {
12420 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12421 }
12422 }
12423 }
12424 }
12425
12426
12428 {
12429 int id = muzzle_owner.GetMuzzleID();
12430 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12431
12432 if (WPOOH_array)
12433 {
12434 for (int i = 0; i < WPOOH_array.Count(); i++)
12435 {
12436 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12437
12438 if (WPOOH)
12439 {
12440 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12441 }
12442 }
12443 }
12444 }
12445
12446
12448 {
12449 int id = muzzle_owner.GetMuzzleID();
12450 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12451
12452 if (WPOOH_array)
12453 {
12454 for (int i = 0; i < WPOOH_array.Count(); i++)
12455 {
12456 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12457
12458 if (WPOOH)
12459 {
12460 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12461 }
12462 }
12463 }
12464 }
12465
12466
12468 {
12469 int id = muzzle_owner.GetMuzzleID();
12470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12471
12472 if (WPOOH_array)
12473 {
12474 for (int i = 0; i < WPOOH_array.Count(); i++)
12475 {
12476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12477
12478 if (WPOOH)
12479 {
12480 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12481 }
12482 }
12483 }
12484 }
12485
12486
12487
12489 {
12491 {
12492 return true;
12493 }
12494
12495 return false;
12496 }
12497
12499 {
12501 {
12502 return true;
12503 }
12504
12505 return false;
12506 }
12507
12509 {
12511 {
12512 return true;
12513 }
12514
12515 return false;
12516 }
12517
12519 {
12520 return false;
12521 }
12522
12525 {
12526 return UATimeSpent.DEFAULT_DEPLOY;
12527 }
12528
12529
12530
12531
12533 {
12535 SetSynchDirty();
12536 }
12537
12539 {
12541 }
12542
12543
12545 {
12546 return false;
12547 }
12548
12551 {
12552 string att_type = "None";
12553
12554 if (ConfigIsExisting("soundAttType"))
12555 {
12556 att_type = ConfigGetString("soundAttType");
12557 }
12558
12560 }
12561
12563 {
12565 }
12566
12567
12568
12569
12570
12576
12578 {
12581
12583 }
12584
12585
12587 {
12589 return;
12590
12592
12595
12598
12599 SoundParameters params = new SoundParameters();
12603 }
12604
12605
12607 {
12609 {
12612
12613 SetSynchDirty();
12614
12617 }
12618 }
12619
12621 {
12623 }
12624
12625
12627 {
12629 return;
12630
12632 SetSynchDirty();
12633
12636 }
12637
12639 {
12642 }
12643
12645 {
12647 }
12648
12649 void OnApply(PlayerBase player);
12650
12652 {
12653 return 1.0;
12654 };
12655
12657 {
12659 }
12660
12662 {
12664 }
12665
12667
12669 {
12670 SetDynamicPhysicsLifeTime(0.01);
12672 }
12673
12675 {
12676 array<string> zone_names = new array<string>;
12677 GetDamageZones(zone_names);
12678 for (int i = 0; i < zone_names.Count(); i++)
12679 {
12680 SetHealthMax(zone_names.Get(i),"Health");
12681 }
12682 SetHealthMax("","Health");
12683 }
12684
12687 {
12688 float global_health = GetHealth01("","Health");
12689 array<string> zones = new array<string>;
12690 GetDamageZones(zones);
12691
12692 for (int i = 0; i < zones.Count(); i++)
12693 {
12694 SetHealth01(zones.Get(i),"Health",global_health);
12695 }
12696 }
12697
12700 {
12701 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12702 }
12703
12705 {
12706 if (!hasRootAsPlayer)
12707 {
12708 if (refParentIB)
12709 {
12710
12711 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12712 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12713
12714 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12715 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12716
12719 }
12720 else
12721 {
12722
12725 }
12726 }
12727 }
12728
12730 {
12732 {
12733 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12734 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12735 {
12736 float heatPermCoef = 1.0;
12738 while (ent)
12739 {
12740 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12741 ent = ent.GetHierarchyParent();
12742 }
12743
12744 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12745 }
12746 }
12747 }
12748
12750 {
12751
12752 EntityAI parent = GetHierarchyParent();
12753 if (!parent)
12754 {
12755 hasParent = false;
12756 hasRootAsPlayer = false;
12757 }
12758 else
12759 {
12760 hasParent = true;
12761 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12762 refParentIB =
ItemBase.Cast(parent);
12763 }
12764 }
12765
12766 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12767 {
12768
12769 }
12770
12772 {
12773
12774 return false;
12775 }
12776
12778 {
12779
12780
12781 return false;
12782 }
12783
12785 {
12786
12787 return false;
12788 }
12789
12792 {
12793 return !GetIsFrozen() &&
IsOpen();
12794 }
12795
12797 {
12798 bool hasParent = false, hasRootAsPlayer = false;
12800
12801 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12802 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12803
12804 if (wwtu || foodDecay)
12805 {
12809
12810 if (processWetness || processTemperature || processDecay)
12811 {
12813
12814 if (processWetness)
12815 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12816
12817 if (processTemperature)
12819
12820 if (processDecay)
12821 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12822 }
12823 }
12824 }
12825
12828 {
12830 }
12831
12833 {
12836
12837 return super.GetTemperatureFreezeThreshold();
12838 }
12839
12841 {
12844
12845 return super.GetTemperatureThawThreshold();
12846 }
12847
12849 {
12852
12853 return super.GetItemOverheatThreshold();
12854 }
12855
12857 {
12859 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12860
12861 return super.GetTemperatureFreezeTime();
12862 }
12863
12865 {
12867 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12868
12869 return super.GetTemperatureThawTime();
12870 }
12871
12876
12878 {
12879 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12880 }
12881
12883 {
12884 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12885 }
12886
12889 {
12891 }
12892
12894 {
12896 }
12897
12899 {
12901 }
12902
12905 {
12906 return null;
12907 }
12908
12911 {
12912 return false;
12913 }
12914
12916 {
12918 {
12921 if (!trg)
12922 {
12924 explosive = this;
12925 }
12926
12927 explosive.PairRemote(trg);
12929
12930 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12931 trg.SetPersistentPairID(persistentID);
12932 explosive.SetPersistentPairID(persistentID);
12933
12934 return true;
12935 }
12936 return false;
12937 }
12938
12941 {
12942 float ret = 1.0;
12945 ret *= GetHealth01();
12946
12947 return ret;
12948 }
12949
12950 #ifdef DEVELOPER
12951 override void SetDebugItem()
12952 {
12953 super.SetDebugItem();
12954 _itemBase = this;
12955 }
12956
12958 {
12959 string text = super.GetDebugText();
12960
12962 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12963
12964 return text;
12965 }
12966 #endif
12967
12969 {
12970 return true;
12971 }
12972
12974
12976
12978 {
12981 }
12982
12983
12991
13007
13008 [
Obsolete(
"Use ItemSoundHandler instead")]
13011 {
13012 if (!
g_Game.IsDedicatedServer())
13013 {
13014 if (ConfigIsExisting("attachSoundSet"))
13015 {
13016 string cfg_path = "";
13017 string soundset = "";
13018 string type_name =
GetType();
13019
13022 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13023 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13024
13025 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13026 {
13027 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13028 {
13029 if (cfg_slot_array[i] == slot_type)
13030 {
13031 soundset = cfg_soundset_array[i];
13032 break;
13033 }
13034 }
13035 }
13036
13037 if (soundset != "")
13038 {
13039 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13041 }
13042 }
13043 }
13044 }
13045
13047}
13048
13050{
13052 if (entity)
13053 {
13054 bool is_item = entity.IsInherited(
ItemBase);
13055 if (is_item && full_quantity)
13056 {
13059 }
13060 }
13061 else
13062 {
13064 return NULL;
13065 }
13066 return entity;
13067}
13068
13070{
13071 if (item)
13072 {
13073 if (health > 0)
13074 item.SetHealth("", "", health);
13075
13076 if (item.CanHaveTemperature())
13077 {
13079 if (item.CanFreeze())
13080 item.SetFrozen(false);
13081 }
13082
13083 if (item.HasEnergyManager())
13084 {
13085 if (quantity >= 0)
13086 {
13087 item.GetCompEM().SetEnergy0To1(quantity);
13088 }
13089 else
13090 {
13092 }
13093 }
13094 else if (item.IsMagazine())
13095 {
13096 Magazine mag = Magazine.Cast(item);
13097 if (quantity >= 0)
13098 {
13099 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13100 }
13101 else
13102 {
13104 }
13105
13106 }
13107 else
13108 {
13109 if (quantity >= 0)
13110 {
13111 item.SetQuantityNormalized(quantity, false);
13112 }
13113 else
13114 {
13116 }
13117
13118 }
13119 }
13120}
13121
13122#ifdef DEVELOPER
13124#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.