9164{
9166 {
9167 return true;
9168 }
9169};
9170
9172{
9173
9174};
9175
9176
9177
9179{
9183
9185
9188
9189
9190
9191
9192
9201
9207
9212
9217
9238 protected bool m_IsResultOfSplit
9239
9241
9246
9247
9248
9250
9254
9255
9256
9258
9261
9262
9263
9269
9270
9278
9281
9282
9284
9285
9287
9288
9293
9294
9299
9301
9302
9304
9305
9307 {
9312
9313 if (!
g_Game.IsDedicatedServer())
9314 {
9316 {
9318
9320 {
9322 }
9323 }
9324
9327 }
9328
9329 m_OldLocation = null;
9330
9332 {
9334 }
9335
9336 if (ConfigIsExisting("headSelectionsToHide"))
9337 {
9340 }
9341
9343 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9344 {
9346 }
9347
9349
9350 m_IsResultOfSplit = false;
9351
9353 }
9354
9356 {
9357 super.InitItemVariables();
9358
9364 m_Count = ConfigGetInt(
"count");
9365
9368
9373
9376
9381
9393
9397
9398
9401 if (ConfigIsExisting("canBeSplit"))
9402 {
9405 }
9406
9408 if (ConfigIsExisting("itemBehaviour"))
9410
9411
9414 RegisterNetSyncVariableInt("m_VarLiquidType");
9415 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9416
9417 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9418 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9419 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9420
9421 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9422 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9423 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9424 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9425
9426 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9427 RegisterNetSyncVariableBool("m_IsTakeable");
9428 RegisterNetSyncVariableBool("m_IsHologram");
9429
9432 {
9435 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9436 }
9437
9439
9441 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9443
9445 }
9446
9448 {
9450 }
9451
9453 {
9456 {
9461 }
9462 }
9463
9464 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9465 {
9467 {
9470 }
9471
9473 }
9474
9476 {
9482 }
9483
9485
9487 {
9489
9490 if (!action)
9491 {
9492 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9493 return;
9494 }
9495
9497 if (!ai)
9498 {
9500 return;
9501 }
9502
9504 if (!action_array)
9505 {
9506 action_array = new array<ActionBase_Basic>;
9508 }
9509 if (LogManager.IsActionLogEnable())
9510 {
9511 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9512 }
9513
9514 if (action_array.Find(action) != -1)
9515 {
9516 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9517 }
9518 else
9519 {
9520 action_array.Insert(action);
9521 }
9522 }
9523
9525 {
9526 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9527 ActionBase action = player.GetActionManager().GetAction(actionName);
9530
9531 if (action_array)
9532 {
9533 action_array.RemoveItem(action);
9534 }
9535 }
9536
9537
9538
9540 {
9541 ActionOverrideData overrideData = new ActionOverrideData();
9545
9547 if (!actionMap)
9548 {
9551 }
9552
9553 actionMap.Insert(this.
Type(), overrideData);
9554
9555 }
9556
9558
9560
9561
9563 {
9566
9569
9570 string config_to_search = "CfgVehicles";
9571 string muzzle_owner_config;
9572
9574 {
9575 if (IsInherited(Weapon))
9576 config_to_search = "CfgWeapons";
9577
9578 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9579
9580 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9581
9582 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9583
9584 if (config_OnFire_subclass_count > 0)
9585 {
9586 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9587
9588 for (int i = 0; i < config_OnFire_subclass_count; i++)
9589 {
9590 string particle_class = "";
9591 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9592 string config_OnFire_entry = config_OnFire_class + particle_class;
9593 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9594 WPOF_array.Insert(WPOF);
9595 }
9596
9597
9599 }
9600 }
9601
9603 {
9604 config_to_search = "CfgWeapons";
9605 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9606
9607 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9608
9609 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9610
9611 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9612 {
9613 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9614
9615 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9616 {
9617 string particle_class2 = "";
9618 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9619 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9620 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9621 WPOBE_array.Insert(WPOBE);
9622 }
9623
9624
9626 }
9627 }
9628 }
9629
9630
9632 {
9635
9637 {
9638 string config_to_search = "CfgVehicles";
9639
9640 if (IsInherited(Weapon))
9641 config_to_search = "CfgWeapons";
9642
9643 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9644 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9645
9646 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9647 {
9648
9650
9652 {
9654 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9656 return;
9657 }
9658
9661
9662
9663
9664 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9665 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9666
9667 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9668 {
9669 string particle_class = "";
9670 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9671 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9672 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9673
9674 if (entry_type == CT_CLASS)
9675 {
9676 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9677 WPOOH_array.Insert(WPOF);
9678 }
9679 }
9680
9681
9683 }
9684 }
9685 }
9686
9688 {
9690 }
9691
9693 {
9695 {
9697
9700
9703
9704 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9705 }
9706 }
9707
9709 {
9711 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9712
9714 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9715
9717 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9718
9720 {
9722 }
9723 }
9724
9726 {
9728 }
9729
9731 {
9734 else
9736
9738 {
9741 }
9742 else
9743 {
9746
9749 }
9750
9752 }
9753
9755 {
9757 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9758 }
9759
9761 {
9763 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9765 }
9766
9768 {
9770 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9771 }
9772
9774 {
9777
9778 OverheatingParticle OP = new OverheatingParticle();
9783
9785 }
9786
9788 {
9791
9792 return -1;
9793 }
9794
9796 {
9798 {
9801
9802 for (int i = count; i > 0; --i)
9803 {
9804 int id = i - 1;
9807
9810
9811 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9812 {
9813 if (p)
9814 {
9817 }
9818 }
9819 }
9820 }
9821 }
9822
9824 {
9826 {
9828 {
9829 int id = i - 1;
9831
9832 if (OP)
9833 {
9835
9836 if (p)
9837 {
9839 }
9840
9841 delete OP;
9842 }
9843 }
9844
9847 }
9848 }
9849
9852 {
9853 return 0.0;
9854 }
9855
9856
9858 {
9859 return 250;
9860 }
9861
9863 {
9864 return 0;
9865 }
9866
9869 {
9871 return true;
9872
9873 return false;
9874 }
9875
9878 {
9881
9883 {
9885 }
9886 else
9887 {
9888
9890 }
9891
9893 }
9894
9901 {
9902 return -1;
9903 }
9904
9905
9906
9907
9909 {
9911 {
9912 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9913 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9914
9915 if (r_index >= 0)
9916 {
9917 InventoryLocation r_il = new InventoryLocation;
9918 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9919
9920 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9923 {
9924 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9925 }
9927 {
9928 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9929 }
9930
9931 }
9932
9933 player.GetHumanInventory().ClearUserReservedLocation(this);
9934 }
9935
9938 }
9939
9940
9941
9942
9944 {
9945 return ItemBase.m_DebugActionsMask;
9946 }
9947
9949 {
9950 return ItemBase.m_DebugActionsMask & mask;
9951 }
9952
9954 {
9955 ItemBase.m_DebugActionsMask = mask;
9956 }
9957
9959 {
9960 ItemBase.m_DebugActionsMask |= mask;
9961 }
9962
9964 {
9965 ItemBase.m_DebugActionsMask &= ~mask;
9966 }
9967
9969 {
9971 {
9973 }
9974 else
9975 {
9977 }
9978 }
9979
9980
9982 {
9983 if (GetEconomyProfile())
9984 {
9985 float q_max = GetEconomyProfile().GetQuantityMax();
9986 if (q_max > 0)
9987 {
9988 float q_min = GetEconomyProfile().GetQuantityMin();
9989 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9990
9992 {
9993 ComponentEnergyManager comp = GetCompEM();
9995 {
9997 }
9998 }
10000 {
10002
10003 }
10004
10005 }
10006 }
10007 }
10008
10011 {
10012 EntityAI parent = GetHierarchyParent();
10013
10014 if (parent)
10015 {
10016 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10017 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10018 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10019 }
10020 }
10021
10024 {
10025 EntityAI parent = GetHierarchyParent();
10026
10027 if (parent)
10028 {
10029 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10030 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10031 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10032 }
10033 }
10034
10036 {
10037
10038
10039
10040
10042
10044 {
10045 if (ScriptInputUserData.CanStoreInputUserData())
10046 {
10047 ScriptInputUserData ctx = new ScriptInputUserData;
10053 ctx.
Write(use_stack_max);
10056
10058 {
10059 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10060 }
10061 }
10062 }
10063 else if (!
g_Game.IsMultiplayer())
10064 {
10066 }
10067 }
10068
10070 {
10072 }
10073
10075 {
10077 }
10078
10080 {
10082 }
10083
10085 {
10086
10087 return false;
10088 }
10089
10091 {
10092 return false;
10093 }
10094
10098 {
10099 return false;
10100 }
10101
10103 {
10104 return "";
10105 }
10106
10108
10110 {
10111 return false;
10112 }
10113
10115 {
10116 return true;
10117 }
10118
10119
10120
10122 {
10123 return true;
10124 }
10125
10127 {
10128 return true;
10129 }
10130
10132 {
10133 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10135 }
10136
10138 {
10140 }
10141
10143 {
10145 if (!is_being_placed)
10147 SetSynchDirty();
10148 }
10149
10150
10152
10154 {
10156 }
10157
10159 {
10161 }
10162
10164 {
10165 return 1;
10166 }
10167
10169 {
10170 return false;
10171 }
10172
10174 {
10176 SetSynchDirty();
10177 }
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10214 {
10215 super.OnMovedInsideCargo(container);
10216
10217 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10218 }
10219
10220 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10221 {
10222 super.EEItemLocationChanged(oldLoc, newLoc);
10223
10224 PlayerBase newPlayer = null;
10225 PlayerBase oldPlayer = null;
10226
10227 if (newLoc.GetParent())
10228 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10229
10230 if (oldLoc.GetParent())
10231 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10232
10234 {
10235 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10236
10237 if (rIndex >= 0)
10238 {
10239 InventoryLocation rIl = new InventoryLocation;
10240 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10241
10242 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10245 {
10246 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10247 }
10249 {
10251 }
10252
10253 }
10254 }
10255
10257 {
10258 if (newPlayer)
10259 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10260
10261 if (newPlayer == oldPlayer)
10262 {
10263 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10264 {
10266 {
10267 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10268 {
10269 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10270 }
10271 }
10272 else
10273 {
10274 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10275 }
10276 }
10277
10278 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10279 {
10280 int type = oldLoc.GetType();
10282 {
10283 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10284 }
10286 {
10287 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10288 }
10289 }
10290 if (!m_OldLocation)
10291 {
10292 m_OldLocation = new InventoryLocation;
10293 }
10294 m_OldLocation.Copy(oldLoc);
10295 }
10296 else
10297 {
10298 if (m_OldLocation)
10299 {
10300 m_OldLocation.Reset();
10301 }
10302 }
10303
10304 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10305 }
10306 else
10307 {
10308 if (newPlayer)
10309 {
10310 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10311 if (resIndex >= 0)
10312 {
10313 InventoryLocation il = new InventoryLocation;
10314 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10316 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10319 {
10320 il.
GetParent().GetOnReleaseLock().Invoke(it);
10321 }
10323 {
10325 }
10326
10327 }
10328 }
10330 {
10331
10333 }
10334
10335 if (m_OldLocation)
10336 {
10337 m_OldLocation.Reset();
10338 }
10339 }
10340
10342 {
10343 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10344 }
10345
10347 {
10348 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10349 }
10350 }
10351
10352 override void EOnContact(IEntity other, Contact extra)
10353 {
10355 {
10356 int liquidType = -1;
10358 if (impactSpeed > 0.0)
10359 {
10361 #ifndef SERVER
10363 #else
10365 SetSynchDirty();
10366 #endif
10368 }
10369 }
10370
10371 #ifdef SERVER
10372 if (GetCompEM() && GetCompEM().IsPlugged())
10373 {
10374 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10375 GetCompEM().UnplugThis();
10376 }
10377 #endif
10378 }
10379
10381
10383 {
10385 }
10386
10388 {
10389
10390 }
10391
10393 {
10394 super.OnItemLocationChanged(old_owner, new_owner);
10395
10396 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10397 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10398
10399 if (!relatedPlayer && playerNew)
10400 relatedPlayer = playerNew;
10401
10402 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10403 {
10405 if (actionMgr)
10406 {
10407 ActionBase currentAction = actionMgr.GetRunningAction();
10408 if (currentAction)
10410 }
10411 }
10412
10413 Man ownerPlayerOld = null;
10414 Man ownerPlayerNew = null;
10415
10416 if (old_owner)
10417 {
10418 if (old_owner.
IsMan())
10419 {
10420 ownerPlayerOld = Man.Cast(old_owner);
10421 }
10422 else
10423 {
10424 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10425 }
10426 }
10427 else
10428 {
10430 {
10432
10433 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10434 {
10435 GetCompEM().UnplugThis();
10436 }
10437 }
10438 }
10439
10440 if (new_owner)
10441 {
10442 if (new_owner.
IsMan())
10443 {
10444 ownerPlayerNew = Man.Cast(new_owner);
10445 }
10446 else
10447 {
10448 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10449 }
10450 }
10451
10452 if (ownerPlayerOld != ownerPlayerNew)
10453 {
10454 if (ownerPlayerOld)
10455 {
10456 array<EntityAI> subItemsExit = new array<EntityAI>;
10458 for (int i = 0; i < subItemsExit.Count(); i++)
10459 {
10462 }
10463 }
10464
10465 if (ownerPlayerNew)
10466 {
10467 array<EntityAI> subItemsEnter = new array<EntityAI>;
10469 for (int j = 0; j < subItemsEnter.Count(); j++)
10470 {
10473 }
10474 }
10475 }
10476 else if (ownerPlayerNew != null)
10477 {
10478 PlayerBase nplayer;
10479 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10480 {
10481 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10483 for (int k = 0; k < subItemsUpdate.Count(); k++)
10484 {
10486 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10487 }
10488 }
10489 }
10490
10491 if (old_owner)
10492 old_owner.OnChildItemRemoved(this);
10493 if (new_owner)
10494 new_owner.OnChildItemReceived(this);
10495 }
10496
10497
10499 {
10500 super.EEDelete(parent);
10501 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10502 if (player)
10503 {
10505
10506 if (player.IsAlive())
10507 {
10508 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10509 if (r_index >= 0)
10510 {
10511 InventoryLocation r_il = new InventoryLocation;
10512 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10513
10514 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10517 {
10518 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10519 }
10521 {
10522 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10523 }
10524
10525 }
10526
10527 player.RemoveQuickBarEntityShortcut(this);
10528 }
10529 }
10530 }
10531
10533 {
10534 super.EEKilled(killer);
10535
10538 {
10539 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10540 {
10541 if (IsMagazine())
10542 {
10543 if (Magazine.Cast(this).GetAmmoCount() > 0)
10544 {
10546 }
10547 }
10548 else
10549 {
10551 }
10552 }
10553 }
10554 }
10555
10557 {
10558 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10559
10560 super.OnWasAttached(parent, slot_id);
10561
10564
10567 }
10568
10570 {
10571 super.OnWasDetached(parent, slot_id);
10572
10575
10578 }
10579
10581 {
10582 int idx;
10585
10586 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10587 if (inventory_slots.Count() < 1)
10588 {
10589 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10590 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10591 }
10592 else
10593 {
10594 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10595 }
10596
10597 idx = inventory_slots.Find(slot);
10598 if (idx < 0)
10599 return "";
10600
10601 return attach_types.Get(idx);
10602 }
10603
10605 {
10606 int idx = -1;
10607 string slot;
10608
10611
10612 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10613 if (inventory_slots.Count() < 1)
10614 {
10615 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10616 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10617 }
10618 else
10619 {
10620 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10621 if (detach_types.Count() < 1)
10622 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10623 }
10624
10625 for (int i = 0; i < inventory_slots.Count(); i++)
10626 {
10627 slot = inventory_slots.Get(i);
10628 }
10629
10630 if (slot != "")
10631 {
10632 if (detach_types.Count() == 1)
10633 idx = 0;
10634 else
10635 idx = inventory_slots.Find(slot);
10636 }
10637 if (idx < 0)
10638 return "";
10639
10640 return detach_types.Get(idx);
10641 }
10642
10644 {
10645
10647
10648
10649 float min_time = 1;
10650 float max_time = 3;
10651 float delay = Math.RandomFloat(min_time, max_time);
10652
10653 explode_timer.Run(delay, this, "DoAmmoExplosion");
10654 }
10655
10657 {
10658 Magazine magazine = Magazine.Cast(this);
10659 int pop_sounds_count = 6;
10660 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10661
10662
10663 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10664 string sound_name = pop_sounds[ sound_idx ];
10665 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10666
10667
10668 magazine.ServerAddAmmoCount(-1);
10669
10670
10671 float min_temp_to_explode = 100;
10672
10673 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10674 {
10676 }
10677 }
10678
10679
10680 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10681 {
10682 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10683
10684 const int CHANCE_DAMAGE_CARGO = 4;
10685 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10686 const int CHANCE_DAMAGE_NOTHING = 2;
10687
10689 {
10690 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10691 int chances;
10692 int rnd;
10693
10694 if (GetInventory().GetCargo())
10695 {
10696 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10697 rnd = Math.RandomInt(0,chances);
10698
10699 if (rnd < CHANCE_DAMAGE_CARGO)
10700 {
10702 }
10703 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10704 {
10706 }
10707 }
10708 else
10709 {
10710 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10711 rnd = Math.RandomInt(0,chances);
10712
10713 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10714 {
10716 }
10717 }
10718 }
10719 }
10720
10722 {
10723 CargoBase cargo = GetInventory().GetCargo();
10724 if (cargo)
10725 {
10727 if (item_count > 0)
10728 {
10729 int random_pick = Math.RandomInt(0, item_count);
10731 if (!item.IsExplosive())
10732 {
10733 item.AddHealth("","",damage);
10734 return true;
10735 }
10736 }
10737 }
10738 return false;
10739 }
10740
10742 {
10743 GameInventory inventory = GetInventory();
10745 if (attachment_count > 0)
10746 {
10747 int random_pick = Math.RandomInt(0, attachment_count);
10749 if (!attachment.IsExplosive())
10750 {
10751 attachment.AddHealth("","",damage);
10752 return true;
10753 }
10754 }
10755 return false;
10756 }
10757
10759 {
10761 }
10762
10764 {
10766 return GetInventory().CanRemoveEntity();
10767
10768 return false;
10769 }
10770
10772 {
10773
10775 return false;
10776
10777
10779 return false;
10780
10781
10782
10784 if (delta == 0)
10785 return false;
10786
10787
10788 return true;
10789 }
10790
10792 {
10794 {
10795 if (ScriptInputUserData.CanStoreInputUserData())
10796 {
10797 ScriptInputUserData ctx = new ScriptInputUserData;
10802 ctx.
Write(destination_entity);
10804 ctx.
Write(slot_id);
10806 }
10807 }
10808 else if (!
g_Game.IsMultiplayer())
10809 {
10811 }
10812 }
10813
10815 {
10816 float split_quantity_new;
10820 InventoryLocation loc = new InventoryLocation;
10821
10822 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10823 {
10825 split_quantity_new = stack_max;
10826 else
10828
10830 {
10831 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10832 if (new_item)
10833 {
10834 new_item.SetResultOfSplit(true);
10835 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10837 new_item.
SetQuantity(split_quantity_new,
false,
true);
10838 }
10839 }
10840 }
10841 else if (destination_entity && slot_id == -1)
10842 {
10843 if (quantity > stack_max)
10844 split_quantity_new = stack_max;
10845 else
10846 split_quantity_new = quantity;
10847
10849 {
10850 GameInventory destinationInventory = destination_entity.GetInventory();
10852 {
10855 }
10856
10857 if (new_item)
10858 {
10859 new_item.SetResultOfSplit(true);
10860 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10862 new_item.
SetQuantity(split_quantity_new,
false,
true);
10863 }
10864 }
10865 }
10866 else
10867 {
10868 if (stack_max != 0)
10869 {
10871 {
10873 }
10874
10875 if (split_quantity_new == 0)
10876 {
10877 if (!
g_Game.IsMultiplayer())
10878 player.PhysicalPredictiveDropItem(this);
10879 else
10880 player.ServerDropEntity(this);
10881 return;
10882 }
10883
10885 {
10887
10888 if (new_item)
10889 {
10890 new_item.SetResultOfSplit(true);
10891 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10894 new_item.PlaceOnSurface();
10895 }
10896 }
10897 }
10898 }
10899 }
10900
10902 {
10903 float split_quantity_new;
10907 InventoryLocation loc = new InventoryLocation;
10908
10909 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10910 {
10912 split_quantity_new = stack_max;
10913 else
10915
10917 {
10918 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10919 if (new_item)
10920 {
10921 new_item.SetResultOfSplit(true);
10922 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10924 new_item.
SetQuantity(split_quantity_new,
false,
true);
10925 }
10926 }
10927 }
10928 else if (destination_entity && slot_id == -1)
10929 {
10930 if (quantity > stack_max)
10931 split_quantity_new = stack_max;
10932 else
10933 split_quantity_new = quantity;
10934
10936 {
10937 GameInventory destinationInventory = destination_entity.GetInventory();
10939 {
10942 }
10943
10944 if (new_item)
10945 {
10946 new_item.SetResultOfSplit(true);
10947 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10949 new_item.
SetQuantity(split_quantity_new,
false,
true);
10950 }
10951 }
10952 }
10953 else
10954 {
10955 if (stack_max != 0)
10956 {
10958 {
10960 }
10961
10963 {
10965
10966 if (new_item)
10967 {
10968 new_item.SetResultOfSplit(true);
10969 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10972 new_item.PlaceOnSurface();
10973 }
10974 }
10975 }
10976 }
10977 }
10978
10980 {
10982 {
10983 if (ScriptInputUserData.CanStoreInputUserData())
10984 {
10985 ScriptInputUserData ctx = new ScriptInputUserData;
10990 dst.WriteToContext(ctx);
10992 }
10993 }
10994 else if (!
g_Game.IsMultiplayer())
10995 {
10997 }
10998 }
10999
11001 {
11003 {
11004 if (ScriptInputUserData.CanStoreInputUserData())
11005 {
11006 ScriptInputUserData ctx = new ScriptInputUserData;
11011 ctx.
Write(destination_entity);
11017 }
11018 }
11019 else if (!
g_Game.IsMultiplayer())
11020 {
11022 }
11023 }
11024
11026 {
11028 }
11029
11031 {
11033 float split_quantity_new;
11035 if (dst.IsValid())
11036 {
11037 int slot_id = dst.GetSlot();
11039
11040 if (quantity > stack_max)
11041 split_quantity_new = stack_max;
11042 else
11043 split_quantity_new = quantity;
11044
11046 {
11048
11049 if (new_item)
11050 {
11051 new_item.SetResultOfSplit(true);
11052 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11054 new_item.
SetQuantity(split_quantity_new,
false,
true);
11055 }
11056
11057 return new_item;
11058 }
11059 }
11060
11061 return null;
11062 }
11063
11065 {
11067 float split_quantity_new;
11069 if (destination_entity)
11070 {
11072 if (quantity > stackable)
11073 split_quantity_new = stackable;
11074 else
11075 split_quantity_new = quantity;
11076
11078 {
11079 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11080 if (new_item)
11081 {
11082 new_item.SetResultOfSplit(true);
11083 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11085 new_item.
SetQuantity(split_quantity_new,
false,
true);
11086 }
11087 }
11088 }
11089 }
11090
11092 {
11094 {
11095 if (ScriptInputUserData.CanStoreInputUserData())
11096 {
11097 ScriptInputUserData ctx = new ScriptInputUserData;
11102 ItemBase destination_entity =
this;
11103 ctx.
Write(destination_entity);
11107 }
11108 }
11109 else if (!
g_Game.IsMultiplayer())
11110 {
11112 }
11113 }
11114
11116 {
11118 float split_quantity_new;
11120 if (player)
11121 {
11123 if (quantity > stackable)
11124 split_quantity_new = stackable;
11125 else
11126 split_quantity_new = quantity;
11127
11129 {
11130 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11131 new_item =
ItemBase.Cast(in_hands);
11132 if (new_item)
11133 {
11134 new_item.SetResultOfSplit(true);
11135 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11137 new_item.SetQuantity(split_quantity_new, false, true);
11138 }
11139 }
11140 }
11141 }
11142
11144 {
11146 float split_quantity_new = Math.Floor(quantity * 0.5);
11147
11149 return;
11150
11152
11153 if (new_item)
11154 {
11155 if (new_item.GetQuantityMax() < split_quantity_new)
11156 {
11157 split_quantity_new = new_item.GetQuantityMax();
11158 }
11159
11160 new_item.SetResultOfSplit(true);
11161 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11162
11164 {
11167 }
11168 else
11169 {
11171 new_item.
SetQuantity(split_quantity_new,
false,
true);
11172 }
11173 }
11174 }
11175
11177 {
11179 float split_quantity_new = Math.Floor(quantity / 2);
11180
11182 return;
11183
11184 InventoryLocation invloc = new InventoryLocation;
11186
11188 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11189
11190 if (new_item)
11191 {
11192 if (new_item.GetQuantityMax() < split_quantity_new)
11193 {
11194 split_quantity_new = new_item.GetQuantityMax();
11195 }
11197 {
11200 }
11201 else if (split_quantity_new > 1)
11202 {
11204 new_item.
SetQuantity(split_quantity_new,
false,
true);
11205 }
11206 }
11207 }
11208
11211 {
11212 SetWeightDirty();
11214
11215 if (parent)
11216 parent.OnAttachmentQuantityChangedEx(this, delta);
11217
11219 {
11221 {
11223 }
11225 {
11226 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11228 }
11229 }
11230 }
11231
11234 {
11235
11236 }
11237
11240 {
11242 }
11243
11245 {
11246 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11247
11249 {
11250 if (newLevel == GameConstants.STATE_RUINED)
11251 {
11253 EntityAI parent = GetHierarchyParent();
11254 if (parent && parent.IsFireplace())
11255 {
11256 CargoBase cargo = GetInventory().GetCargo();
11257 if (cargo)
11258 {
11260 {
11262 }
11263 }
11264 }
11265 }
11266
11268 {
11269
11271 return;
11272 }
11273
11274 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11275 {
11277 }
11278 }
11279 }
11280
11281
11283 {
11284 super.OnRightClick();
11285
11287 {
11289 {
11290 if (ScriptInputUserData.CanStoreInputUserData())
11291 {
11292 EntityAI root = GetHierarchyRoot();
11293 Man playerOwner = GetHierarchyRootPlayer();
11294 InventoryLocation dst = new InventoryLocation;
11295
11296
11297 if (!playerOwner && root && root == this)
11298 {
11300 }
11301 else
11302 {
11303
11304 GetInventory().GetCurrentInventoryLocation(dst);
11306 {
11307 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11309 {
11311 }
11312 else
11313 {
11315
11316
11317 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11318 {
11320 }
11321 else
11322 {
11323 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11324 }
11325 }
11326 }
11327 }
11328
11329 ScriptInputUserData ctx = new ScriptInputUserData;
11337 }
11338 }
11339 else if (!
g_Game.IsMultiplayer())
11340 {
11342 }
11343 }
11344 }
11345
11347 {
11348 if (root)
11349 {
11350 vector m4[4];
11351 root.GetTransform(m4);
11352 dst.SetGround(this, m4);
11353 }
11354 else
11355 {
11356 GetInventory().GetCurrentInventoryLocation(dst);
11357 }
11358 }
11359
11360 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11361 {
11362
11363 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11364 return false;
11365
11366 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11367 return false;
11368
11369
11371 return false;
11372
11373
11374 Magazine mag = Magazine.Cast(this);
11375 if (mag)
11376 {
11377 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11378 return false;
11379
11380 if (stack_max_limit)
11381 {
11382 Magazine other_mag = Magazine.Cast(other_item);
11383 if (other_item)
11384 {
11385 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11386 return false;
11387 }
11388
11389 }
11390 }
11391 else
11392 {
11393
11395 return false;
11396
11398 return false;
11399 }
11400
11401 PlayerBase player = null;
11402 if (CastTo(player, GetHierarchyRootPlayer()))
11403 {
11404 if (player.GetInventory().HasAttachment(this))
11405 return false;
11406
11407 if (player.IsItemsToDelete())
11408 return false;
11409 }
11410
11411 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11412 return false;
11413
11414 int slotID;
11416 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11417 return false;
11418
11419 return true;
11420 }
11421
11423 {
11425 }
11426
11428 {
11429 return m_IsResultOfSplit;
11430 }
11431
11433 {
11434 m_IsResultOfSplit = value;
11435 }
11436
11438 {
11440 }
11441
11443 {
11444 float other_item_quantity = other_item.GetQuantity();
11445 float this_free_space;
11446
11448
11450
11451 if (other_item_quantity > this_free_space)
11452 {
11453 return this_free_space;
11454 }
11455 else
11456 {
11457 return other_item_quantity;
11458 }
11459 }
11460
11462 {
11464 }
11465
11467 {
11469 return;
11470
11471 if (!IsMagazine() && other_item)
11472 {
11474 if (quantity_used != 0)
11475 {
11476 float hp1 = GetHealth01("","");
11477 float hp2 = other_item.GetHealth01("","");
11478 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11479 hpResult = hpResult / (
GetQuantity() + quantity_used);
11480
11481 hpResult *= GetMaxHealth();
11482 Math.Round(hpResult);
11483 SetHealth("", "Health", hpResult);
11484
11486 other_item.AddQuantity(-quantity_used);
11487 }
11488 }
11490 }
11491
11493 {
11494 #ifdef SERVER
11495 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11496 GetHierarchyParent().IncreaseLifetimeUp();
11497 #endif
11498 };
11499
11501 {
11502 PlayerBase p = PlayerBase.Cast(player);
11503
11504 array<int> recipesIds = p.m_Recipes;
11505 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11506 if (moduleRecipesManager)
11507 {
11508 EntityAI itemInHands = player.GetEntityInHands();
11509 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11510 }
11511
11512 for (int i = 0;i < recipesIds.Count(); i++)
11513 {
11514 int key = recipesIds.Get(i);
11515 string recipeName = moduleRecipesManager.GetRecipeName(key);
11517 }
11518 }
11519
11520
11521 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11522 {
11523 super.GetDebugActions(outputList);
11524
11525
11531
11532
11537
11542
11543
11547
11548
11550 {
11554 }
11555
11558
11559
11563
11565
11566 InventoryLocation loc = new InventoryLocation();
11567 GetInventory().GetCurrentInventoryLocation(loc);
11569 {
11570 if (Gizmo_IsSupported())
11573 }
11574
11576 }
11577
11578
11579
11580
11582 {
11583 super.OnAction(action_id, player, ctx);
11584
11586 {
11587 switch (action_id)
11588 {
11592 return true;
11596 return true;
11597 }
11598 }
11599
11601 {
11602 switch (action_id)
11603 {
11605 Delete();
11606 return true;
11607 }
11608 }
11609
11610 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11611 {
11612 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11613 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11614 PlayerBase p = PlayerBase.Cast(player);
11615 if (
EActions.RECIPES_RANGE_START < 1000)
11616 {
11617 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11618 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11619 }
11620 }
11621 #ifndef SERVER
11622 else if (action_id ==
EActions.WATCH_PLAYER)
11623 {
11624 PluginDeveloper.SetDeveloperItemClientEx(player);
11625 }
11626 #endif
11628 {
11629 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11630 {
11631 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11632 OnDebugButtonPressServer(id + 1);
11633 }
11634
11635 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11636 {
11637 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11639 }
11640
11641 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11642 {
11643 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11645 }
11646
11647 else if (action_id ==
EActions.ADD_QUANTITY)
11648 {
11649 if (IsMagazine())
11650 {
11651 Magazine mag = Magazine.Cast(this);
11652 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11653 }
11654 else
11655 {
11657 }
11658
11659 if (m_EM)
11660 {
11661 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11662 }
11663
11664 }
11665
11666 else if (action_id ==
EActions.REMOVE_QUANTITY)
11667 {
11668 if (IsMagazine())
11669 {
11670 Magazine mag2 = Magazine.Cast(this);
11671 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11672 }
11673 else
11674 {
11676 }
11677 if (m_EM)
11678 {
11679 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11680 }
11681
11682 }
11683
11684 else if (action_id ==
EActions.SET_QUANTITY_0)
11685 {
11687
11688 if (m_EM)
11689 {
11690 m_EM.SetEnergy(0);
11691 }
11692 }
11693
11694 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11695 {
11697
11698 if (m_EM)
11699 {
11700 m_EM.SetEnergy(m_EM.GetEnergyMax());
11701 }
11702 }
11703
11704 else if (action_id ==
EActions.ADD_HEALTH)
11705 {
11706 AddHealth("","",GetMaxHealth("","Health")/5);
11707 }
11708 else if (action_id ==
EActions.REMOVE_HEALTH)
11709 {
11710 AddHealth("","",-GetMaxHealth("","Health")/5);
11711 }
11712 else if (action_id ==
EActions.DESTROY_HEALTH)
11713 {
11714 SetHealth01("","",0);
11715 }
11716 else if (action_id ==
EActions.WATCH_ITEM)
11717 {
11719 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11720 #ifdef DEVELOPER
11721 SetDebugDeveloper_item(this);
11722 #endif
11723 }
11724
11725 else if (action_id ==
EActions.ADD_TEMPERATURE)
11726 {
11727 AddTemperature(20);
11728
11729 }
11730
11731 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11732 {
11733 AddTemperature(-20);
11734
11735 }
11736
11737 else if (action_id ==
EActions.FLIP_FROZEN)
11738 {
11739 SetFrozen(!GetIsFrozen());
11740
11741 }
11742
11743 else if (action_id ==
EActions.ADD_WETNESS)
11744 {
11746
11747 }
11748
11749 else if (action_id ==
EActions.REMOVE_WETNESS)
11750 {
11752
11753 }
11754
11755 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11756 {
11759
11760
11761 }
11762
11763 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11764 {
11767 }
11768
11769 else if (action_id ==
EActions.MAKE_SPECIAL)
11770 {
11771 auto debugParams = DebugSpawnParams.WithPlayer(player);
11772 OnDebugSpawnEx(debugParams);
11773 }
11774
11775 }
11776
11777
11778 return false;
11779 }
11780
11781
11782
11783
11787
11790
11791
11792
11794 {
11795 return false;
11796 }
11797
11798
11800 {
11801 return true;
11802 }
11803
11804
11806 {
11807 return true;
11808 }
11809
11810
11811
11813 {
11814 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11815 return g_Game.ConfigIsExisting(config_path);
11816 }
11817
11820 {
11821 return null;
11822 }
11823
11825 {
11826 return false;
11827 }
11828
11830 {
11831 return false;
11832 }
11833
11837
11838
11840 {
11841 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11842 return module_repairing.CanRepair(this, item_repair_kit);
11843 }
11844
11845
11846 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11847 {
11848 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11849 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11850 }
11851
11852
11854 {
11855
11856
11857
11858
11859
11860
11861
11862
11863 return 1;
11864 }
11865
11866
11867
11869 {
11871 }
11872
11873
11874
11876 {
11878 }
11879
11880
11889 {
11890 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11891
11892 if (player)
11893 {
11894 player.MessageStatus(text);
11895 }
11896 }
11897
11898
11907 {
11908 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11909
11910 if (player)
11911 {
11912 player.MessageAction(text);
11913 }
11914 }
11915
11916
11925 {
11926 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11927
11928 if (player)
11929 {
11930 player.MessageFriendly(text);
11931 }
11932 }
11933
11934
11943 {
11944 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11945
11946 if (player)
11947 {
11948 player.MessageImportant(text);
11949 }
11950 }
11951
11953 {
11954 return true;
11955 }
11956
11957
11958 override bool KindOf(
string tag)
11959 {
11960 bool found = false;
11961 string item_name = this.
GetType();
11963 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11964
11965 int array_size = item_tag_array.Count();
11966 for (int i = 0; i < array_size; i++)
11967 {
11968 if (item_tag_array.Get(i) == tag)
11969 {
11970 found = true;
11971 break;
11972 }
11973 }
11974 return found;
11975 }
11976
11977
11979 {
11980
11981 super.OnRPC(sender, rpc_type,ctx);
11982
11983
11984 switch (rpc_type)
11985 {
11986 #ifndef SERVER
11987 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11988 Param2<bool, string> p = new Param2<bool, string>(false, "");
11989
11991 return;
11992
11993 bool play = p.param1;
11994 string soundSet = p.param2;
11995
11996 if (play)
11997 {
11999 {
12001 {
12003 }
12004 }
12005 else
12006 {
12008 }
12009 }
12010 else
12011 {
12013 }
12014
12015 break;
12016 #endif
12017
12018 }
12019
12021 {
12023 }
12024 }
12025
12026
12027
12028
12030 {
12031 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12032 return plugin.GetID(
name);
12033 }
12034
12036 {
12037 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12038 return plugin.GetName(id);
12039 }
12040
12043 {
12044
12045
12046 int varFlags;
12047 if (!ctx.
Read(varFlags))
12048 return;
12049
12050 if (varFlags & ItemVariableFlags.FLOAT)
12051 {
12053 }
12054 }
12055
12057 {
12058
12059 super.SerializeNumericalVars(floats_out);
12060
12061
12062
12064 {
12066 }
12067
12069 {
12071 }
12072
12074 {
12076 }
12077
12079 {
12084 }
12085
12087 {
12089 }
12090 }
12091
12093 {
12094
12095 super.DeSerializeNumericalVars(floats);
12096
12097
12098 int index = 0;
12099 int mask = Math.Round(floats.Get(index));
12100
12101 index++;
12102
12104 {
12106 {
12108 }
12109 else
12110 {
12111 float quantity = floats.Get(index);
12112 SetQuantity(quantity,
true,
false,
false,
false);
12113 }
12114 index++;
12115 }
12116
12118 {
12119 float wet = floats.Get(index);
12121 index++;
12122 }
12123
12125 {
12126 int liquidtype = Math.Round(floats.Get(index));
12128 index++;
12129 }
12130
12132 {
12134 index++;
12136 index++;
12138 index++;
12140 index++;
12141 }
12142
12144 {
12145 int cleanness = Math.Round(floats.Get(index));
12147 index++;
12148 }
12149 }
12150
12152 {
12153 super.WriteVarsToCTX(ctx);
12154
12155
12157 {
12159 }
12160
12162 {
12164 }
12165
12167 {
12169 }
12170
12172 {
12173 int r,g,b,a;
12179 }
12180
12182 {
12184 }
12185 }
12186
12188 {
12189 if (!super.ReadVarsFromCTX(ctx,version))
12190 return false;
12191
12192 int intValue;
12193 float value;
12194
12195 if (version < 140)
12196 {
12197 if (!ctx.
Read(intValue))
12198 return false;
12199
12200 m_VariablesMask = intValue;
12201 }
12202
12204 {
12205 if (!ctx.
Read(value))
12206 return false;
12207
12209 {
12211 }
12212 else
12213 {
12215 }
12216 }
12217
12218 if (version < 140)
12219 {
12221 {
12222 if (!ctx.
Read(value))
12223 return false;
12224 SetTemperatureDirect(value);
12225 }
12226 }
12227
12229 {
12230 if (!ctx.
Read(value))
12231 return false;
12233 }
12234
12236 {
12237 if (!ctx.
Read(intValue))
12238 return false;
12240 }
12241
12243 {
12244 int r,g,b,a;
12246 return false;
12248 return false;
12250 return false;
12252 return false;
12253
12255 }
12256
12258 {
12259 if (!ctx.
Read(intValue))
12260 return false;
12262 }
12263
12264 if (version >= 138 && version < 140)
12265 {
12267 {
12268 if (!ctx.
Read(intValue))
12269 return false;
12270 SetFrozen(intValue);
12271 }
12272 }
12273
12274 return true;
12275 }
12276
12277
12279 {
12282 {
12284 }
12285
12286 if (!super.OnStoreLoad(ctx, version))
12287 {
12289 return false;
12290 }
12291
12292 if (version >= 114)
12293 {
12294 bool hasQuickBarIndexSaved;
12295
12296 if (!ctx.
Read(hasQuickBarIndexSaved))
12297 {
12299 return false;
12300 }
12301
12302 if (hasQuickBarIndexSaved)
12303 {
12304 int itmQBIndex;
12305
12306
12307 if (!ctx.
Read(itmQBIndex))
12308 {
12310 return false;
12311 }
12312
12313 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12314 if (itmQBIndex != -1 && parentPlayer)
12315 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12316 }
12317 }
12318 else
12319 {
12320
12321 PlayerBase player;
12322 int itemQBIndex;
12323 if (version ==
int.
MAX)
12324 {
12325 if (!ctx.
Read(itemQBIndex))
12326 {
12328 return false;
12329 }
12330 }
12331 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12332 {
12333
12334 if (!ctx.
Read(itemQBIndex))
12335 {
12337 return false;
12338 }
12339 if (itemQBIndex != -1 && player)
12340 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12341 }
12342 }
12343
12344 if (version < 140)
12345 {
12346
12347 if (!LoadVariables(ctx, version))
12348 {
12350 return false;
12351 }
12352 }
12353
12354
12356 {
12358 return false;
12359 }
12360 if (version >= 132)
12361 {
12363 if (raib)
12364 {
12366 {
12368 return false;
12369 }
12370 }
12371 }
12372
12374 return true;
12375 }
12376
12377
12378
12380 {
12381 super.OnStoreSave(ctx);
12382
12383 PlayerBase player;
12384 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12385 {
12387
12388 int itemQBIndex = -1;
12389 itemQBIndex = player.FindQuickBarEntityIndex(this);
12390 ctx.
Write(itemQBIndex);
12391 }
12392 else
12393 {
12395 }
12396
12398
12400 if (raib)
12401 {
12403 }
12404 }
12405
12406
12408 {
12409 super.AfterStoreLoad();
12410
12412 {
12414 }
12415
12417 {
12420 }
12421 }
12422
12424 {
12425 super.EEOnAfterLoad();
12426
12428 {
12430 }
12431
12434 }
12435
12437 {
12438 return false;
12439 }
12440
12441
12442
12444 {
12446 {
12447 #ifdef PLATFORM_CONSOLE
12448
12450 {
12452 if (menu)
12453 {
12455 }
12456 }
12457 #endif
12458 }
12459
12461 {
12464 }
12465
12467 {
12468 SetWeightDirty();
12470 }
12472 {
12475 }
12476
12478 {
12481
12484 }
12486 {
12490 }
12491
12492 super.OnVariablesSynchronized();
12493 }
12494
12495
12496
12498 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12499 {
12500 if (!IsServerCheck(allow_client))
12501 return false;
12502
12504 return false;
12505
12508
12509 if (value <= (min + 0.001))
12510 value = min;
12511
12512 if (value == min)
12513 {
12514 if (destroy_config)
12515 {
12516 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12517 if (dstr)
12518 {
12520 this.Delete();
12521 return true;
12522 }
12523 }
12524 else if (destroy_forced)
12525 {
12527 this.Delete();
12528 return true;
12529 }
12530
12532 }
12533
12536
12538 {
12539 EntityAI parent = GetHierarchyRoot();
12540 InventoryLocation iLoc = new InventoryLocation();
12541 GetInventory().GetCurrentInventoryLocation(iLoc);
12543 {
12544 int iLocSlot = iLoc.
GetSlot();
12546 {
12548 }
12550 {
12552 }
12553 }
12554 }
12555
12557 {
12559
12560 if (delta)
12562 }
12563
12565
12566 return false;
12567 }
12568
12569
12571 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12572 {
12574 }
12575
12577 {
12580 }
12581
12583 {
12586 }
12587
12589 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12590 {
12591 float value_clamped = Math.Clamp(value, 0, 1);
12593 SetQuantity(result, destroy_config, destroy_forced);
12594 }
12595
12596
12599 {
12601 }
12602
12604 {
12606 }
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12618 {
12619 int slot = -1;
12620 GameInventory inventory = GetInventory();
12621 if (inventory)
12622 {
12623 InventoryLocation il = new InventoryLocation;
12626 }
12627
12629 }
12630
12632 {
12633 float quantity_max = 0;
12634
12636 {
12637 if (attSlotID != -1)
12638 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12639
12640 if (quantity_max <= 0)
12642 }
12643
12644 if (quantity_max <= 0)
12646
12647 return quantity_max;
12648 }
12649
12651 {
12653 }
12654
12656 {
12658 }
12659
12660
12662 {
12664 }
12665
12667 {
12669 }
12670
12672 {
12674 }
12675
12676
12678 {
12679
12680 float weightEx = GetWeightEx();
12681 float special = GetInventoryAndCargoWeight();
12682 return weightEx - special;
12683 }
12684
12685
12687 {
12689 }
12690
12692 {
12694 {
12695 #ifdef DEVELOPER
12696 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12697 {
12698 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12700 }
12701 #endif
12702
12703 return GetQuantity() * GetConfigWeightModified();
12704 }
12705 else if (HasEnergyManager())
12706 {
12707 #ifdef DEVELOPER
12708 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12709 {
12710 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12711 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12712 }
12713 #endif
12714 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12715 }
12716 else
12717 {
12718 #ifdef DEVELOPER
12719 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12720 {
12721 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12722 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12723 }
12724 #endif
12725 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12726 }
12727 }
12728
12731 {
12732 int item_count = 0;
12734
12735 GameInventory inventory = GetInventory();
12736 CargoBase cargo = inventory.
GetCargo();
12737 if (cargo != NULL)
12738 {
12740 }
12741
12743 for (int i = 0; i < nAttachments; ++i)
12744 {
12746 if (item)
12747 item_count += item.GetNumberOfItems();
12748 }
12749 return item_count;
12750 }
12751
12754 {
12755 float weight = 0;
12756 float wetness = 1;
12757 if (include_wetness)
12760 {
12761 weight = wetness * m_ConfigWeight;
12762 }
12764 {
12765 weight = 1;
12766 }
12767 return weight;
12768 }
12769
12770
12771
12773 {
12774 GameInventory inventory = GetInventory();
12775 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12776 {
12777 array<EntityAI> items = new array<EntityAI>;
12779 for (int i = 0; i < items.Count(); ++i)
12780 {
12782 if (item)
12783 {
12784 g_Game.ObjectDelete(item);
12785 }
12786 }
12787 }
12788 }
12789
12790
12791
12792
12794 {
12795 float energy = 0;
12796 if (HasEnergyManager())
12797 {
12798 energy = GetCompEM().GetEnergy();
12799 }
12800 return energy;
12801 }
12802
12803
12805 {
12806 super.OnEnergyConsumed();
12807
12809 }
12810
12812 {
12813 super.OnEnergyAdded();
12814
12816 }
12817
12818
12820 {
12821 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12822 {
12824 {
12825 float energy_0to1 = GetCompEM().GetEnergy0To1();
12827 }
12828 }
12829 }
12830
12831
12833 {
12834 return ConfigGetFloat("heatIsolation");
12835 }
12836
12838 {
12840 }
12841
12843 {
12844 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12845 if (
g_Game.ConfigIsExisting(paramPath))
12846 return g_Game.ConfigGetFloat(paramPath);
12847
12848 return 0.0;
12849 }
12850
12852 {
12853 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12854 if (
g_Game.ConfigIsExisting(paramPath))
12855 return g_Game.ConfigGetFloat(paramPath);
12856
12857 return 0.0;
12858 }
12859
12860 override void SetWet(
float value,
bool allow_client =
false)
12861 {
12862 if (!IsServerCheck(allow_client))
12863 return;
12864
12867
12869
12870 m_VarWet = Math.Clamp(value, min, max);
12871
12873 {
12876 }
12877 }
12878
12879 override void AddWet(
float value)
12880 {
12882 }
12883
12885 {
12887 }
12888
12890 {
12892 }
12893
12895 {
12897 }
12898
12900 {
12902 }
12903
12905 {
12907 }
12908
12909 override void OnWetChanged(
float newVal,
float oldVal)
12910 {
12913 if (newLevel != oldLevel)
12914 {
12916 }
12917 }
12918
12920 {
12921 SetWeightDirty();
12922 }
12923
12925 {
12926 return GetWetLevelInternal(
m_VarWet);
12927 }
12928
12929
12930
12932 {
12934 }
12935
12937 {
12939 }
12940
12942 {
12944 }
12945
12947 {
12949 }
12950
12951
12952
12954 {
12955 if (ConfigIsExisting("itemModelLength"))
12956 {
12957 return ConfigGetFloat("itemModelLength");
12958 }
12959 return 0;
12960 }
12961
12963 {
12964 if (ConfigIsExisting("itemAttachOffset"))
12965 {
12966 return ConfigGetFloat("itemAttachOffset");
12967 }
12968 return 0;
12969 }
12970
12971 override void SetCleanness(
int value,
bool allow_client =
false)
12972 {
12973 if (!IsServerCheck(allow_client))
12974 return;
12975
12977
12979
12982 }
12983
12985 {
12987 }
12988
12990 {
12991 return true;
12992 }
12993
12994
12995
12996
12998 {
13000 }
13001
13003 {
13005 }
13006
13007
13008
13009
13010 override void SetColor(
int r,
int g,
int b,
int a)
13011 {
13017 }
13019 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13020 {
13025 }
13026
13028 {
13030 }
13031
13034 {
13035 int r,g,b,a;
13037 r = r/255;
13038 g = g/255;
13039 b = b/255;
13040 a = a/255;
13041 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13042 }
13043
13044
13045
13046 override void SetLiquidType(
int value,
bool allow_client =
false)
13047 {
13048 if (!IsServerCheck(allow_client))
13049 return;
13050
13055 }
13056
13058 {
13059 return ConfigGetInt("varLiquidTypeInit");
13060 }
13061
13063 {
13065 }
13066
13068 {
13070 SetFrozen(false);
13071 }
13072
13075 {
13076 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13077 }
13078
13079
13082 {
13083 PlayerBase nplayer;
13084 if (PlayerBase.CastTo(nplayer, player))
13085 {
13087 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13088 }
13089 }
13090
13091
13094 {
13095 PlayerBase nplayer;
13096 if (PlayerBase.CastTo(nplayer,player))
13097 {
13098 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13099 }
13100
13101 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13102
13103 if (HasEnergyManager())
13104 {
13105 GetCompEM().UpdatePlugState();
13106 }
13107 }
13108
13109
13111 {
13112 super.OnPlacementStarted(player);
13113
13115 }
13116
13117 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13118 {
13120 {
13121 m_AdminLog.OnPlacementComplete(player,
this);
13122 }
13123
13124 super.OnPlacementComplete(player, position, orientation);
13125 }
13126
13127
13128
13129
13130
13132 {
13134 {
13135 return true;
13136 }
13137 else
13138 {
13139 return false;
13140 }
13141 }
13142
13143
13145 {
13147 {
13149 }
13150 }
13151
13152
13154 {
13156 }
13157
13159 {
13161 }
13162
13163 override void InsertAgent(
int agent,
float count = 1)
13164 {
13165 if (count < 1)
13166 return;
13167
13169 }
13170
13173 {
13175 }
13176
13177
13179 {
13181 }
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13225 {
13227 return false;
13228 return true;
13229 }
13230
13232 {
13233
13235 }
13236
13237
13240 {
13241 super.CheckForRoofLimited(timeTresholdMS);
13242
13243 float time =
g_Game.GetTime();
13244 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13245 {
13246 m_PreviousRoofTestTime = time;
13247 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13248 }
13249 }
13250
13251
13253 {
13255 {
13256 return 0;
13257 }
13258
13259 if (GetInventory().GetAttachmentSlotsCount() != 0)
13260 {
13261 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13262 if (filter)
13263 return filter.GetProtectionLevel(type, false, system);
13264 else
13265 return 0;
13266 }
13267
13268 string subclassPath, entryName;
13269
13270 switch (type)
13271 {
13273 entryName = "biological";
13274 break;
13276 entryName = "chemical";
13277 break;
13278 default:
13279 entryName = "biological";
13280 break;
13281 }
13282
13283 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13284
13285 return g_Game.ConfigGetFloat(subclassPath + entryName);
13286 }
13287
13288
13289
13292 {
13293 if (!IsMagazine())
13295
13297 }
13298
13299
13300
13301
13302
13307 {
13308 return true;
13309 }
13310
13312 {
13314 }
13315
13316
13317
13318
13319
13321 {
13322 if (parent)
13323 {
13324 if (parent.IsInherited(DayZInfected))
13325 return true;
13326
13327 if (!parent.IsRuined())
13328 return true;
13329 }
13330
13331 return true;
13332 }
13333
13335 {
13336 if (!super.CanPutAsAttachment(parent))
13337 {
13338 return false;
13339 }
13340
13341 if (!IsRuined() && !parent.IsRuined())
13342 {
13343 return true;
13344 }
13345
13346 return false;
13347 }
13348
13350 {
13351
13352
13353
13354
13355 return super.CanReceiveItemIntoCargo(item);
13356 }
13357
13359 {
13360
13361
13362
13363
13364 GameInventory attachmentInv = attachment.GetInventory();
13366 {
13367 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13368 return false;
13369 }
13370
13371 InventoryLocation loc = new InventoryLocation();
13372 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13373 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13374 return false;
13375
13376 return super.CanReceiveAttachment(attachment, slotId);
13377 }
13378
13380 {
13381 if (!super.CanReleaseAttachment(attachment))
13382 return false;
13383
13384 return GetInventory().AreChildrenAccessible();
13385 }
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13408 {
13409 int id = muzzle_owner.GetMuzzleID();
13410 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13411
13412 if (WPOF_array)
13413 {
13414 for (int i = 0; i < WPOF_array.Count(); i++)
13415 {
13416 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13417
13418 if (WPOF)
13419 {
13420 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13421 }
13422 }
13423 }
13424 }
13425
13426
13428 {
13429 int id = muzzle_owner.GetMuzzleID();
13431
13432 if (WPOBE_array)
13433 {
13434 for (int i = 0; i < WPOBE_array.Count(); i++)
13435 {
13436 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13437
13438 if (WPOBE)
13439 {
13440 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13481 }
13482 }
13483 }
13484 }
13485
13486
13488 {
13489 int id = muzzle_owner.GetMuzzleID();
13490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13491
13492 if (WPOOH_array)
13493 {
13494 for (int i = 0; i < WPOOH_array.Count(); i++)
13495 {
13496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13497
13498 if (WPOOH)
13499 {
13500 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13501 }
13502 }
13503 }
13504 }
13505
13506
13507
13509 {
13511 {
13512 return true;
13513 }
13514
13515 return false;
13516 }
13517
13519 {
13521 {
13522 return true;
13523 }
13524
13525 return false;
13526 }
13527
13529 {
13531 {
13532 return true;
13533 }
13534
13535 return false;
13536 }
13537
13539 {
13540 return false;
13541 }
13542
13545 {
13546 return UATimeSpent.DEFAULT_DEPLOY;
13547 }
13548
13549
13550
13551
13553 {
13555 SetSynchDirty();
13556 }
13557
13559 {
13561 }
13562
13563
13565 {
13566 return false;
13567 }
13568
13571 {
13572 string att_type = "None";
13573
13574 if (ConfigIsExisting("soundAttType"))
13575 {
13576 att_type = ConfigGetString("soundAttType");
13577 }
13578
13580 }
13581
13583 {
13585 }
13586
13587
13588
13589
13590
13596
13598 {
13601
13603 }
13604
13605
13607 {
13609 return;
13610
13612
13615
13618
13619 SoundParameters params = new SoundParameters();
13623 }
13624
13625
13627 {
13629 {
13632
13633 SetSynchDirty();
13634
13637 }
13638 }
13639
13641 {
13643 }
13644
13645
13647 {
13649 return;
13650
13652 SetSynchDirty();
13653
13656 }
13657
13659 {
13662 }
13663
13665 {
13667 }
13668
13669 void OnApply(PlayerBase player);
13670
13672 {
13673 return 1.0;
13674 };
13675
13677 {
13679 }
13680
13682 {
13684 }
13685
13687
13689 {
13690 SetDynamicPhysicsLifeTime(0.01);
13692 }
13693
13695 {
13696 array<string> zone_names = new array<string>;
13697 GetDamageZones(zone_names);
13698 for (int i = 0; i < zone_names.Count(); i++)
13699 {
13700 SetHealthMax(zone_names.Get(i),"Health");
13701 }
13702 SetHealthMax("","Health");
13703 }
13704
13707 {
13708 float global_health = GetHealth01("","Health");
13709 array<string> zones = new array<string>;
13710 GetDamageZones(zones);
13711
13712 for (int i = 0; i < zones.Count(); i++)
13713 {
13714 SetHealth01(zones.Get(i),"Health",global_health);
13715 }
13716 }
13717
13720 {
13721 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13722 }
13723
13725 {
13726 if (!hasRootAsPlayer)
13727 {
13728 if (refParentIB)
13729 {
13730
13731 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13732 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13733
13734 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13735 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13736
13739 }
13740 else
13741 {
13742
13745 }
13746 }
13747 }
13748
13750 {
13752 {
13753 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13754 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13755 {
13756 float heatPermCoef = 1.0;
13758 while (ent)
13759 {
13760 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13761 ent = ent.GetHierarchyParent();
13762 }
13763
13764 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13765 }
13766 }
13767 }
13768
13770 {
13771
13772 EntityAI parent = GetHierarchyParent();
13773 if (!parent)
13774 {
13775 hasParent = false;
13776 hasRootAsPlayer = false;
13777 }
13778 else
13779 {
13780 hasParent = true;
13781 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13782 refParentIB =
ItemBase.Cast(parent);
13783 }
13784 }
13785
13786 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13787 {
13788
13789 }
13790
13792 {
13793
13794 return false;
13795 }
13796
13798 {
13799
13800
13801 return false;
13802 }
13803
13805 {
13806
13807 return false;
13808 }
13809
13812 {
13813 return !GetIsFrozen() &&
IsOpen();
13814 }
13815
13817 {
13818 bool hasParent = false, hasRootAsPlayer = false;
13820
13821 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13822 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13823
13824 if (wwtu || foodDecay)
13825 {
13829
13830 if (processWetness || processTemperature || processDecay)
13831 {
13833
13834 if (processWetness)
13835 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13836
13837 if (processTemperature)
13839
13840 if (processDecay)
13841 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13842 }
13843 }
13844 }
13845
13848 {
13850 }
13851
13853 {
13856
13857 return super.GetTemperatureFreezeThreshold();
13858 }
13859
13861 {
13864
13865 return super.GetTemperatureThawThreshold();
13866 }
13867
13869 {
13872
13873 return super.GetItemOverheatThreshold();
13874 }
13875
13877 {
13879 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13880
13881 return super.GetTemperatureFreezeTime();
13882 }
13883
13885 {
13887 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13888
13889 return super.GetTemperatureThawTime();
13890 }
13891
13896
13898 {
13899 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13900 }
13901
13903 {
13904 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13905 }
13906
13909 {
13911 }
13912
13914 {
13916 }
13917
13919 {
13921 }
13922
13925 {
13926 return null;
13927 }
13928
13931 {
13932 return false;
13933 }
13934
13936 {
13938 {
13941 if (!trg)
13942 {
13944 explosive = this;
13945 }
13946
13947 explosive.PairRemote(trg);
13949
13950 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13951 trg.SetPersistentPairID(persistentID);
13952 explosive.SetPersistentPairID(persistentID);
13953
13954 return true;
13955 }
13956 return false;
13957 }
13958
13961 {
13962 float ret = 1.0;
13965 ret *= GetHealth01();
13966
13967 return ret;
13968 }
13969
13970 #ifdef DEVELOPER
13971 override void SetDebugItem()
13972 {
13973 super.SetDebugItem();
13974 _itemBase = this;
13975 }
13976
13978 {
13979 string text = super.GetDebugText();
13980
13982 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13983
13984 return text;
13985 }
13986 #endif
13987
13989 {
13990 return true;
13991 }
13992
13994
13996
13998 {
14001 }
14002
14003
14011
14027
14028 [
Obsolete(
"Use ItemSoundHandler instead")]
14031 {
14032 if (!
g_Game.IsDedicatedServer())
14033 {
14034 if (ConfigIsExisting("attachSoundSet"))
14035 {
14036 string cfg_path = "";
14037 string soundset = "";
14038 string type_name =
GetType();
14039
14042 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14043 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14044
14045 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14046 {
14047 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14048 {
14049 if (cfg_slot_array[i] == slot_type)
14050 {
14051 soundset = cfg_soundset_array[i];
14052 break;
14053 }
14054 }
14055 }
14056
14057 if (soundset != "")
14058 {
14059 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14061 }
14062 }
14063 }
14064 }
14065
14067}
14068
14070{
14072 if (entity)
14073 {
14074 bool is_item = entity.IsInherited(
ItemBase);
14075 if (is_item && full_quantity)
14076 {
14079 }
14080 }
14081 else
14082 {
14084 return NULL;
14085 }
14086 return entity;
14087}
14088
14090{
14091 if (item)
14092 {
14093 if (health > 0)
14094 item.SetHealth("", "", health);
14095
14096 if (item.CanHaveTemperature())
14097 {
14099 if (item.CanFreeze())
14100 item.SetFrozen(false);
14101 }
14102
14103 if (item.HasEnergyManager())
14104 {
14105 if (quantity >= 0)
14106 {
14107 item.GetCompEM().SetEnergy0To1(quantity);
14108 }
14109 else
14110 {
14112 }
14113 }
14114 else if (item.IsMagazine())
14115 {
14116 Magazine mag = Magazine.Cast(item);
14117 if (quantity >= 0)
14118 {
14119 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14120 }
14121 else
14122 {
14124 }
14125
14126 }
14127 else
14128 {
14129 if (quantity >= 0)
14130 {
14131 item.SetQuantityNormalized(quantity, false);
14132 }
14133 else
14134 {
14136 }
14137
14138 }
14139 }
14140}
14141
14142#ifdef DEVELOPER
14144#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.