8163{
8165 {
8166 return true;
8167 }
8168};
8169
8170
8171
8173{
8177
8179
8182
8183
8184
8185
8186
8195
8201
8206
8211
8232 protected bool m_IsResultOfSplit
8233
8235
8240
8241
8242
8244
8248
8249
8250
8252
8255
8256
8257
8263
8264
8272
8275
8276
8278
8279
8281
8282
8287
8288
8293
8294
8296
8297
8299 {
8304
8305 if (!
GetGame().IsDedicatedServer())
8306 {
8308 {
8310
8312 {
8314 }
8315 }
8316
8319 }
8320
8321 m_OldLocation = null;
8322
8324 {
8326 }
8327
8328 if (ConfigIsExisting("headSelectionsToHide"))
8329 {
8332 }
8333
8335 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8336 {
8338 }
8339
8341
8342 m_IsResultOfSplit = false;
8343
8345 }
8346
8348 {
8349 super.InitItemVariables();
8350
8356 m_Count = ConfigGetInt(
"count");
8357
8360
8365
8368
8373
8385
8389
8390
8393 if (ConfigIsExisting("canBeSplit"))
8394 {
8397 }
8398
8400 if (ConfigIsExisting("itemBehaviour"))
8402
8403
8406 RegisterNetSyncVariableInt("m_VarLiquidType");
8407 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8408
8409 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8410 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8411 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8412
8413 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8414 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8415 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8416 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8417
8418 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8419 RegisterNetSyncVariableBool("m_IsTakeable");
8420 RegisterNetSyncVariableBool("m_IsHologram");
8421
8424 {
8427 }
8428
8430
8432 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8434
8435 }
8436
8438 {
8440 }
8441
8443 {
8446 {
8451 }
8452 }
8453
8454 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8455 {
8457 {
8460 }
8461
8463 }
8464
8466 {
8472 }
8473
8475
8477 {
8479
8480 if (!action)
8481 {
8482 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8483 return;
8484 }
8485
8487 if (!ai)
8488 {
8490 return;
8491 }
8492
8494 if (!action_array)
8495 {
8496 action_array = new array<ActionBase_Basic>;
8498 }
8499 if (LogManager.IsActionLogEnable())
8500 {
8501 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8502 }
8503
8504 if (action_array.Find(action) != -1)
8505 {
8506 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8507 }
8508 else
8509 {
8510 action_array.Insert(action);
8511 }
8512 }
8513
8515 {
8517 ActionBase action = player.GetActionManager().GetAction(actionName);
8520
8521 if (action_array)
8522 {
8523 action_array.RemoveItem(action);
8524 }
8525 }
8526
8527
8528
8530 {
8531 ActionOverrideData overrideData = new ActionOverrideData();
8535
8537 if (!actionMap)
8538 {
8541 }
8542
8543 actionMap.Insert(this.
Type(), overrideData);
8544
8545 }
8546
8548
8550
8551
8553 {
8556
8559
8560 string config_to_search = "CfgVehicles";
8561 string muzzle_owner_config;
8562
8564 {
8565 if (IsInherited(Weapon))
8566 config_to_search = "CfgWeapons";
8567
8568 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8569
8570 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8571
8573
8574 if (config_OnFire_subclass_count > 0)
8575 {
8576 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8577
8578 for (int i = 0; i < config_OnFire_subclass_count; i++)
8579 {
8580 string particle_class = "";
8582 string config_OnFire_entry = config_OnFire_class + particle_class;
8583 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8584 WPOF_array.Insert(WPOF);
8585 }
8586
8587
8589 }
8590 }
8591
8593 {
8594 config_to_search = "CfgWeapons";
8595 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8596
8597 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8598
8600
8601 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8602 {
8603 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8604
8605 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8606 {
8607 string particle_class2 = "";
8609 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8610 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8611 WPOBE_array.Insert(WPOBE);
8612 }
8613
8614
8616 }
8617 }
8618 }
8619
8620
8622 {
8625
8627 {
8628 string config_to_search = "CfgVehicles";
8629
8630 if (IsInherited(Weapon))
8631 config_to_search = "CfgWeapons";
8632
8633 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8634 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8635
8636 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8637 {
8638
8640
8642 {
8644 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8646 return;
8647 }
8648
8651
8652
8653
8655 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8656
8657 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8658 {
8659 string particle_class = "";
8661 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8663
8664 if (entry_type == CT_CLASS)
8665 {
8666 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8667 WPOOH_array.Insert(WPOF);
8668 }
8669 }
8670
8671
8673 }
8674 }
8675 }
8676
8678 {
8680 }
8681
8683 {
8685 {
8687
8690
8693
8694 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8695 }
8696 }
8697
8699 {
8701 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8702
8704 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8705
8707 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8708
8710 {
8712 }
8713 }
8714
8716 {
8718 }
8719
8721 {
8724 else
8726
8728 {
8731 }
8732 else
8733 {
8736
8739 }
8740
8742 }
8743
8745 {
8747 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8748 }
8749
8751 {
8753 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8755 }
8756
8758 {
8760 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8761 }
8762
8764 {
8767
8768 OverheatingParticle OP = new OverheatingParticle();
8773
8775 }
8776
8778 {
8781
8782 return -1;
8783 }
8784
8786 {
8788 {
8791
8792 for (int i = count; i > 0; --i)
8793 {
8794 int id = i - 1;
8797
8800
8801 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8802 {
8803 if (p)
8804 {
8807 }
8808 }
8809 }
8810 }
8811 }
8812
8814 {
8816 {
8818 {
8819 int id = i - 1;
8821
8822 if (OP)
8823 {
8825
8826 if (p)
8827 {
8829 }
8830
8831 delete OP;
8832 }
8833 }
8834
8837 }
8838 }
8839
8842 {
8843 return 0.0;
8844 }
8845
8846
8848 {
8849 return 250;
8850 }
8851
8853 {
8854 return 0;
8855 }
8856
8859 {
8861 return true;
8862
8863 return false;
8864 }
8865
8868 {
8871
8873 {
8875 }
8876 else
8877 {
8878
8880 }
8881
8883 }
8884
8891 {
8892 return -1;
8893 }
8894
8895
8896
8897
8899 {
8901 {
8903 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8904
8905 if (r_index >= 0)
8906 {
8907 InventoryLocation r_il = new InventoryLocation;
8908 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8909
8910 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8913 {
8914 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8915 }
8917 {
8918 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8919 }
8920
8921 }
8922
8923 player.GetHumanInventory().ClearUserReservedLocation(this);
8924 }
8925
8928 }
8929
8930
8931
8932
8934 {
8935 return ItemBase.m_DebugActionsMask;
8936 }
8937
8939 {
8940 return ItemBase.m_DebugActionsMask & mask;
8941 }
8942
8944 {
8945 ItemBase.m_DebugActionsMask = mask;
8946 }
8947
8949 {
8950 ItemBase.m_DebugActionsMask |= mask;
8951 }
8952
8954 {
8955 ItemBase.m_DebugActionsMask &= ~mask;
8956 }
8957
8959 {
8961 {
8963 }
8964 else
8965 {
8967 }
8968 }
8969
8970
8972 {
8973 if (GetEconomyProfile())
8974 {
8975 float q_max = GetEconomyProfile().GetQuantityMax();
8976 if (q_max > 0)
8977 {
8978 float q_min = GetEconomyProfile().GetQuantityMin();
8979 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8980
8982 {
8983 ComponentEnergyManager comp = GetCompEM();
8985 {
8987 }
8988 }
8990 {
8992
8993 }
8994
8995 }
8996 }
8997 }
8998
9001 {
9002 EntityAI parent = GetHierarchyParent();
9003
9004 if (parent)
9005 {
9006 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9007 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9008 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9009 }
9010 }
9011
9014 {
9015 EntityAI parent = GetHierarchyParent();
9016
9017 if (parent)
9018 {
9019 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9020 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9021 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9022 }
9023 }
9024
9026 {
9027
9028
9029
9030
9032
9034 {
9035 if (ScriptInputUserData.CanStoreInputUserData())
9036 {
9037 ScriptInputUserData ctx = new ScriptInputUserData;
9043 ctx.
Write(use_stack_max);
9046
9048 {
9049 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9050 }
9051 }
9052 }
9053 else if (!
GetGame().IsMultiplayer())
9054 {
9056 }
9057 }
9058
9060 {
9062 }
9063
9065 {
9067 }
9068
9070 {
9072 }
9073
9075 {
9076
9077 return false;
9078 }
9079
9081 {
9082 return false;
9083 }
9084
9088 {
9089 return false;
9090 }
9091
9093 {
9094 return "";
9095 }
9096
9098
9100 {
9101 return false;
9102 }
9103
9105 {
9106 return true;
9107 }
9108
9109
9110
9112 {
9113 return true;
9114 }
9115
9117 {
9118 return true;
9119 }
9120
9122 {
9123 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9125 }
9126
9128 {
9130 }
9131
9133 {
9135 if (!is_being_placed)
9137 SetSynchDirty();
9138 }
9139
9140
9142
9144 {
9146 }
9147
9149 {
9151 }
9152
9154 {
9155 return 1;
9156 }
9157
9159 {
9160 return false;
9161 }
9162
9164 {
9166 SetSynchDirty();
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
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9204 {
9205 super.OnMovedInsideCargo(container);
9206
9207 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9208 }
9209
9210 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9211 {
9212 super.EEItemLocationChanged(oldLoc,newLoc);
9213
9214 PlayerBase new_player = null;
9215 PlayerBase old_player = null;
9216
9217 if (newLoc.GetParent())
9218 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9219
9220 if (oldLoc.GetParent())
9221 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9222
9224 {
9225 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9226
9227 if (r_index >= 0)
9228 {
9229 InventoryLocation r_il = new InventoryLocation;
9230 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9231
9232 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9235 {
9236 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9237 }
9239 {
9240 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9241 }
9242
9243 }
9244 }
9245
9247 {
9248 if (new_player)
9249 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9250
9251 if (new_player == old_player)
9252 {
9253
9254 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9255 {
9257 {
9258 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9259 {
9260 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9261 }
9262 }
9263 else
9264 {
9265 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9266 }
9267 }
9268
9269 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9270 {
9271 int type = oldLoc.GetType();
9273 {
9274 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9275 }
9277 {
9278 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9279 }
9280 }
9281 if (!m_OldLocation)
9282 {
9283 m_OldLocation = new InventoryLocation;
9284 }
9285 m_OldLocation.Copy(oldLoc);
9286 }
9287 else
9288 {
9289 if (m_OldLocation)
9290 {
9291 m_OldLocation.Reset();
9292 }
9293 }
9294
9296 }
9297 else
9298 {
9299 if (new_player)
9300 {
9301 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9302 if (res_index >= 0)
9303 {
9304 InventoryLocation il = new InventoryLocation;
9305 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9307 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9310 {
9311 il.
GetParent().GetOnReleaseLock().Invoke(it);
9312 }
9314 {
9316 }
9317
9318 }
9319 }
9321 {
9322
9324 }
9325
9326 if (m_OldLocation)
9327 {
9328 m_OldLocation.Reset();
9329 }
9330 }
9331 }
9332
9333 override void EOnContact(IEntity other, Contact extra)
9334 {
9336 {
9337 int liquidType = -1;
9339 if (impactSpeed > 0.0)
9340 {
9342 #ifndef SERVER
9344 #else
9346 SetSynchDirty();
9347 #endif
9349 }
9350 }
9351
9352 #ifdef SERVER
9353 if (GetCompEM() && GetCompEM().IsPlugged())
9354 {
9355 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9356 GetCompEM().UnplugThis();
9357 }
9358 #endif
9359 }
9360
9362
9364 {
9366 }
9367
9369 {
9370
9371 }
9372
9374 {
9375 super.OnItemLocationChanged(old_owner, new_owner);
9376
9377 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9378 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9379
9380 if (!relatedPlayer && playerNew)
9381 relatedPlayer = playerNew;
9382
9383 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9384 {
9386 if (actionMgr)
9387 {
9388 ActionBase currentAction = actionMgr.GetRunningAction();
9389 if (currentAction)
9391 }
9392 }
9393
9394 Man ownerPlayerOld = null;
9395 Man ownerPlayerNew = null;
9396
9397 if (old_owner)
9398 {
9399 if (old_owner.
IsMan())
9400 {
9401 ownerPlayerOld = Man.Cast(old_owner);
9402 }
9403 else
9404 {
9405 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9406 }
9407 }
9408 else
9409 {
9411 {
9413
9414 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9415 {
9416 GetCompEM().UnplugThis();
9417 }
9418 }
9419 }
9420
9421 if (new_owner)
9422 {
9423 if (new_owner.
IsMan())
9424 {
9425 ownerPlayerNew = Man.Cast(new_owner);
9426 }
9427 else
9428 {
9429 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9430 }
9431 }
9432
9433 if (ownerPlayerOld != ownerPlayerNew)
9434 {
9435 if (ownerPlayerOld)
9436 {
9437 array<EntityAI> subItemsExit = new array<EntityAI>;
9439 for (int i = 0; i < subItemsExit.Count(); i++)
9440 {
9443 }
9444 }
9445
9446 if (ownerPlayerNew)
9447 {
9448 array<EntityAI> subItemsEnter = new array<EntityAI>;
9450 for (int j = 0; j < subItemsEnter.Count(); j++)
9451 {
9454 }
9455 }
9456 }
9457 else if (ownerPlayerNew != null)
9458 {
9459 PlayerBase nplayer;
9460 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9461 {
9462 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9464 for (int k = 0; k < subItemsUpdate.Count(); k++)
9465 {
9467 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9468 }
9469 }
9470 }
9471
9472 if (old_owner)
9473 old_owner.OnChildItemRemoved(this);
9474 if (new_owner)
9475 new_owner.OnChildItemReceived(this);
9476 }
9477
9478
9480 {
9481 super.EEDelete(parent);
9482 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9483 if (player)
9484 {
9486
9487 if (player.IsAlive())
9488 {
9489 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9490 if (r_index >= 0)
9491 {
9492 InventoryLocation r_il = new InventoryLocation;
9493 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9494
9495 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9498 {
9499 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9500 }
9502 {
9503 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9504 }
9505
9506 }
9507
9508 player.RemoveQuickBarEntityShortcut(this);
9509 }
9510 }
9511 }
9512
9514 {
9515 super.EEKilled(killer);
9516
9519 {
9520 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9521 {
9522 if (IsMagazine())
9523 {
9524 if (Magazine.Cast(this).GetAmmoCount() > 0)
9525 {
9527 }
9528 }
9529 else
9530 {
9532 }
9533 }
9534 }
9535 }
9536
9538 {
9539 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9540
9541 super.OnWasAttached(parent, slot_id);
9542
9545
9547 }
9548
9550 {
9551 super.OnWasDetached(parent, slot_id);
9552
9555 }
9556
9558 {
9559 int idx;
9562
9563 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9564 if (inventory_slots.Count() < 1)
9565 {
9566 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9567 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9568 }
9569 else
9570 {
9571 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9572 }
9573
9574 idx = inventory_slots.Find(slot);
9575 if (idx < 0)
9576 return "";
9577
9578 return attach_types.Get(idx);
9579 }
9580
9582 {
9583 int idx = -1;
9584 string slot;
9585
9588
9589 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9590 if (inventory_slots.Count() < 1)
9591 {
9592 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9593 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9594 }
9595 else
9596 {
9597 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9598 if (detach_types.Count() < 1)
9599 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9600 }
9601
9602 for (int i = 0; i < inventory_slots.Count(); i++)
9603 {
9604 slot = inventory_slots.Get(i);
9605 }
9606
9607 if (slot != "")
9608 {
9609 if (detach_types.Count() == 1)
9610 idx = 0;
9611 else
9612 idx = inventory_slots.Find(slot);
9613 }
9614 if (idx < 0)
9615 return "";
9616
9617 return detach_types.Get(idx);
9618 }
9619
9621 {
9622
9624
9625
9626 float min_time = 1;
9627 float max_time = 3;
9628 float delay = Math.RandomFloat(min_time, max_time);
9629
9630 explode_timer.Run(delay, this, "DoAmmoExplosion");
9631 }
9632
9634 {
9635 Magazine magazine = Magazine.Cast(this);
9636 int pop_sounds_count = 6;
9637 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9638
9639
9640 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9641 string sound_name = pop_sounds[ sound_idx ];
9643
9644
9645 magazine.ServerAddAmmoCount(-1);
9646
9647
9648 float min_temp_to_explode = 100;
9649
9650 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
9651 {
9653 }
9654 }
9655
9656
9657 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9658 {
9659 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9660
9661 const int CHANCE_DAMAGE_CARGO = 4;
9662 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9663 const int CHANCE_DAMAGE_NOTHING = 2;
9664
9666 {
9667 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9668 int chances;
9669 int rnd;
9670
9671 if (GetInventory().GetCargo())
9672 {
9673 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9674 rnd = Math.RandomInt(0,chances);
9675
9676 if (rnd < CHANCE_DAMAGE_CARGO)
9677 {
9679 }
9680 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9681 {
9683 }
9684 }
9685 else
9686 {
9687 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9688 rnd = Math.RandomInt(0,chances);
9689
9690 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9691 {
9693 }
9694 }
9695 }
9696 }
9697
9699 {
9700 if (GetInventory().GetCargo())
9701 {
9702 int item_count = GetInventory().GetCargo().GetItemCount();
9703 if (item_count > 0)
9704 {
9705 int random_pick = Math.RandomInt(0, item_count);
9707 if (!item.IsExplosive())
9708 {
9709 item.AddHealth("","",damage);
9710 return true;
9711 }
9712 }
9713 }
9714 return false;
9715 }
9716
9718 {
9719 int attachment_count = GetInventory().AttachmentCount();
9720 if (attachment_count > 0)
9721 {
9722 int random_pick = Math.RandomInt(0, attachment_count);
9723 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9724 if (!attachment.IsExplosive())
9725 {
9726 attachment.AddHealth("","",damage);
9727 return true;
9728 }
9729 }
9730 return false;
9731 }
9732
9734 {
9736 }
9737
9739 {
9741 return GetInventory().CanRemoveEntity();
9742
9743 return false;
9744 }
9745
9747 {
9749 return;
9750
9752 {
9753 if (ScriptInputUserData.CanStoreInputUserData())
9754 {
9755 ScriptInputUserData ctx = new ScriptInputUserData;
9760 ctx.
Write(destination_entity);
9764 }
9765 }
9766 else if (!
GetGame().IsMultiplayer())
9767 {
9769 }
9770 }
9771
9773 {
9775 return;
9776
9777 float split_quantity_new;
9781 InventoryLocation loc = new InventoryLocation;
9782
9783 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9784 {
9786 split_quantity_new = stack_max;
9787 else
9789
9790 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9791 if (new_item)
9792 {
9793 new_item.SetResultOfSplit(true);
9794 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9796 new_item.SetQuantity(split_quantity_new);
9797 }
9798 }
9799 else if (destination_entity && slot_id == -1)
9800 {
9801 if (quantity > stack_max)
9802 split_quantity_new = stack_max;
9803 else
9804 split_quantity_new = quantity;
9805
9807 {
9810 }
9811
9812 if (new_item)
9813 {
9814 new_item.SetResultOfSplit(true);
9815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9817 new_item.SetQuantity(split_quantity_new);
9818 }
9819 }
9820 else
9821 {
9822 if (stack_max != 0)
9823 {
9825 {
9827 }
9828
9829 if (split_quantity_new == 0)
9830 {
9831 if (!
GetGame().IsMultiplayer())
9832 player.PhysicalPredictiveDropItem(this);
9833 else
9834 player.ServerDropEntity(this);
9835 return;
9836 }
9837
9839
9840 if (new_item)
9841 {
9842 new_item.SetResultOfSplit(true);
9843 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9845 new_item.SetQuantity(stack_max);
9846 new_item.PlaceOnSurface();
9847 }
9848 }
9849 }
9850 }
9851
9853 {
9855 return;
9856
9857 float split_quantity_new;
9861 InventoryLocation loc = new InventoryLocation;
9862
9863 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9864 {
9866 split_quantity_new = stack_max;
9867 else
9869
9870 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9871 if (new_item)
9872 {
9873 new_item.SetResultOfSplit(true);
9874 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9876 new_item.SetQuantity(split_quantity_new);
9877 }
9878 }
9879 else if (destination_entity && slot_id == -1)
9880 {
9881 if (quantity > stack_max)
9882 split_quantity_new = stack_max;
9883 else
9884 split_quantity_new = quantity;
9885
9887 {
9890 }
9891
9892 if (new_item)
9893 {
9894 new_item.SetResultOfSplit(true);
9895 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9897 new_item.SetQuantity(split_quantity_new);
9898 }
9899 }
9900 else
9901 {
9902 if (stack_max != 0)
9903 {
9905 {
9907 }
9908
9910
9911 if (new_item)
9912 {
9913 new_item.SetResultOfSplit(true);
9914 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9916 new_item.SetQuantity(stack_max);
9917 new_item.PlaceOnSurface();
9918 }
9919 }
9920 }
9921 }
9922
9924 {
9926 return;
9927
9929 {
9930 if (ScriptInputUserData.CanStoreInputUserData())
9931 {
9932 ScriptInputUserData ctx = new ScriptInputUserData;
9937 dst.WriteToContext(ctx);
9939 }
9940 }
9941 else if (!
GetGame().IsMultiplayer())
9942 {
9944 }
9945 }
9946
9948 {
9950 return;
9951
9953 {
9954 if (ScriptInputUserData.CanStoreInputUserData())
9955 {
9956 ScriptInputUserData ctx = new ScriptInputUserData;
9961 ctx.
Write(destination_entity);
9967 }
9968 }
9969 else if (!
GetGame().IsMultiplayer())
9970 {
9972 }
9973 }
9974
9976 {
9978 }
9979
9981 {
9983 return this;
9984
9986 float split_quantity_new;
9988 if (dst.IsValid())
9989 {
9990 int slot_id = dst.GetSlot();
9992
9993 if (quantity > stack_max)
9994 split_quantity_new = stack_max;
9995 else
9996 split_quantity_new = quantity;
9997
9999
10000 if (new_item)
10001 {
10002 new_item.SetResultOfSplit(true);
10003 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10006 }
10007
10008 return new_item;
10009 }
10010
10011 return null;
10012 }
10013
10015 {
10017 return;
10018
10020 float split_quantity_new;
10022 if (destination_entity)
10023 {
10025 if (quantity > stackable)
10026 split_quantity_new = stackable;
10027 else
10028 split_quantity_new = quantity;
10029
10030 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10031 if (new_item)
10032 {
10033 new_item.SetResultOfSplit(true);
10034 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10036 new_item.SetQuantity(split_quantity_new);
10037 }
10038 }
10039 }
10040
10042 {
10044 return;
10045
10047 {
10048 if (ScriptInputUserData.CanStoreInputUserData())
10049 {
10050 ScriptInputUserData ctx = new ScriptInputUserData;
10055 ItemBase destination_entity =
this;
10056 ctx.
Write(destination_entity);
10060 }
10061 }
10062 else if (!
GetGame().IsMultiplayer())
10063 {
10065 }
10066 }
10067
10069 {
10071 return;
10072
10074 float split_quantity_new;
10076 if (player)
10077 {
10079 if (quantity > stackable)
10080 split_quantity_new = stackable;
10081 else
10082 split_quantity_new = quantity;
10083
10084 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10085 new_item =
ItemBase.Cast(in_hands);
10086 if (new_item)
10087 {
10088 new_item.SetResultOfSplit(true);
10089 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10091 new_item.SetQuantity(split_quantity_new);
10092 }
10093 }
10094 }
10095
10097 {
10099 return;
10100
10102 float split_quantity_new = Math.Floor(quantity * 0.5);
10103
10105
10106 if (new_item)
10107 {
10108 if (new_item.GetQuantityMax() < split_quantity_new)
10109 {
10110 split_quantity_new = new_item.GetQuantityMax();
10111 }
10112
10113 new_item.SetResultOfSplit(true);
10114 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10115
10117 {
10120 }
10121 else
10122 {
10125 }
10126 }
10127 }
10128
10130 {
10132 return;
10133
10135 float split_quantity_new = Math.Floor(quantity / 2);
10136
10137 InventoryLocation invloc = new InventoryLocation;
10139
10141 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10142
10143 if (new_item)
10144 {
10145 if (new_item.GetQuantityMax() < split_quantity_new)
10146 {
10147 split_quantity_new = new_item.GetQuantityMax();
10148 }
10150 {
10153 }
10154 else
10155 {
10158 }
10159 }
10160 }
10161
10164 {
10165 SetWeightDirty();
10167
10168 if (parent)
10169 parent.OnAttachmentQuantityChangedEx(this, delta);
10170
10172 {
10174 {
10176 }
10178 {
10179 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10181 }
10182 }
10183
10184 }
10185
10188 {
10189
10190 }
10191
10194 {
10196 }
10197
10199 {
10200 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10201
10203 {
10204 if (newLevel == GameConstants.STATE_RUINED)
10205 {
10207 EntityAI parent = GetHierarchyParent();
10208 if (parent && parent.IsFireplace())
10209 {
10210 CargoBase cargo = GetInventory().GetCargo();
10211 if (cargo)
10212 {
10214 {
10216 }
10217 }
10218 }
10219 }
10220
10222 {
10223
10225 return;
10226 }
10227
10228 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10229 {
10231 }
10232 }
10233 }
10234
10235
10237 {
10238 super.OnRightClick();
10239
10241 {
10243 {
10244 if (ScriptInputUserData.CanStoreInputUserData())
10245 {
10246 vector m4[4];
10248
10249 EntityAI root = GetHierarchyRoot();
10250
10251 InventoryLocation dst = new InventoryLocation;
10253 {
10254 if (root)
10255 {
10256 root.GetTransform(m4);
10258 }
10259 else
10260 GetInventory().GetCurrentInventoryLocation(dst);
10261 }
10262 else
10263 {
10265
10266
10267 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10268 {
10269 if (root)
10270 {
10271 root.GetTransform(m4);
10273 }
10274 else
10275 GetInventory().GetCurrentInventoryLocation(dst);
10276 }
10277 else
10278 {
10279 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10280 }
10281 }
10282
10283 ScriptInputUserData ctx = new ScriptInputUserData;
10291 }
10292 }
10293 else if (!
GetGame().IsMultiplayer())
10294 {
10296 }
10297 }
10298 }
10299
10300 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10301 {
10302
10303 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10304 return false;
10305
10306 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10307 return false;
10308
10309
10311 return false;
10312
10313
10314 Magazine mag = Magazine.Cast(this);
10315 if (mag)
10316 {
10317 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10318 return false;
10319
10320 if (stack_max_limit)
10321 {
10322 Magazine other_mag = Magazine.Cast(other_item);
10323 if (other_item)
10324 {
10325 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10326 return false;
10327 }
10328
10329 }
10330 }
10331 else
10332 {
10333
10335 return false;
10336
10338 return false;
10339 }
10340
10341 PlayerBase player = null;
10342 if (CastTo(player, GetHierarchyRootPlayer()))
10343 {
10344 if (player.GetInventory().HasAttachment(this))
10345 return false;
10346
10347 if (player.IsItemsToDelete())
10348 return false;
10349 }
10350
10351 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10352 return false;
10353
10354 int slotID;
10356 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10357 return false;
10358
10359 return true;
10360 }
10361
10363 {
10365 }
10366
10368 {
10369 return m_IsResultOfSplit;
10370 }
10371
10373 {
10374 m_IsResultOfSplit = value;
10375 }
10376
10378 {
10380 }
10381
10383 {
10384 float other_item_quantity = other_item.GetQuantity();
10385 float this_free_space;
10386
10388
10390
10391 if (other_item_quantity > this_free_space)
10392 {
10393 return this_free_space;
10394 }
10395 else
10396 {
10397 return other_item_quantity;
10398 }
10399 }
10400
10402 {
10404 }
10405
10407 {
10409 return;
10410
10411 if (!IsMagazine() && other_item)
10412 {
10414 if (quantity_used != 0)
10415 {
10416 float hp1 = GetHealth01("","");
10417 float hp2 = other_item.GetHealth01("","");
10418 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10419 hpResult = hpResult / (
GetQuantity() + quantity_used);
10420
10421 hpResult *= GetMaxHealth();
10422 Math.Round(hpResult);
10423 SetHealth("", "Health", hpResult);
10424
10426 other_item.AddQuantity(-quantity_used);
10427 }
10428 }
10430 }
10431
10433 {
10434 #ifdef SERVER
10435 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10436 GetHierarchyParent().IncreaseLifetimeUp();
10437 #endif
10438 };
10439
10441 {
10442 PlayerBase p = PlayerBase.Cast(player);
10443
10444 array<int> recipesIds = p.m_Recipes;
10445 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10446 if (moduleRecipesManager)
10447 {
10448 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10449 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10450 }
10451
10452 for (int i = 0;i < recipesIds.Count(); i++)
10453 {
10454 int key = recipesIds.Get(i);
10455 string recipeName = moduleRecipesManager.GetRecipeName(key);
10457 }
10458 }
10459
10460
10461 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10462 {
10463 super.GetDebugActions(outputList);
10464
10465
10470
10471
10475
10479
10480
10483
10484
10486 {
10489 }
10490
10492
10495
10499 }
10500
10501
10502
10503
10505 {
10506 super.OnAction(action_id, player, ctx);
10507 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10508 {
10509 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10510 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10511 PlayerBase p = PlayerBase.Cast(player);
10512 if (
EActions.RECIPES_RANGE_START < 1000)
10513 {
10514 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10515 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10516 }
10517 }
10518 #ifndef SERVER
10519 else if (action_id ==
EActions.WATCH_PLAYER)
10520 {
10521 PluginDeveloper.SetDeveloperItemClientEx(player);
10522 }
10523 #endif
10525 {
10526 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10527 {
10528 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10529 OnDebugButtonPressServer(id + 1);
10530 }
10531
10532 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10533 {
10534 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10536 }
10537
10538 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10539 {
10540 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10542 }
10543
10544 else if (action_id ==
EActions.ADD_QUANTITY)
10545 {
10546 if (IsMagazine())
10547 {
10548 Magazine mag = Magazine.Cast(this);
10549 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10550 }
10551 else
10552 {
10554 }
10555
10556 if (m_EM)
10557 {
10558 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10559 }
10560
10561 }
10562
10563 else if (action_id ==
EActions.REMOVE_QUANTITY)
10564 {
10565 if (IsMagazine())
10566 {
10567 Magazine mag2 = Magazine.Cast(this);
10568 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10569 }
10570 else
10571 {
10573 }
10574 if (m_EM)
10575 {
10576 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10577 }
10578
10579 }
10580
10581 else if (action_id ==
EActions.SET_QUANTITY_0)
10582 {
10584
10585 if (m_EM)
10586 {
10587 m_EM.SetEnergy(0);
10588 }
10589 }
10590
10591 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10592 {
10594
10595 if (m_EM)
10596 {
10597 m_EM.SetEnergy(m_EM.GetEnergyMax());
10598 }
10599 }
10600
10601 else if (action_id ==
EActions.ADD_HEALTH)
10602 {
10603 AddHealth("","",GetMaxHealth("","Health")/5);
10604 }
10605 else if (action_id ==
EActions.REMOVE_HEALTH)
10606 {
10607 AddHealth("","",-GetMaxHealth("","Health")/5);
10608 }
10609 else if (action_id ==
EActions.DESTROY_HEALTH)
10610 {
10611 SetHealth01("","",0);
10612 }
10613 else if (action_id ==
EActions.WATCH_ITEM)
10614 {
10616 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10617 #ifdef DEVELOPER
10618 SetDebugDeveloper_item(this);
10619 #endif
10620 }
10621
10622 else if (action_id ==
EActions.ADD_TEMPERATURE)
10623 {
10624 AddTemperature(20);
10625
10626 }
10627
10628 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10629 {
10630 AddTemperature(-20);
10631
10632 }
10633
10634 else if (action_id ==
EActions.FLIP_FROZEN)
10635 {
10636 SetFrozen(!GetIsFrozen());
10637
10638 }
10639
10640 else if (action_id ==
EActions.ADD_WETNESS)
10641 {
10643
10644 }
10645
10646 else if (action_id ==
EActions.REMOVE_WETNESS)
10647 {
10649
10650 }
10651
10652 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10653 {
10656
10657
10658 }
10659
10660 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10661 {
10664 }
10665
10666 else if (action_id ==
EActions.MAKE_SPECIAL)
10667 {
10668 auto debugParams = DebugSpawnParams.WithPlayer(player);
10669 OnDebugSpawnEx(debugParams);
10670 }
10671
10672 else if (action_id ==
EActions.DELETE)
10673 {
10674 Delete();
10675 }
10676
10677 }
10678
10679
10680 return false;
10681 }
10682
10683
10684
10685
10689
10692
10693
10694
10696 {
10697 return false;
10698 }
10699
10700
10702 {
10703 return true;
10704 }
10705
10706
10708 {
10709 return true;
10710 }
10711
10712
10713
10715 {
10716 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10718 }
10719
10722 {
10723 return null;
10724 }
10725
10727 {
10728 return false;
10729 }
10730
10732 {
10733 return false;
10734 }
10735
10739
10740
10742 {
10743 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10744 return module_repairing.CanRepair(this, item_repair_kit);
10745 }
10746
10747
10748 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10749 {
10750 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10751 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10752 }
10753
10754
10756 {
10757
10758
10759
10760
10761
10762
10763
10764
10765 return 1;
10766 }
10767
10768
10769
10771 {
10773 }
10774
10775
10776
10778 {
10780 }
10781
10782
10791 {
10792 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10793
10794 if (player)
10795 {
10796 player.MessageStatus(text);
10797 }
10798 }
10799
10800
10809 {
10810 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10811
10812 if (player)
10813 {
10814 player.MessageAction(text);
10815 }
10816 }
10817
10818
10827 {
10828 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10829
10830 if (player)
10831 {
10832 player.MessageFriendly(text);
10833 }
10834 }
10835
10836
10845 {
10846 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10847
10848 if (player)
10849 {
10850 player.MessageImportant(text);
10851 }
10852 }
10853
10855 {
10856 return true;
10857 }
10858
10859
10860 override bool KindOf(
string tag)
10861 {
10862 bool found = false;
10863 string item_name = this.
GetType();
10866
10867 int array_size = item_tag_array.Count();
10868 for (int i = 0; i < array_size; i++)
10869 {
10870 if (item_tag_array.Get(i) == tag)
10871 {
10872 found = true;
10873 break;
10874 }
10875 }
10876 return found;
10877 }
10878
10879
10881 {
10882
10883 super.OnRPC(sender, rpc_type,ctx);
10884
10885
10886 switch (rpc_type)
10887 {
10888 #ifndef SERVER
10889 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10890 Param2<bool, string> p = new Param2<bool, string>(false, "");
10891
10893 return;
10894
10895 bool play = p.param1;
10896 string soundSet = p.param2;
10897
10898 if (play)
10899 {
10901 {
10903 {
10905 }
10906 }
10907 else
10908 {
10910 }
10911 }
10912 else
10913 {
10915 }
10916
10917 break;
10918 #endif
10919
10920 }
10921
10923 {
10925 }
10926 }
10927
10928
10929
10930
10932 {
10933 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10934 return plugin.GetID(
name);
10935 }
10936
10938 {
10939 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10940 return plugin.GetName(id);
10941 }
10942
10945 {
10946
10947
10948 int varFlags;
10949 if (!ctx.
Read(varFlags))
10950 return;
10951
10952 if (varFlags & ItemVariableFlags.FLOAT)
10953 {
10955 }
10956 }
10957
10959 {
10960
10961 super.SerializeNumericalVars(floats_out);
10962
10963
10964
10966 {
10968 }
10969
10971 {
10973 }
10974
10976 {
10978 }
10979
10981 {
10986 }
10987
10989 {
10991 }
10992 }
10993
10995 {
10996
10997 super.DeSerializeNumericalVars(floats);
10998
10999
11000 int index = 0;
11001 int mask = Math.Round(floats.Get(index));
11002
11003 index++;
11004
11006 {
11008 {
11010 }
11011 else
11012 {
11013 float quantity = floats.Get(index);
11014 SetQuantity(quantity,
true,
false,
false,
false);
11015 }
11016 index++;
11017 }
11018
11020 {
11021 float wet = floats.Get(index);
11023 index++;
11024 }
11025
11027 {
11028 int liquidtype = Math.Round(floats.Get(index));
11030 index++;
11031 }
11032
11034 {
11036 index++;
11038 index++;
11040 index++;
11042 index++;
11043 }
11044
11046 {
11047 int cleanness = Math.Round(floats.Get(index));
11049 index++;
11050 }
11051 }
11052
11054 {
11055 super.WriteVarsToCTX(ctx);
11056
11057
11059 {
11061 }
11062
11064 {
11066 }
11067
11069 {
11071 }
11072
11074 {
11075 int r,g,b,a;
11081 }
11082
11084 {
11086 }
11087 }
11088
11090 {
11091 if (!super.ReadVarsFromCTX(ctx,version))
11092 return false;
11093
11094 int intValue;
11095 float value;
11096
11097 if (version < 140)
11098 {
11099 if (!ctx.
Read(intValue))
11100 return false;
11101
11102 m_VariablesMask = intValue;
11103 }
11104
11106 {
11107 if (!ctx.
Read(value))
11108 return false;
11109
11111 {
11113 }
11114 else
11115 {
11117 }
11118 }
11119
11120 if (version < 140)
11121 {
11123 {
11124 if (!ctx.
Read(value))
11125 return false;
11126 SetTemperatureDirect(value);
11127 }
11128 }
11129
11131 {
11132 if (!ctx.
Read(value))
11133 return false;
11135 }
11136
11138 {
11139 if (!ctx.
Read(intValue))
11140 return false;
11142 }
11143
11145 {
11146 int r,g,b,a;
11148 return false;
11150 return false;
11152 return false;
11154 return false;
11155
11157 }
11158
11160 {
11161 if (!ctx.
Read(intValue))
11162 return false;
11164 }
11165
11166 if (version >= 138 && version < 140)
11167 {
11169 {
11170 if (!ctx.
Read(intValue))
11171 return false;
11172 SetFrozen(intValue);
11173 }
11174 }
11175
11176 return true;
11177 }
11178
11179
11181 {
11184 {
11186 }
11187
11188 if (!super.OnStoreLoad(ctx, version))
11189 {
11191 return false;
11192 }
11193
11194 if (version >= 114)
11195 {
11196 bool hasQuickBarIndexSaved;
11197
11198 if (!ctx.
Read(hasQuickBarIndexSaved))
11199 {
11201 return false;
11202 }
11203
11204 if (hasQuickBarIndexSaved)
11205 {
11206 int itmQBIndex;
11207
11208
11209 if (!ctx.
Read(itmQBIndex))
11210 {
11212 return false;
11213 }
11214
11215 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11216 if (itmQBIndex != -1 && parentPlayer)
11217 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11218 }
11219 }
11220 else
11221 {
11222
11223 PlayerBase player;
11224 int itemQBIndex;
11225 if (version ==
int.
MAX)
11226 {
11227 if (!ctx.
Read(itemQBIndex))
11228 {
11230 return false;
11231 }
11232 }
11233 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11234 {
11235
11236 if (!ctx.
Read(itemQBIndex))
11237 {
11239 return false;
11240 }
11241 if (itemQBIndex != -1 && player)
11242 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11243 }
11244 }
11245
11246 if (version < 140)
11247 {
11248
11249 if (!LoadVariables(ctx, version))
11250 {
11252 return false;
11253 }
11254 }
11255
11256
11258 {
11260 return false;
11261 }
11262 if (version >= 132)
11263 {
11265 if (raib)
11266 {
11268 {
11270 return false;
11271 }
11272 }
11273 }
11274
11276 return true;
11277 }
11278
11279
11280
11282 {
11283 super.OnStoreSave(ctx);
11284
11285 PlayerBase player;
11286 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11287 {
11289
11290 int itemQBIndex = -1;
11291 itemQBIndex = player.FindQuickBarEntityIndex(this);
11292 ctx.
Write(itemQBIndex);
11293 }
11294 else
11295 {
11297 }
11298
11300
11302 if (raib)
11303 {
11305 }
11306 }
11307
11308
11310 {
11311 super.AfterStoreLoad();
11312
11314 {
11316 }
11317
11319 {
11322 }
11323 }
11324
11326 {
11327 super.EEOnAfterLoad();
11328
11330 {
11332 }
11333
11336 }
11337
11339 {
11340 return false;
11341 }
11342
11343
11344
11346 {
11348 {
11349 #ifdef PLATFORM_CONSOLE
11350
11352 {
11354 if (menu)
11355 {
11357 }
11358 }
11359 #endif
11360 }
11361
11363 {
11366 }
11367
11369 {
11370 SetWeightDirty();
11372 }
11374 {
11377 }
11378
11380 {
11383 }
11385 {
11388 }
11389
11390 super.OnVariablesSynchronized();
11391 }
11392
11393
11394
11396 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11397 {
11398 if (!IsServerCheck(allow_client))
11399 return false;
11400
11402 return false;
11403
11406
11407 if (value <= (min + 0.001))
11408 value = min;
11409
11410 if (value == min)
11411 {
11412 if (destroy_config)
11413 {
11414 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11415 if (dstr)
11416 {
11418 this.Delete();
11419 return true;
11420 }
11421 }
11422 else if (destroy_forced)
11423 {
11425 this.Delete();
11426 return true;
11427 }
11428
11430 }
11431
11434
11436 {
11438
11439 if (delta)
11441 }
11442
11444
11445 return false;
11446 }
11447
11448
11450 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11451 {
11453 }
11454
11456 {
11459 }
11460
11462 {
11465 }
11466
11469 {
11470 float value_clamped = Math.Clamp(value, 0, 1);
11472 SetQuantity(result, destroy_config, destroy_forced);
11473 }
11474
11475
11478 {
11480 }
11481
11483 {
11485 }
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11497 {
11498 int slot = -1;
11499 if (GetInventory())
11500 {
11501 InventoryLocation il = new InventoryLocation;
11502 GetInventory().GetCurrentInventoryLocation(il);
11504 }
11505
11507 }
11508
11510 {
11511 float quantity_max = 0;
11512
11514 {
11515 if (attSlotID != -1)
11516 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11517
11518 if (quantity_max <= 0)
11520 }
11521
11522 if (quantity_max <= 0)
11524
11525 return quantity_max;
11526 }
11527
11529 {
11531 }
11532
11534 {
11536 }
11537
11538
11540 {
11542 }
11543
11545 {
11547 }
11548
11550 {
11552 }
11553
11554
11556 {
11557
11558 float weightEx = GetWeightEx();
11559 float special = GetInventoryAndCargoWeight();
11560 return weightEx - special;
11561 }
11562
11563
11565 {
11567 }
11568
11570 {
11572 {
11573 #ifdef DEVELOPER
11574 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11575 {
11576 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11578 }
11579 #endif
11580
11581 return GetQuantity() * GetConfigWeightModified();
11582 }
11583 else if (HasEnergyManager())
11584 {
11585 #ifdef DEVELOPER
11586 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11587 {
11588 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11589 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11590 }
11591 #endif
11592 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11593 }
11594 else
11595 {
11596 #ifdef DEVELOPER
11597 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11598 {
11599 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11600 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11601 }
11602 #endif
11603 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
11604 }
11605 }
11606
11609 {
11610 int item_count = 0;
11612
11613 if (GetInventory().GetCargo() != NULL)
11614 {
11615 item_count = GetInventory().GetCargo().GetItemCount();
11616 }
11617
11618 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11619 {
11620 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11621 if (item)
11622 item_count += item.GetNumberOfItems();
11623 }
11624 return item_count;
11625 }
11626
11629 {
11630 float weight = 0;
11631 float wetness = 1;
11632 if (include_wetness)
11635 {
11636 weight = wetness * m_ConfigWeight;
11637 }
11639 {
11640 weight = 1;
11641 }
11642 return weight;
11643 }
11644
11645
11646
11648 {
11649 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11650 {
11651 GameInventory inv = GetInventory();
11652 array<EntityAI> items = new array<EntityAI>;
11654 for (int i = 0; i < items.Count(); i++)
11655 {
11657 if (item)
11658 {
11660 }
11661 }
11662 }
11663 }
11664
11665
11666
11667
11669 {
11670 float energy = 0;
11671 if (HasEnergyManager())
11672 {
11673 energy = GetCompEM().GetEnergy();
11674 }
11675 return energy;
11676 }
11677
11678
11680 {
11681 super.OnEnergyConsumed();
11682
11684 }
11685
11687 {
11688 super.OnEnergyAdded();
11689
11691 }
11692
11693
11695 {
11696 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11697 {
11699 {
11700 float energy_0to1 = GetCompEM().GetEnergy0To1();
11702 }
11703 }
11704 }
11705
11706
11708 {
11709 return ConfigGetFloat("heatIsolation");
11710 }
11711
11713 {
11715 }
11716
11718 {
11719 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11720 if (
GetGame().ConfigIsExisting(paramPath))
11722
11723 return 0.0;
11724 }
11725
11727 {
11728 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11729 if (
GetGame().ConfigIsExisting(paramPath))
11731
11732 return 0.0;
11733 }
11734
11735 override void SetWet(
float value,
bool allow_client =
false)
11736 {
11737 if (!IsServerCheck(allow_client))
11738 return;
11739
11742
11744
11745 m_VarWet = Math.Clamp(value, min, max);
11746
11748 {
11751 }
11752 }
11753
11754 override void AddWet(
float value)
11755 {
11757 }
11758
11760 {
11762 }
11763
11765 {
11767 }
11768
11770 {
11772 }
11773
11775 {
11777 }
11778
11780 {
11782 }
11783
11784 override void OnWetChanged(
float newVal,
float oldVal)
11785 {
11788 if (newLevel != oldLevel)
11789 {
11791 }
11792 }
11793
11795 {
11796 SetWeightDirty();
11797 }
11798
11800 {
11801 return GetWetLevelInternal(
m_VarWet);
11802 }
11803
11804
11805
11807 {
11809 }
11810
11812 {
11814 }
11815
11817 {
11819 }
11820
11822 {
11824 }
11825
11826
11827
11829 {
11830 if (ConfigIsExisting("itemModelLength"))
11831 {
11832 return ConfigGetFloat("itemModelLength");
11833 }
11834 return 0;
11835 }
11836
11838 {
11839 if (ConfigIsExisting("itemAttachOffset"))
11840 {
11841 return ConfigGetFloat("itemAttachOffset");
11842 }
11843 return 0;
11844 }
11845
11846 override void SetCleanness(
int value,
bool allow_client =
false)
11847 {
11848 if (!IsServerCheck(allow_client))
11849 return;
11850
11852
11854
11857 }
11858
11860 {
11862 }
11863
11865 {
11866 return true;
11867 }
11868
11869
11870
11871
11873 {
11875 }
11876
11878 {
11880 }
11881
11882
11883
11884
11885 override void SetColor(
int r,
int g,
int b,
int a)
11886 {
11892 }
11894 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11895 {
11900 }
11901
11903 {
11905 }
11906
11909 {
11910 int r,g,b,a;
11912 r = r/255;
11913 g = g/255;
11914 b = b/255;
11915 a = a/255;
11916 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11917 }
11918
11919
11920
11921 override void SetLiquidType(
int value,
bool allow_client =
false)
11922 {
11923 if (!IsServerCheck(allow_client))
11924 return;
11925
11930 }
11931
11933 {
11934 return ConfigGetInt("varLiquidTypeInit");
11935 }
11936
11938 {
11940 }
11941
11943 {
11945 SetFrozen(false);
11946 }
11947
11950 {
11951 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11952 }
11953
11954
11957 {
11958 PlayerBase nplayer;
11959 if (PlayerBase.CastTo(nplayer, player))
11960 {
11962
11963 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11964 }
11965 }
11966
11967
11970 {
11971 PlayerBase nplayer;
11972 if (PlayerBase.CastTo(nplayer,player))
11973 {
11974
11975 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11976
11977 }
11978
11979
11980 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11981
11982
11983 if (HasEnergyManager())
11984 {
11985 GetCompEM().UpdatePlugState();
11986 }
11987 }
11988
11989
11991 {
11992 super.OnPlacementStarted(player);
11993
11995 }
11996
11997 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11998 {
12000 {
12001 m_AdminLog.OnPlacementComplete(player,
this);
12002 }
12003
12004 super.OnPlacementComplete(player, position, orientation);
12005 }
12006
12007
12008
12009
12010
12012 {
12014 {
12015 return true;
12016 }
12017 else
12018 {
12019 return false;
12020 }
12021 }
12022
12023
12025 {
12027 {
12029 }
12030 }
12031
12032
12034 {
12036 }
12037
12039 {
12041 }
12042
12043 override void InsertAgent(
int agent,
float count = 1)
12044 {
12045 if (count < 1)
12046 return;
12047
12049 }
12050
12053 {
12055 }
12056
12057
12059 {
12061 }
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12105 {
12107 return false;
12108 return true;
12109 }
12110
12112 {
12113
12115 }
12116
12117
12120 {
12121 super.CheckForRoofLimited(timeTresholdMS);
12122
12124 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12125 {
12126 m_PreviousRoofTestTime = time;
12127 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12128 }
12129 }
12130
12131
12133 {
12135 {
12136 return 0;
12137 }
12138
12139 if (GetInventory().GetAttachmentSlotsCount() != 0)
12140 {
12141 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12142 if (filter)
12143 return filter.GetProtectionLevel(type, false, system);
12144 else
12145 return 0;
12146 }
12147
12148 string subclassPath, entryName;
12149
12150 switch (type)
12151 {
12153 entryName = "biological";
12154 break;
12156 entryName = "chemical";
12157 break;
12158 default:
12159 entryName = "biological";
12160 break;
12161 }
12162
12163 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12164
12166 }
12167
12168
12169
12172 {
12173 if (!IsMagazine())
12175
12177 }
12178
12179
12180
12181
12182
12187 {
12188 return true;
12189 }
12190
12192 {
12194 }
12195
12196
12197
12198
12199
12201 {
12202 if (parent)
12203 {
12204 if (parent.IsInherited(DayZInfected))
12205 return true;
12206
12207 if (!parent.IsRuined())
12208 return true;
12209 }
12210
12211 return true;
12212 }
12213
12215 {
12216 if (!super.CanPutAsAttachment(parent))
12217 {
12218 return false;
12219 }
12220
12221 if (!IsRuined() && !parent.IsRuined())
12222 {
12223 return true;
12224 }
12225
12226 return false;
12227 }
12228
12230 {
12231
12232
12233
12234
12235 return super.CanReceiveItemIntoCargo(item);
12236 }
12237
12239 {
12240
12241
12242
12243
12244 GameInventory attachmentInv = attachment.GetInventory();
12246 {
12247 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12248 return false;
12249 }
12250
12251 InventoryLocation loc = new InventoryLocation();
12252 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12253 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12254 return false;
12255
12256 return super.CanReceiveAttachment(attachment, slotId);
12257 }
12258
12260 {
12261 if (!super.CanReleaseAttachment(attachment))
12262 return false;
12263
12264 return GetInventory().AreChildrenAccessible();
12265 }
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12288 {
12289 int id = muzzle_owner.GetMuzzleID();
12290 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12291
12292 if (WPOF_array)
12293 {
12294 for (int i = 0; i < WPOF_array.Count(); i++)
12295 {
12296 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12297
12298 if (WPOF)
12299 {
12300 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12301 }
12302 }
12303 }
12304 }
12305
12306
12308 {
12309 int id = muzzle_owner.GetMuzzleID();
12311
12312 if (WPOBE_array)
12313 {
12314 for (int i = 0; i < WPOBE_array.Count(); i++)
12315 {
12316 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12317
12318 if (WPOBE)
12319 {
12320 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12321 }
12322 }
12323 }
12324 }
12325
12326
12328 {
12329 int id = muzzle_owner.GetMuzzleID();
12330 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12331
12332 if (WPOOH_array)
12333 {
12334 for (int i = 0; i < WPOOH_array.Count(); i++)
12335 {
12336 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12337
12338 if (WPOOH)
12339 {
12340 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12341 }
12342 }
12343 }
12344 }
12345
12346
12348 {
12349 int id = muzzle_owner.GetMuzzleID();
12350 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12351
12352 if (WPOOH_array)
12353 {
12354 for (int i = 0; i < WPOOH_array.Count(); i++)
12355 {
12356 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12357
12358 if (WPOOH)
12359 {
12360 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12361 }
12362 }
12363 }
12364 }
12365
12366
12368 {
12369 int id = muzzle_owner.GetMuzzleID();
12370 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12371
12372 if (WPOOH_array)
12373 {
12374 for (int i = 0; i < WPOOH_array.Count(); i++)
12375 {
12376 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12377
12378 if (WPOOH)
12379 {
12380 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12381 }
12382 }
12383 }
12384 }
12385
12386
12387
12389 {
12391 {
12392 return true;
12393 }
12394
12395 return false;
12396 }
12397
12399 {
12401 {
12402 return true;
12403 }
12404
12405 return false;
12406 }
12407
12409 {
12411 {
12412 return true;
12413 }
12414
12415 return false;
12416 }
12417
12419 {
12420 return false;
12421 }
12422
12425 {
12426 return UATimeSpent.DEFAULT_DEPLOY;
12427 }
12428
12429
12430
12431
12433 {
12435 SetSynchDirty();
12436 }
12437
12439 {
12441 }
12442
12443
12445 {
12446 return false;
12447 }
12448
12451 {
12452 string att_type = "None";
12453
12454 if (ConfigIsExisting("soundAttType"))
12455 {
12456 att_type = ConfigGetString("soundAttType");
12457 }
12458
12460 }
12461
12463 {
12465 }
12466
12467
12468
12469
12470
12474
12476 {
12479
12481 }
12482
12483
12485 {
12487 return;
12488
12490
12493
12496
12497 SoundParameters params = new SoundParameters();
12501 }
12502
12503
12505 {
12507 return;
12508
12510 SetSynchDirty();
12511
12514 }
12515
12516
12518 {
12520 return;
12521
12523 SetSynchDirty();
12524
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 }
12538
12541 {
12542 if (!
GetGame().IsDedicatedServer())
12543 {
12544 if (ConfigIsExisting("attachSoundSet"))
12545 {
12546 string cfg_path = "";
12547 string soundset = "";
12548 string type_name =
GetType();
12549
12552 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12553 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12554
12555 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12556 {
12557 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12558 {
12559 if (cfg_slot_array[i] == slot_type)
12560 {
12561 soundset = cfg_soundset_array[i];
12562 break;
12563 }
12564 }
12565 }
12566
12567 if (soundset != "")
12568 {
12569 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12571 }
12572 }
12573 }
12574 }
12575
12577 {
12578
12579 }
12580
12581 void OnApply(PlayerBase player);
12582
12584 {
12585 return 1.0;
12586 };
12587
12589 {
12591 }
12592
12594 {
12596 }
12597
12599
12601 {
12602 SetDynamicPhysicsLifeTime(0.01);
12604 }
12605
12607 {
12608 array<string> zone_names = new array<string>;
12609 GetDamageZones(zone_names);
12610 for (int i = 0; i < zone_names.Count(); i++)
12611 {
12612 SetHealthMax(zone_names.Get(i),"Health");
12613 }
12614 SetHealthMax("","Health");
12615 }
12616
12619 {
12620 float global_health = GetHealth01("","Health");
12621 array<string> zones = new array<string>;
12622 GetDamageZones(zones);
12623
12624 for (int i = 0; i < zones.Count(); i++)
12625 {
12626 SetHealth01(zones.Get(i),"Health",global_health);
12627 }
12628 }
12629
12632 {
12633 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12634 }
12635
12637 {
12638 if (!hasRootAsPlayer)
12639 {
12640 if (refParentIB)
12641 {
12642
12643 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12644 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12645
12646 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12647 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12648
12651 }
12652 else
12653 {
12654
12657 }
12658 }
12659 }
12660
12662 {
12664 {
12665 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12666 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12667 {
12668 float heatPermCoef = 1.0;
12670 while (ent)
12671 {
12672 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12673 ent = ent.GetHierarchyParent();
12674 }
12675
12676 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12677 }
12678 }
12679 }
12680
12682 {
12683
12684 EntityAI parent = GetHierarchyParent();
12685 if (!parent)
12686 {
12687 hasParent = false;
12688 hasRootAsPlayer = false;
12689 }
12690 else
12691 {
12692 hasParent = true;
12693 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12694 refParentIB =
ItemBase.Cast(parent);
12695 }
12696 }
12697
12698 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12699 {
12700
12701 }
12702
12704 {
12705
12706 return false;
12707 }
12708
12710 {
12711
12712
12713 return false;
12714 }
12715
12717 {
12718
12719 return false;
12720 }
12721
12724 {
12725 return !GetIsFrozen() &&
IsOpen();
12726 }
12727
12729 {
12730 bool hasParent = false, hasRootAsPlayer = false;
12732
12733 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12734 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12735
12736 if (wwtu || foodDecay)
12737 {
12741
12742 if (processWetness || processTemperature || processDecay)
12743 {
12745
12746 if (processWetness)
12747 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12748
12749 if (processTemperature)
12751
12752 if (processDecay)
12753 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12754 }
12755 }
12756 }
12757
12760 {
12762 }
12763
12765 {
12768
12769 return super.GetTemperatureFreezeThreshold();
12770 }
12771
12773 {
12776
12777 return super.GetTemperatureThawThreshold();
12778 }
12779
12781 {
12784
12785 return super.GetItemOverheatThreshold();
12786 }
12787
12789 {
12791 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12792
12793 return super.GetTemperatureFreezeTime();
12794 }
12795
12797 {
12799 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12800
12801 return super.GetTemperatureThawTime();
12802 }
12803
12808
12810 {
12811 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12812 }
12813
12815 {
12816 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12817 }
12818
12821 {
12823 }
12824
12826 {
12828 }
12829
12831 {
12833 }
12834
12837 {
12838 return null;
12839 }
12840
12843 {
12844 return false;
12845 }
12846
12848 {
12850 {
12853 if (!trg)
12854 {
12856 explosive = this;
12857 }
12858
12859 explosive.PairRemote(trg);
12861
12862 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12863 trg.SetPersistentPairID(persistentID);
12864 explosive.SetPersistentPairID(persistentID);
12865
12866 return true;
12867 }
12868 return false;
12869 }
12870
12873 {
12874 float ret = 1.0;
12877 ret *= GetHealth01();
12878
12879 return ret;
12880 }
12881
12882 #ifdef DEVELOPER
12883 override void SetDebugItem()
12884 {
12885 super.SetDebugItem();
12886 _itemBase = this;
12887 }
12888
12890 {
12891 string text = super.GetDebugText();
12892
12894 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12895
12896 return text;
12897 }
12898 #endif
12899
12901 {
12902 return true;
12903 }
12904
12906
12908
12910 {
12913 }
12914
12915
12923
12939}
12940
12942{
12944 if (entity)
12945 {
12946 bool is_item = entity.IsInherited(
ItemBase);
12947 if (is_item && full_quantity)
12948 {
12951 }
12952 }
12953 else
12954 {
12956 return NULL;
12957 }
12958 return entity;
12959}
12960
12962{
12963 if (item)
12964 {
12965 if (health > 0)
12966 item.SetHealth("", "", health);
12967
12968 if (item.CanHaveTemperature())
12969 {
12971 if (item.CanFreeze())
12972 item.SetFrozen(false);
12973 }
12974
12975 if (item.HasEnergyManager())
12976 {
12977 if (quantity >= 0)
12978 {
12979 item.GetCompEM().SetEnergy0To1(quantity);
12980 }
12981 else
12982 {
12984 }
12985 }
12986 else if (item.IsMagazine())
12987 {
12988 Magazine mag = Magazine.Cast(item);
12989 if (quantity >= 0)
12990 {
12991 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12992 }
12993 else
12994 {
12996 }
12997
12998 }
12999 else
13000 {
13001 if (quantity >= 0)
13002 {
13003 item.SetQuantityNormalized(quantity, false);
13004 }
13005 else
13006 {
13008 }
13009
13010 }
13011 }
13012}
13013
13014#ifdef DEVELOPER
13016#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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 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...
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)
void StartItemSoundServer(int id)
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.