8173{
8175 {
8176 return true;
8177 }
8178};
8179
8181{
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
8310
8311
8313
8314
8316 {
8321
8322 if (!
g_Game.IsDedicatedServer())
8323 {
8325 {
8327
8329 {
8331 }
8332 }
8333
8336 }
8337
8338 m_OldLocation = null;
8339
8341 {
8343 }
8344
8345 if (ConfigIsExisting("headSelectionsToHide"))
8346 {
8349 }
8350
8352 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8353 {
8355 }
8356
8358
8359 m_IsResultOfSplit = false;
8360
8362 }
8363
8365 {
8366 super.InitItemVariables();
8367
8373 m_Count = ConfigGetInt(
"count");
8374
8377
8382
8385
8390
8402
8406
8407
8410 if (ConfigIsExisting("canBeSplit"))
8411 {
8414 }
8415
8417 if (ConfigIsExisting("itemBehaviour"))
8419
8420
8423 RegisterNetSyncVariableInt("m_VarLiquidType");
8424 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8425
8426 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8427 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8428 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8429
8430 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8431 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8432 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8433 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8434
8435 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8436 RegisterNetSyncVariableBool("m_IsTakeable");
8437 RegisterNetSyncVariableBool("m_IsHologram");
8438
8441 {
8444 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8445 }
8446
8448
8450 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8452
8454 }
8455
8457 {
8459 }
8460
8462 {
8465 {
8470 }
8471 }
8472
8473 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8474 {
8476 {
8479 }
8480
8482 }
8483
8485 {
8491 }
8492
8494
8496 {
8498
8499 if (!action)
8500 {
8501 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8502 return;
8503 }
8504
8506 if (!ai)
8507 {
8509 return;
8510 }
8511
8513 if (!action_array)
8514 {
8515 action_array = new array<ActionBase_Basic>;
8517 }
8518 if (LogManager.IsActionLogEnable())
8519 {
8520 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8521 }
8522
8523 if (action_array.Find(action) != -1)
8524 {
8525 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8526 }
8527 else
8528 {
8529 action_array.Insert(action);
8530 }
8531 }
8532
8534 {
8535 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8536 ActionBase action = player.GetActionManager().GetAction(actionName);
8539
8540 if (action_array)
8541 {
8542 action_array.RemoveItem(action);
8543 }
8544 }
8545
8546
8547
8549 {
8550 ActionOverrideData overrideData = new ActionOverrideData();
8554
8556 if (!actionMap)
8557 {
8560 }
8561
8562 actionMap.Insert(this.
Type(), overrideData);
8563
8564 }
8565
8567
8569
8570
8572 {
8575
8578
8579 string config_to_search = "CfgVehicles";
8580 string muzzle_owner_config;
8581
8583 {
8584 if (IsInherited(Weapon))
8585 config_to_search = "CfgWeapons";
8586
8587 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8588
8589 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8590
8591 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8592
8593 if (config_OnFire_subclass_count > 0)
8594 {
8595 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8596
8597 for (int i = 0; i < config_OnFire_subclass_count; i++)
8598 {
8599 string particle_class = "";
8600 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8601 string config_OnFire_entry = config_OnFire_class + particle_class;
8602 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8603 WPOF_array.Insert(WPOF);
8604 }
8605
8606
8608 }
8609 }
8610
8612 {
8613 config_to_search = "CfgWeapons";
8614 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8615
8616 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8617
8618 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8619
8620 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8621 {
8622 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8623
8624 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8625 {
8626 string particle_class2 = "";
8627 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8628 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8629 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8630 WPOBE_array.Insert(WPOBE);
8631 }
8632
8633
8635 }
8636 }
8637 }
8638
8639
8641 {
8644
8646 {
8647 string config_to_search = "CfgVehicles";
8648
8649 if (IsInherited(Weapon))
8650 config_to_search = "CfgWeapons";
8651
8652 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8653 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8654
8655 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8656 {
8657
8659
8661 {
8663 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8665 return;
8666 }
8667
8670
8671
8672
8673 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8674 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8675
8676 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8677 {
8678 string particle_class = "";
8679 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8680 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8681 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8682
8683 if (entry_type == CT_CLASS)
8684 {
8685 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8686 WPOOH_array.Insert(WPOF);
8687 }
8688 }
8689
8690
8692 }
8693 }
8694 }
8695
8697 {
8699 }
8700
8702 {
8704 {
8706
8709
8712
8713 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8714 }
8715 }
8716
8718 {
8720 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8721
8723 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8724
8726 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8727
8729 {
8731 }
8732 }
8733
8735 {
8737 }
8738
8740 {
8743 else
8745
8747 {
8750 }
8751 else
8752 {
8755
8758 }
8759
8761 }
8762
8764 {
8766 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8767 }
8768
8770 {
8772 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8774 }
8775
8777 {
8779 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8780 }
8781
8783 {
8786
8787 OverheatingParticle OP = new OverheatingParticle();
8792
8794 }
8795
8797 {
8800
8801 return -1;
8802 }
8803
8805 {
8807 {
8810
8811 for (int i = count; i > 0; --i)
8812 {
8813 int id = i - 1;
8816
8819
8820 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8821 {
8822 if (p)
8823 {
8826 }
8827 }
8828 }
8829 }
8830 }
8831
8833 {
8835 {
8837 {
8838 int id = i - 1;
8840
8841 if (OP)
8842 {
8844
8845 if (p)
8846 {
8848 }
8849
8850 delete OP;
8851 }
8852 }
8853
8856 }
8857 }
8858
8861 {
8862 return 0.0;
8863 }
8864
8865
8867 {
8868 return 250;
8869 }
8870
8872 {
8873 return 0;
8874 }
8875
8878 {
8880 return true;
8881
8882 return false;
8883 }
8884
8887 {
8890
8892 {
8894 }
8895 else
8896 {
8897
8899 }
8900
8902 }
8903
8910 {
8911 return -1;
8912 }
8913
8914
8915
8916
8918 {
8920 {
8921 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8922 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8923
8924 if (r_index >= 0)
8925 {
8926 InventoryLocation r_il = new InventoryLocation;
8927 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8928
8929 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8932 {
8933 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8934 }
8936 {
8937 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8938 }
8939
8940 }
8941
8942 player.GetHumanInventory().ClearUserReservedLocation(this);
8943 }
8944
8947 }
8948
8949
8950
8951
8953 {
8954 return ItemBase.m_DebugActionsMask;
8955 }
8956
8958 {
8959 return ItemBase.m_DebugActionsMask & mask;
8960 }
8961
8963 {
8964 ItemBase.m_DebugActionsMask = mask;
8965 }
8966
8968 {
8969 ItemBase.m_DebugActionsMask |= mask;
8970 }
8971
8973 {
8974 ItemBase.m_DebugActionsMask &= ~mask;
8975 }
8976
8978 {
8980 {
8982 }
8983 else
8984 {
8986 }
8987 }
8988
8989
8991 {
8992 if (GetEconomyProfile())
8993 {
8994 float q_max = GetEconomyProfile().GetQuantityMax();
8995 if (q_max > 0)
8996 {
8997 float q_min = GetEconomyProfile().GetQuantityMin();
8998 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8999
9001 {
9002 ComponentEnergyManager comp = GetCompEM();
9004 {
9006 }
9007 }
9009 {
9011
9012 }
9013
9014 }
9015 }
9016 }
9017
9020 {
9021 EntityAI parent = GetHierarchyParent();
9022
9023 if (parent)
9024 {
9025 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9026 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9027 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9028 }
9029 }
9030
9033 {
9034 EntityAI parent = GetHierarchyParent();
9035
9036 if (parent)
9037 {
9038 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9039 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9040 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9041 }
9042 }
9043
9045 {
9046
9047
9048
9049
9051
9053 {
9054 if (ScriptInputUserData.CanStoreInputUserData())
9055 {
9056 ScriptInputUserData ctx = new ScriptInputUserData;
9062 ctx.
Write(use_stack_max);
9065
9067 {
9068 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9069 }
9070 }
9071 }
9072 else if (!
g_Game.IsMultiplayer())
9073 {
9075 }
9076 }
9077
9079 {
9081 }
9082
9084 {
9086 }
9087
9089 {
9091 }
9092
9094 {
9095
9096 return false;
9097 }
9098
9100 {
9101 return false;
9102 }
9103
9107 {
9108 return false;
9109 }
9110
9112 {
9113 return "";
9114 }
9115
9117
9119 {
9120 return false;
9121 }
9122
9124 {
9125 return true;
9126 }
9127
9128
9129
9131 {
9132 return true;
9133 }
9134
9136 {
9137 return true;
9138 }
9139
9141 {
9142 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9144 }
9145
9147 {
9149 }
9150
9152 {
9154 if (!is_being_placed)
9156 SetSynchDirty();
9157 }
9158
9159
9161
9163 {
9165 }
9166
9168 {
9170 }
9171
9173 {
9174 return 1;
9175 }
9176
9178 {
9179 return false;
9180 }
9181
9183 {
9185 SetSynchDirty();
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
9218
9219
9220
9221
9223 {
9224 super.OnMovedInsideCargo(container);
9225
9226 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9227 }
9228
9229 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9230 {
9231 super.EEItemLocationChanged(oldLoc, newLoc);
9232
9233 PlayerBase newPlayer = null;
9234 PlayerBase oldPlayer = null;
9235
9236 if (newLoc.GetParent())
9237 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9238
9239 if (oldLoc.GetParent())
9240 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9241
9243 {
9244 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9245
9246 if (rIndex >= 0)
9247 {
9248 InventoryLocation rIl = new InventoryLocation;
9249 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9250
9251 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9254 {
9255 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9256 }
9258 {
9260 }
9261
9262 }
9263 }
9264
9266 {
9267 if (newPlayer)
9268 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9269
9270 if (newPlayer == oldPlayer)
9271 {
9272 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9273 {
9275 {
9276 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9277 {
9278 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9279 }
9280 }
9281 else
9282 {
9283 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9284 }
9285 }
9286
9287 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9288 {
9289 int type = oldLoc.GetType();
9291 {
9292 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9293 }
9295 {
9296 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9297 }
9298 }
9299 if (!m_OldLocation)
9300 {
9301 m_OldLocation = new InventoryLocation;
9302 }
9303 m_OldLocation.Copy(oldLoc);
9304 }
9305 else
9306 {
9307 if (m_OldLocation)
9308 {
9309 m_OldLocation.Reset();
9310 }
9311 }
9312
9313 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9314 }
9315 else
9316 {
9317 if (newPlayer)
9318 {
9319 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9320 if (resIndex >= 0)
9321 {
9322 InventoryLocation il = new InventoryLocation;
9323 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9325 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9328 {
9329 il.
GetParent().GetOnReleaseLock().Invoke(it);
9330 }
9332 {
9334 }
9335
9336 }
9337 }
9339 {
9340
9342 }
9343
9344 if (m_OldLocation)
9345 {
9346 m_OldLocation.Reset();
9347 }
9348 }
9349
9351 {
9352 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9353 }
9354
9356 {
9357 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9358 }
9359 }
9360
9361 override void EOnContact(IEntity other, Contact extra)
9362 {
9364 {
9365 int liquidType = -1;
9367 if (impactSpeed > 0.0)
9368 {
9370 #ifndef SERVER
9372 #else
9374 SetSynchDirty();
9375 #endif
9377 }
9378 }
9379
9380 #ifdef SERVER
9381 if (GetCompEM() && GetCompEM().IsPlugged())
9382 {
9383 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9384 GetCompEM().UnplugThis();
9385 }
9386 #endif
9387 }
9388
9390
9392 {
9394 }
9395
9397 {
9398
9399 }
9400
9402 {
9403 super.OnItemLocationChanged(old_owner, new_owner);
9404
9405 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9406 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9407
9408 if (!relatedPlayer && playerNew)
9409 relatedPlayer = playerNew;
9410
9411 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9412 {
9414 if (actionMgr)
9415 {
9416 ActionBase currentAction = actionMgr.GetRunningAction();
9417 if (currentAction)
9419 }
9420 }
9421
9422 Man ownerPlayerOld = null;
9423 Man ownerPlayerNew = null;
9424
9425 if (old_owner)
9426 {
9427 if (old_owner.
IsMan())
9428 {
9429 ownerPlayerOld = Man.Cast(old_owner);
9430 }
9431 else
9432 {
9433 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9434 }
9435 }
9436 else
9437 {
9439 {
9441
9442 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9443 {
9444 GetCompEM().UnplugThis();
9445 }
9446 }
9447 }
9448
9449 if (new_owner)
9450 {
9451 if (new_owner.
IsMan())
9452 {
9453 ownerPlayerNew = Man.Cast(new_owner);
9454 }
9455 else
9456 {
9457 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9458 }
9459 }
9460
9461 if (ownerPlayerOld != ownerPlayerNew)
9462 {
9463 if (ownerPlayerOld)
9464 {
9465 array<EntityAI> subItemsExit = new array<EntityAI>;
9467 for (int i = 0; i < subItemsExit.Count(); i++)
9468 {
9471 }
9472 }
9473
9474 if (ownerPlayerNew)
9475 {
9476 array<EntityAI> subItemsEnter = new array<EntityAI>;
9478 for (int j = 0; j < subItemsEnter.Count(); j++)
9479 {
9482 }
9483 }
9484 }
9485 else if (ownerPlayerNew != null)
9486 {
9487 PlayerBase nplayer;
9488 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9489 {
9490 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9492 for (int k = 0; k < subItemsUpdate.Count(); k++)
9493 {
9495 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9496 }
9497 }
9498 }
9499
9500 if (old_owner)
9501 old_owner.OnChildItemRemoved(this);
9502 if (new_owner)
9503 new_owner.OnChildItemReceived(this);
9504 }
9505
9506
9508 {
9509 super.EEDelete(parent);
9510 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9511 if (player)
9512 {
9514
9515 if (player.IsAlive())
9516 {
9517 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9518 if (r_index >= 0)
9519 {
9520 InventoryLocation r_il = new InventoryLocation;
9521 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9522
9523 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9526 {
9527 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9528 }
9530 {
9531 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9532 }
9533
9534 }
9535
9536 player.RemoveQuickBarEntityShortcut(this);
9537 }
9538 }
9539 }
9540
9542 {
9543 super.EEKilled(killer);
9544
9547 {
9548 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9549 {
9550 if (IsMagazine())
9551 {
9552 if (Magazine.Cast(this).GetAmmoCount() > 0)
9553 {
9555 }
9556 }
9557 else
9558 {
9560 }
9561 }
9562 }
9563 }
9564
9566 {
9567 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9568
9569 super.OnWasAttached(parent, slot_id);
9570
9573
9576 }
9577
9579 {
9580 super.OnWasDetached(parent, slot_id);
9581
9584
9587 }
9588
9590 {
9591 int idx;
9594
9595 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9596 if (inventory_slots.Count() < 1)
9597 {
9598 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9599 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9600 }
9601 else
9602 {
9603 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9604 }
9605
9606 idx = inventory_slots.Find(slot);
9607 if (idx < 0)
9608 return "";
9609
9610 return attach_types.Get(idx);
9611 }
9612
9614 {
9615 int idx = -1;
9616 string slot;
9617
9620
9621 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9622 if (inventory_slots.Count() < 1)
9623 {
9624 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9625 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9626 }
9627 else
9628 {
9629 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9630 if (detach_types.Count() < 1)
9631 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9632 }
9633
9634 for (int i = 0; i < inventory_slots.Count(); i++)
9635 {
9636 slot = inventory_slots.Get(i);
9637 }
9638
9639 if (slot != "")
9640 {
9641 if (detach_types.Count() == 1)
9642 idx = 0;
9643 else
9644 idx = inventory_slots.Find(slot);
9645 }
9646 if (idx < 0)
9647 return "";
9648
9649 return detach_types.Get(idx);
9650 }
9651
9653 {
9654
9656
9657
9658 float min_time = 1;
9659 float max_time = 3;
9660 float delay = Math.RandomFloat(min_time, max_time);
9661
9662 explode_timer.Run(delay, this, "DoAmmoExplosion");
9663 }
9664
9666 {
9667 Magazine magazine = Magazine.Cast(this);
9668 int pop_sounds_count = 6;
9669 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9670
9671
9672 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9673 string sound_name = pop_sounds[ sound_idx ];
9674 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9675
9676
9677 magazine.ServerAddAmmoCount(-1);
9678
9679
9680 float min_temp_to_explode = 100;
9681
9682 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9683 {
9685 }
9686 }
9687
9688
9689 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9690 {
9691 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9692
9693 const int CHANCE_DAMAGE_CARGO = 4;
9694 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9695 const int CHANCE_DAMAGE_NOTHING = 2;
9696
9698 {
9699 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9700 int chances;
9701 int rnd;
9702
9703 if (GetInventory().GetCargo())
9704 {
9705 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9706 rnd = Math.RandomInt(0,chances);
9707
9708 if (rnd < CHANCE_DAMAGE_CARGO)
9709 {
9711 }
9712 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9713 {
9715 }
9716 }
9717 else
9718 {
9719 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9720 rnd = Math.RandomInt(0,chances);
9721
9722 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9723 {
9725 }
9726 }
9727 }
9728 }
9729
9731 {
9732 CargoBase cargo = GetInventory().GetCargo();
9733 if (cargo)
9734 {
9736 if (item_count > 0)
9737 {
9738 int random_pick = Math.RandomInt(0, item_count);
9740 if (!item.IsExplosive())
9741 {
9742 item.AddHealth("","",damage);
9743 return true;
9744 }
9745 }
9746 }
9747 return false;
9748 }
9749
9751 {
9752 GameInventory inventory = GetInventory();
9754 if (attachment_count > 0)
9755 {
9756 int random_pick = Math.RandomInt(0, attachment_count);
9758 if (!attachment.IsExplosive())
9759 {
9760 attachment.AddHealth("","",damage);
9761 return true;
9762 }
9763 }
9764 return false;
9765 }
9766
9768 {
9770 }
9771
9773 {
9775 return GetInventory().CanRemoveEntity();
9776
9777 return false;
9778 }
9779
9781 {
9782
9784 return false;
9785
9786
9788 return false;
9789
9790
9791
9793 if (delta == 0)
9794 return false;
9795
9796
9797 return true;
9798 }
9799
9801 {
9803 {
9804 if (ScriptInputUserData.CanStoreInputUserData())
9805 {
9806 ScriptInputUserData ctx = new ScriptInputUserData;
9811 ctx.
Write(destination_entity);
9815 }
9816 }
9817 else if (!
g_Game.IsMultiplayer())
9818 {
9820 }
9821 }
9822
9824 {
9825 float split_quantity_new;
9829 InventoryLocation loc = new InventoryLocation;
9830
9831 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9832 {
9834 split_quantity_new = stack_max;
9835 else
9837
9839 {
9840 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9841 if (new_item)
9842 {
9843 new_item.SetResultOfSplit(true);
9844 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9846 new_item.
SetQuantity(split_quantity_new,
false,
true);
9847 }
9848 }
9849 }
9850 else if (destination_entity && slot_id == -1)
9851 {
9852 if (quantity > stack_max)
9853 split_quantity_new = stack_max;
9854 else
9855 split_quantity_new = quantity;
9856
9858 {
9859 GameInventory destinationInventory = destination_entity.GetInventory();
9861 {
9864 }
9865
9866 if (new_item)
9867 {
9868 new_item.SetResultOfSplit(true);
9869 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9871 new_item.
SetQuantity(split_quantity_new,
false,
true);
9872 }
9873 }
9874 }
9875 else
9876 {
9877 if (stack_max != 0)
9878 {
9880 {
9882 }
9883
9884 if (split_quantity_new == 0)
9885 {
9886 if (!
g_Game.IsMultiplayer())
9887 player.PhysicalPredictiveDropItem(this);
9888 else
9889 player.ServerDropEntity(this);
9890 return;
9891 }
9892
9894 {
9896
9897 if (new_item)
9898 {
9899 new_item.SetResultOfSplit(true);
9900 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9903 new_item.PlaceOnSurface();
9904 }
9905 }
9906 }
9907 }
9908 }
9909
9911 {
9912 float split_quantity_new;
9916 InventoryLocation loc = new InventoryLocation;
9917
9918 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9919 {
9921 split_quantity_new = stack_max;
9922 else
9924
9926 {
9927 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9928 if (new_item)
9929 {
9930 new_item.SetResultOfSplit(true);
9931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9933 new_item.
SetQuantity(split_quantity_new,
false,
true);
9934 }
9935 }
9936 }
9937 else if (destination_entity && slot_id == -1)
9938 {
9939 if (quantity > stack_max)
9940 split_quantity_new = stack_max;
9941 else
9942 split_quantity_new = quantity;
9943
9945 {
9946 GameInventory destinationInventory = destination_entity.GetInventory();
9948 {
9951 }
9952
9953 if (new_item)
9954 {
9955 new_item.SetResultOfSplit(true);
9956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9958 new_item.
SetQuantity(split_quantity_new,
false,
true);
9959 }
9960 }
9961 }
9962 else
9963 {
9964 if (stack_max != 0)
9965 {
9967 {
9969 }
9970
9972 {
9974
9975 if (new_item)
9976 {
9977 new_item.SetResultOfSplit(true);
9978 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9981 new_item.PlaceOnSurface();
9982 }
9983 }
9984 }
9985 }
9986 }
9987
9989 {
9991 {
9992 if (ScriptInputUserData.CanStoreInputUserData())
9993 {
9994 ScriptInputUserData ctx = new ScriptInputUserData;
9999 dst.WriteToContext(ctx);
10001 }
10002 }
10003 else if (!
g_Game.IsMultiplayer())
10004 {
10006 }
10007 }
10008
10010 {
10012 {
10013 if (ScriptInputUserData.CanStoreInputUserData())
10014 {
10015 ScriptInputUserData ctx = new ScriptInputUserData;
10020 ctx.
Write(destination_entity);
10026 }
10027 }
10028 else if (!
g_Game.IsMultiplayer())
10029 {
10031 }
10032 }
10033
10035 {
10037 }
10038
10040 {
10042 float split_quantity_new;
10044 if (dst.IsValid())
10045 {
10046 int slot_id = dst.GetSlot();
10048
10049 if (quantity > stack_max)
10050 split_quantity_new = stack_max;
10051 else
10052 split_quantity_new = quantity;
10053
10055 {
10057
10058 if (new_item)
10059 {
10060 new_item.SetResultOfSplit(true);
10061 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10063 new_item.
SetQuantity(split_quantity_new,
false,
true);
10064 }
10065
10066 return new_item;
10067 }
10068 }
10069
10070 return null;
10071 }
10072
10074 {
10076 float split_quantity_new;
10078 if (destination_entity)
10079 {
10081 if (quantity > stackable)
10082 split_quantity_new = stackable;
10083 else
10084 split_quantity_new = quantity;
10085
10087 {
10088 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10089 if (new_item)
10090 {
10091 new_item.SetResultOfSplit(true);
10092 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10094 new_item.
SetQuantity(split_quantity_new,
false,
true);
10095 }
10096 }
10097 }
10098 }
10099
10101 {
10103 {
10104 if (ScriptInputUserData.CanStoreInputUserData())
10105 {
10106 ScriptInputUserData ctx = new ScriptInputUserData;
10111 ItemBase destination_entity =
this;
10112 ctx.
Write(destination_entity);
10116 }
10117 }
10118 else if (!
g_Game.IsMultiplayer())
10119 {
10121 }
10122 }
10123
10125 {
10127 float split_quantity_new;
10129 if (player)
10130 {
10132 if (quantity > stackable)
10133 split_quantity_new = stackable;
10134 else
10135 split_quantity_new = quantity;
10136
10138 {
10139 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10140 new_item =
ItemBase.Cast(in_hands);
10141 if (new_item)
10142 {
10143 new_item.SetResultOfSplit(true);
10144 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10146 new_item.SetQuantity(split_quantity_new, false, true);
10147 }
10148 }
10149 }
10150 }
10151
10153 {
10155 float split_quantity_new = Math.Floor(quantity * 0.5);
10156
10158 return;
10159
10161
10162 if (new_item)
10163 {
10164 if (new_item.GetQuantityMax() < split_quantity_new)
10165 {
10166 split_quantity_new = new_item.GetQuantityMax();
10167 }
10168
10169 new_item.SetResultOfSplit(true);
10170 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10171
10173 {
10176 }
10177 else
10178 {
10180 new_item.
SetQuantity(split_quantity_new,
false,
true);
10181 }
10182 }
10183 }
10184
10186 {
10188 float split_quantity_new = Math.Floor(quantity / 2);
10189
10191 return;
10192
10193 InventoryLocation invloc = new InventoryLocation;
10195
10197 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10198
10199 if (new_item)
10200 {
10201 if (new_item.GetQuantityMax() < split_quantity_new)
10202 {
10203 split_quantity_new = new_item.GetQuantityMax();
10204 }
10206 {
10209 }
10210 else if (split_quantity_new > 1)
10211 {
10213 new_item.
SetQuantity(split_quantity_new,
false,
true);
10214 }
10215 }
10216 }
10217
10220 {
10221 SetWeightDirty();
10223
10224 if (parent)
10225 parent.OnAttachmentQuantityChangedEx(this, delta);
10226
10228 {
10230 {
10232 }
10234 {
10235 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10237 }
10238 }
10239 }
10240
10243 {
10244
10245 }
10246
10249 {
10251 }
10252
10254 {
10255 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10256
10258 {
10259 if (newLevel == GameConstants.STATE_RUINED)
10260 {
10262 EntityAI parent = GetHierarchyParent();
10263 if (parent && parent.IsFireplace())
10264 {
10265 CargoBase cargo = GetInventory().GetCargo();
10266 if (cargo)
10267 {
10269 {
10271 }
10272 }
10273 }
10274 }
10275
10277 {
10278
10280 return;
10281 }
10282
10283 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10284 {
10286 }
10287 }
10288 }
10289
10290
10292 {
10293 super.OnRightClick();
10294
10296 {
10298 {
10299 if (ScriptInputUserData.CanStoreInputUserData())
10300 {
10301 EntityAI root = GetHierarchyRoot();
10302 Man playerOwner = GetHierarchyRootPlayer();
10303 InventoryLocation dst = new InventoryLocation;
10304
10305
10306 if (!playerOwner && root && root == this)
10307 {
10309 }
10310 else
10311 {
10312
10313 GetInventory().GetCurrentInventoryLocation(dst);
10315 {
10316 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10318 {
10320 }
10321 else
10322 {
10324
10325
10326 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10327 {
10329 }
10330 else
10331 {
10332 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10333 }
10334 }
10335 }
10336 }
10337
10338 ScriptInputUserData ctx = new ScriptInputUserData;
10346 }
10347 }
10348 else if (!
g_Game.IsMultiplayer())
10349 {
10351 }
10352 }
10353 }
10354
10356 {
10357 if (root)
10358 {
10359 vector m4[4];
10360 root.GetTransform(m4);
10361 dst.SetGround(this, m4);
10362 }
10363 else
10364 {
10365 GetInventory().GetCurrentInventoryLocation(dst);
10366 }
10367 }
10368
10369 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10370 {
10371
10372 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10373 return false;
10374
10375 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10376 return false;
10377
10378
10380 return false;
10381
10382
10383 Magazine mag = Magazine.Cast(this);
10384 if (mag)
10385 {
10386 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10387 return false;
10388
10389 if (stack_max_limit)
10390 {
10391 Magazine other_mag = Magazine.Cast(other_item);
10392 if (other_item)
10393 {
10394 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10395 return false;
10396 }
10397
10398 }
10399 }
10400 else
10401 {
10402
10404 return false;
10405
10407 return false;
10408 }
10409
10410 PlayerBase player = null;
10411 if (CastTo(player, GetHierarchyRootPlayer()))
10412 {
10413 if (player.GetInventory().HasAttachment(this))
10414 return false;
10415
10416 if (player.IsItemsToDelete())
10417 return false;
10418 }
10419
10420 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10421 return false;
10422
10423 int slotID;
10425 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10426 return false;
10427
10428 return true;
10429 }
10430
10432 {
10434 }
10435
10437 {
10438 return m_IsResultOfSplit;
10439 }
10440
10442 {
10443 m_IsResultOfSplit = value;
10444 }
10445
10447 {
10449 }
10450
10452 {
10453 float other_item_quantity = other_item.GetQuantity();
10454 float this_free_space;
10455
10457
10459
10460 if (other_item_quantity > this_free_space)
10461 {
10462 return this_free_space;
10463 }
10464 else
10465 {
10466 return other_item_quantity;
10467 }
10468 }
10469
10471 {
10473 }
10474
10476 {
10478 return;
10479
10480 if (!IsMagazine() && other_item)
10481 {
10483 if (quantity_used != 0)
10484 {
10485 float hp1 = GetHealth01("","");
10486 float hp2 = other_item.GetHealth01("","");
10487 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10488 hpResult = hpResult / (
GetQuantity() + quantity_used);
10489
10490 hpResult *= GetMaxHealth();
10491 Math.Round(hpResult);
10492 SetHealth("", "Health", hpResult);
10493
10495 other_item.AddQuantity(-quantity_used);
10496 }
10497 }
10499 }
10500
10502 {
10503 #ifdef SERVER
10504 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10505 GetHierarchyParent().IncreaseLifetimeUp();
10506 #endif
10507 };
10508
10510 {
10511 PlayerBase p = PlayerBase.Cast(player);
10512
10513 array<int> recipesIds = p.m_Recipes;
10514 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10515 if (moduleRecipesManager)
10516 {
10517 EntityAI itemInHands = player.GetEntityInHands();
10518 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10519 }
10520
10521 for (int i = 0;i < recipesIds.Count(); i++)
10522 {
10523 int key = recipesIds.Get(i);
10524 string recipeName = moduleRecipesManager.GetRecipeName(key);
10526 }
10527 }
10528
10529
10530 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10531 {
10532 super.GetDebugActions(outputList);
10533
10534
10540
10541
10546
10551
10552
10556
10557
10559 {
10563 }
10564
10567
10568
10572
10574
10575 InventoryLocation loc = new InventoryLocation();
10576 GetInventory().GetCurrentInventoryLocation(loc);
10578 {
10579 if (Gizmo_IsSupported())
10582 }
10583
10585 }
10586
10587
10588
10589
10591 {
10592 super.OnAction(action_id, player, ctx);
10593
10595 {
10596 switch (action_id)
10597 {
10601 return true;
10605 return true;
10606 }
10607 }
10608
10610 {
10611 switch (action_id)
10612 {
10614 Delete();
10615 return true;
10616 }
10617 }
10618
10619 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10620 {
10621 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10622 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10623 PlayerBase p = PlayerBase.Cast(player);
10624 if (
EActions.RECIPES_RANGE_START < 1000)
10625 {
10626 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10627 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10628 }
10629 }
10630 #ifndef SERVER
10631 else if (action_id ==
EActions.WATCH_PLAYER)
10632 {
10633 PluginDeveloper.SetDeveloperItemClientEx(player);
10634 }
10635 #endif
10637 {
10638 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10639 {
10640 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10641 OnDebugButtonPressServer(id + 1);
10642 }
10643
10644 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10645 {
10646 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10648 }
10649
10650 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10651 {
10652 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10654 }
10655
10656 else if (action_id ==
EActions.ADD_QUANTITY)
10657 {
10658 if (IsMagazine())
10659 {
10660 Magazine mag = Magazine.Cast(this);
10661 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10662 }
10663 else
10664 {
10666 }
10667
10668 if (m_EM)
10669 {
10670 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10671 }
10672
10673 }
10674
10675 else if (action_id ==
EActions.REMOVE_QUANTITY)
10676 {
10677 if (IsMagazine())
10678 {
10679 Magazine mag2 = Magazine.Cast(this);
10680 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10681 }
10682 else
10683 {
10685 }
10686 if (m_EM)
10687 {
10688 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10689 }
10690
10691 }
10692
10693 else if (action_id ==
EActions.SET_QUANTITY_0)
10694 {
10696
10697 if (m_EM)
10698 {
10699 m_EM.SetEnergy(0);
10700 }
10701 }
10702
10703 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10704 {
10706
10707 if (m_EM)
10708 {
10709 m_EM.SetEnergy(m_EM.GetEnergyMax());
10710 }
10711 }
10712
10713 else if (action_id ==
EActions.ADD_HEALTH)
10714 {
10715 AddHealth("","",GetMaxHealth("","Health")/5);
10716 }
10717 else if (action_id ==
EActions.REMOVE_HEALTH)
10718 {
10719 AddHealth("","",-GetMaxHealth("","Health")/5);
10720 }
10721 else if (action_id ==
EActions.DESTROY_HEALTH)
10722 {
10723 SetHealth01("","",0);
10724 }
10725 else if (action_id ==
EActions.WATCH_ITEM)
10726 {
10728 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10729 #ifdef DEVELOPER
10730 SetDebugDeveloper_item(this);
10731 #endif
10732 }
10733
10734 else if (action_id ==
EActions.ADD_TEMPERATURE)
10735 {
10736 AddTemperature(20);
10737
10738 }
10739
10740 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10741 {
10742 AddTemperature(-20);
10743
10744 }
10745
10746 else if (action_id ==
EActions.FLIP_FROZEN)
10747 {
10748 SetFrozen(!GetIsFrozen());
10749
10750 }
10751
10752 else if (action_id ==
EActions.ADD_WETNESS)
10753 {
10755
10756 }
10757
10758 else if (action_id ==
EActions.REMOVE_WETNESS)
10759 {
10761
10762 }
10763
10764 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10765 {
10768
10769
10770 }
10771
10772 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10773 {
10776 }
10777
10778 else if (action_id ==
EActions.MAKE_SPECIAL)
10779 {
10780 auto debugParams = DebugSpawnParams.WithPlayer(player);
10781 OnDebugSpawnEx(debugParams);
10782 }
10783
10784 }
10785
10786
10787 return false;
10788 }
10789
10790
10791
10792
10796
10799
10800
10801
10803 {
10804 return false;
10805 }
10806
10807
10809 {
10810 return true;
10811 }
10812
10813
10815 {
10816 return true;
10817 }
10818
10819
10820
10822 {
10823 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10824 return g_Game.ConfigIsExisting(config_path);
10825 }
10826
10829 {
10830 return null;
10831 }
10832
10834 {
10835 return false;
10836 }
10837
10839 {
10840 return false;
10841 }
10842
10846
10847
10849 {
10850 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10851 return module_repairing.CanRepair(this, item_repair_kit);
10852 }
10853
10854
10855 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10856 {
10857 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10858 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10859 }
10860
10861
10863 {
10864
10865
10866
10867
10868
10869
10870
10871
10872 return 1;
10873 }
10874
10875
10876
10878 {
10880 }
10881
10882
10883
10885 {
10887 }
10888
10889
10898 {
10899 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10900
10901 if (player)
10902 {
10903 player.MessageStatus(text);
10904 }
10905 }
10906
10907
10916 {
10917 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10918
10919 if (player)
10920 {
10921 player.MessageAction(text);
10922 }
10923 }
10924
10925
10934 {
10935 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10936
10937 if (player)
10938 {
10939 player.MessageFriendly(text);
10940 }
10941 }
10942
10943
10952 {
10953 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10954
10955 if (player)
10956 {
10957 player.MessageImportant(text);
10958 }
10959 }
10960
10962 {
10963 return true;
10964 }
10965
10966
10967 override bool KindOf(
string tag)
10968 {
10969 bool found = false;
10970 string item_name = this.
GetType();
10972 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10973
10974 int array_size = item_tag_array.Count();
10975 for (int i = 0; i < array_size; i++)
10976 {
10977 if (item_tag_array.Get(i) == tag)
10978 {
10979 found = true;
10980 break;
10981 }
10982 }
10983 return found;
10984 }
10985
10986
10988 {
10989
10990 super.OnRPC(sender, rpc_type,ctx);
10991
10992
10993 switch (rpc_type)
10994 {
10995 #ifndef SERVER
10996 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10997 Param2<bool, string> p = new Param2<bool, string>(false, "");
10998
11000 return;
11001
11002 bool play = p.param1;
11003 string soundSet = p.param2;
11004
11005 if (play)
11006 {
11008 {
11010 {
11012 }
11013 }
11014 else
11015 {
11017 }
11018 }
11019 else
11020 {
11022 }
11023
11024 break;
11025 #endif
11026
11027 }
11028
11030 {
11032 }
11033 }
11034
11035
11036
11037
11039 {
11040 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11041 return plugin.GetID(
name);
11042 }
11043
11045 {
11046 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11047 return plugin.GetName(id);
11048 }
11049
11052 {
11053
11054
11055 int varFlags;
11056 if (!ctx.
Read(varFlags))
11057 return;
11058
11059 if (varFlags & ItemVariableFlags.FLOAT)
11060 {
11062 }
11063 }
11064
11066 {
11067
11068 super.SerializeNumericalVars(floats_out);
11069
11070
11071
11073 {
11075 }
11076
11078 {
11080 }
11081
11083 {
11085 }
11086
11088 {
11093 }
11094
11096 {
11098 }
11099 }
11100
11102 {
11103
11104 super.DeSerializeNumericalVars(floats);
11105
11106
11107 int index = 0;
11108 int mask = Math.Round(floats.Get(index));
11109
11110 index++;
11111
11113 {
11115 {
11117 }
11118 else
11119 {
11120 float quantity = floats.Get(index);
11121 SetQuantity(quantity,
true,
false,
false,
false);
11122 }
11123 index++;
11124 }
11125
11127 {
11128 float wet = floats.Get(index);
11130 index++;
11131 }
11132
11134 {
11135 int liquidtype = Math.Round(floats.Get(index));
11137 index++;
11138 }
11139
11141 {
11143 index++;
11145 index++;
11147 index++;
11149 index++;
11150 }
11151
11153 {
11154 int cleanness = Math.Round(floats.Get(index));
11156 index++;
11157 }
11158 }
11159
11161 {
11162 super.WriteVarsToCTX(ctx);
11163
11164
11166 {
11168 }
11169
11171 {
11173 }
11174
11176 {
11178 }
11179
11181 {
11182 int r,g,b,a;
11188 }
11189
11191 {
11193 }
11194 }
11195
11197 {
11198 if (!super.ReadVarsFromCTX(ctx,version))
11199 return false;
11200
11201 int intValue;
11202 float value;
11203
11204 if (version < 140)
11205 {
11206 if (!ctx.
Read(intValue))
11207 return false;
11208
11209 m_VariablesMask = intValue;
11210 }
11211
11213 {
11214 if (!ctx.
Read(value))
11215 return false;
11216
11218 {
11220 }
11221 else
11222 {
11224 }
11225 }
11226
11227 if (version < 140)
11228 {
11230 {
11231 if (!ctx.
Read(value))
11232 return false;
11233 SetTemperatureDirect(value);
11234 }
11235 }
11236
11238 {
11239 if (!ctx.
Read(value))
11240 return false;
11242 }
11243
11245 {
11246 if (!ctx.
Read(intValue))
11247 return false;
11249 }
11250
11252 {
11253 int r,g,b,a;
11255 return false;
11257 return false;
11259 return false;
11261 return false;
11262
11264 }
11265
11267 {
11268 if (!ctx.
Read(intValue))
11269 return false;
11271 }
11272
11273 if (version >= 138 && version < 140)
11274 {
11276 {
11277 if (!ctx.
Read(intValue))
11278 return false;
11279 SetFrozen(intValue);
11280 }
11281 }
11282
11283 return true;
11284 }
11285
11286
11288 {
11291 {
11293 }
11294
11295 if (!super.OnStoreLoad(ctx, version))
11296 {
11298 return false;
11299 }
11300
11301 if (version >= 114)
11302 {
11303 bool hasQuickBarIndexSaved;
11304
11305 if (!ctx.
Read(hasQuickBarIndexSaved))
11306 {
11308 return false;
11309 }
11310
11311 if (hasQuickBarIndexSaved)
11312 {
11313 int itmQBIndex;
11314
11315
11316 if (!ctx.
Read(itmQBIndex))
11317 {
11319 return false;
11320 }
11321
11322 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11323 if (itmQBIndex != -1 && parentPlayer)
11324 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11325 }
11326 }
11327 else
11328 {
11329
11330 PlayerBase player;
11331 int itemQBIndex;
11332 if (version ==
int.
MAX)
11333 {
11334 if (!ctx.
Read(itemQBIndex))
11335 {
11337 return false;
11338 }
11339 }
11340 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11341 {
11342
11343 if (!ctx.
Read(itemQBIndex))
11344 {
11346 return false;
11347 }
11348 if (itemQBIndex != -1 && player)
11349 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11350 }
11351 }
11352
11353 if (version < 140)
11354 {
11355
11356 if (!LoadVariables(ctx, version))
11357 {
11359 return false;
11360 }
11361 }
11362
11363
11365 {
11367 return false;
11368 }
11369 if (version >= 132)
11370 {
11372 if (raib)
11373 {
11375 {
11377 return false;
11378 }
11379 }
11380 }
11381
11383 return true;
11384 }
11385
11386
11387
11389 {
11390 super.OnStoreSave(ctx);
11391
11392 PlayerBase player;
11393 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11394 {
11396
11397 int itemQBIndex = -1;
11398 itemQBIndex = player.FindQuickBarEntityIndex(this);
11399 ctx.
Write(itemQBIndex);
11400 }
11401 else
11402 {
11404 }
11405
11407
11409 if (raib)
11410 {
11412 }
11413 }
11414
11415
11417 {
11418 super.AfterStoreLoad();
11419
11421 {
11423 }
11424
11426 {
11429 }
11430 }
11431
11433 {
11434 super.EEOnAfterLoad();
11435
11437 {
11439 }
11440
11443 }
11444
11446 {
11447 return false;
11448 }
11449
11450
11451
11453 {
11455 {
11456 #ifdef PLATFORM_CONSOLE
11457
11459 {
11461 if (menu)
11462 {
11464 }
11465 }
11466 #endif
11467 }
11468
11470 {
11473 }
11474
11476 {
11477 SetWeightDirty();
11479 }
11481 {
11484 }
11485
11487 {
11490
11493 }
11495 {
11499 }
11500
11501 super.OnVariablesSynchronized();
11502 }
11503
11504
11505
11507 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11508 {
11509 if (!IsServerCheck(allow_client))
11510 return false;
11511
11513 return false;
11514
11517
11518 if (value <= (min + 0.001))
11519 value = min;
11520
11521 if (value == min)
11522 {
11523 if (destroy_config)
11524 {
11525 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11526 if (dstr)
11527 {
11529 this.Delete();
11530 return true;
11531 }
11532 }
11533 else if (destroy_forced)
11534 {
11536 this.Delete();
11537 return true;
11538 }
11539
11541 }
11542
11545
11547 {
11548 EntityAI parent = GetHierarchyRoot();
11549 InventoryLocation iLoc = new InventoryLocation();
11550 GetInventory().GetCurrentInventoryLocation(iLoc);
11552 {
11553 int iLocSlot = iLoc.
GetSlot();
11555 {
11557 }
11559 {
11561 }
11562 }
11563 }
11564
11566 {
11568
11569 if (delta)
11571 }
11572
11574
11575 return false;
11576 }
11577
11578
11580 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11581 {
11583 }
11584
11586 {
11589 }
11590
11592 {
11595 }
11596
11598 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11599 {
11600 float value_clamped = Math.Clamp(value, 0, 1);
11602 SetQuantity(result, destroy_config, destroy_forced);
11603 }
11604
11605
11608 {
11610 }
11611
11613 {
11615 }
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11627 {
11628 int slot = -1;
11629 GameInventory inventory = GetInventory();
11630 if (inventory)
11631 {
11632 InventoryLocation il = new InventoryLocation;
11635 }
11636
11638 }
11639
11641 {
11642 float quantity_max = 0;
11643
11645 {
11646 if (attSlotID != -1)
11647 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11648
11649 if (quantity_max <= 0)
11651 }
11652
11653 if (quantity_max <= 0)
11655
11656 return quantity_max;
11657 }
11658
11660 {
11662 }
11663
11665 {
11667 }
11668
11669
11671 {
11673 }
11674
11676 {
11678 }
11679
11681 {
11683 }
11684
11685
11687 {
11688
11689 float weightEx = GetWeightEx();
11690 float special = GetInventoryAndCargoWeight();
11691 return weightEx - special;
11692 }
11693
11694
11696 {
11698 }
11699
11701 {
11703 {
11704 #ifdef DEVELOPER
11705 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11706 {
11707 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11709 }
11710 #endif
11711
11712 return GetQuantity() * GetConfigWeightModified();
11713 }
11714 else if (HasEnergyManager())
11715 {
11716 #ifdef DEVELOPER
11717 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11718 {
11719 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11720 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11721 }
11722 #endif
11723 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11724 }
11725 else
11726 {
11727 #ifdef DEVELOPER
11728 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11729 {
11730 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11731 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11732 }
11733 #endif
11734 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11735 }
11736 }
11737
11740 {
11741 int item_count = 0;
11743
11744 GameInventory inventory = GetInventory();
11745 CargoBase cargo = inventory.
GetCargo();
11746 if (cargo != NULL)
11747 {
11749 }
11750
11752 for (int i = 0; i < nAttachments; ++i)
11753 {
11755 if (item)
11756 item_count += item.GetNumberOfItems();
11757 }
11758 return item_count;
11759 }
11760
11763 {
11764 float weight = 0;
11765 float wetness = 1;
11766 if (include_wetness)
11769 {
11770 weight = wetness * m_ConfigWeight;
11771 }
11773 {
11774 weight = 1;
11775 }
11776 return weight;
11777 }
11778
11779
11780
11782 {
11783 GameInventory inventory = GetInventory();
11784 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11785 {
11786 array<EntityAI> items = new array<EntityAI>;
11788 for (int i = 0; i < items.Count(); ++i)
11789 {
11791 if (item)
11792 {
11793 g_Game.ObjectDelete(item);
11794 }
11795 }
11796 }
11797 }
11798
11799
11800
11801
11803 {
11804 float energy = 0;
11805 if (HasEnergyManager())
11806 {
11807 energy = GetCompEM().GetEnergy();
11808 }
11809 return energy;
11810 }
11811
11812
11814 {
11815 super.OnEnergyConsumed();
11816
11818 }
11819
11821 {
11822 super.OnEnergyAdded();
11823
11825 }
11826
11827
11829 {
11830 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11831 {
11833 {
11834 float energy_0to1 = GetCompEM().GetEnergy0To1();
11836 }
11837 }
11838 }
11839
11840
11842 {
11843 return ConfigGetFloat("heatIsolation");
11844 }
11845
11847 {
11849 }
11850
11852 {
11853 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11854 if (
g_Game.ConfigIsExisting(paramPath))
11855 return g_Game.ConfigGetFloat(paramPath);
11856
11857 return 0.0;
11858 }
11859
11861 {
11862 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11863 if (
g_Game.ConfigIsExisting(paramPath))
11864 return g_Game.ConfigGetFloat(paramPath);
11865
11866 return 0.0;
11867 }
11868
11869 override void SetWet(
float value,
bool allow_client =
false)
11870 {
11871 if (!IsServerCheck(allow_client))
11872 return;
11873
11876
11878
11879 m_VarWet = Math.Clamp(value, min, max);
11880
11882 {
11885 }
11886 }
11887
11888 override void AddWet(
float value)
11889 {
11891 }
11892
11894 {
11896 }
11897
11899 {
11901 }
11902
11904 {
11906 }
11907
11909 {
11911 }
11912
11914 {
11916 }
11917
11918 override void OnWetChanged(
float newVal,
float oldVal)
11919 {
11922 if (newLevel != oldLevel)
11923 {
11925 }
11926 }
11927
11929 {
11930 SetWeightDirty();
11931 }
11932
11934 {
11935 return GetWetLevelInternal(
m_VarWet);
11936 }
11937
11938
11939
11941 {
11943 }
11944
11946 {
11948 }
11949
11951 {
11953 }
11954
11956 {
11958 }
11959
11960
11961
11963 {
11964 if (ConfigIsExisting("itemModelLength"))
11965 {
11966 return ConfigGetFloat("itemModelLength");
11967 }
11968 return 0;
11969 }
11970
11972 {
11973 if (ConfigIsExisting("itemAttachOffset"))
11974 {
11975 return ConfigGetFloat("itemAttachOffset");
11976 }
11977 return 0;
11978 }
11979
11980 override void SetCleanness(
int value,
bool allow_client =
false)
11981 {
11982 if (!IsServerCheck(allow_client))
11983 return;
11984
11986
11988
11991 }
11992
11994 {
11996 }
11997
11999 {
12000 return true;
12001 }
12002
12003
12004
12005
12007 {
12009 }
12010
12012 {
12014 }
12015
12016
12017
12018
12019 override void SetColor(
int r,
int g,
int b,
int a)
12020 {
12026 }
12028 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12029 {
12034 }
12035
12037 {
12039 }
12040
12043 {
12044 int r,g,b,a;
12046 r = r/255;
12047 g = g/255;
12048 b = b/255;
12049 a = a/255;
12050 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12051 }
12052
12053
12054
12055 override void SetLiquidType(
int value,
bool allow_client =
false)
12056 {
12057 if (!IsServerCheck(allow_client))
12058 return;
12059
12064 }
12065
12067 {
12068 return ConfigGetInt("varLiquidTypeInit");
12069 }
12070
12072 {
12074 }
12075
12077 {
12079 SetFrozen(false);
12080 }
12081
12084 {
12085 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12086 }
12087
12088
12091 {
12092 PlayerBase nplayer;
12093 if (PlayerBase.CastTo(nplayer, player))
12094 {
12096 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12097 }
12098 }
12099
12100
12103 {
12104 PlayerBase nplayer;
12105 if (PlayerBase.CastTo(nplayer,player))
12106 {
12107 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12108 }
12109
12110 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12111
12112 if (HasEnergyManager())
12113 {
12114 GetCompEM().UpdatePlugState();
12115 }
12116 }
12117
12118
12120 {
12121 super.OnPlacementStarted(player);
12122
12124 }
12125
12126 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12127 {
12129 {
12130 m_AdminLog.OnPlacementComplete(player,
this);
12131 }
12132
12133 super.OnPlacementComplete(player, position, orientation);
12134 }
12135
12136
12137
12138
12139
12141 {
12143 {
12144 return true;
12145 }
12146 else
12147 {
12148 return false;
12149 }
12150 }
12151
12152
12154 {
12156 {
12158 }
12159 }
12160
12161
12163 {
12165 }
12166
12168 {
12170 }
12171
12172 override void InsertAgent(
int agent,
float count = 1)
12173 {
12174 if (count < 1)
12175 return;
12176
12178 }
12179
12182 {
12184 }
12185
12186
12188 {
12190 }
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12234 {
12236 return false;
12237 return true;
12238 }
12239
12241 {
12242
12244 }
12245
12246
12249 {
12250 super.CheckForRoofLimited(timeTresholdMS);
12251
12252 float time =
g_Game.GetTime();
12253 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12254 {
12255 m_PreviousRoofTestTime = time;
12256 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12257 }
12258 }
12259
12260
12262 {
12264 {
12265 return 0;
12266 }
12267
12268 if (GetInventory().GetAttachmentSlotsCount() != 0)
12269 {
12270 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12271 if (filter)
12272 return filter.GetProtectionLevel(type, false, system);
12273 else
12274 return 0;
12275 }
12276
12277 string subclassPath, entryName;
12278
12279 switch (type)
12280 {
12282 entryName = "biological";
12283 break;
12285 entryName = "chemical";
12286 break;
12287 default:
12288 entryName = "biological";
12289 break;
12290 }
12291
12292 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12293
12294 return g_Game.ConfigGetFloat(subclassPath + entryName);
12295 }
12296
12297
12298
12301 {
12302 if (!IsMagazine())
12304
12306 }
12307
12308
12309
12310
12311
12316 {
12317 return true;
12318 }
12319
12321 {
12323 }
12324
12325
12326
12327
12328
12330 {
12331 if (parent)
12332 {
12333 if (parent.IsInherited(DayZInfected))
12334 return true;
12335
12336 if (!parent.IsRuined())
12337 return true;
12338 }
12339
12340 return true;
12341 }
12342
12344 {
12345 if (!super.CanPutAsAttachment(parent))
12346 {
12347 return false;
12348 }
12349
12350 if (!IsRuined() && !parent.IsRuined())
12351 {
12352 return true;
12353 }
12354
12355 return false;
12356 }
12357
12359 {
12360
12361
12362
12363
12364 return super.CanReceiveItemIntoCargo(item);
12365 }
12366
12368 {
12369
12370
12371
12372
12373 GameInventory attachmentInv = attachment.GetInventory();
12375 {
12376 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12377 return false;
12378 }
12379
12380 InventoryLocation loc = new InventoryLocation();
12381 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12382 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12383 return false;
12384
12385 return super.CanReceiveAttachment(attachment, slotId);
12386 }
12387
12389 {
12390 if (!super.CanReleaseAttachment(attachment))
12391 return false;
12392
12393 return GetInventory().AreChildrenAccessible();
12394 }
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12417 {
12418 int id = muzzle_owner.GetMuzzleID();
12419 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12420
12421 if (WPOF_array)
12422 {
12423 for (int i = 0; i < WPOF_array.Count(); i++)
12424 {
12425 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12426
12427 if (WPOF)
12428 {
12429 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12430 }
12431 }
12432 }
12433 }
12434
12435
12437 {
12438 int id = muzzle_owner.GetMuzzleID();
12440
12441 if (WPOBE_array)
12442 {
12443 for (int i = 0; i < WPOBE_array.Count(); i++)
12444 {
12445 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12446
12447 if (WPOBE)
12448 {
12449 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12450 }
12451 }
12452 }
12453 }
12454
12455
12457 {
12458 int id = muzzle_owner.GetMuzzleID();
12459 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12460
12461 if (WPOOH_array)
12462 {
12463 for (int i = 0; i < WPOOH_array.Count(); i++)
12464 {
12465 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12466
12467 if (WPOOH)
12468 {
12469 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12470 }
12471 }
12472 }
12473 }
12474
12475
12477 {
12478 int id = muzzle_owner.GetMuzzleID();
12479 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12480
12481 if (WPOOH_array)
12482 {
12483 for (int i = 0; i < WPOOH_array.Count(); i++)
12484 {
12485 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12486
12487 if (WPOOH)
12488 {
12489 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12490 }
12491 }
12492 }
12493 }
12494
12495
12497 {
12498 int id = muzzle_owner.GetMuzzleID();
12499 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12500
12501 if (WPOOH_array)
12502 {
12503 for (int i = 0; i < WPOOH_array.Count(); i++)
12504 {
12505 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12506
12507 if (WPOOH)
12508 {
12509 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12510 }
12511 }
12512 }
12513 }
12514
12515
12516
12518 {
12520 {
12521 return true;
12522 }
12523
12524 return false;
12525 }
12526
12528 {
12530 {
12531 return true;
12532 }
12533
12534 return false;
12535 }
12536
12538 {
12540 {
12541 return true;
12542 }
12543
12544 return false;
12545 }
12546
12548 {
12549 return false;
12550 }
12551
12554 {
12555 return UATimeSpent.DEFAULT_DEPLOY;
12556 }
12557
12558
12559
12560
12562 {
12564 SetSynchDirty();
12565 }
12566
12568 {
12570 }
12571
12572
12574 {
12575 return false;
12576 }
12577
12580 {
12581 string att_type = "None";
12582
12583 if (ConfigIsExisting("soundAttType"))
12584 {
12585 att_type = ConfigGetString("soundAttType");
12586 }
12587
12589 }
12590
12592 {
12594 }
12595
12596
12597
12598
12599
12605
12607 {
12610
12612 }
12613
12614
12616 {
12618 return;
12619
12621
12624
12627
12628 SoundParameters params = new SoundParameters();
12632 }
12633
12634
12636 {
12638 {
12641
12642 SetSynchDirty();
12643
12646 }
12647 }
12648
12650 {
12652 }
12653
12654
12656 {
12658 return;
12659
12661 SetSynchDirty();
12662
12665 }
12666
12668 {
12671 }
12672
12674 {
12676 }
12677
12678 void OnApply(PlayerBase player);
12679
12681 {
12682 return 1.0;
12683 };
12684
12686 {
12688 }
12689
12691 {
12693 }
12694
12696
12698 {
12699 SetDynamicPhysicsLifeTime(0.01);
12701 }
12702
12704 {
12705 array<string> zone_names = new array<string>;
12706 GetDamageZones(zone_names);
12707 for (int i = 0; i < zone_names.Count(); i++)
12708 {
12709 SetHealthMax(zone_names.Get(i),"Health");
12710 }
12711 SetHealthMax("","Health");
12712 }
12713
12716 {
12717 float global_health = GetHealth01("","Health");
12718 array<string> zones = new array<string>;
12719 GetDamageZones(zones);
12720
12721 for (int i = 0; i < zones.Count(); i++)
12722 {
12723 SetHealth01(zones.Get(i),"Health",global_health);
12724 }
12725 }
12726
12729 {
12730 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12731 }
12732
12734 {
12735 if (!hasRootAsPlayer)
12736 {
12737 if (refParentIB)
12738 {
12739
12740 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12741 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12742
12743 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12744 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12745
12748 }
12749 else
12750 {
12751
12754 }
12755 }
12756 }
12757
12759 {
12761 {
12762 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12763 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12764 {
12765 float heatPermCoef = 1.0;
12767 while (ent)
12768 {
12769 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12770 ent = ent.GetHierarchyParent();
12771 }
12772
12773 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12774 }
12775 }
12776 }
12777
12779 {
12780
12781 EntityAI parent = GetHierarchyParent();
12782 if (!parent)
12783 {
12784 hasParent = false;
12785 hasRootAsPlayer = false;
12786 }
12787 else
12788 {
12789 hasParent = true;
12790 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12791 refParentIB =
ItemBase.Cast(parent);
12792 }
12793 }
12794
12795 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12796 {
12797
12798 }
12799
12801 {
12802
12803 return false;
12804 }
12805
12807 {
12808
12809
12810 return false;
12811 }
12812
12814 {
12815
12816 return false;
12817 }
12818
12821 {
12822 return !GetIsFrozen() &&
IsOpen();
12823 }
12824
12826 {
12827 bool hasParent = false, hasRootAsPlayer = false;
12829
12830 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12831 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12832
12833 if (wwtu || foodDecay)
12834 {
12838
12839 if (processWetness || processTemperature || processDecay)
12840 {
12842
12843 if (processWetness)
12844 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12845
12846 if (processTemperature)
12848
12849 if (processDecay)
12850 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12851 }
12852 }
12853 }
12854
12857 {
12859 }
12860
12862 {
12865
12866 return super.GetTemperatureFreezeThreshold();
12867 }
12868
12870 {
12873
12874 return super.GetTemperatureThawThreshold();
12875 }
12876
12878 {
12881
12882 return super.GetItemOverheatThreshold();
12883 }
12884
12886 {
12888 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12889
12890 return super.GetTemperatureFreezeTime();
12891 }
12892
12894 {
12896 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12897
12898 return super.GetTemperatureThawTime();
12899 }
12900
12905
12907 {
12908 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12909 }
12910
12912 {
12913 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12914 }
12915
12918 {
12920 }
12921
12923 {
12925 }
12926
12928 {
12930 }
12931
12934 {
12935 return null;
12936 }
12937
12940 {
12941 return false;
12942 }
12943
12945 {
12947 {
12950 if (!trg)
12951 {
12953 explosive = this;
12954 }
12955
12956 explosive.PairRemote(trg);
12958
12959 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12960 trg.SetPersistentPairID(persistentID);
12961 explosive.SetPersistentPairID(persistentID);
12962
12963 return true;
12964 }
12965 return false;
12966 }
12967
12970 {
12971 float ret = 1.0;
12974 ret *= GetHealth01();
12975
12976 return ret;
12977 }
12978
12979 #ifdef DEVELOPER
12980 override void SetDebugItem()
12981 {
12982 super.SetDebugItem();
12983 _itemBase = this;
12984 }
12985
12987 {
12988 string text = super.GetDebugText();
12989
12991 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12992
12993 return text;
12994 }
12995 #endif
12996
12998 {
12999 return true;
13000 }
13001
13003
13005
13007 {
13010 }
13011
13012
13020
13036
13037 [
Obsolete(
"Use ItemSoundHandler instead")]
13040 {
13041 if (!
g_Game.IsDedicatedServer())
13042 {
13043 if (ConfigIsExisting("attachSoundSet"))
13044 {
13045 string cfg_path = "";
13046 string soundset = "";
13047 string type_name =
GetType();
13048
13051 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13052 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13053
13054 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13055 {
13056 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13057 {
13058 if (cfg_slot_array[i] == slot_type)
13059 {
13060 soundset = cfg_soundset_array[i];
13061 break;
13062 }
13063 }
13064 }
13065
13066 if (soundset != "")
13067 {
13068 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13070 }
13071 }
13072 }
13073 }
13074
13076}
13077
13079{
13081 if (entity)
13082 {
13083 bool is_item = entity.IsInherited(
ItemBase);
13084 if (is_item && full_quantity)
13085 {
13088 }
13089 }
13090 else
13091 {
13093 return NULL;
13094 }
13095 return entity;
13096}
13097
13099{
13100 if (item)
13101 {
13102 if (health > 0)
13103 item.SetHealth("", "", health);
13104
13105 if (item.CanHaveTemperature())
13106 {
13108 if (item.CanFreeze())
13109 item.SetFrozen(false);
13110 }
13111
13112 if (item.HasEnergyManager())
13113 {
13114 if (quantity >= 0)
13115 {
13116 item.GetCompEM().SetEnergy0To1(quantity);
13117 }
13118 else
13119 {
13121 }
13122 }
13123 else if (item.IsMagazine())
13124 {
13125 Magazine mag = Magazine.Cast(item);
13126 if (quantity >= 0)
13127 {
13128 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13129 }
13130 else
13131 {
13133 }
13134
13135 }
13136 else
13137 {
13138 if (quantity >= 0)
13139 {
13140 item.SetQuantityNormalized(quantity, false);
13141 }
13142 else
13143 {
13145 }
13146
13147 }
13148 }
13149}
13150
13151#ifdef DEVELOPER
13153#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.