9144{
9146 {
9147 return true;
9148 }
9149};
9150
9152{
9153
9154};
9155
9156
9157
9159{
9163
9165
9168
9169
9170
9171
9172
9181
9187
9192
9197
9218 protected bool m_IsResultOfSplit
9219
9221
9226
9227
9228
9230
9234
9235
9236
9238
9241
9242
9243
9249
9250
9258
9261
9262
9264
9265
9267
9268
9273
9274
9279
9281
9282
9284
9285
9287 {
9292
9293 if (!
g_Game.IsDedicatedServer())
9294 {
9296 {
9298
9300 {
9302 }
9303 }
9304
9307 }
9308
9309 m_OldLocation = null;
9310
9312 {
9314 }
9315
9316 if (ConfigIsExisting("headSelectionsToHide"))
9317 {
9320 }
9321
9323 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9324 {
9326 }
9327
9329
9330 m_IsResultOfSplit = false;
9331
9333 }
9334
9336 {
9337 super.InitItemVariables();
9338
9344 m_Count = ConfigGetInt(
"count");
9345
9348
9353
9356
9361
9373
9377
9378
9381 if (ConfigIsExisting("canBeSplit"))
9382 {
9385 }
9386
9388 if (ConfigIsExisting("itemBehaviour"))
9390
9391
9394 RegisterNetSyncVariableInt("m_VarLiquidType");
9395 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9396
9397 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9398 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9399 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9400
9401 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9402 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9403 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9404 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9405
9406 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9407 RegisterNetSyncVariableBool("m_IsTakeable");
9408 RegisterNetSyncVariableBool("m_IsHologram");
9409
9412 {
9415 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9416 }
9417
9419
9421 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9423
9425 }
9426
9428 {
9430 }
9431
9433 {
9436 {
9441 }
9442 }
9443
9444 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9445 {
9447 {
9450 }
9451
9453 }
9454
9456 {
9462 }
9463
9465
9467 {
9469
9470 if (!action)
9471 {
9472 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9473 return;
9474 }
9475
9477 if (!ai)
9478 {
9480 return;
9481 }
9482
9484 if (!action_array)
9485 {
9486 action_array = new array<ActionBase_Basic>;
9488 }
9489 if (LogManager.IsActionLogEnable())
9490 {
9491 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9492 }
9493
9494 if (action_array.Find(action) != -1)
9495 {
9496 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9497 }
9498 else
9499 {
9500 action_array.Insert(action);
9501 }
9502 }
9503
9505 {
9506 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9507 ActionBase action = player.GetActionManager().GetAction(actionName);
9510
9511 if (action_array)
9512 {
9513 action_array.RemoveItem(action);
9514 }
9515 }
9516
9517
9518
9520 {
9521 ActionOverrideData overrideData = new ActionOverrideData();
9525
9527 if (!actionMap)
9528 {
9531 }
9532
9533 actionMap.Insert(this.
Type(), overrideData);
9534
9535 }
9536
9538
9540
9541
9543 {
9546
9549
9550 string config_to_search = "CfgVehicles";
9551 string muzzle_owner_config;
9552
9554 {
9555 if (IsInherited(Weapon))
9556 config_to_search = "CfgWeapons";
9557
9558 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9559
9560 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9561
9562 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9563
9564 if (config_OnFire_subclass_count > 0)
9565 {
9566 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9567
9568 for (int i = 0; i < config_OnFire_subclass_count; i++)
9569 {
9570 string particle_class = "";
9571 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9572 string config_OnFire_entry = config_OnFire_class + particle_class;
9573 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9574 WPOF_array.Insert(WPOF);
9575 }
9576
9577
9579 }
9580 }
9581
9583 {
9584 config_to_search = "CfgWeapons";
9585 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9586
9587 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9588
9589 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9590
9591 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9592 {
9593 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9594
9595 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9596 {
9597 string particle_class2 = "";
9598 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9599 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9600 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9601 WPOBE_array.Insert(WPOBE);
9602 }
9603
9604
9606 }
9607 }
9608 }
9609
9610
9612 {
9615
9617 {
9618 string config_to_search = "CfgVehicles";
9619
9620 if (IsInherited(Weapon))
9621 config_to_search = "CfgWeapons";
9622
9623 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9624 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9625
9626 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9627 {
9628
9630
9632 {
9634 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9636 return;
9637 }
9638
9641
9642
9643
9644 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9645 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9646
9647 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9648 {
9649 string particle_class = "";
9650 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9651 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9652 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9653
9654 if (entry_type == CT_CLASS)
9655 {
9656 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9657 WPOOH_array.Insert(WPOF);
9658 }
9659 }
9660
9661
9663 }
9664 }
9665 }
9666
9668 {
9670 }
9671
9673 {
9675 {
9677
9680
9683
9684 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9685 }
9686 }
9687
9689 {
9691 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9692
9694 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9695
9697 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9698
9700 {
9702 }
9703 }
9704
9706 {
9708 }
9709
9711 {
9714 else
9716
9718 {
9721 }
9722 else
9723 {
9726
9729 }
9730
9732 }
9733
9735 {
9737 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9738 }
9739
9741 {
9743 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9745 }
9746
9748 {
9750 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9751 }
9752
9754 {
9757
9758 OverheatingParticle OP = new OverheatingParticle();
9763
9765 }
9766
9768 {
9771
9772 return -1;
9773 }
9774
9776 {
9778 {
9781
9782 for (int i = count; i > 0; --i)
9783 {
9784 int id = i - 1;
9787
9790
9791 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9792 {
9793 if (p)
9794 {
9797 }
9798 }
9799 }
9800 }
9801 }
9802
9804 {
9806 {
9808 {
9809 int id = i - 1;
9811
9812 if (OP)
9813 {
9815
9816 if (p)
9817 {
9819 }
9820
9821 delete OP;
9822 }
9823 }
9824
9827 }
9828 }
9829
9832 {
9833 return 0.0;
9834 }
9835
9836
9838 {
9839 return 250;
9840 }
9841
9843 {
9844 return 0;
9845 }
9846
9849 {
9851 return true;
9852
9853 return false;
9854 }
9855
9858 {
9861
9863 {
9865 }
9866 else
9867 {
9868
9870 }
9871
9873 }
9874
9881 {
9882 return -1;
9883 }
9884
9885
9886
9887
9889 {
9891 {
9892 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9893 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9894
9895 if (r_index >= 0)
9896 {
9897 InventoryLocation r_il = new InventoryLocation;
9898 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9899
9900 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9903 {
9904 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9905 }
9907 {
9908 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9909 }
9910
9911 }
9912
9913 player.GetHumanInventory().ClearUserReservedLocation(this);
9914 }
9915
9918 }
9919
9920
9921
9922
9924 {
9925 return ItemBase.m_DebugActionsMask;
9926 }
9927
9929 {
9930 return ItemBase.m_DebugActionsMask & mask;
9931 }
9932
9934 {
9935 ItemBase.m_DebugActionsMask = mask;
9936 }
9937
9939 {
9940 ItemBase.m_DebugActionsMask |= mask;
9941 }
9942
9944 {
9945 ItemBase.m_DebugActionsMask &= ~mask;
9946 }
9947
9949 {
9951 {
9953 }
9954 else
9955 {
9957 }
9958 }
9959
9960
9962 {
9963 if (GetEconomyProfile())
9964 {
9965 float q_max = GetEconomyProfile().GetQuantityMax();
9966 if (q_max > 0)
9967 {
9968 float q_min = GetEconomyProfile().GetQuantityMin();
9969 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9970
9972 {
9973 ComponentEnergyManager comp = GetCompEM();
9975 {
9977 }
9978 }
9980 {
9982
9983 }
9984
9985 }
9986 }
9987 }
9988
9991 {
9992 EntityAI parent = GetHierarchyParent();
9993
9994 if (parent)
9995 {
9996 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9997 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9998 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9999 }
10000 }
10001
10004 {
10005 EntityAI parent = GetHierarchyParent();
10006
10007 if (parent)
10008 {
10009 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10010 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10011 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10012 }
10013 }
10014
10016 {
10017
10018
10019
10020
10022
10024 {
10025 if (ScriptInputUserData.CanStoreInputUserData())
10026 {
10027 ScriptInputUserData ctx = new ScriptInputUserData;
10033 ctx.
Write(use_stack_max);
10036
10038 {
10039 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10040 }
10041 }
10042 }
10043 else if (!
g_Game.IsMultiplayer())
10044 {
10046 }
10047 }
10048
10050 {
10052 }
10053
10055 {
10057 }
10058
10060 {
10062 }
10063
10065 {
10066
10067 return false;
10068 }
10069
10071 {
10072 return false;
10073 }
10074
10078 {
10079 return false;
10080 }
10081
10083 {
10084 return "";
10085 }
10086
10088
10090 {
10091 return false;
10092 }
10093
10095 {
10096 return true;
10097 }
10098
10099
10100
10102 {
10103 return true;
10104 }
10105
10107 {
10108 return true;
10109 }
10110
10112 {
10113 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10115 }
10116
10118 {
10120 }
10121
10123 {
10125 if (!is_being_placed)
10127 SetSynchDirty();
10128 }
10129
10130
10132
10134 {
10136 }
10137
10139 {
10141 }
10142
10144 {
10145 return 1;
10146 }
10147
10149 {
10150 return false;
10151 }
10152
10154 {
10156 SetSynchDirty();
10157 }
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10194 {
10195 super.OnMovedInsideCargo(container);
10196
10197 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10198 }
10199
10200 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10201 {
10202 super.EEItemLocationChanged(oldLoc, newLoc);
10203
10204 PlayerBase newPlayer = null;
10205 PlayerBase oldPlayer = null;
10206
10207 if (newLoc.GetParent())
10208 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10209
10210 if (oldLoc.GetParent())
10211 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10212
10214 {
10215 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10216
10217 if (rIndex >= 0)
10218 {
10219 InventoryLocation rIl = new InventoryLocation;
10220 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10221
10222 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10225 {
10226 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10227 }
10229 {
10231 }
10232
10233 }
10234 }
10235
10237 {
10238 if (newPlayer)
10239 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10240
10241 if (newPlayer == oldPlayer)
10242 {
10243 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10244 {
10246 {
10247 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10248 {
10249 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10250 }
10251 }
10252 else
10253 {
10254 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10255 }
10256 }
10257
10258 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10259 {
10260 int type = oldLoc.GetType();
10262 {
10263 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10264 }
10266 {
10267 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10268 }
10269 }
10270 if (!m_OldLocation)
10271 {
10272 m_OldLocation = new InventoryLocation;
10273 }
10274 m_OldLocation.Copy(oldLoc);
10275 }
10276 else
10277 {
10278 if (m_OldLocation)
10279 {
10280 m_OldLocation.Reset();
10281 }
10282 }
10283
10284 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10285 }
10286 else
10287 {
10288 if (newPlayer)
10289 {
10290 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10291 if (resIndex >= 0)
10292 {
10293 InventoryLocation il = new InventoryLocation;
10294 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10296 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10299 {
10300 il.
GetParent().GetOnReleaseLock().Invoke(it);
10301 }
10303 {
10305 }
10306
10307 }
10308 }
10310 {
10311
10313 }
10314
10315 if (m_OldLocation)
10316 {
10317 m_OldLocation.Reset();
10318 }
10319 }
10320
10322 {
10323 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10324 }
10325
10327 {
10328 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10329 }
10330 }
10331
10332 override void EOnContact(IEntity other, Contact extra)
10333 {
10335 {
10336 int liquidType = -1;
10338 if (impactSpeed > 0.0)
10339 {
10341 #ifndef SERVER
10343 #else
10345 SetSynchDirty();
10346 #endif
10348 }
10349 }
10350
10351 #ifdef SERVER
10352 if (GetCompEM() && GetCompEM().IsPlugged())
10353 {
10354 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10355 GetCompEM().UnplugThis();
10356 }
10357 #endif
10358 }
10359
10361
10363 {
10365 }
10366
10368 {
10369
10370 }
10371
10373 {
10374 super.OnItemLocationChanged(old_owner, new_owner);
10375
10376 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10377 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10378
10379 if (!relatedPlayer && playerNew)
10380 relatedPlayer = playerNew;
10381
10382 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10383 {
10385 if (actionMgr)
10386 {
10387 ActionBase currentAction = actionMgr.GetRunningAction();
10388 if (currentAction)
10390 }
10391 }
10392
10393 Man ownerPlayerOld = null;
10394 Man ownerPlayerNew = null;
10395
10396 if (old_owner)
10397 {
10398 if (old_owner.
IsMan())
10399 {
10400 ownerPlayerOld = Man.Cast(old_owner);
10401 }
10402 else
10403 {
10404 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10405 }
10406 }
10407 else
10408 {
10410 {
10412
10413 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10414 {
10415 GetCompEM().UnplugThis();
10416 }
10417 }
10418 }
10419
10420 if (new_owner)
10421 {
10422 if (new_owner.
IsMan())
10423 {
10424 ownerPlayerNew = Man.Cast(new_owner);
10425 }
10426 else
10427 {
10428 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10429 }
10430 }
10431
10432 if (ownerPlayerOld != ownerPlayerNew)
10433 {
10434 if (ownerPlayerOld)
10435 {
10436 array<EntityAI> subItemsExit = new array<EntityAI>;
10438 for (int i = 0; i < subItemsExit.Count(); i++)
10439 {
10442 }
10443 }
10444
10445 if (ownerPlayerNew)
10446 {
10447 array<EntityAI> subItemsEnter = new array<EntityAI>;
10449 for (int j = 0; j < subItemsEnter.Count(); j++)
10450 {
10453 }
10454 }
10455 }
10456 else if (ownerPlayerNew != null)
10457 {
10458 PlayerBase nplayer;
10459 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10460 {
10461 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10463 for (int k = 0; k < subItemsUpdate.Count(); k++)
10464 {
10466 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10467 }
10468 }
10469 }
10470
10471 if (old_owner)
10472 old_owner.OnChildItemRemoved(this);
10473 if (new_owner)
10474 new_owner.OnChildItemReceived(this);
10475 }
10476
10477
10479 {
10480 super.EEDelete(parent);
10481 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10482 if (player)
10483 {
10485
10486 if (player.IsAlive())
10487 {
10488 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10489 if (r_index >= 0)
10490 {
10491 InventoryLocation r_il = new InventoryLocation;
10492 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10493
10494 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10497 {
10498 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10499 }
10501 {
10502 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10503 }
10504
10505 }
10506
10507 player.RemoveQuickBarEntityShortcut(this);
10508 }
10509 }
10510 }
10511
10513 {
10514 super.EEKilled(killer);
10515
10518 {
10519 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10520 {
10521 if (IsMagazine())
10522 {
10523 if (Magazine.Cast(this).GetAmmoCount() > 0)
10524 {
10526 }
10527 }
10528 else
10529 {
10531 }
10532 }
10533 }
10534 }
10535
10537 {
10538 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10539
10540 super.OnWasAttached(parent, slot_id);
10541
10544
10547 }
10548
10550 {
10551 super.OnWasDetached(parent, slot_id);
10552
10555
10558 }
10559
10561 {
10562 int idx;
10565
10566 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10567 if (inventory_slots.Count() < 1)
10568 {
10569 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10570 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10571 }
10572 else
10573 {
10574 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10575 }
10576
10577 idx = inventory_slots.Find(slot);
10578 if (idx < 0)
10579 return "";
10580
10581 return attach_types.Get(idx);
10582 }
10583
10585 {
10586 int idx = -1;
10587 string slot;
10588
10591
10592 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10593 if (inventory_slots.Count() < 1)
10594 {
10595 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10596 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10597 }
10598 else
10599 {
10600 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10601 if (detach_types.Count() < 1)
10602 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10603 }
10604
10605 for (int i = 0; i < inventory_slots.Count(); i++)
10606 {
10607 slot = inventory_slots.Get(i);
10608 }
10609
10610 if (slot != "")
10611 {
10612 if (detach_types.Count() == 1)
10613 idx = 0;
10614 else
10615 idx = inventory_slots.Find(slot);
10616 }
10617 if (idx < 0)
10618 return "";
10619
10620 return detach_types.Get(idx);
10621 }
10622
10624 {
10625
10627
10628
10629 float min_time = 1;
10630 float max_time = 3;
10631 float delay = Math.RandomFloat(min_time, max_time);
10632
10633 explode_timer.Run(delay, this, "DoAmmoExplosion");
10634 }
10635
10637 {
10638 Magazine magazine = Magazine.Cast(this);
10639 int pop_sounds_count = 6;
10640 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10641
10642
10643 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10644 string sound_name = pop_sounds[ sound_idx ];
10645 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10646
10647
10648 magazine.ServerAddAmmoCount(-1);
10649
10650
10651 float min_temp_to_explode = 100;
10652
10653 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10654 {
10656 }
10657 }
10658
10659
10660 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10661 {
10662 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10663
10664 const int CHANCE_DAMAGE_CARGO = 4;
10665 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10666 const int CHANCE_DAMAGE_NOTHING = 2;
10667
10669 {
10670 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10671 int chances;
10672 int rnd;
10673
10674 if (GetInventory().GetCargo())
10675 {
10676 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10677 rnd = Math.RandomInt(0,chances);
10678
10679 if (rnd < CHANCE_DAMAGE_CARGO)
10680 {
10682 }
10683 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10684 {
10686 }
10687 }
10688 else
10689 {
10690 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10691 rnd = Math.RandomInt(0,chances);
10692
10693 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10694 {
10696 }
10697 }
10698 }
10699 }
10700
10702 {
10703 CargoBase cargo = GetInventory().GetCargo();
10704 if (cargo)
10705 {
10707 if (item_count > 0)
10708 {
10709 int random_pick = Math.RandomInt(0, item_count);
10711 if (!item.IsExplosive())
10712 {
10713 item.AddHealth("","",damage);
10714 return true;
10715 }
10716 }
10717 }
10718 return false;
10719 }
10720
10722 {
10723 GameInventory inventory = GetInventory();
10725 if (attachment_count > 0)
10726 {
10727 int random_pick = Math.RandomInt(0, attachment_count);
10729 if (!attachment.IsExplosive())
10730 {
10731 attachment.AddHealth("","",damage);
10732 return true;
10733 }
10734 }
10735 return false;
10736 }
10737
10739 {
10741 }
10742
10744 {
10746 return GetInventory().CanRemoveEntity();
10747
10748 return false;
10749 }
10750
10752 {
10753
10755 return false;
10756
10757
10759 return false;
10760
10761
10762
10764 if (delta == 0)
10765 return false;
10766
10767
10768 return true;
10769 }
10770
10772 {
10774 {
10775 if (ScriptInputUserData.CanStoreInputUserData())
10776 {
10777 ScriptInputUserData ctx = new ScriptInputUserData;
10782 ctx.
Write(destination_entity);
10784 ctx.
Write(slot_id);
10786 }
10787 }
10788 else if (!
g_Game.IsMultiplayer())
10789 {
10791 }
10792 }
10793
10795 {
10796 float split_quantity_new;
10800 InventoryLocation loc = new InventoryLocation;
10801
10802 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10803 {
10805 split_quantity_new = stack_max;
10806 else
10808
10810 {
10811 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10812 if (new_item)
10813 {
10814 new_item.SetResultOfSplit(true);
10815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10817 new_item.
SetQuantity(split_quantity_new,
false,
true);
10818 }
10819 }
10820 }
10821 else if (destination_entity && slot_id == -1)
10822 {
10823 if (quantity > stack_max)
10824 split_quantity_new = stack_max;
10825 else
10826 split_quantity_new = quantity;
10827
10829 {
10830 GameInventory destinationInventory = destination_entity.GetInventory();
10832 {
10835 }
10836
10837 if (new_item)
10838 {
10839 new_item.SetResultOfSplit(true);
10840 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10842 new_item.
SetQuantity(split_quantity_new,
false,
true);
10843 }
10844 }
10845 }
10846 else
10847 {
10848 if (stack_max != 0)
10849 {
10851 {
10853 }
10854
10855 if (split_quantity_new == 0)
10856 {
10857 if (!
g_Game.IsMultiplayer())
10858 player.PhysicalPredictiveDropItem(this);
10859 else
10860 player.ServerDropEntity(this);
10861 return;
10862 }
10863
10865 {
10867
10868 if (new_item)
10869 {
10870 new_item.SetResultOfSplit(true);
10871 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10874 new_item.PlaceOnSurface();
10875 }
10876 }
10877 }
10878 }
10879 }
10880
10882 {
10883 float split_quantity_new;
10887 InventoryLocation loc = new InventoryLocation;
10888
10889 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10890 {
10892 split_quantity_new = stack_max;
10893 else
10895
10897 {
10898 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10899 if (new_item)
10900 {
10901 new_item.SetResultOfSplit(true);
10902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10904 new_item.
SetQuantity(split_quantity_new,
false,
true);
10905 }
10906 }
10907 }
10908 else if (destination_entity && slot_id == -1)
10909 {
10910 if (quantity > stack_max)
10911 split_quantity_new = stack_max;
10912 else
10913 split_quantity_new = quantity;
10914
10916 {
10917 GameInventory destinationInventory = destination_entity.GetInventory();
10919 {
10922 }
10923
10924 if (new_item)
10925 {
10926 new_item.SetResultOfSplit(true);
10927 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10929 new_item.
SetQuantity(split_quantity_new,
false,
true);
10930 }
10931 }
10932 }
10933 else
10934 {
10935 if (stack_max != 0)
10936 {
10938 {
10940 }
10941
10943 {
10945
10946 if (new_item)
10947 {
10948 new_item.SetResultOfSplit(true);
10949 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10952 new_item.PlaceOnSurface();
10953 }
10954 }
10955 }
10956 }
10957 }
10958
10960 {
10962 {
10963 if (ScriptInputUserData.CanStoreInputUserData())
10964 {
10965 ScriptInputUserData ctx = new ScriptInputUserData;
10970 dst.WriteToContext(ctx);
10972 }
10973 }
10974 else if (!
g_Game.IsMultiplayer())
10975 {
10977 }
10978 }
10979
10981 {
10983 {
10984 if (ScriptInputUserData.CanStoreInputUserData())
10985 {
10986 ScriptInputUserData ctx = new ScriptInputUserData;
10991 ctx.
Write(destination_entity);
10997 }
10998 }
10999 else if (!
g_Game.IsMultiplayer())
11000 {
11002 }
11003 }
11004
11006 {
11008 }
11009
11011 {
11013 float split_quantity_new;
11015 if (dst.IsValid())
11016 {
11017 int slot_id = dst.GetSlot();
11019
11020 if (quantity > stack_max)
11021 split_quantity_new = stack_max;
11022 else
11023 split_quantity_new = quantity;
11024
11026 {
11028
11029 if (new_item)
11030 {
11031 new_item.SetResultOfSplit(true);
11032 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11034 new_item.
SetQuantity(split_quantity_new,
false,
true);
11035 }
11036
11037 return new_item;
11038 }
11039 }
11040
11041 return null;
11042 }
11043
11045 {
11047 float split_quantity_new;
11049 if (destination_entity)
11050 {
11052 if (quantity > stackable)
11053 split_quantity_new = stackable;
11054 else
11055 split_quantity_new = quantity;
11056
11058 {
11059 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11060 if (new_item)
11061 {
11062 new_item.SetResultOfSplit(true);
11063 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11065 new_item.
SetQuantity(split_quantity_new,
false,
true);
11066 }
11067 }
11068 }
11069 }
11070
11072 {
11074 {
11075 if (ScriptInputUserData.CanStoreInputUserData())
11076 {
11077 ScriptInputUserData ctx = new ScriptInputUserData;
11082 ItemBase destination_entity =
this;
11083 ctx.
Write(destination_entity);
11087 }
11088 }
11089 else if (!
g_Game.IsMultiplayer())
11090 {
11092 }
11093 }
11094
11096 {
11098 float split_quantity_new;
11100 if (player)
11101 {
11103 if (quantity > stackable)
11104 split_quantity_new = stackable;
11105 else
11106 split_quantity_new = quantity;
11107
11109 {
11110 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11111 new_item =
ItemBase.Cast(in_hands);
11112 if (new_item)
11113 {
11114 new_item.SetResultOfSplit(true);
11115 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11117 new_item.SetQuantity(split_quantity_new, false, true);
11118 }
11119 }
11120 }
11121 }
11122
11124 {
11126 float split_quantity_new = Math.Floor(quantity * 0.5);
11127
11129 return;
11130
11132
11133 if (new_item)
11134 {
11135 if (new_item.GetQuantityMax() < split_quantity_new)
11136 {
11137 split_quantity_new = new_item.GetQuantityMax();
11138 }
11139
11140 new_item.SetResultOfSplit(true);
11141 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11142
11144 {
11147 }
11148 else
11149 {
11151 new_item.
SetQuantity(split_quantity_new,
false,
true);
11152 }
11153 }
11154 }
11155
11157 {
11159 float split_quantity_new = Math.Floor(quantity / 2);
11160
11162 return;
11163
11164 InventoryLocation invloc = new InventoryLocation;
11166
11168 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11169
11170 if (new_item)
11171 {
11172 if (new_item.GetQuantityMax() < split_quantity_new)
11173 {
11174 split_quantity_new = new_item.GetQuantityMax();
11175 }
11177 {
11180 }
11181 else if (split_quantity_new > 1)
11182 {
11184 new_item.
SetQuantity(split_quantity_new,
false,
true);
11185 }
11186 }
11187 }
11188
11191 {
11192 SetWeightDirty();
11194
11195 if (parent)
11196 parent.OnAttachmentQuantityChangedEx(this, delta);
11197
11199 {
11201 {
11203 }
11205 {
11206 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11208 }
11209 }
11210 }
11211
11214 {
11215
11216 }
11217
11220 {
11222 }
11223
11225 {
11226 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11227
11229 {
11230 if (newLevel == GameConstants.STATE_RUINED)
11231 {
11233 EntityAI parent = GetHierarchyParent();
11234 if (parent && parent.IsFireplace())
11235 {
11236 CargoBase cargo = GetInventory().GetCargo();
11237 if (cargo)
11238 {
11240 {
11242 }
11243 }
11244 }
11245 }
11246
11248 {
11249
11251 return;
11252 }
11253
11254 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11255 {
11257 }
11258 }
11259 }
11260
11261
11263 {
11264 super.OnRightClick();
11265
11267 {
11269 {
11270 if (ScriptInputUserData.CanStoreInputUserData())
11271 {
11272 EntityAI root = GetHierarchyRoot();
11273 Man playerOwner = GetHierarchyRootPlayer();
11274 InventoryLocation dst = new InventoryLocation;
11275
11276
11277 if (!playerOwner && root && root == this)
11278 {
11280 }
11281 else
11282 {
11283
11284 GetInventory().GetCurrentInventoryLocation(dst);
11286 {
11287 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11289 {
11291 }
11292 else
11293 {
11295
11296
11297 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11298 {
11300 }
11301 else
11302 {
11303 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11304 }
11305 }
11306 }
11307 }
11308
11309 ScriptInputUserData ctx = new ScriptInputUserData;
11317 }
11318 }
11319 else if (!
g_Game.IsMultiplayer())
11320 {
11322 }
11323 }
11324 }
11325
11327 {
11328 if (root)
11329 {
11330 vector m4[4];
11331 root.GetTransform(m4);
11332 dst.SetGround(this, m4);
11333 }
11334 else
11335 {
11336 GetInventory().GetCurrentInventoryLocation(dst);
11337 }
11338 }
11339
11340 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11341 {
11342
11343 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11344 return false;
11345
11346 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11347 return false;
11348
11349
11351 return false;
11352
11353
11354 Magazine mag = Magazine.Cast(this);
11355 if (mag)
11356 {
11357 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11358 return false;
11359
11360 if (stack_max_limit)
11361 {
11362 Magazine other_mag = Magazine.Cast(other_item);
11363 if (other_item)
11364 {
11365 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11366 return false;
11367 }
11368
11369 }
11370 }
11371 else
11372 {
11373
11375 return false;
11376
11378 return false;
11379 }
11380
11381 PlayerBase player = null;
11382 if (CastTo(player, GetHierarchyRootPlayer()))
11383 {
11384 if (player.GetInventory().HasAttachment(this))
11385 return false;
11386
11387 if (player.IsItemsToDelete())
11388 return false;
11389 }
11390
11391 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11392 return false;
11393
11394 int slotID;
11396 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11397 return false;
11398
11399 return true;
11400 }
11401
11403 {
11405 }
11406
11408 {
11409 return m_IsResultOfSplit;
11410 }
11411
11413 {
11414 m_IsResultOfSplit = value;
11415 }
11416
11418 {
11420 }
11421
11423 {
11424 float other_item_quantity = other_item.GetQuantity();
11425 float this_free_space;
11426
11428
11430
11431 if (other_item_quantity > this_free_space)
11432 {
11433 return this_free_space;
11434 }
11435 else
11436 {
11437 return other_item_quantity;
11438 }
11439 }
11440
11442 {
11444 }
11445
11447 {
11449 return;
11450
11451 if (!IsMagazine() && other_item)
11452 {
11454 if (quantity_used != 0)
11455 {
11456 float hp1 = GetHealth01("","");
11457 float hp2 = other_item.GetHealth01("","");
11458 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11459 hpResult = hpResult / (
GetQuantity() + quantity_used);
11460
11461 hpResult *= GetMaxHealth();
11462 Math.Round(hpResult);
11463 SetHealth("", "Health", hpResult);
11464
11466 other_item.AddQuantity(-quantity_used);
11467 }
11468 }
11470 }
11471
11473 {
11474 #ifdef SERVER
11475 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11476 GetHierarchyParent().IncreaseLifetimeUp();
11477 #endif
11478 };
11479
11481 {
11482 PlayerBase p = PlayerBase.Cast(player);
11483
11484 array<int> recipesIds = p.m_Recipes;
11485 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11486 if (moduleRecipesManager)
11487 {
11488 EntityAI itemInHands = player.GetEntityInHands();
11489 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11490 }
11491
11492 for (int i = 0;i < recipesIds.Count(); i++)
11493 {
11494 int key = recipesIds.Get(i);
11495 string recipeName = moduleRecipesManager.GetRecipeName(key);
11497 }
11498 }
11499
11500
11501 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11502 {
11503 super.GetDebugActions(outputList);
11504
11505
11511
11512
11517
11522
11523
11527
11528
11530 {
11534 }
11535
11538
11539
11543
11545
11546 InventoryLocation loc = new InventoryLocation();
11547 GetInventory().GetCurrentInventoryLocation(loc);
11549 {
11550 if (Gizmo_IsSupported())
11553 }
11554
11556 }
11557
11558
11559
11560
11562 {
11563 super.OnAction(action_id, player, ctx);
11564
11566 {
11567 switch (action_id)
11568 {
11572 return true;
11576 return true;
11577 }
11578 }
11579
11581 {
11582 switch (action_id)
11583 {
11585 Delete();
11586 return true;
11587 }
11588 }
11589
11590 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11591 {
11592 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11593 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11594 PlayerBase p = PlayerBase.Cast(player);
11595 if (
EActions.RECIPES_RANGE_START < 1000)
11596 {
11597 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11598 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11599 }
11600 }
11601 #ifndef SERVER
11602 else if (action_id ==
EActions.WATCH_PLAYER)
11603 {
11604 PluginDeveloper.SetDeveloperItemClientEx(player);
11605 }
11606 #endif
11608 {
11609 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11610 {
11611 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11612 OnDebugButtonPressServer(id + 1);
11613 }
11614
11615 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11616 {
11617 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11619 }
11620
11621 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11622 {
11623 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11625 }
11626
11627 else if (action_id ==
EActions.ADD_QUANTITY)
11628 {
11629 if (IsMagazine())
11630 {
11631 Magazine mag = Magazine.Cast(this);
11632 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11633 }
11634 else
11635 {
11637 }
11638
11639 if (m_EM)
11640 {
11641 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11642 }
11643
11644 }
11645
11646 else if (action_id ==
EActions.REMOVE_QUANTITY)
11647 {
11648 if (IsMagazine())
11649 {
11650 Magazine mag2 = Magazine.Cast(this);
11651 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11652 }
11653 else
11654 {
11656 }
11657 if (m_EM)
11658 {
11659 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11660 }
11661
11662 }
11663
11664 else if (action_id ==
EActions.SET_QUANTITY_0)
11665 {
11667
11668 if (m_EM)
11669 {
11670 m_EM.SetEnergy(0);
11671 }
11672 }
11673
11674 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11675 {
11677
11678 if (m_EM)
11679 {
11680 m_EM.SetEnergy(m_EM.GetEnergyMax());
11681 }
11682 }
11683
11684 else if (action_id ==
EActions.ADD_HEALTH)
11685 {
11686 AddHealth("","",GetMaxHealth("","Health")/5);
11687 }
11688 else if (action_id ==
EActions.REMOVE_HEALTH)
11689 {
11690 AddHealth("","",-GetMaxHealth("","Health")/5);
11691 }
11692 else if (action_id ==
EActions.DESTROY_HEALTH)
11693 {
11694 SetHealth01("","",0);
11695 }
11696 else if (action_id ==
EActions.WATCH_ITEM)
11697 {
11699 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11700 #ifdef DEVELOPER
11701 SetDebugDeveloper_item(this);
11702 #endif
11703 }
11704
11705 else if (action_id ==
EActions.ADD_TEMPERATURE)
11706 {
11707 AddTemperature(20);
11708
11709 }
11710
11711 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11712 {
11713 AddTemperature(-20);
11714
11715 }
11716
11717 else if (action_id ==
EActions.FLIP_FROZEN)
11718 {
11719 SetFrozen(!GetIsFrozen());
11720
11721 }
11722
11723 else if (action_id ==
EActions.ADD_WETNESS)
11724 {
11726
11727 }
11728
11729 else if (action_id ==
EActions.REMOVE_WETNESS)
11730 {
11732
11733 }
11734
11735 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11736 {
11739
11740
11741 }
11742
11743 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11744 {
11747 }
11748
11749 else if (action_id ==
EActions.MAKE_SPECIAL)
11750 {
11751 auto debugParams = DebugSpawnParams.WithPlayer(player);
11752 OnDebugSpawnEx(debugParams);
11753 }
11754
11755 }
11756
11757
11758 return false;
11759 }
11760
11761
11762
11763
11767
11770
11771
11772
11774 {
11775 return false;
11776 }
11777
11778
11780 {
11781 return true;
11782 }
11783
11784
11786 {
11787 return true;
11788 }
11789
11790
11791
11793 {
11794 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11795 return g_Game.ConfigIsExisting(config_path);
11796 }
11797
11800 {
11801 return null;
11802 }
11803
11805 {
11806 return false;
11807 }
11808
11810 {
11811 return false;
11812 }
11813
11817
11818
11820 {
11821 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11822 return module_repairing.CanRepair(this, item_repair_kit);
11823 }
11824
11825
11826 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11827 {
11828 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11829 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11830 }
11831
11832
11834 {
11835
11836
11837
11838
11839
11840
11841
11842
11843 return 1;
11844 }
11845
11846
11847
11849 {
11851 }
11852
11853
11854
11856 {
11858 }
11859
11860
11869 {
11870 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11871
11872 if (player)
11873 {
11874 player.MessageStatus(text);
11875 }
11876 }
11877
11878
11887 {
11888 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11889
11890 if (player)
11891 {
11892 player.MessageAction(text);
11893 }
11894 }
11895
11896
11905 {
11906 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11907
11908 if (player)
11909 {
11910 player.MessageFriendly(text);
11911 }
11912 }
11913
11914
11923 {
11924 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11925
11926 if (player)
11927 {
11928 player.MessageImportant(text);
11929 }
11930 }
11931
11933 {
11934 return true;
11935 }
11936
11937
11938 override bool KindOf(
string tag)
11939 {
11940 bool found = false;
11941 string item_name = this.
GetType();
11943 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11944
11945 int array_size = item_tag_array.Count();
11946 for (int i = 0; i < array_size; i++)
11947 {
11948 if (item_tag_array.Get(i) == tag)
11949 {
11950 found = true;
11951 break;
11952 }
11953 }
11954 return found;
11955 }
11956
11957
11959 {
11960
11961 super.OnRPC(sender, rpc_type,ctx);
11962
11963
11964 switch (rpc_type)
11965 {
11966 #ifndef SERVER
11967 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11968 Param2<bool, string> p = new Param2<bool, string>(false, "");
11969
11971 return;
11972
11973 bool play = p.param1;
11974 string soundSet = p.param2;
11975
11976 if (play)
11977 {
11979 {
11981 {
11983 }
11984 }
11985 else
11986 {
11988 }
11989 }
11990 else
11991 {
11993 }
11994
11995 break;
11996 #endif
11997
11998 }
11999
12001 {
12003 }
12004 }
12005
12006
12007
12008
12010 {
12011 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12012 return plugin.GetID(
name);
12013 }
12014
12016 {
12017 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12018 return plugin.GetName(id);
12019 }
12020
12023 {
12024
12025
12026 int varFlags;
12027 if (!ctx.
Read(varFlags))
12028 return;
12029
12030 if (varFlags & ItemVariableFlags.FLOAT)
12031 {
12033 }
12034 }
12035
12037 {
12038
12039 super.SerializeNumericalVars(floats_out);
12040
12041
12042
12044 {
12046 }
12047
12049 {
12051 }
12052
12054 {
12056 }
12057
12059 {
12064 }
12065
12067 {
12069 }
12070 }
12071
12073 {
12074
12075 super.DeSerializeNumericalVars(floats);
12076
12077
12078 int index = 0;
12079 int mask = Math.Round(floats.Get(index));
12080
12081 index++;
12082
12084 {
12086 {
12088 }
12089 else
12090 {
12091 float quantity = floats.Get(index);
12092 SetQuantity(quantity,
true,
false,
false,
false);
12093 }
12094 index++;
12095 }
12096
12098 {
12099 float wet = floats.Get(index);
12101 index++;
12102 }
12103
12105 {
12106 int liquidtype = Math.Round(floats.Get(index));
12108 index++;
12109 }
12110
12112 {
12114 index++;
12116 index++;
12118 index++;
12120 index++;
12121 }
12122
12124 {
12125 int cleanness = Math.Round(floats.Get(index));
12127 index++;
12128 }
12129 }
12130
12132 {
12133 super.WriteVarsToCTX(ctx);
12134
12135
12137 {
12139 }
12140
12142 {
12144 }
12145
12147 {
12149 }
12150
12152 {
12153 int r,g,b,a;
12159 }
12160
12162 {
12164 }
12165 }
12166
12168 {
12169 if (!super.ReadVarsFromCTX(ctx,version))
12170 return false;
12171
12172 int intValue;
12173 float value;
12174
12175 if (version < 140)
12176 {
12177 if (!ctx.
Read(intValue))
12178 return false;
12179
12180 m_VariablesMask = intValue;
12181 }
12182
12184 {
12185 if (!ctx.
Read(value))
12186 return false;
12187
12189 {
12191 }
12192 else
12193 {
12195 }
12196 }
12197
12198 if (version < 140)
12199 {
12201 {
12202 if (!ctx.
Read(value))
12203 return false;
12204 SetTemperatureDirect(value);
12205 }
12206 }
12207
12209 {
12210 if (!ctx.
Read(value))
12211 return false;
12213 }
12214
12216 {
12217 if (!ctx.
Read(intValue))
12218 return false;
12220 }
12221
12223 {
12224 int r,g,b,a;
12226 return false;
12228 return false;
12230 return false;
12232 return false;
12233
12235 }
12236
12238 {
12239 if (!ctx.
Read(intValue))
12240 return false;
12242 }
12243
12244 if (version >= 138 && version < 140)
12245 {
12247 {
12248 if (!ctx.
Read(intValue))
12249 return false;
12250 SetFrozen(intValue);
12251 }
12252 }
12253
12254 return true;
12255 }
12256
12257
12259 {
12262 {
12264 }
12265
12266 if (!super.OnStoreLoad(ctx, version))
12267 {
12269 return false;
12270 }
12271
12272 if (version >= 114)
12273 {
12274 bool hasQuickBarIndexSaved;
12275
12276 if (!ctx.
Read(hasQuickBarIndexSaved))
12277 {
12279 return false;
12280 }
12281
12282 if (hasQuickBarIndexSaved)
12283 {
12284 int itmQBIndex;
12285
12286
12287 if (!ctx.
Read(itmQBIndex))
12288 {
12290 return false;
12291 }
12292
12293 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12294 if (itmQBIndex != -1 && parentPlayer)
12295 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12296 }
12297 }
12298 else
12299 {
12300
12301 PlayerBase player;
12302 int itemQBIndex;
12303 if (version ==
int.
MAX)
12304 {
12305 if (!ctx.
Read(itemQBIndex))
12306 {
12308 return false;
12309 }
12310 }
12311 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12312 {
12313
12314 if (!ctx.
Read(itemQBIndex))
12315 {
12317 return false;
12318 }
12319 if (itemQBIndex != -1 && player)
12320 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12321 }
12322 }
12323
12324 if (version < 140)
12325 {
12326
12327 if (!LoadVariables(ctx, version))
12328 {
12330 return false;
12331 }
12332 }
12333
12334
12336 {
12338 return false;
12339 }
12340 if (version >= 132)
12341 {
12343 if (raib)
12344 {
12346 {
12348 return false;
12349 }
12350 }
12351 }
12352
12354 return true;
12355 }
12356
12357
12358
12360 {
12361 super.OnStoreSave(ctx);
12362
12363 PlayerBase player;
12364 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12365 {
12367
12368 int itemQBIndex = -1;
12369 itemQBIndex = player.FindQuickBarEntityIndex(this);
12370 ctx.
Write(itemQBIndex);
12371 }
12372 else
12373 {
12375 }
12376
12378
12380 if (raib)
12381 {
12383 }
12384 }
12385
12386
12388 {
12389 super.AfterStoreLoad();
12390
12392 {
12394 }
12395
12397 {
12400 }
12401 }
12402
12404 {
12405 super.EEOnAfterLoad();
12406
12408 {
12410 }
12411
12414 }
12415
12417 {
12418 return false;
12419 }
12420
12421
12422
12424 {
12426 {
12427 #ifdef PLATFORM_CONSOLE
12428
12430 {
12432 if (menu)
12433 {
12435 }
12436 }
12437 #endif
12438 }
12439
12441 {
12444 }
12445
12447 {
12448 SetWeightDirty();
12450 }
12452 {
12455 }
12456
12458 {
12461
12464 }
12466 {
12470 }
12471
12472 super.OnVariablesSynchronized();
12473 }
12474
12475
12476
12478 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12479 {
12480 if (!IsServerCheck(allow_client))
12481 return false;
12482
12484 return false;
12485
12488
12489 if (value <= (min + 0.001))
12490 value = min;
12491
12492 if (value == min)
12493 {
12494 if (destroy_config)
12495 {
12496 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12497 if (dstr)
12498 {
12500 this.Delete();
12501 return true;
12502 }
12503 }
12504 else if (destroy_forced)
12505 {
12507 this.Delete();
12508 return true;
12509 }
12510
12512 }
12513
12516
12518 {
12519 EntityAI parent = GetHierarchyRoot();
12520 InventoryLocation iLoc = new InventoryLocation();
12521 GetInventory().GetCurrentInventoryLocation(iLoc);
12523 {
12524 int iLocSlot = iLoc.
GetSlot();
12526 {
12528 }
12530 {
12532 }
12533 }
12534 }
12535
12537 {
12539
12540 if (delta)
12542 }
12543
12545
12546 return false;
12547 }
12548
12549
12551 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12552 {
12554 }
12555
12557 {
12560 }
12561
12563 {
12566 }
12567
12569 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12570 {
12571 float value_clamped = Math.Clamp(value, 0, 1);
12573 SetQuantity(result, destroy_config, destroy_forced);
12574 }
12575
12576
12579 {
12581 }
12582
12584 {
12586 }
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12598 {
12599 int slot = -1;
12600 GameInventory inventory = GetInventory();
12601 if (inventory)
12602 {
12603 InventoryLocation il = new InventoryLocation;
12606 }
12607
12609 }
12610
12612 {
12613 float quantity_max = 0;
12614
12616 {
12617 if (attSlotID != -1)
12618 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12619
12620 if (quantity_max <= 0)
12622 }
12623
12624 if (quantity_max <= 0)
12626
12627 return quantity_max;
12628 }
12629
12631 {
12633 }
12634
12636 {
12638 }
12639
12640
12642 {
12644 }
12645
12647 {
12649 }
12650
12652 {
12654 }
12655
12656
12658 {
12659
12660 float weightEx = GetWeightEx();
12661 float special = GetInventoryAndCargoWeight();
12662 return weightEx - special;
12663 }
12664
12665
12667 {
12669 }
12670
12672 {
12674 {
12675 #ifdef DEVELOPER
12676 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12677 {
12678 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12680 }
12681 #endif
12682
12683 return GetQuantity() * GetConfigWeightModified();
12684 }
12685 else if (HasEnergyManager())
12686 {
12687 #ifdef DEVELOPER
12688 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12689 {
12690 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12691 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12692 }
12693 #endif
12694 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12695 }
12696 else
12697 {
12698 #ifdef DEVELOPER
12699 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12700 {
12701 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12702 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12703 }
12704 #endif
12705 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12706 }
12707 }
12708
12711 {
12712 int item_count = 0;
12714
12715 GameInventory inventory = GetInventory();
12716 CargoBase cargo = inventory.
GetCargo();
12717 if (cargo != NULL)
12718 {
12720 }
12721
12723 for (int i = 0; i < nAttachments; ++i)
12724 {
12726 if (item)
12727 item_count += item.GetNumberOfItems();
12728 }
12729 return item_count;
12730 }
12731
12734 {
12735 float weight = 0;
12736 float wetness = 1;
12737 if (include_wetness)
12740 {
12741 weight = wetness * m_ConfigWeight;
12742 }
12744 {
12745 weight = 1;
12746 }
12747 return weight;
12748 }
12749
12750
12751
12753 {
12754 GameInventory inventory = GetInventory();
12755 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12756 {
12757 array<EntityAI> items = new array<EntityAI>;
12759 for (int i = 0; i < items.Count(); ++i)
12760 {
12762 if (item)
12763 {
12764 g_Game.ObjectDelete(item);
12765 }
12766 }
12767 }
12768 }
12769
12770
12771
12772
12774 {
12775 float energy = 0;
12776 if (HasEnergyManager())
12777 {
12778 energy = GetCompEM().GetEnergy();
12779 }
12780 return energy;
12781 }
12782
12783
12785 {
12786 super.OnEnergyConsumed();
12787
12789 }
12790
12792 {
12793 super.OnEnergyAdded();
12794
12796 }
12797
12798
12800 {
12801 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12802 {
12804 {
12805 float energy_0to1 = GetCompEM().GetEnergy0To1();
12807 }
12808 }
12809 }
12810
12811
12813 {
12814 return ConfigGetFloat("heatIsolation");
12815 }
12816
12818 {
12820 }
12821
12823 {
12824 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12825 if (
g_Game.ConfigIsExisting(paramPath))
12826 return g_Game.ConfigGetFloat(paramPath);
12827
12828 return 0.0;
12829 }
12830
12832 {
12833 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12834 if (
g_Game.ConfigIsExisting(paramPath))
12835 return g_Game.ConfigGetFloat(paramPath);
12836
12837 return 0.0;
12838 }
12839
12840 override void SetWet(
float value,
bool allow_client =
false)
12841 {
12842 if (!IsServerCheck(allow_client))
12843 return;
12844
12847
12849
12850 m_VarWet = Math.Clamp(value, min, max);
12851
12853 {
12856 }
12857 }
12858
12859 override void AddWet(
float value)
12860 {
12862 }
12863
12865 {
12867 }
12868
12870 {
12872 }
12873
12875 {
12877 }
12878
12880 {
12882 }
12883
12885 {
12887 }
12888
12889 override void OnWetChanged(
float newVal,
float oldVal)
12890 {
12893 if (newLevel != oldLevel)
12894 {
12896 }
12897 }
12898
12900 {
12901 SetWeightDirty();
12902 }
12903
12905 {
12906 return GetWetLevelInternal(
m_VarWet);
12907 }
12908
12909
12910
12912 {
12914 }
12915
12917 {
12919 }
12920
12922 {
12924 }
12925
12927 {
12929 }
12930
12931
12932
12934 {
12935 if (ConfigIsExisting("itemModelLength"))
12936 {
12937 return ConfigGetFloat("itemModelLength");
12938 }
12939 return 0;
12940 }
12941
12943 {
12944 if (ConfigIsExisting("itemAttachOffset"))
12945 {
12946 return ConfigGetFloat("itemAttachOffset");
12947 }
12948 return 0;
12949 }
12950
12951 override void SetCleanness(
int value,
bool allow_client =
false)
12952 {
12953 if (!IsServerCheck(allow_client))
12954 return;
12955
12957
12959
12962 }
12963
12965 {
12967 }
12968
12970 {
12971 return true;
12972 }
12973
12974
12975
12976
12978 {
12980 }
12981
12983 {
12985 }
12986
12987
12988
12989
12990 override void SetColor(
int r,
int g,
int b,
int a)
12991 {
12997 }
12999 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13000 {
13005 }
13006
13008 {
13010 }
13011
13014 {
13015 int r,g,b,a;
13017 r = r/255;
13018 g = g/255;
13019 b = b/255;
13020 a = a/255;
13021 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13022 }
13023
13024
13025
13026 override void SetLiquidType(
int value,
bool allow_client =
false)
13027 {
13028 if (!IsServerCheck(allow_client))
13029 return;
13030
13035 }
13036
13038 {
13039 return ConfigGetInt("varLiquidTypeInit");
13040 }
13041
13043 {
13045 }
13046
13048 {
13050 SetFrozen(false);
13051 }
13052
13055 {
13056 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13057 }
13058
13059
13062 {
13063 PlayerBase nplayer;
13064 if (PlayerBase.CastTo(nplayer, player))
13065 {
13067 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13068 }
13069 }
13070
13071
13074 {
13075 PlayerBase nplayer;
13076 if (PlayerBase.CastTo(nplayer,player))
13077 {
13078 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13079 }
13080
13081 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13082
13083 if (HasEnergyManager())
13084 {
13085 GetCompEM().UpdatePlugState();
13086 }
13087 }
13088
13089
13091 {
13092 super.OnPlacementStarted(player);
13093
13095 }
13096
13097 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13098 {
13100 {
13101 m_AdminLog.OnPlacementComplete(player,
this);
13102 }
13103
13104 super.OnPlacementComplete(player, position, orientation);
13105 }
13106
13107
13108
13109
13110
13112 {
13114 {
13115 return true;
13116 }
13117 else
13118 {
13119 return false;
13120 }
13121 }
13122
13123
13125 {
13127 {
13129 }
13130 }
13131
13132
13134 {
13136 }
13137
13139 {
13141 }
13142
13143 override void InsertAgent(
int agent,
float count = 1)
13144 {
13145 if (count < 1)
13146 return;
13147
13149 }
13150
13153 {
13155 }
13156
13157
13159 {
13161 }
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13205 {
13207 return false;
13208 return true;
13209 }
13210
13212 {
13213
13215 }
13216
13217
13220 {
13221 super.CheckForRoofLimited(timeTresholdMS);
13222
13223 float time =
g_Game.GetTime();
13224 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13225 {
13226 m_PreviousRoofTestTime = time;
13227 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13228 }
13229 }
13230
13231
13233 {
13235 {
13236 return 0;
13237 }
13238
13239 if (GetInventory().GetAttachmentSlotsCount() != 0)
13240 {
13241 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13242 if (filter)
13243 return filter.GetProtectionLevel(type, false, system);
13244 else
13245 return 0;
13246 }
13247
13248 string subclassPath, entryName;
13249
13250 switch (type)
13251 {
13253 entryName = "biological";
13254 break;
13256 entryName = "chemical";
13257 break;
13258 default:
13259 entryName = "biological";
13260 break;
13261 }
13262
13263 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13264
13265 return g_Game.ConfigGetFloat(subclassPath + entryName);
13266 }
13267
13268
13269
13272 {
13273 if (!IsMagazine())
13275
13277 }
13278
13279
13280
13281
13282
13287 {
13288 return true;
13289 }
13290
13292 {
13294 }
13295
13296
13297
13298
13299
13301 {
13302 if (parent)
13303 {
13304 if (parent.IsInherited(DayZInfected))
13305 return true;
13306
13307 if (!parent.IsRuined())
13308 return true;
13309 }
13310
13311 return true;
13312 }
13313
13315 {
13316 if (!super.CanPutAsAttachment(parent))
13317 {
13318 return false;
13319 }
13320
13321 if (!IsRuined() && !parent.IsRuined())
13322 {
13323 return true;
13324 }
13325
13326 return false;
13327 }
13328
13330 {
13331
13332
13333
13334
13335 return super.CanReceiveItemIntoCargo(item);
13336 }
13337
13339 {
13340
13341
13342
13343
13344 GameInventory attachmentInv = attachment.GetInventory();
13346 {
13347 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13348 return false;
13349 }
13350
13351 InventoryLocation loc = new InventoryLocation();
13352 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13353 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13354 return false;
13355
13356 return super.CanReceiveAttachment(attachment, slotId);
13357 }
13358
13360 {
13361 if (!super.CanReleaseAttachment(attachment))
13362 return false;
13363
13364 return GetInventory().AreChildrenAccessible();
13365 }
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13388 {
13389 int id = muzzle_owner.GetMuzzleID();
13390 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13391
13392 if (WPOF_array)
13393 {
13394 for (int i = 0; i < WPOF_array.Count(); i++)
13395 {
13396 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13397
13398 if (WPOF)
13399 {
13400 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13401 }
13402 }
13403 }
13404 }
13405
13406
13408 {
13409 int id = muzzle_owner.GetMuzzleID();
13411
13412 if (WPOBE_array)
13413 {
13414 for (int i = 0; i < WPOBE_array.Count(); i++)
13415 {
13416 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13417
13418 if (WPOBE)
13419 {
13420 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13421 }
13422 }
13423 }
13424 }
13425
13426
13428 {
13429 int id = muzzle_owner.GetMuzzleID();
13430 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13431
13432 if (WPOOH_array)
13433 {
13434 for (int i = 0; i < WPOOH_array.Count(); i++)
13435 {
13436 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13437
13438 if (WPOOH)
13439 {
13440 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13441 }
13442 }
13443 }
13444 }
13445
13446
13448 {
13449 int id = muzzle_owner.GetMuzzleID();
13450 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13451
13452 if (WPOOH_array)
13453 {
13454 for (int i = 0; i < WPOOH_array.Count(); i++)
13455 {
13456 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13457
13458 if (WPOOH)
13459 {
13460 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13461 }
13462 }
13463 }
13464 }
13465
13466
13468 {
13469 int id = muzzle_owner.GetMuzzleID();
13470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13471
13472 if (WPOOH_array)
13473 {
13474 for (int i = 0; i < WPOOH_array.Count(); i++)
13475 {
13476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13477
13478 if (WPOOH)
13479 {
13480 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13481 }
13482 }
13483 }
13484 }
13485
13486
13487
13489 {
13491 {
13492 return true;
13493 }
13494
13495 return false;
13496 }
13497
13499 {
13501 {
13502 return true;
13503 }
13504
13505 return false;
13506 }
13507
13509 {
13511 {
13512 return true;
13513 }
13514
13515 return false;
13516 }
13517
13519 {
13520 return false;
13521 }
13522
13525 {
13526 return UATimeSpent.DEFAULT_DEPLOY;
13527 }
13528
13529
13530
13531
13533 {
13535 SetSynchDirty();
13536 }
13537
13539 {
13541 }
13542
13543
13545 {
13546 return false;
13547 }
13548
13551 {
13552 string att_type = "None";
13553
13554 if (ConfigIsExisting("soundAttType"))
13555 {
13556 att_type = ConfigGetString("soundAttType");
13557 }
13558
13560 }
13561
13563 {
13565 }
13566
13567
13568
13569
13570
13576
13578 {
13581
13583 }
13584
13585
13587 {
13589 return;
13590
13592
13595
13598
13599 SoundParameters params = new SoundParameters();
13603 }
13604
13605
13607 {
13609 {
13612
13613 SetSynchDirty();
13614
13617 }
13618 }
13619
13621 {
13623 }
13624
13625
13627 {
13629 return;
13630
13632 SetSynchDirty();
13633
13636 }
13637
13639 {
13642 }
13643
13645 {
13647 }
13648
13649 void OnApply(PlayerBase player);
13650
13652 {
13653 return 1.0;
13654 };
13655
13657 {
13659 }
13660
13662 {
13664 }
13665
13667
13669 {
13670 SetDynamicPhysicsLifeTime(0.01);
13672 }
13673
13675 {
13676 array<string> zone_names = new array<string>;
13677 GetDamageZones(zone_names);
13678 for (int i = 0; i < zone_names.Count(); i++)
13679 {
13680 SetHealthMax(zone_names.Get(i),"Health");
13681 }
13682 SetHealthMax("","Health");
13683 }
13684
13687 {
13688 float global_health = GetHealth01("","Health");
13689 array<string> zones = new array<string>;
13690 GetDamageZones(zones);
13691
13692 for (int i = 0; i < zones.Count(); i++)
13693 {
13694 SetHealth01(zones.Get(i),"Health",global_health);
13695 }
13696 }
13697
13700 {
13701 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13702 }
13703
13705 {
13706 if (!hasRootAsPlayer)
13707 {
13708 if (refParentIB)
13709 {
13710
13711 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13712 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13713
13714 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13715 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13716
13719 }
13720 else
13721 {
13722
13725 }
13726 }
13727 }
13728
13730 {
13732 {
13733 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13734 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13735 {
13736 float heatPermCoef = 1.0;
13738 while (ent)
13739 {
13740 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13741 ent = ent.GetHierarchyParent();
13742 }
13743
13744 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13745 }
13746 }
13747 }
13748
13750 {
13751
13752 EntityAI parent = GetHierarchyParent();
13753 if (!parent)
13754 {
13755 hasParent = false;
13756 hasRootAsPlayer = false;
13757 }
13758 else
13759 {
13760 hasParent = true;
13761 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13762 refParentIB =
ItemBase.Cast(parent);
13763 }
13764 }
13765
13766 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13767 {
13768
13769 }
13770
13772 {
13773
13774 return false;
13775 }
13776
13778 {
13779
13780
13781 return false;
13782 }
13783
13785 {
13786
13787 return false;
13788 }
13789
13792 {
13793 return !GetIsFrozen() &&
IsOpen();
13794 }
13795
13797 {
13798 bool hasParent = false, hasRootAsPlayer = false;
13800
13801 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13802 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13803
13804 if (wwtu || foodDecay)
13805 {
13809
13810 if (processWetness || processTemperature || processDecay)
13811 {
13813
13814 if (processWetness)
13815 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13816
13817 if (processTemperature)
13819
13820 if (processDecay)
13821 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13822 }
13823 }
13824 }
13825
13828 {
13830 }
13831
13833 {
13836
13837 return super.GetTemperatureFreezeThreshold();
13838 }
13839
13841 {
13844
13845 return super.GetTemperatureThawThreshold();
13846 }
13847
13849 {
13852
13853 return super.GetItemOverheatThreshold();
13854 }
13855
13857 {
13859 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13860
13861 return super.GetTemperatureFreezeTime();
13862 }
13863
13865 {
13867 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13868
13869 return super.GetTemperatureThawTime();
13870 }
13871
13876
13878 {
13879 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13880 }
13881
13883 {
13884 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13885 }
13886
13889 {
13891 }
13892
13894 {
13896 }
13897
13899 {
13901 }
13902
13905 {
13906 return null;
13907 }
13908
13911 {
13912 return false;
13913 }
13914
13916 {
13918 {
13921 if (!trg)
13922 {
13924 explosive = this;
13925 }
13926
13927 explosive.PairRemote(trg);
13929
13930 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13931 trg.SetPersistentPairID(persistentID);
13932 explosive.SetPersistentPairID(persistentID);
13933
13934 return true;
13935 }
13936 return false;
13937 }
13938
13941 {
13942 float ret = 1.0;
13945 ret *= GetHealth01();
13946
13947 return ret;
13948 }
13949
13950 #ifdef DEVELOPER
13951 override void SetDebugItem()
13952 {
13953 super.SetDebugItem();
13954 _itemBase = this;
13955 }
13956
13958 {
13959 string text = super.GetDebugText();
13960
13962 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13963
13964 return text;
13965 }
13966 #endif
13967
13969 {
13970 return true;
13971 }
13972
13974
13976
13978 {
13981 }
13982
13983
13991
14007
14008 [
Obsolete(
"Use ItemSoundHandler instead")]
14011 {
14012 if (!
g_Game.IsDedicatedServer())
14013 {
14014 if (ConfigIsExisting("attachSoundSet"))
14015 {
14016 string cfg_path = "";
14017 string soundset = "";
14018 string type_name =
GetType();
14019
14022 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14023 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14024
14025 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14026 {
14027 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14028 {
14029 if (cfg_slot_array[i] == slot_type)
14030 {
14031 soundset = cfg_soundset_array[i];
14032 break;
14033 }
14034 }
14035 }
14036
14037 if (soundset != "")
14038 {
14039 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14041 }
14042 }
14043 }
14044 }
14045
14047}
14048
14050{
14052 if (entity)
14053 {
14054 bool is_item = entity.IsInherited(
ItemBase);
14055 if (is_item && full_quantity)
14056 {
14059 }
14060 }
14061 else
14062 {
14064 return NULL;
14065 }
14066 return entity;
14067}
14068
14070{
14071 if (item)
14072 {
14073 if (health > 0)
14074 item.SetHealth("", "", health);
14075
14076 if (item.CanHaveTemperature())
14077 {
14079 if (item.CanFreeze())
14080 item.SetFrozen(false);
14081 }
14082
14083 if (item.HasEnergyManager())
14084 {
14085 if (quantity >= 0)
14086 {
14087 item.GetCompEM().SetEnergy0To1(quantity);
14088 }
14089 else
14090 {
14092 }
14093 }
14094 else if (item.IsMagazine())
14095 {
14096 Magazine mag = Magazine.Cast(item);
14097 if (quantity >= 0)
14098 {
14099 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14100 }
14101 else
14102 {
14104 }
14105
14106 }
14107 else
14108 {
14109 if (quantity >= 0)
14110 {
14111 item.SetQuantityNormalized(quantity, false);
14112 }
14113 else
14114 {
14116 }
14117
14118 }
14119 }
14120}
14121
14122#ifdef DEVELOPER
14124#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.