8178{
8180 {
8181 return true;
8182 }
8183};
8184
8185
8186
8188{
8192
8194
8197
8198
8199
8200
8201
8210
8216
8221
8226
8247 protected bool m_IsResultOfSplit
8248
8250
8255
8256
8257
8259
8263
8264
8265
8267
8270
8271
8272
8278
8279
8287
8290
8291
8293
8294
8296
8297
8302
8303
8308
8309
8311
8312
8314 {
8319
8320 if (!
GetGame().IsDedicatedServer())
8321 {
8323 {
8325
8327 {
8329 }
8330 }
8331
8334 }
8335
8336 m_OldLocation = null;
8337
8339 {
8341 }
8342
8343 if (ConfigIsExisting("headSelectionsToHide"))
8344 {
8347 }
8348
8350 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8351 {
8353 }
8354
8356
8357 m_IsResultOfSplit = false;
8358
8360 }
8361
8363 {
8364 super.InitItemVariables();
8365
8371 m_Count = ConfigGetInt(
"count");
8372
8375
8380
8383
8388
8400
8404
8405
8408 if (ConfigIsExisting("canBeSplit"))
8409 {
8412 }
8413
8415 if (ConfigIsExisting("itemBehaviour"))
8417
8418
8421 RegisterNetSyncVariableInt("m_VarLiquidType");
8422 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8423
8424 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8425 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8426 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8427
8428 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8429 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8430 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8431 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8432
8433 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8434 RegisterNetSyncVariableBool("m_IsTakeable");
8435 RegisterNetSyncVariableBool("m_IsHologram");
8436
8439 {
8442 }
8443
8445
8447 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8449
8450 }
8451
8453 {
8455 }
8456
8458 {
8461 {
8466 }
8467 }
8468
8469 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8470 {
8472 {
8475 }
8476
8478 }
8479
8481 {
8487 }
8488
8490
8492 {
8494
8495 if (!action)
8496 {
8497 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8498 return;
8499 }
8500
8502 if (!ai)
8503 {
8505 return;
8506 }
8507
8509 if (!action_array)
8510 {
8511 action_array = new array<ActionBase_Basic>;
8513 }
8514 if (LogManager.IsActionLogEnable())
8515 {
8516 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8517 }
8518
8519 if (action_array.Find(action) != -1)
8520 {
8521 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8522 }
8523 else
8524 {
8525 action_array.Insert(action);
8526 }
8527 }
8528
8530 {
8532 ActionBase action = player.GetActionManager().GetAction(actionName);
8535
8536 if (action_array)
8537 {
8538 action_array.RemoveItem(action);
8539 }
8540 }
8541
8542
8543
8545 {
8546 ActionOverrideData overrideData = new ActionOverrideData();
8550
8552 if (!actionMap)
8553 {
8556 }
8557
8558 actionMap.Insert(this.
Type(), overrideData);
8559
8560 }
8561
8563
8565
8566
8568 {
8571
8574
8575 string config_to_search = "CfgVehicles";
8576 string muzzle_owner_config;
8577
8579 {
8580 if (IsInherited(Weapon))
8581 config_to_search = "CfgWeapons";
8582
8583 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8584
8585 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8586
8588
8589 if (config_OnFire_subclass_count > 0)
8590 {
8591 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8592
8593 for (int i = 0; i < config_OnFire_subclass_count; i++)
8594 {
8595 string particle_class = "";
8597 string config_OnFire_entry = config_OnFire_class + particle_class;
8598 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8599 WPOF_array.Insert(WPOF);
8600 }
8601
8602
8604 }
8605 }
8606
8608 {
8609 config_to_search = "CfgWeapons";
8610 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8611
8612 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8613
8615
8616 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8617 {
8618 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8619
8620 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8621 {
8622 string particle_class2 = "";
8624 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8625 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8626 WPOBE_array.Insert(WPOBE);
8627 }
8628
8629
8631 }
8632 }
8633 }
8634
8635
8637 {
8640
8642 {
8643 string config_to_search = "CfgVehicles";
8644
8645 if (IsInherited(Weapon))
8646 config_to_search = "CfgWeapons";
8647
8648 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8649 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8650
8651 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8652 {
8653
8655
8657 {
8659 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8661 return;
8662 }
8663
8666
8667
8668
8670 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8671
8672 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8673 {
8674 string particle_class = "";
8676 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8678
8679 if (entry_type == CT_CLASS)
8680 {
8681 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8682 WPOOH_array.Insert(WPOF);
8683 }
8684 }
8685
8686
8688 }
8689 }
8690 }
8691
8693 {
8695 }
8696
8698 {
8700 {
8702
8705
8708
8709 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8710 }
8711 }
8712
8714 {
8716 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8717
8719 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8720
8722 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8723
8725 {
8727 }
8728 }
8729
8731 {
8733 }
8734
8736 {
8739 else
8741
8743 {
8746 }
8747 else
8748 {
8751
8754 }
8755
8757 }
8758
8760 {
8762 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8763 }
8764
8766 {
8768 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8770 }
8771
8773 {
8775 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8776 }
8777
8779 {
8782
8783 OverheatingParticle OP = new OverheatingParticle();
8788
8790 }
8791
8793 {
8796
8797 return -1;
8798 }
8799
8801 {
8803 {
8806
8807 for (int i = count; i > 0; --i)
8808 {
8809 int id = i - 1;
8812
8815
8816 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8817 {
8818 if (p)
8819 {
8822 }
8823 }
8824 }
8825 }
8826 }
8827
8829 {
8831 {
8833 {
8834 int id = i - 1;
8836
8837 if (OP)
8838 {
8840
8841 if (p)
8842 {
8844 }
8845
8846 delete OP;
8847 }
8848 }
8849
8852 }
8853 }
8854
8857 {
8858 return 0.0;
8859 }
8860
8861
8863 {
8864 return 250;
8865 }
8866
8868 {
8869 return 0;
8870 }
8871
8874 {
8876 return true;
8877
8878 return false;
8879 }
8880
8883 {
8886
8888 {
8890 }
8891 else
8892 {
8893
8895 }
8896
8898 }
8899
8906 {
8907 return -1;
8908 }
8909
8910
8911
8912
8914 {
8916 {
8918 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8919
8920 if (r_index >= 0)
8921 {
8922 InventoryLocation r_il = new InventoryLocation;
8923 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8924
8925 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8928 {
8929 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8930 }
8932 {
8933 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8934 }
8935
8936 }
8937
8938 player.GetHumanInventory().ClearUserReservedLocation(this);
8939 }
8940
8943 }
8944
8945
8946
8947
8949 {
8950 return ItemBase.m_DebugActionsMask;
8951 }
8952
8954 {
8955 return ItemBase.m_DebugActionsMask & mask;
8956 }
8957
8959 {
8960 ItemBase.m_DebugActionsMask = mask;
8961 }
8962
8964 {
8965 ItemBase.m_DebugActionsMask |= mask;
8966 }
8967
8969 {
8970 ItemBase.m_DebugActionsMask &= ~mask;
8971 }
8972
8974 {
8976 {
8978 }
8979 else
8980 {
8982 }
8983 }
8984
8985
8987 {
8988 if (GetEconomyProfile())
8989 {
8990 float q_max = GetEconomyProfile().GetQuantityMax();
8991 if (q_max > 0)
8992 {
8993 float q_min = GetEconomyProfile().GetQuantityMin();
8994 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8995
8997 {
8998 ComponentEnergyManager comp = GetCompEM();
9000 {
9002 }
9003 }
9005 {
9007
9008 }
9009
9010 }
9011 }
9012 }
9013
9016 {
9017 EntityAI parent = GetHierarchyParent();
9018
9019 if (parent)
9020 {
9021 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9022 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9023 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9024 }
9025 }
9026
9029 {
9030 EntityAI parent = GetHierarchyParent();
9031
9032 if (parent)
9033 {
9034 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9035 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9036 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9037 }
9038 }
9039
9041 {
9042
9043
9044
9045
9047
9049 {
9050 if (ScriptInputUserData.CanStoreInputUserData())
9051 {
9052 ScriptInputUserData ctx = new ScriptInputUserData;
9058 ctx.
Write(use_stack_max);
9061
9063 {
9064 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9065 }
9066 }
9067 }
9068 else if (!
GetGame().IsMultiplayer())
9069 {
9071 }
9072 }
9073
9075 {
9077 }
9078
9080 {
9082 }
9083
9085 {
9087 }
9088
9090 {
9091
9092 return false;
9093 }
9094
9096 {
9097 return false;
9098 }
9099
9103 {
9104 return false;
9105 }
9106
9108 {
9109 return "";
9110 }
9111
9113
9115 {
9116 return false;
9117 }
9118
9120 {
9121 return true;
9122 }
9123
9124
9125
9127 {
9128 return true;
9129 }
9130
9132 {
9133 return true;
9134 }
9135
9137 {
9138 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9140 }
9141
9143 {
9145 }
9146
9148 {
9150 if (!is_being_placed)
9152 SetSynchDirty();
9153 }
9154
9155
9157
9159 {
9161 }
9162
9164 {
9166 }
9167
9169 {
9170 return 1;
9171 }
9172
9174 {
9175 return false;
9176 }
9177
9179 {
9181 SetSynchDirty();
9182 }
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9219 {
9220 super.OnMovedInsideCargo(container);
9221
9222 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9223 }
9224
9225 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9226 {
9227 super.EEItemLocationChanged(oldLoc,newLoc);
9228
9229 PlayerBase new_player = null;
9230 PlayerBase old_player = null;
9231
9232 if (newLoc.GetParent())
9233 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9234
9235 if (oldLoc.GetParent())
9236 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9237
9239 {
9240 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9241
9242 if (r_index >= 0)
9243 {
9244 InventoryLocation r_il = new InventoryLocation;
9245 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9246
9247 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9250 {
9251 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9252 }
9254 {
9255 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9256 }
9257
9258 }
9259 }
9260
9262 {
9263 if (new_player)
9264 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9265
9266 if (new_player == old_player)
9267 {
9268
9269 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9270 {
9272 {
9273 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9274 {
9275 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9276 }
9277 }
9278 else
9279 {
9280 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9281 }
9282 }
9283
9284 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9285 {
9286 int type = oldLoc.GetType();
9288 {
9289 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9290 }
9292 {
9293 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9294 }
9295 }
9296 if (!m_OldLocation)
9297 {
9298 m_OldLocation = new InventoryLocation;
9299 }
9300 m_OldLocation.Copy(oldLoc);
9301 }
9302 else
9303 {
9304 if (m_OldLocation)
9305 {
9306 m_OldLocation.Reset();
9307 }
9308 }
9309
9311 }
9312 else
9313 {
9314 if (new_player)
9315 {
9316 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9317 if (res_index >= 0)
9318 {
9319 InventoryLocation il = new InventoryLocation;
9320 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9322 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9325 {
9326 il.
GetParent().GetOnReleaseLock().Invoke(it);
9327 }
9329 {
9331 }
9332
9333 }
9334 }
9336 {
9337
9339 }
9340
9341 if (m_OldLocation)
9342 {
9343 m_OldLocation.Reset();
9344 }
9345 }
9346 }
9347
9348 override void EOnContact(IEntity other, Contact extra)
9349 {
9351 {
9352 int liquidType = -1;
9354 if (impactSpeed > 0.0)
9355 {
9357 #ifndef SERVER
9359 #else
9361 SetSynchDirty();
9362 #endif
9364 }
9365 }
9366
9367 #ifdef SERVER
9368 if (GetCompEM() && GetCompEM().IsPlugged())
9369 {
9370 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9371 GetCompEM().UnplugThis();
9372 }
9373 #endif
9374 }
9375
9377
9379 {
9381 }
9382
9384 {
9385
9386 }
9387
9389 {
9390 super.OnItemLocationChanged(old_owner, new_owner);
9391
9392 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9393 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9394
9395 if (!relatedPlayer && playerNew)
9396 relatedPlayer = playerNew;
9397
9398 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9399 {
9401 if (actionMgr)
9402 {
9403 ActionBase currentAction = actionMgr.GetRunningAction();
9404 if (currentAction)
9406 }
9407 }
9408
9409 Man ownerPlayerOld = null;
9410 Man ownerPlayerNew = null;
9411
9412 if (old_owner)
9413 {
9414 if (old_owner.
IsMan())
9415 {
9416 ownerPlayerOld = Man.Cast(old_owner);
9417 }
9418 else
9419 {
9420 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9421 }
9422 }
9423 else
9424 {
9426 {
9428
9429 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9430 {
9431 GetCompEM().UnplugThis();
9432 }
9433 }
9434 }
9435
9436 if (new_owner)
9437 {
9438 if (new_owner.
IsMan())
9439 {
9440 ownerPlayerNew = Man.Cast(new_owner);
9441 }
9442 else
9443 {
9444 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9445 }
9446 }
9447
9448 if (ownerPlayerOld != ownerPlayerNew)
9449 {
9450 if (ownerPlayerOld)
9451 {
9452 array<EntityAI> subItemsExit = new array<EntityAI>;
9454 for (int i = 0; i < subItemsExit.Count(); i++)
9455 {
9458 }
9459 }
9460
9461 if (ownerPlayerNew)
9462 {
9463 array<EntityAI> subItemsEnter = new array<EntityAI>;
9465 for (int j = 0; j < subItemsEnter.Count(); j++)
9466 {
9469 }
9470 }
9471 }
9472 else if (ownerPlayerNew != null)
9473 {
9474 PlayerBase nplayer;
9475 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9476 {
9477 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9479 for (int k = 0; k < subItemsUpdate.Count(); k++)
9480 {
9482 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9483 }
9484 }
9485 }
9486
9487 if (old_owner)
9488 old_owner.OnChildItemRemoved(this);
9489 if (new_owner)
9490 new_owner.OnChildItemReceived(this);
9491 }
9492
9493
9495 {
9496 super.EEDelete(parent);
9497 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9498 if (player)
9499 {
9501
9502 if (player.IsAlive())
9503 {
9504 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9505 if (r_index >= 0)
9506 {
9507 InventoryLocation r_il = new InventoryLocation;
9508 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9509
9510 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9513 {
9514 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9515 }
9517 {
9518 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9519 }
9520
9521 }
9522
9523 player.RemoveQuickBarEntityShortcut(this);
9524 }
9525 }
9526 }
9527
9529 {
9530 super.EEKilled(killer);
9531
9534 {
9535 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9536 {
9537 if (IsMagazine())
9538 {
9539 if (Magazine.Cast(this).GetAmmoCount() > 0)
9540 {
9542 }
9543 }
9544 else
9545 {
9547 }
9548 }
9549 }
9550 }
9551
9553 {
9554 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9555
9556 super.OnWasAttached(parent, slot_id);
9557
9560
9562 }
9563
9565 {
9566 super.OnWasDetached(parent, slot_id);
9567
9570 }
9571
9573 {
9574 int idx;
9577
9578 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9579 if (inventory_slots.Count() < 1)
9580 {
9581 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9582 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9583 }
9584 else
9585 {
9586 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9587 }
9588
9589 idx = inventory_slots.Find(slot);
9590 if (idx < 0)
9591 return "";
9592
9593 return attach_types.Get(idx);
9594 }
9595
9597 {
9598 int idx = -1;
9599 string slot;
9600
9603
9604 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9605 if (inventory_slots.Count() < 1)
9606 {
9607 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9608 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9609 }
9610 else
9611 {
9612 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9613 if (detach_types.Count() < 1)
9614 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9615 }
9616
9617 for (int i = 0; i < inventory_slots.Count(); i++)
9618 {
9619 slot = inventory_slots.Get(i);
9620 }
9621
9622 if (slot != "")
9623 {
9624 if (detach_types.Count() == 1)
9625 idx = 0;
9626 else
9627 idx = inventory_slots.Find(slot);
9628 }
9629 if (idx < 0)
9630 return "";
9631
9632 return detach_types.Get(idx);
9633 }
9634
9636 {
9637
9639
9640
9641 float min_time = 1;
9642 float max_time = 3;
9643 float delay = Math.RandomFloat(min_time, max_time);
9644
9645 explode_timer.Run(delay, this, "DoAmmoExplosion");
9646 }
9647
9649 {
9650 Magazine magazine = Magazine.Cast(this);
9651 int pop_sounds_count = 6;
9652 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9653
9654
9655 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9656 string sound_name = pop_sounds[ sound_idx ];
9658
9659
9660 magazine.ServerAddAmmoCount(-1);
9661
9662
9663 float min_temp_to_explode = 100;
9664
9665 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
9666 {
9668 }
9669 }
9670
9671
9672 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9673 {
9674 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9675
9676 const int CHANCE_DAMAGE_CARGO = 4;
9677 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9678 const int CHANCE_DAMAGE_NOTHING = 2;
9679
9681 {
9682 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9683 int chances;
9684 int rnd;
9685
9686 if (GetInventory().GetCargo())
9687 {
9688 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9689 rnd = Math.RandomInt(0,chances);
9690
9691 if (rnd < CHANCE_DAMAGE_CARGO)
9692 {
9694 }
9695 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9696 {
9698 }
9699 }
9700 else
9701 {
9702 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9703 rnd = Math.RandomInt(0,chances);
9704
9705 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9706 {
9708 }
9709 }
9710 }
9711 }
9712
9714 {
9715 if (GetInventory().GetCargo())
9716 {
9717 int item_count = GetInventory().GetCargo().GetItemCount();
9718 if (item_count > 0)
9719 {
9720 int random_pick = Math.RandomInt(0, item_count);
9722 if (!item.IsExplosive())
9723 {
9724 item.AddHealth("","",damage);
9725 return true;
9726 }
9727 }
9728 }
9729 return false;
9730 }
9731
9733 {
9734 int attachment_count = GetInventory().AttachmentCount();
9735 if (attachment_count > 0)
9736 {
9737 int random_pick = Math.RandomInt(0, attachment_count);
9738 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9739 if (!attachment.IsExplosive())
9740 {
9741 attachment.AddHealth("","",damage);
9742 return true;
9743 }
9744 }
9745 return false;
9746 }
9747
9749 {
9751 }
9752
9754 {
9756 return GetInventory().CanRemoveEntity();
9757
9758 return false;
9759 }
9760
9762 {
9764 return;
9765
9767 {
9768 if (ScriptInputUserData.CanStoreInputUserData())
9769 {
9770 ScriptInputUserData ctx = new ScriptInputUserData;
9775 ctx.
Write(destination_entity);
9779 }
9780 }
9781 else if (!
GetGame().IsMultiplayer())
9782 {
9784 }
9785 }
9786
9788 {
9790 return;
9791
9792 float split_quantity_new;
9796 InventoryLocation loc = new InventoryLocation;
9797
9798 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9799 {
9801 split_quantity_new = stack_max;
9802 else
9804
9805 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9806 if (new_item)
9807 {
9808 new_item.SetResultOfSplit(true);
9809 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9811 new_item.SetQuantity(split_quantity_new);
9812 }
9813 }
9814 else if (destination_entity && slot_id == -1)
9815 {
9816 if (quantity > stack_max)
9817 split_quantity_new = stack_max;
9818 else
9819 split_quantity_new = quantity;
9820
9822 {
9825 }
9826
9827 if (new_item)
9828 {
9829 new_item.SetResultOfSplit(true);
9830 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9832 new_item.SetQuantity(split_quantity_new);
9833 }
9834 }
9835 else
9836 {
9837 if (stack_max != 0)
9838 {
9840 {
9842 }
9843
9844 if (split_quantity_new == 0)
9845 {
9846 if (!
GetGame().IsMultiplayer())
9847 player.PhysicalPredictiveDropItem(this);
9848 else
9849 player.ServerDropEntity(this);
9850 return;
9851 }
9852
9854
9855 if (new_item)
9856 {
9857 new_item.SetResultOfSplit(true);
9858 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9860 new_item.SetQuantity(stack_max);
9861 new_item.PlaceOnSurface();
9862 }
9863 }
9864 }
9865 }
9866
9868 {
9870 return;
9871
9872 float split_quantity_new;
9876 InventoryLocation loc = new InventoryLocation;
9877
9878 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9879 {
9881 split_quantity_new = stack_max;
9882 else
9884
9885 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9886 if (new_item)
9887 {
9888 new_item.SetResultOfSplit(true);
9889 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9891 new_item.SetQuantity(split_quantity_new);
9892 }
9893 }
9894 else if (destination_entity && slot_id == -1)
9895 {
9896 if (quantity > stack_max)
9897 split_quantity_new = stack_max;
9898 else
9899 split_quantity_new = quantity;
9900
9902 {
9905 }
9906
9907 if (new_item)
9908 {
9909 new_item.SetResultOfSplit(true);
9910 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9912 new_item.SetQuantity(split_quantity_new);
9913 }
9914 }
9915 else
9916 {
9917 if (stack_max != 0)
9918 {
9920 {
9922 }
9923
9925
9926 if (new_item)
9927 {
9928 new_item.SetResultOfSplit(true);
9929 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9931 new_item.SetQuantity(stack_max);
9932 new_item.PlaceOnSurface();
9933 }
9934 }
9935 }
9936 }
9937
9939 {
9941 return;
9942
9944 {
9945 if (ScriptInputUserData.CanStoreInputUserData())
9946 {
9947 ScriptInputUserData ctx = new ScriptInputUserData;
9952 dst.WriteToContext(ctx);
9954 }
9955 }
9956 else if (!
GetGame().IsMultiplayer())
9957 {
9959 }
9960 }
9961
9963 {
9965 return;
9966
9968 {
9969 if (ScriptInputUserData.CanStoreInputUserData())
9970 {
9971 ScriptInputUserData ctx = new ScriptInputUserData;
9976 ctx.
Write(destination_entity);
9982 }
9983 }
9984 else if (!
GetGame().IsMultiplayer())
9985 {
9987 }
9988 }
9989
9991 {
9993 }
9994
9996 {
9998 return this;
9999
10001 float split_quantity_new;
10003 if (dst.IsValid())
10004 {
10005 int slot_id = dst.GetSlot();
10007
10008 if (quantity > stack_max)
10009 split_quantity_new = stack_max;
10010 else
10011 split_quantity_new = quantity;
10012
10014
10015 if (new_item)
10016 {
10017 new_item.SetResultOfSplit(true);
10018 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10021 }
10022
10023 return new_item;
10024 }
10025
10026 return null;
10027 }
10028
10030 {
10032 return;
10033
10035 float split_quantity_new;
10037 if (destination_entity)
10038 {
10040 if (quantity > stackable)
10041 split_quantity_new = stackable;
10042 else
10043 split_quantity_new = quantity;
10044
10045 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10046 if (new_item)
10047 {
10048 new_item.SetResultOfSplit(true);
10049 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10051 new_item.SetQuantity(split_quantity_new);
10052 }
10053 }
10054 }
10055
10057 {
10059 return;
10060
10062 {
10063 if (ScriptInputUserData.CanStoreInputUserData())
10064 {
10065 ScriptInputUserData ctx = new ScriptInputUserData;
10070 ItemBase destination_entity =
this;
10071 ctx.
Write(destination_entity);
10075 }
10076 }
10077 else if (!
GetGame().IsMultiplayer())
10078 {
10080 }
10081 }
10082
10084 {
10086 return;
10087
10089 float split_quantity_new;
10091 if (player)
10092 {
10094 if (quantity > stackable)
10095 split_quantity_new = stackable;
10096 else
10097 split_quantity_new = quantity;
10098
10099 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10100 new_item =
ItemBase.Cast(in_hands);
10101 if (new_item)
10102 {
10103 new_item.SetResultOfSplit(true);
10104 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10106 new_item.SetQuantity(split_quantity_new);
10107 }
10108 }
10109 }
10110
10112 {
10114 return;
10115
10117 float split_quantity_new = Math.Floor(quantity * 0.5);
10118
10120
10121 if (new_item)
10122 {
10123 if (new_item.GetQuantityMax() < split_quantity_new)
10124 {
10125 split_quantity_new = new_item.GetQuantityMax();
10126 }
10127
10128 new_item.SetResultOfSplit(true);
10129 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10130
10132 {
10135 }
10136 else
10137 {
10140 }
10141 }
10142 }
10143
10145 {
10147 return;
10148
10150 float split_quantity_new = Math.Floor(quantity / 2);
10151
10152 InventoryLocation invloc = new InventoryLocation;
10154
10156 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10157
10158 if (new_item)
10159 {
10160 if (new_item.GetQuantityMax() < split_quantity_new)
10161 {
10162 split_quantity_new = new_item.GetQuantityMax();
10163 }
10165 {
10168 }
10169 else
10170 {
10173 }
10174 }
10175 }
10176
10179 {
10180 SetWeightDirty();
10182
10183 if (parent)
10184 parent.OnAttachmentQuantityChangedEx(this, delta);
10185
10187 {
10189 {
10191 }
10193 {
10194 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10196 }
10197 }
10198
10199 }
10200
10203 {
10204
10205 }
10206
10209 {
10211 }
10212
10214 {
10215 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10216
10218 {
10219 if (newLevel == GameConstants.STATE_RUINED)
10220 {
10222 EntityAI parent = GetHierarchyParent();
10223 if (parent && parent.IsFireplace())
10224 {
10225 CargoBase cargo = GetInventory().GetCargo();
10226 if (cargo)
10227 {
10229 {
10231 }
10232 }
10233 }
10234 }
10235
10237 {
10238
10240 return;
10241 }
10242
10243 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10244 {
10246 }
10247 }
10248 }
10249
10250
10252 {
10253 super.OnRightClick();
10254
10256 {
10258 {
10259 if (ScriptInputUserData.CanStoreInputUserData())
10260 {
10261 vector m4[4];
10263
10264 EntityAI root = GetHierarchyRoot();
10265
10266 InventoryLocation dst = new InventoryLocation;
10268 {
10269 if (root)
10270 {
10271 root.GetTransform(m4);
10273 }
10274 else
10275 GetInventory().GetCurrentInventoryLocation(dst);
10276 }
10277 else
10278 {
10280
10281
10282 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10283 {
10284 if (root)
10285 {
10286 root.GetTransform(m4);
10288 }
10289 else
10290 GetInventory().GetCurrentInventoryLocation(dst);
10291 }
10292 else
10293 {
10294 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10295 }
10296 }
10297
10298 ScriptInputUserData ctx = new ScriptInputUserData;
10306 }
10307 }
10308 else if (!
GetGame().IsMultiplayer())
10309 {
10311 }
10312 }
10313 }
10314
10315 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10316 {
10317
10318 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10319 return false;
10320
10321 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10322 return false;
10323
10324
10326 return false;
10327
10328
10329 Magazine mag = Magazine.Cast(this);
10330 if (mag)
10331 {
10332 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10333 return false;
10334
10335 if (stack_max_limit)
10336 {
10337 Magazine other_mag = Magazine.Cast(other_item);
10338 if (other_item)
10339 {
10340 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10341 return false;
10342 }
10343
10344 }
10345 }
10346 else
10347 {
10348
10350 return false;
10351
10353 return false;
10354 }
10355
10356 PlayerBase player = null;
10357 if (CastTo(player, GetHierarchyRootPlayer()))
10358 {
10359 if (player.GetInventory().HasAttachment(this))
10360 return false;
10361
10362 if (player.IsItemsToDelete())
10363 return false;
10364 }
10365
10366 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10367 return false;
10368
10369 int slotID;
10371 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10372 return false;
10373
10374 return true;
10375 }
10376
10378 {
10380 }
10381
10383 {
10384 return m_IsResultOfSplit;
10385 }
10386
10388 {
10389 m_IsResultOfSplit = value;
10390 }
10391
10393 {
10395 }
10396
10398 {
10399 float other_item_quantity = other_item.GetQuantity();
10400 float this_free_space;
10401
10403
10405
10406 if (other_item_quantity > this_free_space)
10407 {
10408 return this_free_space;
10409 }
10410 else
10411 {
10412 return other_item_quantity;
10413 }
10414 }
10415
10417 {
10419 }
10420
10422 {
10424 return;
10425
10426 if (!IsMagazine() && other_item)
10427 {
10429 if (quantity_used != 0)
10430 {
10431 float hp1 = GetHealth01("","");
10432 float hp2 = other_item.GetHealth01("","");
10433 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10434 hpResult = hpResult / (
GetQuantity() + quantity_used);
10435
10436 hpResult *= GetMaxHealth();
10437 Math.Round(hpResult);
10438 SetHealth("", "Health", hpResult);
10439
10441 other_item.AddQuantity(-quantity_used);
10442 }
10443 }
10445 }
10446
10448 {
10449 #ifdef SERVER
10450 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10451 GetHierarchyParent().IncreaseLifetimeUp();
10452 #endif
10453 };
10454
10456 {
10457 PlayerBase p = PlayerBase.Cast(player);
10458
10459 array<int> recipesIds = p.m_Recipes;
10460 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10461 if (moduleRecipesManager)
10462 {
10463 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10464 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10465 }
10466
10467 for (int i = 0;i < recipesIds.Count(); i++)
10468 {
10469 int key = recipesIds.Get(i);
10470 string recipeName = moduleRecipesManager.GetRecipeName(key);
10472 }
10473 }
10474
10475
10476 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10477 {
10478 super.GetDebugActions(outputList);
10479
10480
10485
10486
10490
10494
10495
10498
10499
10501 {
10504 }
10505
10507
10510
10514 }
10515
10516
10517
10518
10520 {
10521 super.OnAction(action_id, player, ctx);
10522 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10523 {
10524 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10525 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10526 PlayerBase p = PlayerBase.Cast(player);
10527 if (
EActions.RECIPES_RANGE_START < 1000)
10528 {
10529 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10530 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10531 }
10532 }
10533 #ifndef SERVER
10534 else if (action_id ==
EActions.WATCH_PLAYER)
10535 {
10536 PluginDeveloper.SetDeveloperItemClientEx(player);
10537 }
10538 #endif
10540 {
10541 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10542 {
10543 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10544 OnDebugButtonPressServer(id + 1);
10545 }
10546
10547 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10548 {
10549 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10551 }
10552
10553 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10554 {
10555 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10557 }
10558
10559 else if (action_id ==
EActions.ADD_QUANTITY)
10560 {
10561 if (IsMagazine())
10562 {
10563 Magazine mag = Magazine.Cast(this);
10564 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10565 }
10566 else
10567 {
10569 }
10570
10571 if (m_EM)
10572 {
10573 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10574 }
10575
10576 }
10577
10578 else if (action_id ==
EActions.REMOVE_QUANTITY)
10579 {
10580 if (IsMagazine())
10581 {
10582 Magazine mag2 = Magazine.Cast(this);
10583 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10584 }
10585 else
10586 {
10588 }
10589 if (m_EM)
10590 {
10591 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10592 }
10593
10594 }
10595
10596 else if (action_id ==
EActions.SET_QUANTITY_0)
10597 {
10599
10600 if (m_EM)
10601 {
10602 m_EM.SetEnergy(0);
10603 }
10604 }
10605
10606 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10607 {
10609
10610 if (m_EM)
10611 {
10612 m_EM.SetEnergy(m_EM.GetEnergyMax());
10613 }
10614 }
10615
10616 else if (action_id ==
EActions.ADD_HEALTH)
10617 {
10618 AddHealth("","",GetMaxHealth("","Health")/5);
10619 }
10620 else if (action_id ==
EActions.REMOVE_HEALTH)
10621 {
10622 AddHealth("","",-GetMaxHealth("","Health")/5);
10623 }
10624 else if (action_id ==
EActions.DESTROY_HEALTH)
10625 {
10626 SetHealth01("","",0);
10627 }
10628 else if (action_id ==
EActions.WATCH_ITEM)
10629 {
10631 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10632 #ifdef DEVELOPER
10633 SetDebugDeveloper_item(this);
10634 #endif
10635 }
10636
10637 else if (action_id ==
EActions.ADD_TEMPERATURE)
10638 {
10639 AddTemperature(20);
10640
10641 }
10642
10643 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10644 {
10645 AddTemperature(-20);
10646
10647 }
10648
10649 else if (action_id ==
EActions.FLIP_FROZEN)
10650 {
10651 SetFrozen(!GetIsFrozen());
10652
10653 }
10654
10655 else if (action_id ==
EActions.ADD_WETNESS)
10656 {
10658
10659 }
10660
10661 else if (action_id ==
EActions.REMOVE_WETNESS)
10662 {
10664
10665 }
10666
10667 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10668 {
10671
10672
10673 }
10674
10675 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10676 {
10679 }
10680
10681 else if (action_id ==
EActions.MAKE_SPECIAL)
10682 {
10683 auto debugParams = DebugSpawnParams.WithPlayer(player);
10684 OnDebugSpawnEx(debugParams);
10685 }
10686
10687 else if (action_id ==
EActions.DELETE)
10688 {
10689 Delete();
10690 }
10691
10692 }
10693
10694
10695 return false;
10696 }
10697
10698
10699
10700
10704
10707
10708
10709
10711 {
10712 return false;
10713 }
10714
10715
10717 {
10718 return true;
10719 }
10720
10721
10723 {
10724 return true;
10725 }
10726
10727
10728
10730 {
10731 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10733 }
10734
10737 {
10738 return null;
10739 }
10740
10742 {
10743 return false;
10744 }
10745
10747 {
10748 return false;
10749 }
10750
10754
10755
10757 {
10758 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10759 return module_repairing.CanRepair(this, item_repair_kit);
10760 }
10761
10762
10763 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10764 {
10765 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10766 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10767 }
10768
10769
10771 {
10772
10773
10774
10775
10776
10777
10778
10779
10780 return 1;
10781 }
10782
10783
10784
10786 {
10788 }
10789
10790
10791
10793 {
10795 }
10796
10797
10806 {
10807 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10808
10809 if (player)
10810 {
10811 player.MessageStatus(text);
10812 }
10813 }
10814
10815
10824 {
10825 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10826
10827 if (player)
10828 {
10829 player.MessageAction(text);
10830 }
10831 }
10832
10833
10842 {
10843 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10844
10845 if (player)
10846 {
10847 player.MessageFriendly(text);
10848 }
10849 }
10850
10851
10860 {
10861 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10862
10863 if (player)
10864 {
10865 player.MessageImportant(text);
10866 }
10867 }
10868
10870 {
10871 return true;
10872 }
10873
10874
10875 override bool KindOf(
string tag)
10876 {
10877 bool found = false;
10878 string item_name = this.
GetType();
10881
10882 int array_size = item_tag_array.Count();
10883 for (int i = 0; i < array_size; i++)
10884 {
10885 if (item_tag_array.Get(i) == tag)
10886 {
10887 found = true;
10888 break;
10889 }
10890 }
10891 return found;
10892 }
10893
10894
10896 {
10897
10898 super.OnRPC(sender, rpc_type,ctx);
10899
10900
10901 switch (rpc_type)
10902 {
10903 #ifndef SERVER
10904 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10905 Param2<bool, string> p = new Param2<bool, string>(false, "");
10906
10908 return;
10909
10910 bool play = p.param1;
10911 string soundSet = p.param2;
10912
10913 if (play)
10914 {
10916 {
10918 {
10920 }
10921 }
10922 else
10923 {
10925 }
10926 }
10927 else
10928 {
10930 }
10931
10932 break;
10933 #endif
10934
10935 }
10936
10938 {
10940 }
10941 }
10942
10943
10944
10945
10947 {
10948 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10949 return plugin.GetID(
name);
10950 }
10951
10953 {
10954 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10955 return plugin.GetName(id);
10956 }
10957
10960 {
10961
10962
10963 int varFlags;
10964 if (!ctx.
Read(varFlags))
10965 return;
10966
10967 if (varFlags & ItemVariableFlags.FLOAT)
10968 {
10970 }
10971 }
10972
10974 {
10975
10976 super.SerializeNumericalVars(floats_out);
10977
10978
10979
10981 {
10983 }
10984
10986 {
10988 }
10989
10991 {
10993 }
10994
10996 {
11001 }
11002
11004 {
11006 }
11007 }
11008
11010 {
11011
11012 super.DeSerializeNumericalVars(floats);
11013
11014
11015 int index = 0;
11016 int mask = Math.Round(floats.Get(index));
11017
11018 index++;
11019
11021 {
11023 {
11025 }
11026 else
11027 {
11028 float quantity = floats.Get(index);
11029 SetQuantity(quantity,
true,
false,
false,
false);
11030 }
11031 index++;
11032 }
11033
11035 {
11036 float wet = floats.Get(index);
11038 index++;
11039 }
11040
11042 {
11043 int liquidtype = Math.Round(floats.Get(index));
11045 index++;
11046 }
11047
11049 {
11051 index++;
11053 index++;
11055 index++;
11057 index++;
11058 }
11059
11061 {
11062 int cleanness = Math.Round(floats.Get(index));
11064 index++;
11065 }
11066 }
11067
11069 {
11070 super.WriteVarsToCTX(ctx);
11071
11072
11074 {
11076 }
11077
11079 {
11081 }
11082
11084 {
11086 }
11087
11089 {
11090 int r,g,b,a;
11096 }
11097
11099 {
11101 }
11102 }
11103
11105 {
11106 if (!super.ReadVarsFromCTX(ctx,version))
11107 return false;
11108
11109 int intValue;
11110 float value;
11111
11112 if (version < 140)
11113 {
11114 if (!ctx.
Read(intValue))
11115 return false;
11116
11117 m_VariablesMask = intValue;
11118 }
11119
11121 {
11122 if (!ctx.
Read(value))
11123 return false;
11124
11126 {
11128 }
11129 else
11130 {
11132 }
11133 }
11134
11135 if (version < 140)
11136 {
11138 {
11139 if (!ctx.
Read(value))
11140 return false;
11141 SetTemperatureDirect(value);
11142 }
11143 }
11144
11146 {
11147 if (!ctx.
Read(value))
11148 return false;
11150 }
11151
11153 {
11154 if (!ctx.
Read(intValue))
11155 return false;
11157 }
11158
11160 {
11161 int r,g,b,a;
11163 return false;
11165 return false;
11167 return false;
11169 return false;
11170
11172 }
11173
11175 {
11176 if (!ctx.
Read(intValue))
11177 return false;
11179 }
11180
11181 if (version >= 138 && version < 140)
11182 {
11184 {
11185 if (!ctx.
Read(intValue))
11186 return false;
11187 SetFrozen(intValue);
11188 }
11189 }
11190
11191 return true;
11192 }
11193
11194
11196 {
11199 {
11201 }
11202
11203 if (!super.OnStoreLoad(ctx, version))
11204 {
11206 return false;
11207 }
11208
11209 if (version >= 114)
11210 {
11211 bool hasQuickBarIndexSaved;
11212
11213 if (!ctx.
Read(hasQuickBarIndexSaved))
11214 {
11216 return false;
11217 }
11218
11219 if (hasQuickBarIndexSaved)
11220 {
11221 int itmQBIndex;
11222
11223
11224 if (!ctx.
Read(itmQBIndex))
11225 {
11227 return false;
11228 }
11229
11230 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11231 if (itmQBIndex != -1 && parentPlayer)
11232 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11233 }
11234 }
11235 else
11236 {
11237
11238 PlayerBase player;
11239 int itemQBIndex;
11240 if (version ==
int.
MAX)
11241 {
11242 if (!ctx.
Read(itemQBIndex))
11243 {
11245 return false;
11246 }
11247 }
11248 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11249 {
11250
11251 if (!ctx.
Read(itemQBIndex))
11252 {
11254 return false;
11255 }
11256 if (itemQBIndex != -1 && player)
11257 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11258 }
11259 }
11260
11261 if (version < 140)
11262 {
11263
11264 if (!LoadVariables(ctx, version))
11265 {
11267 return false;
11268 }
11269 }
11270
11271
11273 {
11275 return false;
11276 }
11277 if (version >= 132)
11278 {
11280 if (raib)
11281 {
11283 {
11285 return false;
11286 }
11287 }
11288 }
11289
11291 return true;
11292 }
11293
11294
11295
11297 {
11298 super.OnStoreSave(ctx);
11299
11300 PlayerBase player;
11301 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11302 {
11304
11305 int itemQBIndex = -1;
11306 itemQBIndex = player.FindQuickBarEntityIndex(this);
11307 ctx.
Write(itemQBIndex);
11308 }
11309 else
11310 {
11312 }
11313
11315
11317 if (raib)
11318 {
11320 }
11321 }
11322
11323
11325 {
11326 super.AfterStoreLoad();
11327
11329 {
11331 }
11332
11334 {
11337 }
11338 }
11339
11341 {
11342 super.EEOnAfterLoad();
11343
11345 {
11347 }
11348
11351 }
11352
11354 {
11355 return false;
11356 }
11357
11358
11359
11361 {
11363 {
11364 #ifdef PLATFORM_CONSOLE
11365
11367 {
11369 if (menu)
11370 {
11372 }
11373 }
11374 #endif
11375 }
11376
11378 {
11381 }
11382
11384 {
11385 SetWeightDirty();
11387 }
11389 {
11392 }
11393
11395 {
11398 }
11400 {
11403 }
11404
11405 super.OnVariablesSynchronized();
11406 }
11407
11408
11409
11411 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11412 {
11413 if (!IsServerCheck(allow_client))
11414 return false;
11415
11417 return false;
11418
11421
11422 if (value <= (min + 0.001))
11423 value = min;
11424
11425 if (value == min)
11426 {
11427 if (destroy_config)
11428 {
11429 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11430 if (dstr)
11431 {
11433 this.Delete();
11434 return true;
11435 }
11436 }
11437 else if (destroy_forced)
11438 {
11440 this.Delete();
11441 return true;
11442 }
11443
11445 }
11446
11449
11451 {
11453
11454 if (delta)
11456 }
11457
11459
11460 return false;
11461 }
11462
11463
11465 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11466 {
11468 }
11469
11471 {
11474 }
11475
11477 {
11480 }
11481
11484 {
11485 float value_clamped = Math.Clamp(value, 0, 1);
11487 SetQuantity(result, destroy_config, destroy_forced);
11488 }
11489
11490
11493 {
11495 }
11496
11498 {
11500 }
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11512 {
11513 int slot = -1;
11514 if (GetInventory())
11515 {
11516 InventoryLocation il = new InventoryLocation;
11517 GetInventory().GetCurrentInventoryLocation(il);
11519 }
11520
11522 }
11523
11525 {
11526 float quantity_max = 0;
11527
11529 {
11530 if (attSlotID != -1)
11531 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11532
11533 if (quantity_max <= 0)
11535 }
11536
11537 if (quantity_max <= 0)
11539
11540 return quantity_max;
11541 }
11542
11544 {
11546 }
11547
11549 {
11551 }
11552
11553
11555 {
11557 }
11558
11560 {
11562 }
11563
11565 {
11567 }
11568
11569
11571 {
11572
11573 float weightEx = GetWeightEx();
11574 float special = GetInventoryAndCargoWeight();
11575 return weightEx - special;
11576 }
11577
11578
11580 {
11582 }
11583
11585 {
11587 {
11588 #ifdef DEVELOPER
11589 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11590 {
11591 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11593 }
11594 #endif
11595
11596 return GetQuantity() * GetConfigWeightModified();
11597 }
11598 else if (HasEnergyManager())
11599 {
11600 #ifdef DEVELOPER
11601 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11602 {
11603 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11604 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11605 }
11606 #endif
11607 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11608 }
11609 else
11610 {
11611 #ifdef DEVELOPER
11612 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11613 {
11614 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11615 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11616 }
11617 #endif
11618 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
11619 }
11620 }
11621
11624 {
11625 int item_count = 0;
11627
11628 if (GetInventory().GetCargo() != NULL)
11629 {
11630 item_count = GetInventory().GetCargo().GetItemCount();
11631 }
11632
11633 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11634 {
11635 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11636 if (item)
11637 item_count += item.GetNumberOfItems();
11638 }
11639 return item_count;
11640 }
11641
11644 {
11645 float weight = 0;
11646 float wetness = 1;
11647 if (include_wetness)
11650 {
11651 weight = wetness * m_ConfigWeight;
11652 }
11654 {
11655 weight = 1;
11656 }
11657 return weight;
11658 }
11659
11660
11661
11663 {
11664 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11665 {
11666 GameInventory inv = GetInventory();
11667 array<EntityAI> items = new array<EntityAI>;
11669 for (int i = 0; i < items.Count(); i++)
11670 {
11672 if (item)
11673 {
11675 }
11676 }
11677 }
11678 }
11679
11680
11681
11682
11684 {
11685 float energy = 0;
11686 if (HasEnergyManager())
11687 {
11688 energy = GetCompEM().GetEnergy();
11689 }
11690 return energy;
11691 }
11692
11693
11695 {
11696 super.OnEnergyConsumed();
11697
11699 }
11700
11702 {
11703 super.OnEnergyAdded();
11704
11706 }
11707
11708
11710 {
11711 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11712 {
11714 {
11715 float energy_0to1 = GetCompEM().GetEnergy0To1();
11717 }
11718 }
11719 }
11720
11721
11723 {
11724 return ConfigGetFloat("heatIsolation");
11725 }
11726
11728 {
11730 }
11731
11733 {
11734 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11735 if (
GetGame().ConfigIsExisting(paramPath))
11737
11738 return 0.0;
11739 }
11740
11742 {
11743 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11744 if (
GetGame().ConfigIsExisting(paramPath))
11746
11747 return 0.0;
11748 }
11749
11750 override void SetWet(
float value,
bool allow_client =
false)
11751 {
11752 if (!IsServerCheck(allow_client))
11753 return;
11754
11757
11759
11760 m_VarWet = Math.Clamp(value, min, max);
11761
11763 {
11766 }
11767 }
11768
11769 override void AddWet(
float value)
11770 {
11772 }
11773
11775 {
11777 }
11778
11780 {
11782 }
11783
11785 {
11787 }
11788
11790 {
11792 }
11793
11795 {
11797 }
11798
11799 override void OnWetChanged(
float newVal,
float oldVal)
11800 {
11803 if (newLevel != oldLevel)
11804 {
11806 }
11807 }
11808
11810 {
11811 SetWeightDirty();
11812 }
11813
11815 {
11816 return GetWetLevelInternal(
m_VarWet);
11817 }
11818
11819
11820
11822 {
11824 }
11825
11827 {
11829 }
11830
11832 {
11834 }
11835
11837 {
11839 }
11840
11841
11842
11844 {
11845 if (ConfigIsExisting("itemModelLength"))
11846 {
11847 return ConfigGetFloat("itemModelLength");
11848 }
11849 return 0;
11850 }
11851
11853 {
11854 if (ConfigIsExisting("itemAttachOffset"))
11855 {
11856 return ConfigGetFloat("itemAttachOffset");
11857 }
11858 return 0;
11859 }
11860
11861 override void SetCleanness(
int value,
bool allow_client =
false)
11862 {
11863 if (!IsServerCheck(allow_client))
11864 return;
11865
11867
11869
11872 }
11873
11875 {
11877 }
11878
11880 {
11881 return true;
11882 }
11883
11884
11885
11886
11888 {
11890 }
11891
11893 {
11895 }
11896
11897
11898
11899
11900 override void SetColor(
int r,
int g,
int b,
int a)
11901 {
11907 }
11909 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11910 {
11915 }
11916
11918 {
11920 }
11921
11924 {
11925 int r,g,b,a;
11927 r = r/255;
11928 g = g/255;
11929 b = b/255;
11930 a = a/255;
11931 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11932 }
11933
11934
11935
11936 override void SetLiquidType(
int value,
bool allow_client =
false)
11937 {
11938 if (!IsServerCheck(allow_client))
11939 return;
11940
11945 }
11946
11948 {
11949 return ConfigGetInt("varLiquidTypeInit");
11950 }
11951
11953 {
11955 }
11956
11958 {
11960 SetFrozen(false);
11961 }
11962
11965 {
11966 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11967 }
11968
11969
11972 {
11973 PlayerBase nplayer;
11974 if (PlayerBase.CastTo(nplayer, player))
11975 {
11977
11978 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11979 }
11980 }
11981
11982
11985 {
11986 PlayerBase nplayer;
11987 if (PlayerBase.CastTo(nplayer,player))
11988 {
11989
11990 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11991
11992 }
11993
11994
11995 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11996
11997
11998 if (HasEnergyManager())
11999 {
12000 GetCompEM().UpdatePlugState();
12001 }
12002 }
12003
12004
12006 {
12007 super.OnPlacementStarted(player);
12008
12010 }
12011
12012 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12013 {
12015 {
12016 m_AdminLog.OnPlacementComplete(player,
this);
12017 }
12018
12019 super.OnPlacementComplete(player, position, orientation);
12020 }
12021
12022
12023
12024
12025
12027 {
12029 {
12030 return true;
12031 }
12032 else
12033 {
12034 return false;
12035 }
12036 }
12037
12038
12040 {
12042 {
12044 }
12045 }
12046
12047
12049 {
12051 }
12052
12054 {
12056 }
12057
12058 override void InsertAgent(
int agent,
float count = 1)
12059 {
12060 if (count < 1)
12061 return;
12062
12064 }
12065
12068 {
12070 }
12071
12072
12074 {
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
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12120 {
12122 return false;
12123 return true;
12124 }
12125
12127 {
12128
12130 }
12131
12132
12135 {
12136 super.CheckForRoofLimited(timeTresholdMS);
12137
12139 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12140 {
12141 m_PreviousRoofTestTime = time;
12142 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12143 }
12144 }
12145
12146
12148 {
12150 {
12151 return 0;
12152 }
12153
12154 if (GetInventory().GetAttachmentSlotsCount() != 0)
12155 {
12156 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12157 if (filter)
12158 return filter.GetProtectionLevel(type, false, system);
12159 else
12160 return 0;
12161 }
12162
12163 string subclassPath, entryName;
12164
12165 switch (type)
12166 {
12168 entryName = "biological";
12169 break;
12171 entryName = "chemical";
12172 break;
12173 default:
12174 entryName = "biological";
12175 break;
12176 }
12177
12178 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12179
12181 }
12182
12183
12184
12187 {
12188 if (!IsMagazine())
12190
12192 }
12193
12194
12195
12196
12197
12202 {
12203 return true;
12204 }
12205
12207 {
12209 }
12210
12211
12212
12213
12214
12216 {
12217 if (parent)
12218 {
12219 if (parent.IsInherited(DayZInfected))
12220 return true;
12221
12222 if (!parent.IsRuined())
12223 return true;
12224 }
12225
12226 return true;
12227 }
12228
12230 {
12231 if (!super.CanPutAsAttachment(parent))
12232 {
12233 return false;
12234 }
12235
12236 if (!IsRuined() && !parent.IsRuined())
12237 {
12238 return true;
12239 }
12240
12241 return false;
12242 }
12243
12245 {
12246
12247
12248
12249
12250 return super.CanReceiveItemIntoCargo(item);
12251 }
12252
12254 {
12255
12256
12257
12258
12259 GameInventory attachmentInv = attachment.GetInventory();
12261 {
12262 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12263 return false;
12264 }
12265
12266 InventoryLocation loc = new InventoryLocation();
12267 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12268 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12269 return false;
12270
12271 return super.CanReceiveAttachment(attachment, slotId);
12272 }
12273
12275 {
12276 if (!super.CanReleaseAttachment(attachment))
12277 return false;
12278
12279 return GetInventory().AreChildrenAccessible();
12280 }
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12303 {
12304 int id = muzzle_owner.GetMuzzleID();
12305 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12306
12307 if (WPOF_array)
12308 {
12309 for (int i = 0; i < WPOF_array.Count(); i++)
12310 {
12311 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12312
12313 if (WPOF)
12314 {
12315 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12316 }
12317 }
12318 }
12319 }
12320
12321
12323 {
12324 int id = muzzle_owner.GetMuzzleID();
12326
12327 if (WPOBE_array)
12328 {
12329 for (int i = 0; i < WPOBE_array.Count(); i++)
12330 {
12331 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12332
12333 if (WPOBE)
12334 {
12335 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12336 }
12337 }
12338 }
12339 }
12340
12341
12343 {
12344 int id = muzzle_owner.GetMuzzleID();
12345 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12346
12347 if (WPOOH_array)
12348 {
12349 for (int i = 0; i < WPOOH_array.Count(); i++)
12350 {
12351 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12352
12353 if (WPOOH)
12354 {
12355 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12356 }
12357 }
12358 }
12359 }
12360
12361
12363 {
12364 int id = muzzle_owner.GetMuzzleID();
12365 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12366
12367 if (WPOOH_array)
12368 {
12369 for (int i = 0; i < WPOOH_array.Count(); i++)
12370 {
12371 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12372
12373 if (WPOOH)
12374 {
12375 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12376 }
12377 }
12378 }
12379 }
12380
12381
12383 {
12384 int id = muzzle_owner.GetMuzzleID();
12385 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12386
12387 if (WPOOH_array)
12388 {
12389 for (int i = 0; i < WPOOH_array.Count(); i++)
12390 {
12391 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12392
12393 if (WPOOH)
12394 {
12395 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12396 }
12397 }
12398 }
12399 }
12400
12401
12402
12404 {
12406 {
12407 return true;
12408 }
12409
12410 return false;
12411 }
12412
12414 {
12416 {
12417 return true;
12418 }
12419
12420 return false;
12421 }
12422
12424 {
12426 {
12427 return true;
12428 }
12429
12430 return false;
12431 }
12432
12434 {
12435 return false;
12436 }
12437
12440 {
12441 return UATimeSpent.DEFAULT_DEPLOY;
12442 }
12443
12444
12445
12446
12448 {
12450 SetSynchDirty();
12451 }
12452
12454 {
12456 }
12457
12458
12460 {
12461 return false;
12462 }
12463
12466 {
12467 string att_type = "None";
12468
12469 if (ConfigIsExisting("soundAttType"))
12470 {
12471 att_type = ConfigGetString("soundAttType");
12472 }
12473
12475 }
12476
12478 {
12480 }
12481
12482
12483
12484
12485
12489
12491 {
12494
12496 }
12497
12498
12500 {
12502 return;
12503
12505
12508
12511
12512 SoundParameters params = new SoundParameters();
12516 }
12517
12518
12520 {
12522 return;
12523
12525 SetSynchDirty();
12526
12529 }
12530
12531
12533 {
12535 return;
12536
12538 SetSynchDirty();
12539
12542 }
12543
12545 {
12547 }
12548
12550 {
12552 }
12553
12556 {
12557 if (!
GetGame().IsDedicatedServer())
12558 {
12559 if (ConfigIsExisting("attachSoundSet"))
12560 {
12561 string cfg_path = "";
12562 string soundset = "";
12563 string type_name =
GetType();
12564
12567 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12568 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12569
12570 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12571 {
12572 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12573 {
12574 if (cfg_slot_array[i] == slot_type)
12575 {
12576 soundset = cfg_soundset_array[i];
12577 break;
12578 }
12579 }
12580 }
12581
12582 if (soundset != "")
12583 {
12584 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12586 }
12587 }
12588 }
12589 }
12590
12592 {
12593
12594 }
12595
12596 void OnApply(PlayerBase player);
12597
12599 {
12600 return 1.0;
12601 };
12602
12604 {
12606 }
12607
12609 {
12611 }
12612
12614
12616 {
12617 SetDynamicPhysicsLifeTime(0.01);
12619 }
12620
12622 {
12623 array<string> zone_names = new array<string>;
12624 GetDamageZones(zone_names);
12625 for (int i = 0; i < zone_names.Count(); i++)
12626 {
12627 SetHealthMax(zone_names.Get(i),"Health");
12628 }
12629 SetHealthMax("","Health");
12630 }
12631
12634 {
12635 float global_health = GetHealth01("","Health");
12636 array<string> zones = new array<string>;
12637 GetDamageZones(zones);
12638
12639 for (int i = 0; i < zones.Count(); i++)
12640 {
12641 SetHealth01(zones.Get(i),"Health",global_health);
12642 }
12643 }
12644
12647 {
12648 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12649 }
12650
12652 {
12653 if (!hasRootAsPlayer)
12654 {
12655 if (refParentIB)
12656 {
12657
12658 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12659 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12660
12661 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12662 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12663
12666 }
12667 else
12668 {
12669
12672 }
12673 }
12674 }
12675
12677 {
12679 {
12680 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12681 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12682 {
12683 float heatPermCoef = 1.0;
12685 while (ent)
12686 {
12687 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12688 ent = ent.GetHierarchyParent();
12689 }
12690
12691 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12692 }
12693 }
12694 }
12695
12697 {
12698
12699 EntityAI parent = GetHierarchyParent();
12700 if (!parent)
12701 {
12702 hasParent = false;
12703 hasRootAsPlayer = false;
12704 }
12705 else
12706 {
12707 hasParent = true;
12708 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12709 refParentIB =
ItemBase.Cast(parent);
12710 }
12711 }
12712
12713 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12714 {
12715
12716 }
12717
12719 {
12720
12721 return false;
12722 }
12723
12725 {
12726
12727
12728 return false;
12729 }
12730
12732 {
12733
12734 return false;
12735 }
12736
12739 {
12740 return !GetIsFrozen() &&
IsOpen();
12741 }
12742
12744 {
12745 bool hasParent = false, hasRootAsPlayer = false;
12747
12748 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12749 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12750
12751 if (wwtu || foodDecay)
12752 {
12756
12757 if (processWetness || processTemperature || processDecay)
12758 {
12760
12761 if (processWetness)
12762 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12763
12764 if (processTemperature)
12766
12767 if (processDecay)
12768 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12769 }
12770 }
12771 }
12772
12775 {
12777 }
12778
12780 {
12783
12784 return super.GetTemperatureFreezeThreshold();
12785 }
12786
12788 {
12791
12792 return super.GetTemperatureThawThreshold();
12793 }
12794
12796 {
12799
12800 return super.GetItemOverheatThreshold();
12801 }
12802
12804 {
12806 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12807
12808 return super.GetTemperatureFreezeTime();
12809 }
12810
12812 {
12814 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12815
12816 return super.GetTemperatureThawTime();
12817 }
12818
12823
12825 {
12826 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12827 }
12828
12830 {
12831 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12832 }
12833
12836 {
12838 }
12839
12841 {
12843 }
12844
12846 {
12848 }
12849
12852 {
12853 return null;
12854 }
12855
12858 {
12859 return false;
12860 }
12861
12863 {
12865 {
12868 if (!trg)
12869 {
12871 explosive = this;
12872 }
12873
12874 explosive.PairRemote(trg);
12876
12877 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12878 trg.SetPersistentPairID(persistentID);
12879 explosive.SetPersistentPairID(persistentID);
12880
12881 return true;
12882 }
12883 return false;
12884 }
12885
12888 {
12889 float ret = 1.0;
12892 ret *= GetHealth01();
12893
12894 return ret;
12895 }
12896
12897 #ifdef DEVELOPER
12898 override void SetDebugItem()
12899 {
12900 super.SetDebugItem();
12901 _itemBase = this;
12902 }
12903
12905 {
12906 string text = super.GetDebugText();
12907
12909 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12910
12911 return text;
12912 }
12913 #endif
12914
12916 {
12917 return true;
12918 }
12919
12921
12923
12925 {
12928 }
12929
12930
12938
12954}
12955
12957{
12959 if (entity)
12960 {
12961 bool is_item = entity.IsInherited(
ItemBase);
12962 if (is_item && full_quantity)
12963 {
12966 }
12967 }
12968 else
12969 {
12971 return NULL;
12972 }
12973 return entity;
12974}
12975
12977{
12978 if (item)
12979 {
12980 if (health > 0)
12981 item.SetHealth("", "", health);
12982
12983 if (item.CanHaveTemperature())
12984 {
12986 if (item.CanFreeze())
12987 item.SetFrozen(false);
12988 }
12989
12990 if (item.HasEnergyManager())
12991 {
12992 if (quantity >= 0)
12993 {
12994 item.GetCompEM().SetEnergy0To1(quantity);
12995 }
12996 else
12997 {
12999 }
13000 }
13001 else if (item.IsMagazine())
13002 {
13003 Magazine mag = Magazine.Cast(item);
13004 if (quantity >= 0)
13005 {
13006 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13007 }
13008 else
13009 {
13011 }
13012
13013 }
13014 else
13015 {
13016 if (quantity >= 0)
13017 {
13018 item.SetQuantityNormalized(quantity, false);
13019 }
13020 else
13021 {
13023 }
13024
13025 }
13026 }
13027}
13028
13029#ifdef DEVELOPER
13031#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.