8116{
8118 {
8119 return true;
8120 }
8121};
8122
8124{
8125
8126};
8127
8128
8129
8131{
8135
8137
8140
8141
8142
8143
8144
8153
8159
8164
8169
8190 protected bool m_IsResultOfSplit
8191
8193
8198
8199
8200
8202
8206
8207
8208
8210
8213
8214
8215
8221
8222
8230
8233
8234
8236
8237
8239
8240
8245
8246
8251
8253
8254
8256
8257
8259 {
8264
8265 if (!
g_Game.IsDedicatedServer())
8266 {
8268 {
8270
8272 {
8274 }
8275 }
8276
8279 }
8280
8281 m_OldLocation = null;
8282
8284 {
8286 }
8287
8288 if (ConfigIsExisting("headSelectionsToHide"))
8289 {
8292 }
8293
8295 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8296 {
8298 }
8299
8301
8302 m_IsResultOfSplit = false;
8303
8305 }
8306
8308 {
8309 super.InitItemVariables();
8310
8316 m_Count = ConfigGetInt(
"count");
8317
8320
8325
8328
8333
8345
8349
8350
8353 if (ConfigIsExisting("canBeSplit"))
8354 {
8357 }
8358
8360 if (ConfigIsExisting("itemBehaviour"))
8362
8363
8366 RegisterNetSyncVariableInt("m_VarLiquidType");
8367 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8368
8369 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8370 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8371 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8372
8373 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8374 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8375 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8376 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8377
8378 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8379 RegisterNetSyncVariableBool("m_IsTakeable");
8380 RegisterNetSyncVariableBool("m_IsHologram");
8381
8384 {
8387 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8388 }
8389
8391
8393 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8395
8397 }
8398
8400 {
8402 }
8403
8405 {
8408 {
8413 }
8414 }
8415
8416 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8417 {
8419 {
8422 }
8423
8425 }
8426
8428 {
8434 }
8435
8437
8439 {
8441
8442 if (!action)
8443 {
8444 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8445 return;
8446 }
8447
8449 if (!ai)
8450 {
8452 return;
8453 }
8454
8456 if (!action_array)
8457 {
8458 action_array = new array<ActionBase_Basic>;
8460 }
8461 if (LogManager.IsActionLogEnable())
8462 {
8463 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8464 }
8465
8466 if (action_array.Find(action) != -1)
8467 {
8468 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8469 }
8470 else
8471 {
8472 action_array.Insert(action);
8473 }
8474 }
8475
8477 {
8478 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8479 ActionBase action = player.GetActionManager().GetAction(actionName);
8482
8483 if (action_array)
8484 {
8485 action_array.RemoveItem(action);
8486 }
8487 }
8488
8489
8490
8492 {
8493 ActionOverrideData overrideData = new ActionOverrideData();
8497
8499 if (!actionMap)
8500 {
8503 }
8504
8505 actionMap.Insert(this.
Type(), overrideData);
8506
8507 }
8508
8510
8512
8513
8515 {
8518
8521
8522 string config_to_search = "CfgVehicles";
8523 string muzzle_owner_config;
8524
8526 {
8527 if (IsInherited(Weapon))
8528 config_to_search = "CfgWeapons";
8529
8530 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8531
8532 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8533
8534 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8535
8536 if (config_OnFire_subclass_count > 0)
8537 {
8538 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8539
8540 for (int i = 0; i < config_OnFire_subclass_count; i++)
8541 {
8542 string particle_class = "";
8543 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8544 string config_OnFire_entry = config_OnFire_class + particle_class;
8545 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8546 WPOF_array.Insert(WPOF);
8547 }
8548
8549
8551 }
8552 }
8553
8555 {
8556 config_to_search = "CfgWeapons";
8557 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8558
8559 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8560
8561 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8562
8563 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8564 {
8565 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8566
8567 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8568 {
8569 string particle_class2 = "";
8570 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8571 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8572 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8573 WPOBE_array.Insert(WPOBE);
8574 }
8575
8576
8578 }
8579 }
8580 }
8581
8582
8584 {
8587
8589 {
8590 string config_to_search = "CfgVehicles";
8591
8592 if (IsInherited(Weapon))
8593 config_to_search = "CfgWeapons";
8594
8595 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8596 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8597
8598 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8599 {
8600
8602
8604 {
8606 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8608 return;
8609 }
8610
8613
8614
8615
8616 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8617 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8618
8619 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8620 {
8621 string particle_class = "";
8622 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8623 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8624 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8625
8626 if (entry_type == CT_CLASS)
8627 {
8628 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8629 WPOOH_array.Insert(WPOF);
8630 }
8631 }
8632
8633
8635 }
8636 }
8637 }
8638
8640 {
8642 }
8643
8645 {
8647 {
8649
8652
8655
8656 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8657 }
8658 }
8659
8661 {
8663 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8664
8666 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8667
8669 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8670
8672 {
8674 }
8675 }
8676
8678 {
8680 }
8681
8683 {
8686 else
8688
8690 {
8693 }
8694 else
8695 {
8698
8701 }
8702
8704 }
8705
8707 {
8709 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8710 }
8711
8713 {
8715 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8717 }
8718
8720 {
8722 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8723 }
8724
8726 {
8729
8730 OverheatingParticle OP = new OverheatingParticle();
8735
8737 }
8738
8740 {
8743
8744 return -1;
8745 }
8746
8748 {
8750 {
8753
8754 for (int i = count; i > 0; --i)
8755 {
8756 int id = i - 1;
8759
8762
8763 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8764 {
8765 if (p)
8766 {
8769 }
8770 }
8771 }
8772 }
8773 }
8774
8776 {
8778 {
8780 {
8781 int id = i - 1;
8783
8784 if (OP)
8785 {
8787
8788 if (p)
8789 {
8791 }
8792
8793 delete OP;
8794 }
8795 }
8796
8799 }
8800 }
8801
8804 {
8805 return 0.0;
8806 }
8807
8808
8810 {
8811 return 250;
8812 }
8813
8815 {
8816 return 0;
8817 }
8818
8821 {
8823 return true;
8824
8825 return false;
8826 }
8827
8830 {
8833
8835 {
8837 }
8838 else
8839 {
8840
8842 }
8843
8845 }
8846
8853 {
8854 return -1;
8855 }
8856
8857
8858
8859
8861 {
8863 {
8864 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8865 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8866
8867 if (r_index >= 0)
8868 {
8869 InventoryLocation r_il = new InventoryLocation;
8870 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8871
8872 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8875 {
8876 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8877 }
8879 {
8880 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8881 }
8882
8883 }
8884
8885 player.GetHumanInventory().ClearUserReservedLocation(this);
8886 }
8887
8890 }
8891
8892
8893
8894
8896 {
8897 return ItemBase.m_DebugActionsMask;
8898 }
8899
8901 {
8902 return ItemBase.m_DebugActionsMask & mask;
8903 }
8904
8906 {
8907 ItemBase.m_DebugActionsMask = mask;
8908 }
8909
8911 {
8912 ItemBase.m_DebugActionsMask |= mask;
8913 }
8914
8916 {
8917 ItemBase.m_DebugActionsMask &= ~mask;
8918 }
8919
8921 {
8923 {
8925 }
8926 else
8927 {
8929 }
8930 }
8931
8932
8934 {
8935 if (GetEconomyProfile())
8936 {
8937 float q_max = GetEconomyProfile().GetQuantityMax();
8938 if (q_max > 0)
8939 {
8940 float q_min = GetEconomyProfile().GetQuantityMin();
8941 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8942
8944 {
8945 ComponentEnergyManager comp = GetCompEM();
8947 {
8949 }
8950 }
8952 {
8954
8955 }
8956
8957 }
8958 }
8959 }
8960
8963 {
8964 EntityAI parent = GetHierarchyParent();
8965
8966 if (parent)
8967 {
8968 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8969 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8970 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8971 }
8972 }
8973
8976 {
8977 EntityAI parent = GetHierarchyParent();
8978
8979 if (parent)
8980 {
8981 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8982 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8983 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8984 }
8985 }
8986
8988 {
8989
8990
8991
8992
8994
8996 {
8997 if (ScriptInputUserData.CanStoreInputUserData())
8998 {
8999 ScriptInputUserData ctx = new ScriptInputUserData;
9005 ctx.
Write(use_stack_max);
9008
9010 {
9011 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9012 }
9013 }
9014 }
9015 else if (!
g_Game.IsMultiplayer())
9016 {
9018 }
9019 }
9020
9022 {
9024 }
9025
9027 {
9029 }
9030
9032 {
9034 }
9035
9037 {
9038
9039 return false;
9040 }
9041
9043 {
9044 return false;
9045 }
9046
9050 {
9051 return false;
9052 }
9053
9055 {
9056 return "";
9057 }
9058
9060
9062 {
9063 return false;
9064 }
9065
9067 {
9068 return true;
9069 }
9070
9071
9072
9074 {
9075 return true;
9076 }
9077
9079 {
9080 return true;
9081 }
9082
9084 {
9085 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9087 }
9088
9090 {
9092 }
9093
9095 {
9097 if (!is_being_placed)
9099 SetSynchDirty();
9100 }
9101
9102
9104
9106 {
9108 }
9109
9111 {
9113 }
9114
9116 {
9117 return 1;
9118 }
9119
9121 {
9122 return false;
9123 }
9124
9126 {
9128 SetSynchDirty();
9129 }
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9166 {
9167 super.OnMovedInsideCargo(container);
9168
9169 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9170 }
9171
9172 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9173 {
9174 super.EEItemLocationChanged(oldLoc, newLoc);
9175
9176 PlayerBase newPlayer = null;
9177 PlayerBase oldPlayer = null;
9178
9179 if (newLoc.GetParent())
9180 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9181
9182 if (oldLoc.GetParent())
9183 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9184
9186 {
9187 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9188
9189 if (rIndex >= 0)
9190 {
9191 InventoryLocation rIl = new InventoryLocation;
9192 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9193
9194 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9197 {
9198 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9199 }
9201 {
9203 }
9204
9205 }
9206 }
9207
9209 {
9210 if (newPlayer)
9211 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9212
9213 if (newPlayer == oldPlayer)
9214 {
9215 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9216 {
9218 {
9219 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9220 {
9221 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9222 }
9223 }
9224 else
9225 {
9226 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9227 }
9228 }
9229
9230 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9231 {
9232 int type = oldLoc.GetType();
9234 {
9235 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9236 }
9238 {
9239 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9240 }
9241 }
9242 if (!m_OldLocation)
9243 {
9244 m_OldLocation = new InventoryLocation;
9245 }
9246 m_OldLocation.Copy(oldLoc);
9247 }
9248 else
9249 {
9250 if (m_OldLocation)
9251 {
9252 m_OldLocation.Reset();
9253 }
9254 }
9255
9256 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9257 }
9258 else
9259 {
9260 if (newPlayer)
9261 {
9262 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9263 if (resIndex >= 0)
9264 {
9265 InventoryLocation il = new InventoryLocation;
9266 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9268 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9271 {
9272 il.
GetParent().GetOnReleaseLock().Invoke(it);
9273 }
9275 {
9277 }
9278
9279 }
9280 }
9282 {
9283
9285 }
9286
9287 if (m_OldLocation)
9288 {
9289 m_OldLocation.Reset();
9290 }
9291 }
9292
9294 {
9295 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9296 }
9297
9299 {
9300 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9301 }
9302 }
9303
9304 override void EOnContact(IEntity other, Contact extra)
9305 {
9307 {
9308 int liquidType = -1;
9310 if (impactSpeed > 0.0)
9311 {
9313 #ifndef SERVER
9315 #else
9317 SetSynchDirty();
9318 #endif
9320 }
9321 }
9322
9323 #ifdef SERVER
9324 if (GetCompEM() && GetCompEM().IsPlugged())
9325 {
9326 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9327 GetCompEM().UnplugThis();
9328 }
9329 #endif
9330 }
9331
9333
9335 {
9337 }
9338
9340 {
9341
9342 }
9343
9345 {
9346 super.OnItemLocationChanged(old_owner, new_owner);
9347
9348 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9349 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9350
9351 if (!relatedPlayer && playerNew)
9352 relatedPlayer = playerNew;
9353
9354 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9355 {
9357 if (actionMgr)
9358 {
9359 ActionBase currentAction = actionMgr.GetRunningAction();
9360 if (currentAction)
9362 }
9363 }
9364
9365 Man ownerPlayerOld = null;
9366 Man ownerPlayerNew = null;
9367
9368 if (old_owner)
9369 {
9370 if (old_owner.
IsMan())
9371 {
9372 ownerPlayerOld = Man.Cast(old_owner);
9373 }
9374 else
9375 {
9376 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9377 }
9378 }
9379 else
9380 {
9382 {
9384
9385 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9386 {
9387 GetCompEM().UnplugThis();
9388 }
9389 }
9390 }
9391
9392 if (new_owner)
9393 {
9394 if (new_owner.
IsMan())
9395 {
9396 ownerPlayerNew = Man.Cast(new_owner);
9397 }
9398 else
9399 {
9400 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9401 }
9402 }
9403
9404 if (ownerPlayerOld != ownerPlayerNew)
9405 {
9406 if (ownerPlayerOld)
9407 {
9408 array<EntityAI> subItemsExit = new array<EntityAI>;
9410 for (int i = 0; i < subItemsExit.Count(); i++)
9411 {
9414 }
9415 }
9416
9417 if (ownerPlayerNew)
9418 {
9419 array<EntityAI> subItemsEnter = new array<EntityAI>;
9421 for (int j = 0; j < subItemsEnter.Count(); j++)
9422 {
9425 }
9426 }
9427 }
9428 else if (ownerPlayerNew != null)
9429 {
9430 PlayerBase nplayer;
9431 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9432 {
9433 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9435 for (int k = 0; k < subItemsUpdate.Count(); k++)
9436 {
9438 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9439 }
9440 }
9441 }
9442
9443 if (old_owner)
9444 old_owner.OnChildItemRemoved(this);
9445 if (new_owner)
9446 new_owner.OnChildItemReceived(this);
9447 }
9448
9449
9451 {
9452 super.EEDelete(parent);
9453 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9454 if (player)
9455 {
9457
9458 if (player.IsAlive())
9459 {
9460 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9461 if (r_index >= 0)
9462 {
9463 InventoryLocation r_il = new InventoryLocation;
9464 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9465
9466 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9469 {
9470 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9471 }
9473 {
9474 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9475 }
9476
9477 }
9478
9479 player.RemoveQuickBarEntityShortcut(this);
9480 }
9481 }
9482 }
9483
9485 {
9486 super.EEKilled(killer);
9487
9490 {
9491 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9492 {
9493 if (IsMagazine())
9494 {
9495 if (Magazine.Cast(this).GetAmmoCount() > 0)
9496 {
9498 }
9499 }
9500 else
9501 {
9503 }
9504 }
9505 }
9506 }
9507
9509 {
9510 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9511
9512 super.OnWasAttached(parent, slot_id);
9513
9516
9519 }
9520
9522 {
9523 super.OnWasDetached(parent, slot_id);
9524
9527
9530 }
9531
9533 {
9534 int idx;
9537
9538 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9539 if (inventory_slots.Count() < 1)
9540 {
9541 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9542 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9543 }
9544 else
9545 {
9546 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9547 }
9548
9549 idx = inventory_slots.Find(slot);
9550 if (idx < 0)
9551 return "";
9552
9553 return attach_types.Get(idx);
9554 }
9555
9557 {
9558 int idx = -1;
9559 string slot;
9560
9563
9564 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9565 if (inventory_slots.Count() < 1)
9566 {
9567 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9568 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9569 }
9570 else
9571 {
9572 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9573 if (detach_types.Count() < 1)
9574 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9575 }
9576
9577 for (int i = 0; i < inventory_slots.Count(); i++)
9578 {
9579 slot = inventory_slots.Get(i);
9580 }
9581
9582 if (slot != "")
9583 {
9584 if (detach_types.Count() == 1)
9585 idx = 0;
9586 else
9587 idx = inventory_slots.Find(slot);
9588 }
9589 if (idx < 0)
9590 return "";
9591
9592 return detach_types.Get(idx);
9593 }
9594
9596 {
9597
9599
9600
9601 float min_time = 1;
9602 float max_time = 3;
9603 float delay = Math.RandomFloat(min_time, max_time);
9604
9605 explode_timer.Run(delay, this, "DoAmmoExplosion");
9606 }
9607
9609 {
9610 Magazine magazine = Magazine.Cast(this);
9611 int pop_sounds_count = 6;
9612 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9613
9614
9615 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9616 string sound_name = pop_sounds[ sound_idx ];
9617 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9618
9619
9620 magazine.ServerAddAmmoCount(-1);
9621
9622
9623 float min_temp_to_explode = 100;
9624
9625 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9626 {
9628 }
9629 }
9630
9631
9632 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9633 {
9634 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9635
9636 const int CHANCE_DAMAGE_CARGO = 4;
9637 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9638 const int CHANCE_DAMAGE_NOTHING = 2;
9639
9641 {
9642 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9643 int chances;
9644 int rnd;
9645
9646 if (GetInventory().GetCargo())
9647 {
9648 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9649 rnd = Math.RandomInt(0,chances);
9650
9651 if (rnd < CHANCE_DAMAGE_CARGO)
9652 {
9654 }
9655 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9656 {
9658 }
9659 }
9660 else
9661 {
9662 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9663 rnd = Math.RandomInt(0,chances);
9664
9665 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9666 {
9668 }
9669 }
9670 }
9671 }
9672
9674 {
9675 CargoBase cargo = GetInventory().GetCargo();
9676 if (cargo)
9677 {
9679 if (item_count > 0)
9680 {
9681 int random_pick = Math.RandomInt(0, item_count);
9683 if (!item.IsExplosive())
9684 {
9685 item.AddHealth("","",damage);
9686 return true;
9687 }
9688 }
9689 }
9690 return false;
9691 }
9692
9694 {
9695 GameInventory inventory = GetInventory();
9697 if (attachment_count > 0)
9698 {
9699 int random_pick = Math.RandomInt(0, attachment_count);
9701 if (!attachment.IsExplosive())
9702 {
9703 attachment.AddHealth("","",damage);
9704 return true;
9705 }
9706 }
9707 return false;
9708 }
9709
9711 {
9713 }
9714
9716 {
9718 return GetInventory().CanRemoveEntity();
9719
9720 return false;
9721 }
9722
9724 {
9725
9727 return false;
9728
9729
9731 return false;
9732
9733
9734
9736 if (delta == 0)
9737 return false;
9738
9739
9740 return true;
9741 }
9742
9744 {
9746 {
9747 if (ScriptInputUserData.CanStoreInputUserData())
9748 {
9749 ScriptInputUserData ctx = new ScriptInputUserData;
9754 ctx.
Write(destination_entity);
9758 }
9759 }
9760 else if (!
g_Game.IsMultiplayer())
9761 {
9763 }
9764 }
9765
9767 {
9768 float split_quantity_new;
9772 InventoryLocation loc = new InventoryLocation;
9773
9774 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9775 {
9777 split_quantity_new = stack_max;
9778 else
9780
9782 {
9783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9784 if (new_item)
9785 {
9786 new_item.SetResultOfSplit(true);
9787 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9789 new_item.
SetQuantity(split_quantity_new,
false,
true);
9790 }
9791 }
9792 }
9793 else if (destination_entity && slot_id == -1)
9794 {
9795 if (quantity > stack_max)
9796 split_quantity_new = stack_max;
9797 else
9798 split_quantity_new = quantity;
9799
9801 {
9802 GameInventory destinationInventory = destination_entity.GetInventory();
9804 {
9807 }
9808
9809 if (new_item)
9810 {
9811 new_item.SetResultOfSplit(true);
9812 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9814 new_item.
SetQuantity(split_quantity_new,
false,
true);
9815 }
9816 }
9817 }
9818 else
9819 {
9820 if (stack_max != 0)
9821 {
9823 {
9825 }
9826
9827 if (split_quantity_new == 0)
9828 {
9829 if (!
g_Game.IsMultiplayer())
9830 player.PhysicalPredictiveDropItem(this);
9831 else
9832 player.ServerDropEntity(this);
9833 return;
9834 }
9835
9837 {
9839
9840 if (new_item)
9841 {
9842 new_item.SetResultOfSplit(true);
9843 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9846 new_item.PlaceOnSurface();
9847 }
9848 }
9849 }
9850 }
9851 }
9852
9854 {
9855 float split_quantity_new;
9859 InventoryLocation loc = new InventoryLocation;
9860
9861 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9862 {
9864 split_quantity_new = stack_max;
9865 else
9867
9869 {
9870 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9871 if (new_item)
9872 {
9873 new_item.SetResultOfSplit(true);
9874 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9876 new_item.
SetQuantity(split_quantity_new,
false,
true);
9877 }
9878 }
9879 }
9880 else if (destination_entity && slot_id == -1)
9881 {
9882 if (quantity > stack_max)
9883 split_quantity_new = stack_max;
9884 else
9885 split_quantity_new = quantity;
9886
9888 {
9889 GameInventory destinationInventory = destination_entity.GetInventory();
9891 {
9894 }
9895
9896 if (new_item)
9897 {
9898 new_item.SetResultOfSplit(true);
9899 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9901 new_item.
SetQuantity(split_quantity_new,
false,
true);
9902 }
9903 }
9904 }
9905 else
9906 {
9907 if (stack_max != 0)
9908 {
9910 {
9912 }
9913
9915 {
9917
9918 if (new_item)
9919 {
9920 new_item.SetResultOfSplit(true);
9921 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9924 new_item.PlaceOnSurface();
9925 }
9926 }
9927 }
9928 }
9929 }
9930
9932 {
9934 {
9935 if (ScriptInputUserData.CanStoreInputUserData())
9936 {
9937 ScriptInputUserData ctx = new ScriptInputUserData;
9942 dst.WriteToContext(ctx);
9944 }
9945 }
9946 else if (!
g_Game.IsMultiplayer())
9947 {
9949 }
9950 }
9951
9953 {
9955 {
9956 if (ScriptInputUserData.CanStoreInputUserData())
9957 {
9958 ScriptInputUserData ctx = new ScriptInputUserData;
9963 ctx.
Write(destination_entity);
9969 }
9970 }
9971 else if (!
g_Game.IsMultiplayer())
9972 {
9974 }
9975 }
9976
9978 {
9980 }
9981
9983 {
9985 float split_quantity_new;
9987 if (dst.IsValid())
9988 {
9989 int slot_id = dst.GetSlot();
9991
9992 if (quantity > stack_max)
9993 split_quantity_new = stack_max;
9994 else
9995 split_quantity_new = quantity;
9996
9998 {
10000
10001 if (new_item)
10002 {
10003 new_item.SetResultOfSplit(true);
10004 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10006 new_item.
SetQuantity(split_quantity_new,
false,
true);
10007 }
10008
10009 return new_item;
10010 }
10011 }
10012
10013 return null;
10014 }
10015
10017 {
10019 float split_quantity_new;
10021 if (destination_entity)
10022 {
10024 if (quantity > stackable)
10025 split_quantity_new = stackable;
10026 else
10027 split_quantity_new = quantity;
10028
10030 {
10031 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10032 if (new_item)
10033 {
10034 new_item.SetResultOfSplit(true);
10035 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10037 new_item.
SetQuantity(split_quantity_new,
false,
true);
10038 }
10039 }
10040 }
10041 }
10042
10044 {
10046 {
10047 if (ScriptInputUserData.CanStoreInputUserData())
10048 {
10049 ScriptInputUserData ctx = new ScriptInputUserData;
10054 ItemBase destination_entity =
this;
10055 ctx.
Write(destination_entity);
10059 }
10060 }
10061 else if (!
g_Game.IsMultiplayer())
10062 {
10064 }
10065 }
10066
10068 {
10070 float split_quantity_new;
10072 if (player)
10073 {
10075 if (quantity > stackable)
10076 split_quantity_new = stackable;
10077 else
10078 split_quantity_new = quantity;
10079
10081 {
10082 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10083 new_item =
ItemBase.Cast(in_hands);
10084 if (new_item)
10085 {
10086 new_item.SetResultOfSplit(true);
10087 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10089 new_item.SetQuantity(split_quantity_new, false, true);
10090 }
10091 }
10092 }
10093 }
10094
10096 {
10098 float split_quantity_new = Math.Floor(quantity * 0.5);
10099
10101 return;
10102
10104
10105 if (new_item)
10106 {
10107 if (new_item.GetQuantityMax() < split_quantity_new)
10108 {
10109 split_quantity_new = new_item.GetQuantityMax();
10110 }
10111
10112 new_item.SetResultOfSplit(true);
10113 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10114
10116 {
10119 }
10120 else
10121 {
10123 new_item.
SetQuantity(split_quantity_new,
false,
true);
10124 }
10125 }
10126 }
10127
10129 {
10131 float split_quantity_new = Math.Floor(quantity / 2);
10132
10134 return;
10135
10136 InventoryLocation invloc = new InventoryLocation;
10138
10140 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10141
10142 if (new_item)
10143 {
10144 if (new_item.GetQuantityMax() < split_quantity_new)
10145 {
10146 split_quantity_new = new_item.GetQuantityMax();
10147 }
10149 {
10152 }
10153 else if (split_quantity_new > 1)
10154 {
10156 new_item.
SetQuantity(split_quantity_new,
false,
true);
10157 }
10158 }
10159 }
10160
10163 {
10164 SetWeightDirty();
10166
10167 if (parent)
10168 parent.OnAttachmentQuantityChangedEx(this, delta);
10169
10171 {
10173 {
10175 }
10177 {
10178 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10180 }
10181 }
10182 }
10183
10186 {
10187
10188 }
10189
10192 {
10194 }
10195
10197 {
10198 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10199
10201 {
10202 if (newLevel == GameConstants.STATE_RUINED)
10203 {
10205 EntityAI parent = GetHierarchyParent();
10206 if (parent && parent.IsFireplace())
10207 {
10208 CargoBase cargo = GetInventory().GetCargo();
10209 if (cargo)
10210 {
10212 {
10214 }
10215 }
10216 }
10217 }
10218
10220 {
10221
10223 return;
10224 }
10225
10226 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10227 {
10229 }
10230 }
10231 }
10232
10233
10235 {
10236 super.OnRightClick();
10237
10239 {
10241 {
10242 if (ScriptInputUserData.CanStoreInputUserData())
10243 {
10244 EntityAI root = GetHierarchyRoot();
10245 Man playerOwner = GetHierarchyRootPlayer();
10246 InventoryLocation dst = new InventoryLocation;
10247
10248
10249 if (!playerOwner && root && root == this)
10250 {
10252 }
10253 else
10254 {
10255
10256 GetInventory().GetCurrentInventoryLocation(dst);
10258 {
10259 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10261 {
10263 }
10264 else
10265 {
10267
10268
10269 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10270 {
10272 }
10273 else
10274 {
10275 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10276 }
10277 }
10278 }
10279 }
10280
10281 ScriptInputUserData ctx = new ScriptInputUserData;
10289 }
10290 }
10291 else if (!
g_Game.IsMultiplayer())
10292 {
10294 }
10295 }
10296 }
10297
10299 {
10300 if (root)
10301 {
10302 vector m4[4];
10303 root.GetTransform(m4);
10304 dst.SetGround(this, m4);
10305 }
10306 else
10307 {
10308 GetInventory().GetCurrentInventoryLocation(dst);
10309 }
10310 }
10311
10312 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10313 {
10314
10315 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10316 return false;
10317
10318 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10319 return false;
10320
10321
10323 return false;
10324
10325
10326 Magazine mag = Magazine.Cast(this);
10327 if (mag)
10328 {
10329 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10330 return false;
10331
10332 if (stack_max_limit)
10333 {
10334 Magazine other_mag = Magazine.Cast(other_item);
10335 if (other_item)
10336 {
10337 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10338 return false;
10339 }
10340
10341 }
10342 }
10343 else
10344 {
10345
10347 return false;
10348
10350 return false;
10351 }
10352
10353 PlayerBase player = null;
10354 if (CastTo(player, GetHierarchyRootPlayer()))
10355 {
10356 if (player.GetInventory().HasAttachment(this))
10357 return false;
10358
10359 if (player.IsItemsToDelete())
10360 return false;
10361 }
10362
10363 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10364 return false;
10365
10366 int slotID;
10368 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10369 return false;
10370
10371 return true;
10372 }
10373
10375 {
10377 }
10378
10380 {
10381 return m_IsResultOfSplit;
10382 }
10383
10385 {
10386 m_IsResultOfSplit = value;
10387 }
10388
10390 {
10392 }
10393
10395 {
10396 float other_item_quantity = other_item.GetQuantity();
10397 float this_free_space;
10398
10400
10402
10403 if (other_item_quantity > this_free_space)
10404 {
10405 return this_free_space;
10406 }
10407 else
10408 {
10409 return other_item_quantity;
10410 }
10411 }
10412
10414 {
10416 }
10417
10419 {
10421 return;
10422
10423 if (!IsMagazine() && other_item)
10424 {
10426 if (quantity_used != 0)
10427 {
10428 float hp1 = GetHealth01("","");
10429 float hp2 = other_item.GetHealth01("","");
10430 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10431 hpResult = hpResult / (
GetQuantity() + quantity_used);
10432
10433 hpResult *= GetMaxHealth();
10434 Math.Round(hpResult);
10435 SetHealth("", "Health", hpResult);
10436
10438 other_item.AddQuantity(-quantity_used);
10439 }
10440 }
10442 }
10443
10445 {
10446 #ifdef SERVER
10447 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10448 GetHierarchyParent().IncreaseLifetimeUp();
10449 #endif
10450 };
10451
10453 {
10454 PlayerBase p = PlayerBase.Cast(player);
10455
10456 array<int> recipesIds = p.m_Recipes;
10457 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10458 if (moduleRecipesManager)
10459 {
10460 EntityAI itemInHands = player.GetEntityInHands();
10461 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10462 }
10463
10464 for (int i = 0;i < recipesIds.Count(); i++)
10465 {
10466 int key = recipesIds.Get(i);
10467 string recipeName = moduleRecipesManager.GetRecipeName(key);
10469 }
10470 }
10471
10472
10473 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10474 {
10475 super.GetDebugActions(outputList);
10476
10477
10483
10484
10489
10494
10495
10499
10500
10502 {
10506 }
10507
10510
10511
10515
10517
10518 InventoryLocation loc = new InventoryLocation();
10519 GetInventory().GetCurrentInventoryLocation(loc);
10521 {
10522 if (Gizmo_IsSupported())
10525 }
10526
10528 }
10529
10530
10531
10532
10534 {
10535 super.OnAction(action_id, player, ctx);
10536
10538 {
10539 switch (action_id)
10540 {
10544 return true;
10548 return true;
10549 }
10550 }
10551
10553 {
10554 switch (action_id)
10555 {
10557 Delete();
10558 return true;
10559 }
10560 }
10561
10562 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10563 {
10564 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10565 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10566 PlayerBase p = PlayerBase.Cast(player);
10567 if (
EActions.RECIPES_RANGE_START < 1000)
10568 {
10569 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10570 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10571 }
10572 }
10573 #ifndef SERVER
10574 else if (action_id ==
EActions.WATCH_PLAYER)
10575 {
10576 PluginDeveloper.SetDeveloperItemClientEx(player);
10577 }
10578 #endif
10580 {
10581 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10582 {
10583 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10584 OnDebugButtonPressServer(id + 1);
10585 }
10586
10587 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10588 {
10589 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10591 }
10592
10593 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10594 {
10595 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10597 }
10598
10599 else if (action_id ==
EActions.ADD_QUANTITY)
10600 {
10601 if (IsMagazine())
10602 {
10603 Magazine mag = Magazine.Cast(this);
10604 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10605 }
10606 else
10607 {
10609 }
10610
10611 if (m_EM)
10612 {
10613 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10614 }
10615
10616 }
10617
10618 else if (action_id ==
EActions.REMOVE_QUANTITY)
10619 {
10620 if (IsMagazine())
10621 {
10622 Magazine mag2 = Magazine.Cast(this);
10623 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10624 }
10625 else
10626 {
10628 }
10629 if (m_EM)
10630 {
10631 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10632 }
10633
10634 }
10635
10636 else if (action_id ==
EActions.SET_QUANTITY_0)
10637 {
10639
10640 if (m_EM)
10641 {
10642 m_EM.SetEnergy(0);
10643 }
10644 }
10645
10646 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10647 {
10649
10650 if (m_EM)
10651 {
10652 m_EM.SetEnergy(m_EM.GetEnergyMax());
10653 }
10654 }
10655
10656 else if (action_id ==
EActions.ADD_HEALTH)
10657 {
10658 AddHealth("","",GetMaxHealth("","Health")/5);
10659 }
10660 else if (action_id ==
EActions.REMOVE_HEALTH)
10661 {
10662 AddHealth("","",-GetMaxHealth("","Health")/5);
10663 }
10664 else if (action_id ==
EActions.DESTROY_HEALTH)
10665 {
10666 SetHealth01("","",0);
10667 }
10668 else if (action_id ==
EActions.WATCH_ITEM)
10669 {
10671 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10672 #ifdef DEVELOPER
10673 SetDebugDeveloper_item(this);
10674 #endif
10675 }
10676
10677 else if (action_id ==
EActions.ADD_TEMPERATURE)
10678 {
10679 AddTemperature(20);
10680
10681 }
10682
10683 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10684 {
10685 AddTemperature(-20);
10686
10687 }
10688
10689 else if (action_id ==
EActions.FLIP_FROZEN)
10690 {
10691 SetFrozen(!GetIsFrozen());
10692
10693 }
10694
10695 else if (action_id ==
EActions.ADD_WETNESS)
10696 {
10698
10699 }
10700
10701 else if (action_id ==
EActions.REMOVE_WETNESS)
10702 {
10704
10705 }
10706
10707 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10708 {
10711
10712
10713 }
10714
10715 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10716 {
10719 }
10720
10721 else if (action_id ==
EActions.MAKE_SPECIAL)
10722 {
10723 auto debugParams = DebugSpawnParams.WithPlayer(player);
10724 OnDebugSpawnEx(debugParams);
10725 }
10726
10727 }
10728
10729
10730 return false;
10731 }
10732
10733
10734
10735
10739
10742
10743
10744
10746 {
10747 return false;
10748 }
10749
10750
10752 {
10753 return true;
10754 }
10755
10756
10758 {
10759 return true;
10760 }
10761
10762
10763
10765 {
10766 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10767 return g_Game.ConfigIsExisting(config_path);
10768 }
10769
10772 {
10773 return null;
10774 }
10775
10777 {
10778 return false;
10779 }
10780
10782 {
10783 return false;
10784 }
10785
10789
10790
10792 {
10793 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10794 return module_repairing.CanRepair(this, item_repair_kit);
10795 }
10796
10797
10798 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10799 {
10800 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10801 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10802 }
10803
10804
10806 {
10807
10808
10809
10810
10811
10812
10813
10814
10815 return 1;
10816 }
10817
10818
10819
10821 {
10823 }
10824
10825
10826
10828 {
10830 }
10831
10832
10841 {
10842 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10843
10844 if (player)
10845 {
10846 player.MessageStatus(text);
10847 }
10848 }
10849
10850
10859 {
10860 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10861
10862 if (player)
10863 {
10864 player.MessageAction(text);
10865 }
10866 }
10867
10868
10877 {
10878 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10879
10880 if (player)
10881 {
10882 player.MessageFriendly(text);
10883 }
10884 }
10885
10886
10895 {
10896 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10897
10898 if (player)
10899 {
10900 player.MessageImportant(text);
10901 }
10902 }
10903
10905 {
10906 return true;
10907 }
10908
10909
10910 override bool KindOf(
string tag)
10911 {
10912 bool found = false;
10913 string item_name = this.
GetType();
10915 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10916
10917 int array_size = item_tag_array.Count();
10918 for (int i = 0; i < array_size; i++)
10919 {
10920 if (item_tag_array.Get(i) == tag)
10921 {
10922 found = true;
10923 break;
10924 }
10925 }
10926 return found;
10927 }
10928
10929
10931 {
10932
10933 super.OnRPC(sender, rpc_type,ctx);
10934
10935
10936 switch (rpc_type)
10937 {
10938 #ifndef SERVER
10939 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10940 Param2<bool, string> p = new Param2<bool, string>(false, "");
10941
10943 return;
10944
10945 bool play = p.param1;
10946 string soundSet = p.param2;
10947
10948 if (play)
10949 {
10951 {
10953 {
10955 }
10956 }
10957 else
10958 {
10960 }
10961 }
10962 else
10963 {
10965 }
10966
10967 break;
10968 #endif
10969
10970 }
10971
10973 {
10975 }
10976 }
10977
10978
10979
10980
10982 {
10983 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10984 return plugin.GetID(
name);
10985 }
10986
10988 {
10989 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10990 return plugin.GetName(id);
10991 }
10992
10995 {
10996
10997
10998 int varFlags;
10999 if (!ctx.
Read(varFlags))
11000 return;
11001
11002 if (varFlags & ItemVariableFlags.FLOAT)
11003 {
11005 }
11006 }
11007
11009 {
11010
11011 super.SerializeNumericalVars(floats_out);
11012
11013
11014
11016 {
11018 }
11019
11021 {
11023 }
11024
11026 {
11028 }
11029
11031 {
11036 }
11037
11039 {
11041 }
11042 }
11043
11045 {
11046
11047 super.DeSerializeNumericalVars(floats);
11048
11049
11050 int index = 0;
11051 int mask = Math.Round(floats.Get(index));
11052
11053 index++;
11054
11056 {
11058 {
11060 }
11061 else
11062 {
11063 float quantity = floats.Get(index);
11064 SetQuantity(quantity,
true,
false,
false,
false);
11065 }
11066 index++;
11067 }
11068
11070 {
11071 float wet = floats.Get(index);
11073 index++;
11074 }
11075
11077 {
11078 int liquidtype = Math.Round(floats.Get(index));
11080 index++;
11081 }
11082
11084 {
11086 index++;
11088 index++;
11090 index++;
11092 index++;
11093 }
11094
11096 {
11097 int cleanness = Math.Round(floats.Get(index));
11099 index++;
11100 }
11101 }
11102
11104 {
11105 super.WriteVarsToCTX(ctx);
11106
11107
11109 {
11111 }
11112
11114 {
11116 }
11117
11119 {
11121 }
11122
11124 {
11125 int r,g,b,a;
11131 }
11132
11134 {
11136 }
11137 }
11138
11140 {
11141 if (!super.ReadVarsFromCTX(ctx,version))
11142 return false;
11143
11144 int intValue;
11145 float value;
11146
11147 if (version < 140)
11148 {
11149 if (!ctx.
Read(intValue))
11150 return false;
11151
11152 m_VariablesMask = intValue;
11153 }
11154
11156 {
11157 if (!ctx.
Read(value))
11158 return false;
11159
11161 {
11163 }
11164 else
11165 {
11167 }
11168 }
11169
11170 if (version < 140)
11171 {
11173 {
11174 if (!ctx.
Read(value))
11175 return false;
11176 SetTemperatureDirect(value);
11177 }
11178 }
11179
11181 {
11182 if (!ctx.
Read(value))
11183 return false;
11185 }
11186
11188 {
11189 if (!ctx.
Read(intValue))
11190 return false;
11192 }
11193
11195 {
11196 int r,g,b,a;
11198 return false;
11200 return false;
11202 return false;
11204 return false;
11205
11207 }
11208
11210 {
11211 if (!ctx.
Read(intValue))
11212 return false;
11214 }
11215
11216 if (version >= 138 && version < 140)
11217 {
11219 {
11220 if (!ctx.
Read(intValue))
11221 return false;
11222 SetFrozen(intValue);
11223 }
11224 }
11225
11226 return true;
11227 }
11228
11229
11231 {
11234 {
11236 }
11237
11238 if (!super.OnStoreLoad(ctx, version))
11239 {
11241 return false;
11242 }
11243
11244 if (version >= 114)
11245 {
11246 bool hasQuickBarIndexSaved;
11247
11248 if (!ctx.
Read(hasQuickBarIndexSaved))
11249 {
11251 return false;
11252 }
11253
11254 if (hasQuickBarIndexSaved)
11255 {
11256 int itmQBIndex;
11257
11258
11259 if (!ctx.
Read(itmQBIndex))
11260 {
11262 return false;
11263 }
11264
11265 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11266 if (itmQBIndex != -1 && parentPlayer)
11267 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11268 }
11269 }
11270 else
11271 {
11272
11273 PlayerBase player;
11274 int itemQBIndex;
11275 if (version ==
int.
MAX)
11276 {
11277 if (!ctx.
Read(itemQBIndex))
11278 {
11280 return false;
11281 }
11282 }
11283 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11284 {
11285
11286 if (!ctx.
Read(itemQBIndex))
11287 {
11289 return false;
11290 }
11291 if (itemQBIndex != -1 && player)
11292 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11293 }
11294 }
11295
11296 if (version < 140)
11297 {
11298
11299 if (!LoadVariables(ctx, version))
11300 {
11302 return false;
11303 }
11304 }
11305
11306
11308 {
11310 return false;
11311 }
11312 if (version >= 132)
11313 {
11315 if (raib)
11316 {
11318 {
11320 return false;
11321 }
11322 }
11323 }
11324
11326 return true;
11327 }
11328
11329
11330
11332 {
11333 super.OnStoreSave(ctx);
11334
11335 PlayerBase player;
11336 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11337 {
11339
11340 int itemQBIndex = -1;
11341 itemQBIndex = player.FindQuickBarEntityIndex(this);
11342 ctx.
Write(itemQBIndex);
11343 }
11344 else
11345 {
11347 }
11348
11350
11352 if (raib)
11353 {
11355 }
11356 }
11357
11358
11360 {
11361 super.AfterStoreLoad();
11362
11364 {
11366 }
11367
11369 {
11372 }
11373 }
11374
11376 {
11377 super.EEOnAfterLoad();
11378
11380 {
11382 }
11383
11386 }
11387
11389 {
11390 return false;
11391 }
11392
11393
11394
11396 {
11398 {
11399 #ifdef PLATFORM_CONSOLE
11400
11402 {
11404 if (menu)
11405 {
11407 }
11408 }
11409 #endif
11410 }
11411
11413 {
11416 }
11417
11419 {
11420 SetWeightDirty();
11422 }
11424 {
11427 }
11428
11430 {
11433
11436 }
11438 {
11442 }
11443
11444 super.OnVariablesSynchronized();
11445 }
11446
11447
11448
11450 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11451 {
11452 if (!IsServerCheck(allow_client))
11453 return false;
11454
11456 return false;
11457
11460
11461 if (value <= (min + 0.001))
11462 value = min;
11463
11464 if (value == min)
11465 {
11466 if (destroy_config)
11467 {
11468 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11469 if (dstr)
11470 {
11472 this.Delete();
11473 return true;
11474 }
11475 }
11476 else if (destroy_forced)
11477 {
11479 this.Delete();
11480 return true;
11481 }
11482
11484 }
11485
11488
11490 {
11491 EntityAI parent = GetHierarchyRoot();
11492 InventoryLocation iLoc = new InventoryLocation();
11493 GetInventory().GetCurrentInventoryLocation(iLoc);
11495 {
11496 int iLocSlot = iLoc.
GetSlot();
11498 {
11500 }
11502 {
11504 }
11505 }
11506 }
11507
11509 {
11511
11512 if (delta)
11514 }
11515
11517
11518 return false;
11519 }
11520
11521
11523 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11524 {
11526 }
11527
11529 {
11532 }
11533
11535 {
11538 }
11539
11541 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11542 {
11543 float value_clamped = Math.Clamp(value, 0, 1);
11545 SetQuantity(result, destroy_config, destroy_forced);
11546 }
11547
11548
11551 {
11553 }
11554
11556 {
11558 }
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11570 {
11571 int slot = -1;
11572 GameInventory inventory = GetInventory();
11573 if (inventory)
11574 {
11575 InventoryLocation il = new InventoryLocation;
11578 }
11579
11581 }
11582
11584 {
11585 float quantity_max = 0;
11586
11588 {
11589 if (attSlotID != -1)
11590 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11591
11592 if (quantity_max <= 0)
11594 }
11595
11596 if (quantity_max <= 0)
11598
11599 return quantity_max;
11600 }
11601
11603 {
11605 }
11606
11608 {
11610 }
11611
11612
11614 {
11616 }
11617
11619 {
11621 }
11622
11624 {
11626 }
11627
11628
11630 {
11631
11632 float weightEx = GetWeightEx();
11633 float special = GetInventoryAndCargoWeight();
11634 return weightEx - special;
11635 }
11636
11637
11639 {
11641 }
11642
11644 {
11646 {
11647 #ifdef DEVELOPER
11648 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11649 {
11650 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11652 }
11653 #endif
11654
11655 return GetQuantity() * GetConfigWeightModified();
11656 }
11657 else if (HasEnergyManager())
11658 {
11659 #ifdef DEVELOPER
11660 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11661 {
11662 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11663 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11664 }
11665 #endif
11666 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11667 }
11668 else
11669 {
11670 #ifdef DEVELOPER
11671 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11672 {
11673 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11674 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11675 }
11676 #endif
11677 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11678 }
11679 }
11680
11683 {
11684 int item_count = 0;
11686
11687 GameInventory inventory = GetInventory();
11688 CargoBase cargo = inventory.
GetCargo();
11689 if (cargo != NULL)
11690 {
11692 }
11693
11695 for (int i = 0; i < nAttachments; ++i)
11696 {
11698 if (item)
11699 item_count += item.GetNumberOfItems();
11700 }
11701 return item_count;
11702 }
11703
11706 {
11707 float weight = 0;
11708 float wetness = 1;
11709 if (include_wetness)
11712 {
11713 weight = wetness * m_ConfigWeight;
11714 }
11716 {
11717 weight = 1;
11718 }
11719 return weight;
11720 }
11721
11722
11723
11725 {
11726 GameInventory inventory = GetInventory();
11727 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11728 {
11729 array<EntityAI> items = new array<EntityAI>;
11731 for (int i = 0; i < items.Count(); ++i)
11732 {
11734 if (item)
11735 {
11736 g_Game.ObjectDelete(item);
11737 }
11738 }
11739 }
11740 }
11741
11742
11743
11744
11746 {
11747 float energy = 0;
11748 if (HasEnergyManager())
11749 {
11750 energy = GetCompEM().GetEnergy();
11751 }
11752 return energy;
11753 }
11754
11755
11757 {
11758 super.OnEnergyConsumed();
11759
11761 }
11762
11764 {
11765 super.OnEnergyAdded();
11766
11768 }
11769
11770
11772 {
11773 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11774 {
11776 {
11777 float energy_0to1 = GetCompEM().GetEnergy0To1();
11779 }
11780 }
11781 }
11782
11783
11785 {
11786 return ConfigGetFloat("heatIsolation");
11787 }
11788
11790 {
11792 }
11793
11795 {
11796 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11797 if (
g_Game.ConfigIsExisting(paramPath))
11798 return g_Game.ConfigGetFloat(paramPath);
11799
11800 return 0.0;
11801 }
11802
11804 {
11805 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11806 if (
g_Game.ConfigIsExisting(paramPath))
11807 return g_Game.ConfigGetFloat(paramPath);
11808
11809 return 0.0;
11810 }
11811
11812 override void SetWet(
float value,
bool allow_client =
false)
11813 {
11814 if (!IsServerCheck(allow_client))
11815 return;
11816
11819
11821
11822 m_VarWet = Math.Clamp(value, min, max);
11823
11825 {
11828 }
11829 }
11830
11831 override void AddWet(
float value)
11832 {
11834 }
11835
11837 {
11839 }
11840
11842 {
11844 }
11845
11847 {
11849 }
11850
11852 {
11854 }
11855
11857 {
11859 }
11860
11861 override void OnWetChanged(
float newVal,
float oldVal)
11862 {
11865 if (newLevel != oldLevel)
11866 {
11868 }
11869 }
11870
11872 {
11873 SetWeightDirty();
11874 }
11875
11877 {
11878 return GetWetLevelInternal(
m_VarWet);
11879 }
11880
11881
11882
11884 {
11886 }
11887
11889 {
11891 }
11892
11894 {
11896 }
11897
11899 {
11901 }
11902
11903
11904
11906 {
11907 if (ConfigIsExisting("itemModelLength"))
11908 {
11909 return ConfigGetFloat("itemModelLength");
11910 }
11911 return 0;
11912 }
11913
11915 {
11916 if (ConfigIsExisting("itemAttachOffset"))
11917 {
11918 return ConfigGetFloat("itemAttachOffset");
11919 }
11920 return 0;
11921 }
11922
11923 override void SetCleanness(
int value,
bool allow_client =
false)
11924 {
11925 if (!IsServerCheck(allow_client))
11926 return;
11927
11929
11931
11934 }
11935
11937 {
11939 }
11940
11942 {
11943 return true;
11944 }
11945
11946
11947
11948
11950 {
11952 }
11953
11955 {
11957 }
11958
11959
11960
11961
11962 override void SetColor(
int r,
int g,
int b,
int a)
11963 {
11969 }
11971 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11972 {
11977 }
11978
11980 {
11982 }
11983
11986 {
11987 int r,g,b,a;
11989 r = r/255;
11990 g = g/255;
11991 b = b/255;
11992 a = a/255;
11993 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11994 }
11995
11996
11997
11998 override void SetLiquidType(
int value,
bool allow_client =
false)
11999 {
12000 if (!IsServerCheck(allow_client))
12001 return;
12002
12007 }
12008
12010 {
12011 return ConfigGetInt("varLiquidTypeInit");
12012 }
12013
12015 {
12017 }
12018
12020 {
12022 SetFrozen(false);
12023 }
12024
12027 {
12028 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12029 }
12030
12031
12034 {
12035 PlayerBase nplayer;
12036 if (PlayerBase.CastTo(nplayer, player))
12037 {
12039 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12040 }
12041 }
12042
12043
12046 {
12047 PlayerBase nplayer;
12048 if (PlayerBase.CastTo(nplayer,player))
12049 {
12050 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12051 }
12052
12053 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12054
12055 if (HasEnergyManager())
12056 {
12057 GetCompEM().UpdatePlugState();
12058 }
12059 }
12060
12061
12063 {
12064 super.OnPlacementStarted(player);
12065
12067 }
12068
12069 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12070 {
12072 {
12073 m_AdminLog.OnPlacementComplete(player,
this);
12074 }
12075
12076 super.OnPlacementComplete(player, position, orientation);
12077 }
12078
12079
12080
12081
12082
12084 {
12086 {
12087 return true;
12088 }
12089 else
12090 {
12091 return false;
12092 }
12093 }
12094
12095
12097 {
12099 {
12101 }
12102 }
12103
12104
12106 {
12108 }
12109
12111 {
12113 }
12114
12115 override void InsertAgent(
int agent,
float count = 1)
12116 {
12117 if (count < 1)
12118 return;
12119
12121 }
12122
12125 {
12127 }
12128
12129
12131 {
12133 }
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12177 {
12179 return false;
12180 return true;
12181 }
12182
12184 {
12185
12187 }
12188
12189
12192 {
12193 super.CheckForRoofLimited(timeTresholdMS);
12194
12195 float time =
g_Game.GetTime();
12196 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12197 {
12198 m_PreviousRoofTestTime = time;
12199 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12200 }
12201 }
12202
12203
12205 {
12207 {
12208 return 0;
12209 }
12210
12211 if (GetInventory().GetAttachmentSlotsCount() != 0)
12212 {
12213 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12214 if (filter)
12215 return filter.GetProtectionLevel(type, false, system);
12216 else
12217 return 0;
12218 }
12219
12220 string subclassPath, entryName;
12221
12222 switch (type)
12223 {
12225 entryName = "biological";
12226 break;
12228 entryName = "chemical";
12229 break;
12230 default:
12231 entryName = "biological";
12232 break;
12233 }
12234
12235 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12236
12237 return g_Game.ConfigGetFloat(subclassPath + entryName);
12238 }
12239
12240
12241
12244 {
12245 if (!IsMagazine())
12247
12249 }
12250
12251
12252
12253
12254
12259 {
12260 return true;
12261 }
12262
12264 {
12266 }
12267
12268
12269
12270
12271
12273 {
12274 if (parent)
12275 {
12276 if (parent.IsInherited(DayZInfected))
12277 return true;
12278
12279 if (!parent.IsRuined())
12280 return true;
12281 }
12282
12283 return true;
12284 }
12285
12287 {
12288 if (!super.CanPutAsAttachment(parent))
12289 {
12290 return false;
12291 }
12292
12293 if (!IsRuined() && !parent.IsRuined())
12294 {
12295 return true;
12296 }
12297
12298 return false;
12299 }
12300
12302 {
12303
12304
12305
12306
12307 return super.CanReceiveItemIntoCargo(item);
12308 }
12309
12311 {
12312
12313
12314
12315
12316 GameInventory attachmentInv = attachment.GetInventory();
12318 {
12319 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12320 return false;
12321 }
12322
12323 InventoryLocation loc = new InventoryLocation();
12324 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12325 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12326 return false;
12327
12328 return super.CanReceiveAttachment(attachment, slotId);
12329 }
12330
12332 {
12333 if (!super.CanReleaseAttachment(attachment))
12334 return false;
12335
12336 return GetInventory().AreChildrenAccessible();
12337 }
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12360 {
12361 int id = muzzle_owner.GetMuzzleID();
12362 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12363
12364 if (WPOF_array)
12365 {
12366 for (int i = 0; i < WPOF_array.Count(); i++)
12367 {
12368 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12369
12370 if (WPOF)
12371 {
12372 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12373 }
12374 }
12375 }
12376 }
12377
12378
12380 {
12381 int id = muzzle_owner.GetMuzzleID();
12383
12384 if (WPOBE_array)
12385 {
12386 for (int i = 0; i < WPOBE_array.Count(); i++)
12387 {
12388 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12389
12390 if (WPOBE)
12391 {
12392 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12393 }
12394 }
12395 }
12396 }
12397
12398
12400 {
12401 int id = muzzle_owner.GetMuzzleID();
12402 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12403
12404 if (WPOOH_array)
12405 {
12406 for (int i = 0; i < WPOOH_array.Count(); i++)
12407 {
12408 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12409
12410 if (WPOOH)
12411 {
12412 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12413 }
12414 }
12415 }
12416 }
12417
12418
12420 {
12421 int id = muzzle_owner.GetMuzzleID();
12422 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12423
12424 if (WPOOH_array)
12425 {
12426 for (int i = 0; i < WPOOH_array.Count(); i++)
12427 {
12428 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12429
12430 if (WPOOH)
12431 {
12432 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12433 }
12434 }
12435 }
12436 }
12437
12438
12440 {
12441 int id = muzzle_owner.GetMuzzleID();
12442 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12443
12444 if (WPOOH_array)
12445 {
12446 for (int i = 0; i < WPOOH_array.Count(); i++)
12447 {
12448 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12449
12450 if (WPOOH)
12451 {
12452 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12453 }
12454 }
12455 }
12456 }
12457
12458
12459
12461 {
12463 {
12464 return true;
12465 }
12466
12467 return false;
12468 }
12469
12471 {
12473 {
12474 return true;
12475 }
12476
12477 return false;
12478 }
12479
12481 {
12483 {
12484 return true;
12485 }
12486
12487 return false;
12488 }
12489
12491 {
12492 return false;
12493 }
12494
12497 {
12498 return UATimeSpent.DEFAULT_DEPLOY;
12499 }
12500
12501
12502
12503
12505 {
12507 SetSynchDirty();
12508 }
12509
12511 {
12513 }
12514
12515
12517 {
12518 return false;
12519 }
12520
12523 {
12524 string att_type = "None";
12525
12526 if (ConfigIsExisting("soundAttType"))
12527 {
12528 att_type = ConfigGetString("soundAttType");
12529 }
12530
12532 }
12533
12535 {
12537 }
12538
12539
12540
12541
12542
12548
12550 {
12553
12555 }
12556
12557
12559 {
12561 return;
12562
12564
12567
12570
12571 SoundParameters params = new SoundParameters();
12575 }
12576
12577
12579 {
12581 {
12584
12585 SetSynchDirty();
12586
12589 }
12590 }
12591
12593 {
12595 }
12596
12597
12599 {
12601 return;
12602
12604 SetSynchDirty();
12605
12608 }
12609
12611 {
12614 }
12615
12617 {
12619 }
12620
12621 void OnApply(PlayerBase player);
12622
12624 {
12625 return 1.0;
12626 };
12627
12629 {
12631 }
12632
12634 {
12636 }
12637
12639
12641 {
12642 SetDynamicPhysicsLifeTime(0.01);
12644 }
12645
12647 {
12648 array<string> zone_names = new array<string>;
12649 GetDamageZones(zone_names);
12650 for (int i = 0; i < zone_names.Count(); i++)
12651 {
12652 SetHealthMax(zone_names.Get(i),"Health");
12653 }
12654 SetHealthMax("","Health");
12655 }
12656
12659 {
12660 float global_health = GetHealth01("","Health");
12661 array<string> zones = new array<string>;
12662 GetDamageZones(zones);
12663
12664 for (int i = 0; i < zones.Count(); i++)
12665 {
12666 SetHealth01(zones.Get(i),"Health",global_health);
12667 }
12668 }
12669
12672 {
12673 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12674 }
12675
12677 {
12678 if (!hasRootAsPlayer)
12679 {
12680 if (refParentIB)
12681 {
12682
12683 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12684 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12685
12686 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12687 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12688
12691 }
12692 else
12693 {
12694
12697 }
12698 }
12699 }
12700
12702 {
12704 {
12705 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12706 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12707 {
12708 float heatPermCoef = 1.0;
12710 while (ent)
12711 {
12712 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12713 ent = ent.GetHierarchyParent();
12714 }
12715
12716 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12717 }
12718 }
12719 }
12720
12722 {
12723
12724 EntityAI parent = GetHierarchyParent();
12725 if (!parent)
12726 {
12727 hasParent = false;
12728 hasRootAsPlayer = false;
12729 }
12730 else
12731 {
12732 hasParent = true;
12733 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12734 refParentIB =
ItemBase.Cast(parent);
12735 }
12736 }
12737
12738 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12739 {
12740
12741 }
12742
12744 {
12745
12746 return false;
12747 }
12748
12750 {
12751
12752
12753 return false;
12754 }
12755
12757 {
12758
12759 return false;
12760 }
12761
12764 {
12765 return !GetIsFrozen() &&
IsOpen();
12766 }
12767
12769 {
12770 bool hasParent = false, hasRootAsPlayer = false;
12772
12773 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12774 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12775
12776 if (wwtu || foodDecay)
12777 {
12781
12782 if (processWetness || processTemperature || processDecay)
12783 {
12785
12786 if (processWetness)
12787 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12788
12789 if (processTemperature)
12791
12792 if (processDecay)
12793 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12794 }
12795 }
12796 }
12797
12800 {
12802 }
12803
12805 {
12808
12809 return super.GetTemperatureFreezeThreshold();
12810 }
12811
12813 {
12816
12817 return super.GetTemperatureThawThreshold();
12818 }
12819
12821 {
12824
12825 return super.GetItemOverheatThreshold();
12826 }
12827
12829 {
12831 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12832
12833 return super.GetTemperatureFreezeTime();
12834 }
12835
12837 {
12839 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12840
12841 return super.GetTemperatureThawTime();
12842 }
12843
12848
12850 {
12851 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12852 }
12853
12855 {
12856 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12857 }
12858
12861 {
12863 }
12864
12866 {
12868 }
12869
12871 {
12873 }
12874
12877 {
12878 return null;
12879 }
12880
12883 {
12884 return false;
12885 }
12886
12888 {
12890 {
12893 if (!trg)
12894 {
12896 explosive = this;
12897 }
12898
12899 explosive.PairRemote(trg);
12901
12902 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12903 trg.SetPersistentPairID(persistentID);
12904 explosive.SetPersistentPairID(persistentID);
12905
12906 return true;
12907 }
12908 return false;
12909 }
12910
12913 {
12914 float ret = 1.0;
12917 ret *= GetHealth01();
12918
12919 return ret;
12920 }
12921
12922 #ifdef DEVELOPER
12923 override void SetDebugItem()
12924 {
12925 super.SetDebugItem();
12926 _itemBase = this;
12927 }
12928
12930 {
12931 string text = super.GetDebugText();
12932
12934 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12935
12936 return text;
12937 }
12938 #endif
12939
12941 {
12942 return true;
12943 }
12944
12946
12948
12950 {
12953 }
12954
12955
12963
12979
12980 [
Obsolete(
"Use ItemSoundHandler instead")]
12983 {
12984 if (!
g_Game.IsDedicatedServer())
12985 {
12986 if (ConfigIsExisting("attachSoundSet"))
12987 {
12988 string cfg_path = "";
12989 string soundset = "";
12990 string type_name =
GetType();
12991
12994 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12995 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12996
12997 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12998 {
12999 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13000 {
13001 if (cfg_slot_array[i] == slot_type)
13002 {
13003 soundset = cfg_soundset_array[i];
13004 break;
13005 }
13006 }
13007 }
13008
13009 if (soundset != "")
13010 {
13011 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13013 }
13014 }
13015 }
13016 }
13017
13019}
13020
13022{
13024 if (entity)
13025 {
13026 bool is_item = entity.IsInherited(
ItemBase);
13027 if (is_item && full_quantity)
13028 {
13031 }
13032 }
13033 else
13034 {
13036 return NULL;
13037 }
13038 return entity;
13039}
13040
13042{
13043 if (item)
13044 {
13045 if (health > 0)
13046 item.SetHealth("", "", health);
13047
13048 if (item.CanHaveTemperature())
13049 {
13051 if (item.CanFreeze())
13052 item.SetFrozen(false);
13053 }
13054
13055 if (item.HasEnergyManager())
13056 {
13057 if (quantity >= 0)
13058 {
13059 item.GetCompEM().SetEnergy0To1(quantity);
13060 }
13061 else
13062 {
13064 }
13065 }
13066 else if (item.IsMagazine())
13067 {
13068 Magazine mag = Magazine.Cast(item);
13069 if (quantity >= 0)
13070 {
13071 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13072 }
13073 else
13074 {
13076 }
13077
13078 }
13079 else
13080 {
13081 if (quantity >= 0)
13082 {
13083 item.SetQuantityNormalized(quantity, false);
13084 }
13085 else
13086 {
13088 }
13089
13090 }
13091 }
13092}
13093
13094#ifdef DEVELOPER
13096#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.