8183{
8185 {
8186 return true;
8187 }
8188};
8189
8190
8191
8193{
8197
8199
8202
8203
8204
8205
8206
8215
8221
8226
8231
8252 protected bool m_IsResultOfSplit
8253
8255
8260
8261
8262
8264
8268
8269
8270
8272
8275
8276
8277
8283
8284
8292
8295
8296
8298
8299
8301
8302
8307
8308
8313
8314
8316
8317
8319 {
8324
8325 if (!
GetGame().IsDedicatedServer())
8326 {
8328 {
8330
8332 {
8334 }
8335 }
8336
8339 }
8340
8341 m_OldLocation = null;
8342
8344 {
8346 }
8347
8348 if (ConfigIsExisting("headSelectionsToHide"))
8349 {
8352 }
8353
8355 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8356 {
8358 }
8359
8361
8362 m_IsResultOfSplit = false;
8363
8365 }
8366
8368 {
8369 super.InitItemVariables();
8370
8376 m_Count = ConfigGetInt(
"count");
8377
8380
8385
8388
8393
8405
8409
8410
8413 if (ConfigIsExisting("canBeSplit"))
8414 {
8417 }
8418
8420 if (ConfigIsExisting("itemBehaviour"))
8422
8423
8426 RegisterNetSyncVariableInt("m_VarLiquidType");
8427 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8428
8429 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8430 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8431 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8432
8433 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8434 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8435 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8436 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8437
8438 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8439 RegisterNetSyncVariableBool("m_IsTakeable");
8440 RegisterNetSyncVariableBool("m_IsHologram");
8441
8444 {
8447 }
8448
8450
8452 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8454
8455 }
8456
8458 {
8460 }
8461
8463 {
8466 {
8471 }
8472 }
8473
8474 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8475 {
8477 {
8480 }
8481
8483 }
8484
8486 {
8492 }
8493
8495
8497 {
8499
8500 if (!action)
8501 {
8502 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8503 return;
8504 }
8505
8507 if (!ai)
8508 {
8510 return;
8511 }
8512
8514 if (!action_array)
8515 {
8516 action_array = new array<ActionBase_Basic>;
8518 }
8519 if (LogManager.IsActionLogEnable())
8520 {
8521 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8522 }
8523
8524 if (action_array.Find(action) != -1)
8525 {
8526 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8527 }
8528 else
8529 {
8530 action_array.Insert(action);
8531 }
8532 }
8533
8535 {
8537 ActionBase action = player.GetActionManager().GetAction(actionName);
8540
8541 if (action_array)
8542 {
8543 action_array.RemoveItem(action);
8544 }
8545 }
8546
8547
8548
8550 {
8551 ActionOverrideData overrideData = new ActionOverrideData();
8555
8557 if (!actionMap)
8558 {
8561 }
8562
8563 actionMap.Insert(this.
Type(), overrideData);
8564
8565 }
8566
8568
8570
8571
8573 {
8576
8579
8580 string config_to_search = "CfgVehicles";
8581 string muzzle_owner_config;
8582
8584 {
8585 if (IsInherited(Weapon))
8586 config_to_search = "CfgWeapons";
8587
8588 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8589
8590 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8591
8593
8594 if (config_OnFire_subclass_count > 0)
8595 {
8596 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8597
8598 for (int i = 0; i < config_OnFire_subclass_count; i++)
8599 {
8600 string particle_class = "";
8602 string config_OnFire_entry = config_OnFire_class + particle_class;
8603 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8604 WPOF_array.Insert(WPOF);
8605 }
8606
8607
8609 }
8610 }
8611
8613 {
8614 config_to_search = "CfgWeapons";
8615 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8616
8617 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8618
8620
8621 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8622 {
8623 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8624
8625 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8626 {
8627 string particle_class2 = "";
8629 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8630 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8631 WPOBE_array.Insert(WPOBE);
8632 }
8633
8634
8636 }
8637 }
8638 }
8639
8640
8642 {
8645
8647 {
8648 string config_to_search = "CfgVehicles";
8649
8650 if (IsInherited(Weapon))
8651 config_to_search = "CfgWeapons";
8652
8653 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8654 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8655
8656 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8657 {
8658
8660
8662 {
8664 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8666 return;
8667 }
8668
8671
8672
8673
8675 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8676
8677 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8678 {
8679 string particle_class = "";
8681 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8683
8684 if (entry_type == CT_CLASS)
8685 {
8686 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8687 WPOOH_array.Insert(WPOF);
8688 }
8689 }
8690
8691
8693 }
8694 }
8695 }
8696
8698 {
8700 }
8701
8703 {
8705 {
8707
8710
8713
8714 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8715 }
8716 }
8717
8719 {
8721 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8722
8724 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8725
8727 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8728
8730 {
8732 }
8733 }
8734
8736 {
8738 }
8739
8741 {
8744 else
8746
8748 {
8751 }
8752 else
8753 {
8756
8759 }
8760
8762 }
8763
8765 {
8767 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8768 }
8769
8771 {
8773 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8775 }
8776
8778 {
8780 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8781 }
8782
8784 {
8787
8788 OverheatingParticle OP = new OverheatingParticle();
8793
8795 }
8796
8798 {
8801
8802 return -1;
8803 }
8804
8806 {
8808 {
8811
8812 for (int i = count; i > 0; --i)
8813 {
8814 int id = i - 1;
8817
8820
8821 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8822 {
8823 if (p)
8824 {
8827 }
8828 }
8829 }
8830 }
8831 }
8832
8834 {
8836 {
8838 {
8839 int id = i - 1;
8841
8842 if (OP)
8843 {
8845
8846 if (p)
8847 {
8849 }
8850
8851 delete OP;
8852 }
8853 }
8854
8857 }
8858 }
8859
8862 {
8863 return 0.0;
8864 }
8865
8866
8868 {
8869 return 250;
8870 }
8871
8873 {
8874 return 0;
8875 }
8876
8879 {
8881 return true;
8882
8883 return false;
8884 }
8885
8888 {
8891
8893 {
8895 }
8896 else
8897 {
8898
8900 }
8901
8903 }
8904
8911 {
8912 return -1;
8913 }
8914
8915
8916
8917
8919 {
8921 {
8923 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8924
8925 if (r_index >= 0)
8926 {
8927 InventoryLocation r_il = new InventoryLocation;
8928 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8929
8930 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8933 {
8934 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8935 }
8937 {
8938 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8939 }
8940
8941 }
8942
8943 player.GetHumanInventory().ClearUserReservedLocation(this);
8944 }
8945
8948 }
8949
8950
8951
8952
8954 {
8955 return ItemBase.m_DebugActionsMask;
8956 }
8957
8959 {
8960 return ItemBase.m_DebugActionsMask & mask;
8961 }
8962
8964 {
8965 ItemBase.m_DebugActionsMask = mask;
8966 }
8967
8969 {
8970 ItemBase.m_DebugActionsMask |= mask;
8971 }
8972
8974 {
8975 ItemBase.m_DebugActionsMask &= ~mask;
8976 }
8977
8979 {
8981 {
8983 }
8984 else
8985 {
8987 }
8988 }
8989
8990
8992 {
8993 if (GetEconomyProfile())
8994 {
8995 float q_max = GetEconomyProfile().GetQuantityMax();
8996 if (q_max > 0)
8997 {
8998 float q_min = GetEconomyProfile().GetQuantityMin();
8999 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9000
9002 {
9003 ComponentEnergyManager comp = GetCompEM();
9005 {
9007 }
9008 }
9010 {
9012
9013 }
9014
9015 }
9016 }
9017 }
9018
9021 {
9022 EntityAI parent = GetHierarchyParent();
9023
9024 if (parent)
9025 {
9026 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9027 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9028 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9029 }
9030 }
9031
9034 {
9035 EntityAI parent = GetHierarchyParent();
9036
9037 if (parent)
9038 {
9039 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9040 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9041 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9042 }
9043 }
9044
9046 {
9047
9048
9049
9050
9052
9054 {
9055 if (ScriptInputUserData.CanStoreInputUserData())
9056 {
9057 ScriptInputUserData ctx = new ScriptInputUserData;
9063 ctx.
Write(use_stack_max);
9066
9068 {
9069 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9070 }
9071 }
9072 }
9073 else if (!
GetGame().IsMultiplayer())
9074 {
9076 }
9077 }
9078
9080 {
9082 }
9083
9085 {
9087 }
9088
9090 {
9092 }
9093
9095 {
9096
9097 return false;
9098 }
9099
9101 {
9102 return false;
9103 }
9104
9108 {
9109 return false;
9110 }
9111
9113 {
9114 return "";
9115 }
9116
9118
9120 {
9121 return false;
9122 }
9123
9125 {
9126 return true;
9127 }
9128
9129
9130
9132 {
9133 return true;
9134 }
9135
9137 {
9138 return true;
9139 }
9140
9142 {
9143 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9145 }
9146
9148 {
9150 }
9151
9153 {
9155 if (!is_being_placed)
9157 SetSynchDirty();
9158 }
9159
9160
9162
9164 {
9166 }
9167
9169 {
9171 }
9172
9174 {
9175 return 1;
9176 }
9177
9179 {
9180 return false;
9181 }
9182
9184 {
9186 SetSynchDirty();
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
9218
9219
9220
9221
9222
9224 {
9225 super.OnMovedInsideCargo(container);
9226
9227 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9228 }
9229
9230 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9231 {
9232 super.EEItemLocationChanged(oldLoc,newLoc);
9233
9234 PlayerBase new_player = null;
9235 PlayerBase old_player = null;
9236
9237 if (newLoc.GetParent())
9238 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9239
9240 if (oldLoc.GetParent())
9241 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9242
9244 {
9245 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9246
9247 if (r_index >= 0)
9248 {
9249 InventoryLocation r_il = new InventoryLocation;
9250 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9251
9252 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9255 {
9256 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9257 }
9259 {
9260 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9261 }
9262
9263 }
9264 }
9265
9267 {
9268 if (new_player)
9269 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9270
9271 if (new_player == old_player)
9272 {
9273
9274 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9275 {
9277 {
9278 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9279 {
9280 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9281 }
9282 }
9283 else
9284 {
9285 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9286 }
9287 }
9288
9289 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9290 {
9291 int type = oldLoc.GetType();
9293 {
9294 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9295 }
9297 {
9298 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9299 }
9300 }
9301 if (!m_OldLocation)
9302 {
9303 m_OldLocation = new InventoryLocation;
9304 }
9305 m_OldLocation.Copy(oldLoc);
9306 }
9307 else
9308 {
9309 if (m_OldLocation)
9310 {
9311 m_OldLocation.Reset();
9312 }
9313 }
9314
9316 }
9317 else
9318 {
9319 if (new_player)
9320 {
9321 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9322 if (res_index >= 0)
9323 {
9324 InventoryLocation il = new InventoryLocation;
9325 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9327 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9330 {
9331 il.
GetParent().GetOnReleaseLock().Invoke(it);
9332 }
9334 {
9336 }
9337
9338 }
9339 }
9341 {
9342
9344 }
9345
9346 if (m_OldLocation)
9347 {
9348 m_OldLocation.Reset();
9349 }
9350 }
9351 }
9352
9353 override void EOnContact(IEntity other, Contact extra)
9354 {
9356 {
9357 int liquidType = -1;
9359 if (impactSpeed > 0.0)
9360 {
9362 #ifndef SERVER
9364 #else
9366 SetSynchDirty();
9367 #endif
9369 }
9370 }
9371
9372 #ifdef SERVER
9373 if (GetCompEM() && GetCompEM().IsPlugged())
9374 {
9375 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9376 GetCompEM().UnplugThis();
9377 }
9378 #endif
9379 }
9380
9382
9384 {
9386 }
9387
9389 {
9390
9391 }
9392
9394 {
9395 super.OnItemLocationChanged(old_owner, new_owner);
9396
9397 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9398 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9399
9400 if (!relatedPlayer && playerNew)
9401 relatedPlayer = playerNew;
9402
9403 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9404 {
9406 if (actionMgr)
9407 {
9408 ActionBase currentAction = actionMgr.GetRunningAction();
9409 if (currentAction)
9411 }
9412 }
9413
9414 Man ownerPlayerOld = null;
9415 Man ownerPlayerNew = null;
9416
9417 if (old_owner)
9418 {
9419 if (old_owner.
IsMan())
9420 {
9421 ownerPlayerOld = Man.Cast(old_owner);
9422 }
9423 else
9424 {
9425 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9426 }
9427 }
9428 else
9429 {
9431 {
9433
9434 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9435 {
9436 GetCompEM().UnplugThis();
9437 }
9438 }
9439 }
9440
9441 if (new_owner)
9442 {
9443 if (new_owner.
IsMan())
9444 {
9445 ownerPlayerNew = Man.Cast(new_owner);
9446 }
9447 else
9448 {
9449 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9450 }
9451 }
9452
9453 if (ownerPlayerOld != ownerPlayerNew)
9454 {
9455 if (ownerPlayerOld)
9456 {
9457 array<EntityAI> subItemsExit = new array<EntityAI>;
9459 for (int i = 0; i < subItemsExit.Count(); i++)
9460 {
9463 }
9464 }
9465
9466 if (ownerPlayerNew)
9467 {
9468 array<EntityAI> subItemsEnter = new array<EntityAI>;
9470 for (int j = 0; j < subItemsEnter.Count(); j++)
9471 {
9474 }
9475 }
9476 }
9477 else if (ownerPlayerNew != null)
9478 {
9479 PlayerBase nplayer;
9480 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9481 {
9482 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9484 for (int k = 0; k < subItemsUpdate.Count(); k++)
9485 {
9487 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9488 }
9489 }
9490 }
9491
9492 if (old_owner)
9493 old_owner.OnChildItemRemoved(this);
9494 if (new_owner)
9495 new_owner.OnChildItemReceived(this);
9496 }
9497
9498
9500 {
9501 super.EEDelete(parent);
9502 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9503 if (player)
9504 {
9506
9507 if (player.IsAlive())
9508 {
9509 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9510 if (r_index >= 0)
9511 {
9512 InventoryLocation r_il = new InventoryLocation;
9513 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9514
9515 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9518 {
9519 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9520 }
9522 {
9523 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9524 }
9525
9526 }
9527
9528 player.RemoveQuickBarEntityShortcut(this);
9529 }
9530 }
9531 }
9532
9534 {
9535 super.EEKilled(killer);
9536
9539 {
9540 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9541 {
9542 if (IsMagazine())
9543 {
9544 if (Magazine.Cast(this).GetAmmoCount() > 0)
9545 {
9547 }
9548 }
9549 else
9550 {
9552 }
9553 }
9554 }
9555 }
9556
9558 {
9559 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9560
9561 super.OnWasAttached(parent, slot_id);
9562
9565
9567 }
9568
9570 {
9571 super.OnWasDetached(parent, slot_id);
9572
9575 }
9576
9578 {
9579 int idx;
9582
9583 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9584 if (inventory_slots.Count() < 1)
9585 {
9586 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9587 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9588 }
9589 else
9590 {
9591 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9592 }
9593
9594 idx = inventory_slots.Find(slot);
9595 if (idx < 0)
9596 return "";
9597
9598 return attach_types.Get(idx);
9599 }
9600
9602 {
9603 int idx = -1;
9604 string slot;
9605
9608
9609 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9610 if (inventory_slots.Count() < 1)
9611 {
9612 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9613 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9614 }
9615 else
9616 {
9617 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9618 if (detach_types.Count() < 1)
9619 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9620 }
9621
9622 for (int i = 0; i < inventory_slots.Count(); i++)
9623 {
9624 slot = inventory_slots.Get(i);
9625 }
9626
9627 if (slot != "")
9628 {
9629 if (detach_types.Count() == 1)
9630 idx = 0;
9631 else
9632 idx = inventory_slots.Find(slot);
9633 }
9634 if (idx < 0)
9635 return "";
9636
9637 return detach_types.Get(idx);
9638 }
9639
9641 {
9642
9644
9645
9646 float min_time = 1;
9647 float max_time = 3;
9648 float delay = Math.RandomFloat(min_time, max_time);
9649
9650 explode_timer.Run(delay, this, "DoAmmoExplosion");
9651 }
9652
9654 {
9655 Magazine magazine = Magazine.Cast(this);
9656 int pop_sounds_count = 6;
9657 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9658
9659
9660 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9661 string sound_name = pop_sounds[ sound_idx ];
9663
9664
9665 magazine.ServerAddAmmoCount(-1);
9666
9667
9668 float min_temp_to_explode = 100;
9669
9670 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
9671 {
9673 }
9674 }
9675
9676
9677 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9678 {
9679 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9680
9681 const int CHANCE_DAMAGE_CARGO = 4;
9682 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9683 const int CHANCE_DAMAGE_NOTHING = 2;
9684
9686 {
9687 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9688 int chances;
9689 int rnd;
9690
9691 if (GetInventory().GetCargo())
9692 {
9693 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9694 rnd = Math.RandomInt(0,chances);
9695
9696 if (rnd < CHANCE_DAMAGE_CARGO)
9697 {
9699 }
9700 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9701 {
9703 }
9704 }
9705 else
9706 {
9707 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9708 rnd = Math.RandomInt(0,chances);
9709
9710 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9711 {
9713 }
9714 }
9715 }
9716 }
9717
9719 {
9720 if (GetInventory().GetCargo())
9721 {
9722 int item_count = GetInventory().GetCargo().GetItemCount();
9723 if (item_count > 0)
9724 {
9725 int random_pick = Math.RandomInt(0, item_count);
9727 if (!item.IsExplosive())
9728 {
9729 item.AddHealth("","",damage);
9730 return true;
9731 }
9732 }
9733 }
9734 return false;
9735 }
9736
9738 {
9739 int attachment_count = GetInventory().AttachmentCount();
9740 if (attachment_count > 0)
9741 {
9742 int random_pick = Math.RandomInt(0, attachment_count);
9743 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9744 if (!attachment.IsExplosive())
9745 {
9746 attachment.AddHealth("","",damage);
9747 return true;
9748 }
9749 }
9750 return false;
9751 }
9752
9754 {
9756 }
9757
9759 {
9761 return GetInventory().CanRemoveEntity();
9762
9763 return false;
9764 }
9765
9767 {
9769 return;
9770
9772 {
9773 if (ScriptInputUserData.CanStoreInputUserData())
9774 {
9775 ScriptInputUserData ctx = new ScriptInputUserData;
9780 ctx.
Write(destination_entity);
9784 }
9785 }
9786 else if (!
GetGame().IsMultiplayer())
9787 {
9789 }
9790 }
9791
9793 {
9795 return;
9796
9797 float split_quantity_new;
9801 InventoryLocation loc = new InventoryLocation;
9802
9803 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9804 {
9806 split_quantity_new = stack_max;
9807 else
9809
9810 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9811 if (new_item)
9812 {
9813 new_item.SetResultOfSplit(true);
9814 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9816 new_item.SetQuantity(split_quantity_new);
9817 }
9818 }
9819 else if (destination_entity && slot_id == -1)
9820 {
9821 if (quantity > stack_max)
9822 split_quantity_new = stack_max;
9823 else
9824 split_quantity_new = quantity;
9825
9827 {
9830 }
9831
9832 if (new_item)
9833 {
9834 new_item.SetResultOfSplit(true);
9835 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9837 new_item.SetQuantity(split_quantity_new);
9838 }
9839 }
9840 else
9841 {
9842 if (stack_max != 0)
9843 {
9845 {
9847 }
9848
9849 if (split_quantity_new == 0)
9850 {
9851 if (!
GetGame().IsMultiplayer())
9852 player.PhysicalPredictiveDropItem(this);
9853 else
9854 player.ServerDropEntity(this);
9855 return;
9856 }
9857
9859
9860 if (new_item)
9861 {
9862 new_item.SetResultOfSplit(true);
9863 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9865 new_item.SetQuantity(stack_max);
9866 new_item.PlaceOnSurface();
9867 }
9868 }
9869 }
9870 }
9871
9873 {
9875 return;
9876
9877 float split_quantity_new;
9881 InventoryLocation loc = new InventoryLocation;
9882
9883 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9884 {
9886 split_quantity_new = stack_max;
9887 else
9889
9890 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9891 if (new_item)
9892 {
9893 new_item.SetResultOfSplit(true);
9894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9896 new_item.SetQuantity(split_quantity_new);
9897 }
9898 }
9899 else if (destination_entity && slot_id == -1)
9900 {
9901 if (quantity > stack_max)
9902 split_quantity_new = stack_max;
9903 else
9904 split_quantity_new = quantity;
9905
9907 {
9910 }
9911
9912 if (new_item)
9913 {
9914 new_item.SetResultOfSplit(true);
9915 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9917 new_item.SetQuantity(split_quantity_new);
9918 }
9919 }
9920 else
9921 {
9922 if (stack_max != 0)
9923 {
9925 {
9927 }
9928
9930
9931 if (new_item)
9932 {
9933 new_item.SetResultOfSplit(true);
9934 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9936 new_item.SetQuantity(stack_max);
9937 new_item.PlaceOnSurface();
9938 }
9939 }
9940 }
9941 }
9942
9944 {
9946 return;
9947
9949 {
9950 if (ScriptInputUserData.CanStoreInputUserData())
9951 {
9952 ScriptInputUserData ctx = new ScriptInputUserData;
9957 dst.WriteToContext(ctx);
9959 }
9960 }
9961 else if (!
GetGame().IsMultiplayer())
9962 {
9964 }
9965 }
9966
9968 {
9970 return;
9971
9973 {
9974 if (ScriptInputUserData.CanStoreInputUserData())
9975 {
9976 ScriptInputUserData ctx = new ScriptInputUserData;
9981 ctx.
Write(destination_entity);
9987 }
9988 }
9989 else if (!
GetGame().IsMultiplayer())
9990 {
9992 }
9993 }
9994
9996 {
9998 }
9999
10001 {
10003 return this;
10004
10006 float split_quantity_new;
10008 if (dst.IsValid())
10009 {
10010 int slot_id = dst.GetSlot();
10012
10013 if (quantity > stack_max)
10014 split_quantity_new = stack_max;
10015 else
10016 split_quantity_new = quantity;
10017
10019
10020 if (new_item)
10021 {
10022 new_item.SetResultOfSplit(true);
10023 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10026 }
10027
10028 return new_item;
10029 }
10030
10031 return null;
10032 }
10033
10035 {
10037 return;
10038
10040 float split_quantity_new;
10042 if (destination_entity)
10043 {
10045 if (quantity > stackable)
10046 split_quantity_new = stackable;
10047 else
10048 split_quantity_new = quantity;
10049
10050 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10051 if (new_item)
10052 {
10053 new_item.SetResultOfSplit(true);
10054 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10056 new_item.SetQuantity(split_quantity_new);
10057 }
10058 }
10059 }
10060
10062 {
10064 return;
10065
10067 {
10068 if (ScriptInputUserData.CanStoreInputUserData())
10069 {
10070 ScriptInputUserData ctx = new ScriptInputUserData;
10075 ItemBase destination_entity =
this;
10076 ctx.
Write(destination_entity);
10080 }
10081 }
10082 else if (!
GetGame().IsMultiplayer())
10083 {
10085 }
10086 }
10087
10089 {
10091 return;
10092
10094 float split_quantity_new;
10096 if (player)
10097 {
10099 if (quantity > stackable)
10100 split_quantity_new = stackable;
10101 else
10102 split_quantity_new = quantity;
10103
10104 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10105 new_item =
ItemBase.Cast(in_hands);
10106 if (new_item)
10107 {
10108 new_item.SetResultOfSplit(true);
10109 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10111 new_item.SetQuantity(split_quantity_new);
10112 }
10113 }
10114 }
10115
10117 {
10119 return;
10120
10122 float split_quantity_new = Math.Floor(quantity * 0.5);
10123
10125
10126 if (new_item)
10127 {
10128 if (new_item.GetQuantityMax() < split_quantity_new)
10129 {
10130 split_quantity_new = new_item.GetQuantityMax();
10131 }
10132
10133 new_item.SetResultOfSplit(true);
10134 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10135
10137 {
10140 }
10141 else
10142 {
10145 }
10146 }
10147 }
10148
10150 {
10152 return;
10153
10155 float split_quantity_new = Math.Floor(quantity / 2);
10156
10157 InventoryLocation invloc = new InventoryLocation;
10159
10161 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10162
10163 if (new_item)
10164 {
10165 if (new_item.GetQuantityMax() < split_quantity_new)
10166 {
10167 split_quantity_new = new_item.GetQuantityMax();
10168 }
10170 {
10173 }
10174 else
10175 {
10178 }
10179 }
10180 }
10181
10184 {
10185 SetWeightDirty();
10187
10188 if (parent)
10189 parent.OnAttachmentQuantityChangedEx(this, delta);
10190
10192 {
10194 {
10196 }
10198 {
10199 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10201 }
10202 }
10203
10204 }
10205
10208 {
10209
10210 }
10211
10214 {
10216 }
10217
10219 {
10220 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10221
10223 {
10224 if (newLevel == GameConstants.STATE_RUINED)
10225 {
10227 EntityAI parent = GetHierarchyParent();
10228 if (parent && parent.IsFireplace())
10229 {
10230 CargoBase cargo = GetInventory().GetCargo();
10231 if (cargo)
10232 {
10234 {
10236 }
10237 }
10238 }
10239 }
10240
10242 {
10243
10245 return;
10246 }
10247
10248 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10249 {
10251 }
10252 }
10253 }
10254
10255
10257 {
10258 super.OnRightClick();
10259
10261 {
10263 {
10264 if (ScriptInputUserData.CanStoreInputUserData())
10265 {
10266 vector m4[4];
10268
10269 EntityAI root = GetHierarchyRoot();
10270
10271 InventoryLocation dst = new InventoryLocation;
10273 {
10274 if (root)
10275 {
10276 root.GetTransform(m4);
10278 }
10279 else
10280 GetInventory().GetCurrentInventoryLocation(dst);
10281 }
10282 else
10283 {
10285
10286
10287 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10288 {
10289 if (root)
10290 {
10291 root.GetTransform(m4);
10293 }
10294 else
10295 GetInventory().GetCurrentInventoryLocation(dst);
10296 }
10297 else
10298 {
10299 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10300 }
10301 }
10302
10303 ScriptInputUserData ctx = new ScriptInputUserData;
10311 }
10312 }
10313 else if (!
GetGame().IsMultiplayer())
10314 {
10316 }
10317 }
10318 }
10319
10320 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10321 {
10322
10323 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10324 return false;
10325
10326 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10327 return false;
10328
10329
10331 return false;
10332
10333
10334 Magazine mag = Magazine.Cast(this);
10335 if (mag)
10336 {
10337 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10338 return false;
10339
10340 if (stack_max_limit)
10341 {
10342 Magazine other_mag = Magazine.Cast(other_item);
10343 if (other_item)
10344 {
10345 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10346 return false;
10347 }
10348
10349 }
10350 }
10351 else
10352 {
10353
10355 return false;
10356
10358 return false;
10359 }
10360
10361 PlayerBase player = null;
10362 if (CastTo(player, GetHierarchyRootPlayer()))
10363 {
10364 if (player.GetInventory().HasAttachment(this))
10365 return false;
10366
10367 if (player.IsItemsToDelete())
10368 return false;
10369 }
10370
10371 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10372 return false;
10373
10374 int slotID;
10376 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10377 return false;
10378
10379 return true;
10380 }
10381
10383 {
10385 }
10386
10388 {
10389 return m_IsResultOfSplit;
10390 }
10391
10393 {
10394 m_IsResultOfSplit = value;
10395 }
10396
10398 {
10400 }
10401
10403 {
10404 float other_item_quantity = other_item.GetQuantity();
10405 float this_free_space;
10406
10408
10410
10411 if (other_item_quantity > this_free_space)
10412 {
10413 return this_free_space;
10414 }
10415 else
10416 {
10417 return other_item_quantity;
10418 }
10419 }
10420
10422 {
10424 }
10425
10427 {
10429 return;
10430
10431 if (!IsMagazine() && other_item)
10432 {
10434 if (quantity_used != 0)
10435 {
10436 float hp1 = GetHealth01("","");
10437 float hp2 = other_item.GetHealth01("","");
10438 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10439 hpResult = hpResult / (
GetQuantity() + quantity_used);
10440
10441 hpResult *= GetMaxHealth();
10442 Math.Round(hpResult);
10443 SetHealth("", "Health", hpResult);
10444
10446 other_item.AddQuantity(-quantity_used);
10447 }
10448 }
10450 }
10451
10453 {
10454 #ifdef SERVER
10455 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10456 GetHierarchyParent().IncreaseLifetimeUp();
10457 #endif
10458 };
10459
10461 {
10462 PlayerBase p = PlayerBase.Cast(player);
10463
10464 array<int> recipesIds = p.m_Recipes;
10465 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10466 if (moduleRecipesManager)
10467 {
10468 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10469 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10470 }
10471
10472 for (int i = 0;i < recipesIds.Count(); i++)
10473 {
10474 int key = recipesIds.Get(i);
10475 string recipeName = moduleRecipesManager.GetRecipeName(key);
10477 }
10478 }
10479
10480
10481 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10482 {
10483 super.GetDebugActions(outputList);
10484
10485
10490
10491
10495
10499
10500
10503
10504
10506 {
10509 }
10510
10512
10515
10519 }
10520
10521
10522
10523
10525 {
10526 super.OnAction(action_id, player, ctx);
10527 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10528 {
10529 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10530 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10531 PlayerBase p = PlayerBase.Cast(player);
10532 if (
EActions.RECIPES_RANGE_START < 1000)
10533 {
10534 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10535 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10536 }
10537 }
10538 #ifndef SERVER
10539 else if (action_id ==
EActions.WATCH_PLAYER)
10540 {
10541 PluginDeveloper.SetDeveloperItemClientEx(player);
10542 }
10543 #endif
10545 {
10546 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10547 {
10548 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10549 OnDebugButtonPressServer(id + 1);
10550 }
10551
10552 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10553 {
10554 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10556 }
10557
10558 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10559 {
10560 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10562 }
10563
10564 else if (action_id ==
EActions.ADD_QUANTITY)
10565 {
10566 if (IsMagazine())
10567 {
10568 Magazine mag = Magazine.Cast(this);
10569 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10570 }
10571 else
10572 {
10574 }
10575
10576 if (m_EM)
10577 {
10578 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10579 }
10580
10581 }
10582
10583 else if (action_id ==
EActions.REMOVE_QUANTITY)
10584 {
10585 if (IsMagazine())
10586 {
10587 Magazine mag2 = Magazine.Cast(this);
10588 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10589 }
10590 else
10591 {
10593 }
10594 if (m_EM)
10595 {
10596 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10597 }
10598
10599 }
10600
10601 else if (action_id ==
EActions.SET_QUANTITY_0)
10602 {
10604
10605 if (m_EM)
10606 {
10607 m_EM.SetEnergy(0);
10608 }
10609 }
10610
10611 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10612 {
10614
10615 if (m_EM)
10616 {
10617 m_EM.SetEnergy(m_EM.GetEnergyMax());
10618 }
10619 }
10620
10621 else if (action_id ==
EActions.ADD_HEALTH)
10622 {
10623 AddHealth("","",GetMaxHealth("","Health")/5);
10624 }
10625 else if (action_id ==
EActions.REMOVE_HEALTH)
10626 {
10627 AddHealth("","",-GetMaxHealth("","Health")/5);
10628 }
10629 else if (action_id ==
EActions.DESTROY_HEALTH)
10630 {
10631 SetHealth01("","",0);
10632 }
10633 else if (action_id ==
EActions.WATCH_ITEM)
10634 {
10636 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10637 #ifdef DEVELOPER
10638 SetDebugDeveloper_item(this);
10639 #endif
10640 }
10641
10642 else if (action_id ==
EActions.ADD_TEMPERATURE)
10643 {
10644 AddTemperature(20);
10645
10646 }
10647
10648 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10649 {
10650 AddTemperature(-20);
10651
10652 }
10653
10654 else if (action_id ==
EActions.FLIP_FROZEN)
10655 {
10656 SetFrozen(!GetIsFrozen());
10657
10658 }
10659
10660 else if (action_id ==
EActions.ADD_WETNESS)
10661 {
10663
10664 }
10665
10666 else if (action_id ==
EActions.REMOVE_WETNESS)
10667 {
10669
10670 }
10671
10672 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10673 {
10676
10677
10678 }
10679
10680 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10681 {
10684 }
10685
10686 else if (action_id ==
EActions.MAKE_SPECIAL)
10687 {
10688 auto debugParams = DebugSpawnParams.WithPlayer(player);
10689 OnDebugSpawnEx(debugParams);
10690 }
10691
10692 else if (action_id ==
EActions.DELETE)
10693 {
10694 Delete();
10695 }
10696
10697 }
10698
10699
10700 return false;
10701 }
10702
10703
10704
10705
10709
10712
10713
10714
10716 {
10717 return false;
10718 }
10719
10720
10722 {
10723 return true;
10724 }
10725
10726
10728 {
10729 return true;
10730 }
10731
10732
10733
10735 {
10736 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10738 }
10739
10742 {
10743 return null;
10744 }
10745
10747 {
10748 return false;
10749 }
10750
10752 {
10753 return false;
10754 }
10755
10759
10760
10762 {
10763 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10764 return module_repairing.CanRepair(this, item_repair_kit);
10765 }
10766
10767
10768 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10769 {
10770 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10771 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10772 }
10773
10774
10776 {
10777
10778
10779
10780
10781
10782
10783
10784
10785 return 1;
10786 }
10787
10788
10789
10791 {
10793 }
10794
10795
10796
10798 {
10800 }
10801
10802
10811 {
10812 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10813
10814 if (player)
10815 {
10816 player.MessageStatus(text);
10817 }
10818 }
10819
10820
10829 {
10830 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10831
10832 if (player)
10833 {
10834 player.MessageAction(text);
10835 }
10836 }
10837
10838
10847 {
10848 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10849
10850 if (player)
10851 {
10852 player.MessageFriendly(text);
10853 }
10854 }
10855
10856
10865 {
10866 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10867
10868 if (player)
10869 {
10870 player.MessageImportant(text);
10871 }
10872 }
10873
10875 {
10876 return true;
10877 }
10878
10879
10880 override bool KindOf(
string tag)
10881 {
10882 bool found = false;
10883 string item_name = this.
GetType();
10886
10887 int array_size = item_tag_array.Count();
10888 for (int i = 0; i < array_size; i++)
10889 {
10890 if (item_tag_array.Get(i) == tag)
10891 {
10892 found = true;
10893 break;
10894 }
10895 }
10896 return found;
10897 }
10898
10899
10901 {
10902
10903 super.OnRPC(sender, rpc_type,ctx);
10904
10905
10906 switch (rpc_type)
10907 {
10908 #ifndef SERVER
10909 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10910 Param2<bool, string> p = new Param2<bool, string>(false, "");
10911
10913 return;
10914
10915 bool play = p.param1;
10916 string soundSet = p.param2;
10917
10918 if (play)
10919 {
10921 {
10923 {
10925 }
10926 }
10927 else
10928 {
10930 }
10931 }
10932 else
10933 {
10935 }
10936
10937 break;
10938 #endif
10939
10940 }
10941
10943 {
10945 }
10946 }
10947
10948
10949
10950
10952 {
10953 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10954 return plugin.GetID(
name);
10955 }
10956
10958 {
10959 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10960 return plugin.GetName(id);
10961 }
10962
10965 {
10966
10967
10968 int varFlags;
10969 if (!ctx.
Read(varFlags))
10970 return;
10971
10972 if (varFlags & ItemVariableFlags.FLOAT)
10973 {
10975 }
10976 }
10977
10979 {
10980
10981 super.SerializeNumericalVars(floats_out);
10982
10983
10984
10986 {
10988 }
10989
10991 {
10993 }
10994
10996 {
10998 }
10999
11001 {
11006 }
11007
11009 {
11011 }
11012 }
11013
11015 {
11016
11017 super.DeSerializeNumericalVars(floats);
11018
11019
11020 int index = 0;
11021 int mask = Math.Round(floats.Get(index));
11022
11023 index++;
11024
11026 {
11028 {
11030 }
11031 else
11032 {
11033 float quantity = floats.Get(index);
11034 SetQuantity(quantity,
true,
false,
false,
false);
11035 }
11036 index++;
11037 }
11038
11040 {
11041 float wet = floats.Get(index);
11043 index++;
11044 }
11045
11047 {
11048 int liquidtype = Math.Round(floats.Get(index));
11050 index++;
11051 }
11052
11054 {
11056 index++;
11058 index++;
11060 index++;
11062 index++;
11063 }
11064
11066 {
11067 int cleanness = Math.Round(floats.Get(index));
11069 index++;
11070 }
11071 }
11072
11074 {
11075 super.WriteVarsToCTX(ctx);
11076
11077
11079 {
11081 }
11082
11084 {
11086 }
11087
11089 {
11091 }
11092
11094 {
11095 int r,g,b,a;
11101 }
11102
11104 {
11106 }
11107 }
11108
11110 {
11111 if (!super.ReadVarsFromCTX(ctx,version))
11112 return false;
11113
11114 int intValue;
11115 float value;
11116
11117 if (version < 140)
11118 {
11119 if (!ctx.
Read(intValue))
11120 return false;
11121
11122 m_VariablesMask = intValue;
11123 }
11124
11126 {
11127 if (!ctx.
Read(value))
11128 return false;
11129
11131 {
11133 }
11134 else
11135 {
11137 }
11138 }
11139
11140 if (version < 140)
11141 {
11143 {
11144 if (!ctx.
Read(value))
11145 return false;
11146 SetTemperatureDirect(value);
11147 }
11148 }
11149
11151 {
11152 if (!ctx.
Read(value))
11153 return false;
11155 }
11156
11158 {
11159 if (!ctx.
Read(intValue))
11160 return false;
11162 }
11163
11165 {
11166 int r,g,b,a;
11168 return false;
11170 return false;
11172 return false;
11174 return false;
11175
11177 }
11178
11180 {
11181 if (!ctx.
Read(intValue))
11182 return false;
11184 }
11185
11186 if (version >= 138 && version < 140)
11187 {
11189 {
11190 if (!ctx.
Read(intValue))
11191 return false;
11192 SetFrozen(intValue);
11193 }
11194 }
11195
11196 return true;
11197 }
11198
11199
11201 {
11204 {
11206 }
11207
11208 if (!super.OnStoreLoad(ctx, version))
11209 {
11211 return false;
11212 }
11213
11214 if (version >= 114)
11215 {
11216 bool hasQuickBarIndexSaved;
11217
11218 if (!ctx.
Read(hasQuickBarIndexSaved))
11219 {
11221 return false;
11222 }
11223
11224 if (hasQuickBarIndexSaved)
11225 {
11226 int itmQBIndex;
11227
11228
11229 if (!ctx.
Read(itmQBIndex))
11230 {
11232 return false;
11233 }
11234
11235 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11236 if (itmQBIndex != -1 && parentPlayer)
11237 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11238 }
11239 }
11240 else
11241 {
11242
11243 PlayerBase player;
11244 int itemQBIndex;
11245 if (version ==
int.
MAX)
11246 {
11247 if (!ctx.
Read(itemQBIndex))
11248 {
11250 return false;
11251 }
11252 }
11253 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11254 {
11255
11256 if (!ctx.
Read(itemQBIndex))
11257 {
11259 return false;
11260 }
11261 if (itemQBIndex != -1 && player)
11262 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11263 }
11264 }
11265
11266 if (version < 140)
11267 {
11268
11269 if (!LoadVariables(ctx, version))
11270 {
11272 return false;
11273 }
11274 }
11275
11276
11278 {
11280 return false;
11281 }
11282 if (version >= 132)
11283 {
11285 if (raib)
11286 {
11288 {
11290 return false;
11291 }
11292 }
11293 }
11294
11296 return true;
11297 }
11298
11299
11300
11302 {
11303 super.OnStoreSave(ctx);
11304
11305 PlayerBase player;
11306 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11307 {
11309
11310 int itemQBIndex = -1;
11311 itemQBIndex = player.FindQuickBarEntityIndex(this);
11312 ctx.
Write(itemQBIndex);
11313 }
11314 else
11315 {
11317 }
11318
11320
11322 if (raib)
11323 {
11325 }
11326 }
11327
11328
11330 {
11331 super.AfterStoreLoad();
11332
11334 {
11336 }
11337
11339 {
11342 }
11343 }
11344
11346 {
11347 super.EEOnAfterLoad();
11348
11350 {
11352 }
11353
11356 }
11357
11359 {
11360 return false;
11361 }
11362
11363
11364
11366 {
11368 {
11369 #ifdef PLATFORM_CONSOLE
11370
11372 {
11374 if (menu)
11375 {
11377 }
11378 }
11379 #endif
11380 }
11381
11383 {
11386 }
11387
11389 {
11390 SetWeightDirty();
11392 }
11394 {
11397 }
11398
11400 {
11403 }
11405 {
11408 }
11409
11410 super.OnVariablesSynchronized();
11411 }
11412
11413
11414
11416 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11417 {
11418 if (!IsServerCheck(allow_client))
11419 return false;
11420
11422 return false;
11423
11426
11427 if (value <= (min + 0.001))
11428 value = min;
11429
11430 if (value == min)
11431 {
11432 if (destroy_config)
11433 {
11434 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11435 if (dstr)
11436 {
11438 this.Delete();
11439 return true;
11440 }
11441 }
11442 else if (destroy_forced)
11443 {
11445 this.Delete();
11446 return true;
11447 }
11448
11450 }
11451
11454
11456 {
11458
11459 if (delta)
11461 }
11462
11464
11465 return false;
11466 }
11467
11468
11470 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11471 {
11473 }
11474
11476 {
11479 }
11480
11482 {
11485 }
11486
11489 {
11490 float value_clamped = Math.Clamp(value, 0, 1);
11492 SetQuantity(result, destroy_config, destroy_forced);
11493 }
11494
11495
11498 {
11500 }
11501
11503 {
11505 }
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11517 {
11518 int slot = -1;
11519 if (GetInventory())
11520 {
11521 InventoryLocation il = new InventoryLocation;
11522 GetInventory().GetCurrentInventoryLocation(il);
11524 }
11525
11527 }
11528
11530 {
11531 float quantity_max = 0;
11532
11534 {
11535 if (attSlotID != -1)
11536 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11537
11538 if (quantity_max <= 0)
11540 }
11541
11542 if (quantity_max <= 0)
11544
11545 return quantity_max;
11546 }
11547
11549 {
11551 }
11552
11554 {
11556 }
11557
11558
11560 {
11562 }
11563
11565 {
11567 }
11568
11570 {
11572 }
11573
11574
11576 {
11577
11578 float weightEx = GetWeightEx();
11579 float special = GetInventoryAndCargoWeight();
11580 return weightEx - special;
11581 }
11582
11583
11585 {
11587 }
11588
11590 {
11592 {
11593 #ifdef DEVELOPER
11594 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11595 {
11596 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11598 }
11599 #endif
11600
11601 return GetQuantity() * GetConfigWeightModified();
11602 }
11603 else if (HasEnergyManager())
11604 {
11605 #ifdef DEVELOPER
11606 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11607 {
11608 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11609 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11610 }
11611 #endif
11612 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11613 }
11614 else
11615 {
11616 #ifdef DEVELOPER
11617 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11618 {
11619 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11620 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11621 }
11622 #endif
11623 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
11624 }
11625 }
11626
11629 {
11630 int item_count = 0;
11632
11633 if (GetInventory().GetCargo() != NULL)
11634 {
11635 item_count = GetInventory().GetCargo().GetItemCount();
11636 }
11637
11638 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11639 {
11640 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11641 if (item)
11642 item_count += item.GetNumberOfItems();
11643 }
11644 return item_count;
11645 }
11646
11649 {
11650 float weight = 0;
11651 float wetness = 1;
11652 if (include_wetness)
11655 {
11656 weight = wetness * m_ConfigWeight;
11657 }
11659 {
11660 weight = 1;
11661 }
11662 return weight;
11663 }
11664
11665
11666
11668 {
11669 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11670 {
11671 GameInventory inv = GetInventory();
11672 array<EntityAI> items = new array<EntityAI>;
11674 for (int i = 0; i < items.Count(); i++)
11675 {
11677 if (item)
11678 {
11680 }
11681 }
11682 }
11683 }
11684
11685
11686
11687
11689 {
11690 float energy = 0;
11691 if (HasEnergyManager())
11692 {
11693 energy = GetCompEM().GetEnergy();
11694 }
11695 return energy;
11696 }
11697
11698
11700 {
11701 super.OnEnergyConsumed();
11702
11704 }
11705
11707 {
11708 super.OnEnergyAdded();
11709
11711 }
11712
11713
11715 {
11716 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11717 {
11719 {
11720 float energy_0to1 = GetCompEM().GetEnergy0To1();
11722 }
11723 }
11724 }
11725
11726
11728 {
11729 return ConfigGetFloat("heatIsolation");
11730 }
11731
11733 {
11735 }
11736
11738 {
11739 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11740 if (
GetGame().ConfigIsExisting(paramPath))
11742
11743 return 0.0;
11744 }
11745
11747 {
11748 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11749 if (
GetGame().ConfigIsExisting(paramPath))
11751
11752 return 0.0;
11753 }
11754
11755 override void SetWet(
float value,
bool allow_client =
false)
11756 {
11757 if (!IsServerCheck(allow_client))
11758 return;
11759
11762
11764
11765 m_VarWet = Math.Clamp(value, min, max);
11766
11768 {
11771 }
11772 }
11773
11774 override void AddWet(
float value)
11775 {
11777 }
11778
11780 {
11782 }
11783
11785 {
11787 }
11788
11790 {
11792 }
11793
11795 {
11797 }
11798
11800 {
11802 }
11803
11804 override void OnWetChanged(
float newVal,
float oldVal)
11805 {
11808 if (newLevel != oldLevel)
11809 {
11811 }
11812 }
11813
11815 {
11816 SetWeightDirty();
11817 }
11818
11820 {
11821 return GetWetLevelInternal(
m_VarWet);
11822 }
11823
11824
11825
11827 {
11829 }
11830
11832 {
11834 }
11835
11837 {
11839 }
11840
11842 {
11844 }
11845
11846
11847
11849 {
11850 if (ConfigIsExisting("itemModelLength"))
11851 {
11852 return ConfigGetFloat("itemModelLength");
11853 }
11854 return 0;
11855 }
11856
11858 {
11859 if (ConfigIsExisting("itemAttachOffset"))
11860 {
11861 return ConfigGetFloat("itemAttachOffset");
11862 }
11863 return 0;
11864 }
11865
11866 override void SetCleanness(
int value,
bool allow_client =
false)
11867 {
11868 if (!IsServerCheck(allow_client))
11869 return;
11870
11872
11874
11877 }
11878
11880 {
11882 }
11883
11885 {
11886 return true;
11887 }
11888
11889
11890
11891
11893 {
11895 }
11896
11898 {
11900 }
11901
11902
11903
11904
11905 override void SetColor(
int r,
int g,
int b,
int a)
11906 {
11912 }
11914 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11915 {
11920 }
11921
11923 {
11925 }
11926
11929 {
11930 int r,g,b,a;
11932 r = r/255;
11933 g = g/255;
11934 b = b/255;
11935 a = a/255;
11936 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11937 }
11938
11939
11940
11941 override void SetLiquidType(
int value,
bool allow_client =
false)
11942 {
11943 if (!IsServerCheck(allow_client))
11944 return;
11945
11950 }
11951
11953 {
11954 return ConfigGetInt("varLiquidTypeInit");
11955 }
11956
11958 {
11960 }
11961
11963 {
11965 SetFrozen(false);
11966 }
11967
11970 {
11971 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11972 }
11973
11974
11977 {
11978 PlayerBase nplayer;
11979 if (PlayerBase.CastTo(nplayer, player))
11980 {
11982
11983 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11984 }
11985 }
11986
11987
11990 {
11991 PlayerBase nplayer;
11992 if (PlayerBase.CastTo(nplayer,player))
11993 {
11994
11995 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11996
11997 }
11998
11999
12000 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12001
12002
12003 if (HasEnergyManager())
12004 {
12005 GetCompEM().UpdatePlugState();
12006 }
12007 }
12008
12009
12011 {
12012 super.OnPlacementStarted(player);
12013
12015 }
12016
12017 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12018 {
12020 {
12021 m_AdminLog.OnPlacementComplete(player,
this);
12022 }
12023
12024 super.OnPlacementComplete(player, position, orientation);
12025 }
12026
12027
12028
12029
12030
12032 {
12034 {
12035 return true;
12036 }
12037 else
12038 {
12039 return false;
12040 }
12041 }
12042
12043
12045 {
12047 {
12049 }
12050 }
12051
12052
12054 {
12056 }
12057
12059 {
12061 }
12062
12063 override void InsertAgent(
int agent,
float count = 1)
12064 {
12065 if (count < 1)
12066 return;
12067
12069 }
12070
12073 {
12075 }
12076
12077
12079 {
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
12119
12120
12121
12122
12123
12125 {
12127 return false;
12128 return true;
12129 }
12130
12132 {
12133
12135 }
12136
12137
12140 {
12141 super.CheckForRoofLimited(timeTresholdMS);
12142
12144 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12145 {
12146 m_PreviousRoofTestTime = time;
12147 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12148 }
12149 }
12150
12151
12153 {
12155 {
12156 return 0;
12157 }
12158
12159 if (GetInventory().GetAttachmentSlotsCount() != 0)
12160 {
12161 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12162 if (filter)
12163 return filter.GetProtectionLevel(type, false, system);
12164 else
12165 return 0;
12166 }
12167
12168 string subclassPath, entryName;
12169
12170 switch (type)
12171 {
12173 entryName = "biological";
12174 break;
12176 entryName = "chemical";
12177 break;
12178 default:
12179 entryName = "biological";
12180 break;
12181 }
12182
12183 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12184
12186 }
12187
12188
12189
12192 {
12193 if (!IsMagazine())
12195
12197 }
12198
12199
12200
12201
12202
12207 {
12208 return true;
12209 }
12210
12212 {
12214 }
12215
12216
12217
12218
12219
12221 {
12222 if (parent)
12223 {
12224 if (parent.IsInherited(DayZInfected))
12225 return true;
12226
12227 if (!parent.IsRuined())
12228 return true;
12229 }
12230
12231 return true;
12232 }
12233
12235 {
12236 if (!super.CanPutAsAttachment(parent))
12237 {
12238 return false;
12239 }
12240
12241 if (!IsRuined() && !parent.IsRuined())
12242 {
12243 return true;
12244 }
12245
12246 return false;
12247 }
12248
12250 {
12251
12252
12253
12254
12255 return super.CanReceiveItemIntoCargo(item);
12256 }
12257
12259 {
12260
12261
12262
12263
12264 GameInventory attachmentInv = attachment.GetInventory();
12266 {
12267 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12268 return false;
12269 }
12270
12271 InventoryLocation loc = new InventoryLocation();
12272 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12273 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12274 return false;
12275
12276 return super.CanReceiveAttachment(attachment, slotId);
12277 }
12278
12280 {
12281 if (!super.CanReleaseAttachment(attachment))
12282 return false;
12283
12284 return GetInventory().AreChildrenAccessible();
12285 }
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12308 {
12309 int id = muzzle_owner.GetMuzzleID();
12310 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12311
12312 if (WPOF_array)
12313 {
12314 for (int i = 0; i < WPOF_array.Count(); i++)
12315 {
12316 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12317
12318 if (WPOF)
12319 {
12320 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12321 }
12322 }
12323 }
12324 }
12325
12326
12328 {
12329 int id = muzzle_owner.GetMuzzleID();
12331
12332 if (WPOBE_array)
12333 {
12334 for (int i = 0; i < WPOBE_array.Count(); i++)
12335 {
12336 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12337
12338 if (WPOBE)
12339 {
12340 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12381 }
12382 }
12383 }
12384 }
12385
12386
12388 {
12389 int id = muzzle_owner.GetMuzzleID();
12390 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12391
12392 if (WPOOH_array)
12393 {
12394 for (int i = 0; i < WPOOH_array.Count(); i++)
12395 {
12396 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12397
12398 if (WPOOH)
12399 {
12400 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12401 }
12402 }
12403 }
12404 }
12405
12406
12407
12409 {
12411 {
12412 return true;
12413 }
12414
12415 return false;
12416 }
12417
12419 {
12421 {
12422 return true;
12423 }
12424
12425 return false;
12426 }
12427
12429 {
12431 {
12432 return true;
12433 }
12434
12435 return false;
12436 }
12437
12439 {
12440 return false;
12441 }
12442
12445 {
12446 return UATimeSpent.DEFAULT_DEPLOY;
12447 }
12448
12449
12450
12451
12453 {
12455 SetSynchDirty();
12456 }
12457
12459 {
12461 }
12462
12463
12465 {
12466 return false;
12467 }
12468
12471 {
12472 string att_type = "None";
12473
12474 if (ConfigIsExisting("soundAttType"))
12475 {
12476 att_type = ConfigGetString("soundAttType");
12477 }
12478
12480 }
12481
12483 {
12485 }
12486
12487
12488
12489
12490
12494
12496 {
12499
12501 }
12502
12503
12505 {
12507 return;
12508
12510
12513
12516
12517 SoundParameters params = new SoundParameters();
12521 }
12522
12523
12525 {
12527 return;
12528
12530 SetSynchDirty();
12531
12534 }
12535
12536
12538 {
12540 return;
12541
12543 SetSynchDirty();
12544
12547 }
12548
12550 {
12552 }
12553
12555 {
12557 }
12558
12561 {
12562 if (!
GetGame().IsDedicatedServer())
12563 {
12564 if (ConfigIsExisting("attachSoundSet"))
12565 {
12566 string cfg_path = "";
12567 string soundset = "";
12568 string type_name =
GetType();
12569
12572 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12573 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12574
12575 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12576 {
12577 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12578 {
12579 if (cfg_slot_array[i] == slot_type)
12580 {
12581 soundset = cfg_soundset_array[i];
12582 break;
12583 }
12584 }
12585 }
12586
12587 if (soundset != "")
12588 {
12589 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12591 }
12592 }
12593 }
12594 }
12595
12597 {
12598
12599 }
12600
12601 void OnApply(PlayerBase player);
12602
12604 {
12605 return 1.0;
12606 };
12607
12609 {
12611 }
12612
12614 {
12616 }
12617
12619
12621 {
12622 SetDynamicPhysicsLifeTime(0.01);
12624 }
12625
12627 {
12628 array<string> zone_names = new array<string>;
12629 GetDamageZones(zone_names);
12630 for (int i = 0; i < zone_names.Count(); i++)
12631 {
12632 SetHealthMax(zone_names.Get(i),"Health");
12633 }
12634 SetHealthMax("","Health");
12635 }
12636
12639 {
12640 float global_health = GetHealth01("","Health");
12641 array<string> zones = new array<string>;
12642 GetDamageZones(zones);
12643
12644 for (int i = 0; i < zones.Count(); i++)
12645 {
12646 SetHealth01(zones.Get(i),"Health",global_health);
12647 }
12648 }
12649
12652 {
12653 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12654 }
12655
12657 {
12658 if (!hasRootAsPlayer)
12659 {
12660 if (refParentIB)
12661 {
12662
12663 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12664 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12665
12666 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12667 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12668
12671 }
12672 else
12673 {
12674
12677 }
12678 }
12679 }
12680
12682 {
12684 {
12685 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12686 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12687 {
12688 float heatPermCoef = 1.0;
12690 while (ent)
12691 {
12692 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12693 ent = ent.GetHierarchyParent();
12694 }
12695
12696 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12697 }
12698 }
12699 }
12700
12702 {
12703
12704 EntityAI parent = GetHierarchyParent();
12705 if (!parent)
12706 {
12707 hasParent = false;
12708 hasRootAsPlayer = false;
12709 }
12710 else
12711 {
12712 hasParent = true;
12713 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12714 refParentIB =
ItemBase.Cast(parent);
12715 }
12716 }
12717
12718 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12719 {
12720
12721 }
12722
12724 {
12725
12726 return false;
12727 }
12728
12730 {
12731
12732
12733 return false;
12734 }
12735
12737 {
12738
12739 return false;
12740 }
12741
12744 {
12745 return !GetIsFrozen() &&
IsOpen();
12746 }
12747
12749 {
12750 bool hasParent = false, hasRootAsPlayer = false;
12752
12753 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12754 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12755
12756 if (wwtu || foodDecay)
12757 {
12761
12762 if (processWetness || processTemperature || processDecay)
12763 {
12765
12766 if (processWetness)
12767 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12768
12769 if (processTemperature)
12771
12772 if (processDecay)
12773 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12774 }
12775 }
12776 }
12777
12780 {
12782 }
12783
12785 {
12788
12789 return super.GetTemperatureFreezeThreshold();
12790 }
12791
12793 {
12796
12797 return super.GetTemperatureThawThreshold();
12798 }
12799
12801 {
12804
12805 return super.GetItemOverheatThreshold();
12806 }
12807
12809 {
12811 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12812
12813 return super.GetTemperatureFreezeTime();
12814 }
12815
12817 {
12819 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12820
12821 return super.GetTemperatureThawTime();
12822 }
12823
12828
12830 {
12831 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12832 }
12833
12835 {
12836 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12837 }
12838
12841 {
12843 }
12844
12846 {
12848 }
12849
12851 {
12853 }
12854
12857 {
12858 return null;
12859 }
12860
12863 {
12864 return false;
12865 }
12866
12868 {
12870 {
12873 if (!trg)
12874 {
12876 explosive = this;
12877 }
12878
12879 explosive.PairRemote(trg);
12881
12882 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12883 trg.SetPersistentPairID(persistentID);
12884 explosive.SetPersistentPairID(persistentID);
12885
12886 return true;
12887 }
12888 return false;
12889 }
12890
12893 {
12894 float ret = 1.0;
12897 ret *= GetHealth01();
12898
12899 return ret;
12900 }
12901
12902 #ifdef DEVELOPER
12903 override void SetDebugItem()
12904 {
12905 super.SetDebugItem();
12906 _itemBase = this;
12907 }
12908
12910 {
12911 string text = super.GetDebugText();
12912
12914 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12915
12916 return text;
12917 }
12918 #endif
12919
12921 {
12922 return true;
12923 }
12924
12926
12928
12930 {
12933 }
12934
12935
12943
12959}
12960
12962{
12964 if (entity)
12965 {
12966 bool is_item = entity.IsInherited(
ItemBase);
12967 if (is_item && full_quantity)
12968 {
12971 }
12972 }
12973 else
12974 {
12976 return NULL;
12977 }
12978 return entity;
12979}
12980
12982{
12983 if (item)
12984 {
12985 if (health > 0)
12986 item.SetHealth("", "", health);
12987
12988 if (item.CanHaveTemperature())
12989 {
12991 if (item.CanFreeze())
12992 item.SetFrozen(false);
12993 }
12994
12995 if (item.HasEnergyManager())
12996 {
12997 if (quantity >= 0)
12998 {
12999 item.GetCompEM().SetEnergy0To1(quantity);
13000 }
13001 else
13002 {
13004 }
13005 }
13006 else if (item.IsMagazine())
13007 {
13008 Magazine mag = Magazine.Cast(item);
13009 if (quantity >= 0)
13010 {
13011 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13012 }
13013 else
13014 {
13016 }
13017
13018 }
13019 else
13020 {
13021 if (quantity >= 0)
13022 {
13023 item.SetQuantityNormalized(quantity, false);
13024 }
13025 else
13026 {
13028 }
13029
13030 }
13031 }
13032}
13033
13034#ifdef DEVELOPER
13036#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.