9043{
9045 {
9046 return true;
9047 }
9048};
9049
9051{
9052
9053};
9054
9055
9056
9058{
9062
9064
9067
9068
9069
9070
9071
9080
9086
9091
9096
9117 protected bool m_IsResultOfSplit
9118
9120
9125
9126
9127
9129
9133
9134
9135
9137
9140
9141
9142
9148
9149
9157
9160
9161
9163
9164
9166
9167
9172
9173
9178
9180
9181
9183
9184
9186 {
9191
9192 if (!
g_Game.IsDedicatedServer())
9193 {
9195 {
9197
9199 {
9201 }
9202 }
9203
9206 }
9207
9208 m_OldLocation = null;
9209
9211 {
9213 }
9214
9215 if (ConfigIsExisting("headSelectionsToHide"))
9216 {
9219 }
9220
9222 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9223 {
9225 }
9226
9228
9229 m_IsResultOfSplit = false;
9230
9232 }
9233
9235 {
9236 super.InitItemVariables();
9237
9243 m_Count = ConfigGetInt(
"count");
9244
9247
9252
9255
9260
9272
9276
9277
9280 if (ConfigIsExisting("canBeSplit"))
9281 {
9284 }
9285
9287 if (ConfigIsExisting("itemBehaviour"))
9289
9290
9293 RegisterNetSyncVariableInt("m_VarLiquidType");
9294 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9295
9296 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9297 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9298 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9299
9300 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9301 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9302 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9303 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9304
9305 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9306 RegisterNetSyncVariableBool("m_IsTakeable");
9307 RegisterNetSyncVariableBool("m_IsHologram");
9308
9311 {
9314 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9315 }
9316
9318
9320 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9322
9324 }
9325
9327 {
9329 }
9330
9332 {
9335 {
9340 }
9341 }
9342
9343 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9344 {
9346 {
9349 }
9350
9352 }
9353
9355 {
9361 }
9362
9364
9366 {
9368
9369 if (!action)
9370 {
9371 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9372 return;
9373 }
9374
9376 if (!ai)
9377 {
9379 return;
9380 }
9381
9383 if (!action_array)
9384 {
9385 action_array = new array<ActionBase_Basic>;
9387 }
9388 if (LogManager.IsActionLogEnable())
9389 {
9390 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9391 }
9392
9393 if (action_array.Find(action) != -1)
9394 {
9395 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9396 }
9397 else
9398 {
9399 action_array.Insert(action);
9400 }
9401 }
9402
9404 {
9405 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9406 ActionBase action = player.GetActionManager().GetAction(actionName);
9409
9410 if (action_array)
9411 {
9412 action_array.RemoveItem(action);
9413 }
9414 }
9415
9416
9417
9419 {
9420 ActionOverrideData overrideData = new ActionOverrideData();
9424
9426 if (!actionMap)
9427 {
9430 }
9431
9432 actionMap.Insert(this.
Type(), overrideData);
9433
9434 }
9435
9437
9439
9440
9442 {
9445
9448
9449 string config_to_search = "CfgVehicles";
9450 string muzzle_owner_config;
9451
9453 {
9454 if (IsInherited(Weapon))
9455 config_to_search = "CfgWeapons";
9456
9457 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9458
9459 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9460
9461 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9462
9463 if (config_OnFire_subclass_count > 0)
9464 {
9465 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9466
9467 for (int i = 0; i < config_OnFire_subclass_count; i++)
9468 {
9469 string particle_class = "";
9470 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9471 string config_OnFire_entry = config_OnFire_class + particle_class;
9472 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9473 WPOF_array.Insert(WPOF);
9474 }
9475
9476
9478 }
9479 }
9480
9482 {
9483 config_to_search = "CfgWeapons";
9484 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9485
9486 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9487
9488 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9489
9490 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9491 {
9492 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9493
9494 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9495 {
9496 string particle_class2 = "";
9497 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9498 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9499 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9500 WPOBE_array.Insert(WPOBE);
9501 }
9502
9503
9505 }
9506 }
9507 }
9508
9509
9511 {
9514
9516 {
9517 string config_to_search = "CfgVehicles";
9518
9519 if (IsInherited(Weapon))
9520 config_to_search = "CfgWeapons";
9521
9522 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9523 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9524
9525 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9526 {
9527
9529
9531 {
9533 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9535 return;
9536 }
9537
9540
9541
9542
9543 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9544 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9545
9546 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9547 {
9548 string particle_class = "";
9549 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9550 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9551 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9552
9553 if (entry_type == CT_CLASS)
9554 {
9555 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9556 WPOOH_array.Insert(WPOF);
9557 }
9558 }
9559
9560
9562 }
9563 }
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 {
9576
9579
9582
9583 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9584 }
9585 }
9586
9588 {
9590 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9591
9593 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9594
9596 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9597
9599 {
9601 }
9602 }
9603
9605 {
9607 }
9608
9610 {
9613 else
9615
9617 {
9620 }
9621 else
9622 {
9625
9628 }
9629
9631 }
9632
9634 {
9636 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9637 }
9638
9640 {
9642 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9644 }
9645
9647 {
9649 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9650 }
9651
9653 {
9656
9657 OverheatingParticle OP = new OverheatingParticle();
9662
9664 }
9665
9667 {
9670
9671 return -1;
9672 }
9673
9675 {
9677 {
9680
9681 for (int i = count; i > 0; --i)
9682 {
9683 int id = i - 1;
9686
9689
9690 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9691 {
9692 if (p)
9693 {
9696 }
9697 }
9698 }
9699 }
9700 }
9701
9703 {
9705 {
9707 {
9708 int id = i - 1;
9710
9711 if (OP)
9712 {
9714
9715 if (p)
9716 {
9718 }
9719
9720 delete OP;
9721 }
9722 }
9723
9726 }
9727 }
9728
9731 {
9732 return 0.0;
9733 }
9734
9735
9737 {
9738 return 250;
9739 }
9740
9742 {
9743 return 0;
9744 }
9745
9748 {
9750 return true;
9751
9752 return false;
9753 }
9754
9757 {
9760
9762 {
9764 }
9765 else
9766 {
9767
9769 }
9770
9772 }
9773
9780 {
9781 return -1;
9782 }
9783
9784
9785
9786
9788 {
9790 {
9791 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9792 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9793
9794 if (r_index >= 0)
9795 {
9796 InventoryLocation r_il = new InventoryLocation;
9797 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9798
9799 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9802 {
9803 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9804 }
9806 {
9807 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9808 }
9809
9810 }
9811
9812 player.GetHumanInventory().ClearUserReservedLocation(this);
9813 }
9814
9817 }
9818
9819
9820
9821
9823 {
9824 return ItemBase.m_DebugActionsMask;
9825 }
9826
9828 {
9829 return ItemBase.m_DebugActionsMask & mask;
9830 }
9831
9833 {
9834 ItemBase.m_DebugActionsMask = mask;
9835 }
9836
9838 {
9839 ItemBase.m_DebugActionsMask |= mask;
9840 }
9841
9843 {
9844 ItemBase.m_DebugActionsMask &= ~mask;
9845 }
9846
9848 {
9850 {
9852 }
9853 else
9854 {
9856 }
9857 }
9858
9859
9861 {
9862 if (GetEconomyProfile())
9863 {
9864 float q_max = GetEconomyProfile().GetQuantityMax();
9865 if (q_max > 0)
9866 {
9867 float q_min = GetEconomyProfile().GetQuantityMin();
9868 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9869
9871 {
9872 ComponentEnergyManager comp = GetCompEM();
9874 {
9876 }
9877 }
9879 {
9881
9882 }
9883
9884 }
9885 }
9886 }
9887
9890 {
9891 EntityAI parent = GetHierarchyParent();
9892
9893 if (parent)
9894 {
9895 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9896 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9897 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9898 }
9899 }
9900
9903 {
9904 EntityAI parent = GetHierarchyParent();
9905
9906 if (parent)
9907 {
9908 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9909 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9910 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9911 }
9912 }
9913
9915 {
9916
9917
9918
9919
9921
9923 {
9924 if (ScriptInputUserData.CanStoreInputUserData())
9925 {
9926 ScriptInputUserData ctx = new ScriptInputUserData;
9932 ctx.
Write(use_stack_max);
9935
9937 {
9938 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9939 }
9940 }
9941 }
9942 else if (!
g_Game.IsMultiplayer())
9943 {
9945 }
9946 }
9947
9949 {
9951 }
9952
9954 {
9956 }
9957
9959 {
9961 }
9962
9964 {
9965
9966 return false;
9967 }
9968
9970 {
9971 return false;
9972 }
9973
9977 {
9978 return false;
9979 }
9980
9982 {
9983 return "";
9984 }
9985
9987
9989 {
9990 return false;
9991 }
9992
9994 {
9995 return true;
9996 }
9997
9998
9999
10001 {
10002 return true;
10003 }
10004
10006 {
10007 return true;
10008 }
10009
10011 {
10012 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10014 }
10015
10017 {
10019 }
10020
10022 {
10024 if (!is_being_placed)
10026 SetSynchDirty();
10027 }
10028
10029
10031
10033 {
10035 }
10036
10038 {
10040 }
10041
10043 {
10044 return 1;
10045 }
10046
10048 {
10049 return false;
10050 }
10051
10053 {
10055 SetSynchDirty();
10056 }
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10093 {
10094 super.OnMovedInsideCargo(container);
10095
10096 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10097 }
10098
10099 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10100 {
10101 super.EEItemLocationChanged(oldLoc, newLoc);
10102
10103 PlayerBase newPlayer = null;
10104 PlayerBase oldPlayer = null;
10105
10106 if (newLoc.GetParent())
10107 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10108
10109 if (oldLoc.GetParent())
10110 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10111
10113 {
10114 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10115
10116 if (rIndex >= 0)
10117 {
10118 InventoryLocation rIl = new InventoryLocation;
10119 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10120
10121 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10124 {
10125 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10126 }
10128 {
10130 }
10131
10132 }
10133 }
10134
10136 {
10137 if (newPlayer)
10138 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10139
10140 if (newPlayer == oldPlayer)
10141 {
10142 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10143 {
10145 {
10146 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10147 {
10148 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10149 }
10150 }
10151 else
10152 {
10153 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10154 }
10155 }
10156
10157 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10158 {
10159 int type = oldLoc.GetType();
10161 {
10162 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10163 }
10165 {
10166 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10167 }
10168 }
10169 if (!m_OldLocation)
10170 {
10171 m_OldLocation = new InventoryLocation;
10172 }
10173 m_OldLocation.Copy(oldLoc);
10174 }
10175 else
10176 {
10177 if (m_OldLocation)
10178 {
10179 m_OldLocation.Reset();
10180 }
10181 }
10182
10183 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10184 }
10185 else
10186 {
10187 if (newPlayer)
10188 {
10189 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10190 if (resIndex >= 0)
10191 {
10192 InventoryLocation il = new InventoryLocation;
10193 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10195 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10198 {
10199 il.
GetParent().GetOnReleaseLock().Invoke(it);
10200 }
10202 {
10204 }
10205
10206 }
10207 }
10209 {
10210
10212 }
10213
10214 if (m_OldLocation)
10215 {
10216 m_OldLocation.Reset();
10217 }
10218 }
10219
10221 {
10222 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10223 }
10224
10226 {
10227 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10228 }
10229 }
10230
10231 override void EOnContact(IEntity other, Contact extra)
10232 {
10234 {
10235 int liquidType = -1;
10237 if (impactSpeed > 0.0)
10238 {
10240 #ifndef SERVER
10242 #else
10244 SetSynchDirty();
10245 #endif
10247 }
10248 }
10249
10250 #ifdef SERVER
10251 if (GetCompEM() && GetCompEM().IsPlugged())
10252 {
10253 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10254 GetCompEM().UnplugThis();
10255 }
10256 #endif
10257 }
10258
10260
10262 {
10264 }
10265
10267 {
10268
10269 }
10270
10272 {
10273 super.OnItemLocationChanged(old_owner, new_owner);
10274
10275 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10276 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10277
10278 if (!relatedPlayer && playerNew)
10279 relatedPlayer = playerNew;
10280
10281 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10282 {
10284 if (actionMgr)
10285 {
10286 ActionBase currentAction = actionMgr.GetRunningAction();
10287 if (currentAction)
10289 }
10290 }
10291
10292 Man ownerPlayerOld = null;
10293 Man ownerPlayerNew = null;
10294
10295 if (old_owner)
10296 {
10297 if (old_owner.
IsMan())
10298 {
10299 ownerPlayerOld = Man.Cast(old_owner);
10300 }
10301 else
10302 {
10303 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10304 }
10305 }
10306 else
10307 {
10309 {
10311
10312 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10313 {
10314 GetCompEM().UnplugThis();
10315 }
10316 }
10317 }
10318
10319 if (new_owner)
10320 {
10321 if (new_owner.
IsMan())
10322 {
10323 ownerPlayerNew = Man.Cast(new_owner);
10324 }
10325 else
10326 {
10327 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10328 }
10329 }
10330
10331 if (ownerPlayerOld != ownerPlayerNew)
10332 {
10333 if (ownerPlayerOld)
10334 {
10335 array<EntityAI> subItemsExit = new array<EntityAI>;
10337 for (int i = 0; i < subItemsExit.Count(); i++)
10338 {
10341 }
10342 }
10343
10344 if (ownerPlayerNew)
10345 {
10346 array<EntityAI> subItemsEnter = new array<EntityAI>;
10348 for (int j = 0; j < subItemsEnter.Count(); j++)
10349 {
10352 }
10353 }
10354 }
10355 else if (ownerPlayerNew != null)
10356 {
10357 PlayerBase nplayer;
10358 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10359 {
10360 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10362 for (int k = 0; k < subItemsUpdate.Count(); k++)
10363 {
10365 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10366 }
10367 }
10368 }
10369
10370 if (old_owner)
10371 old_owner.OnChildItemRemoved(this);
10372 if (new_owner)
10373 new_owner.OnChildItemReceived(this);
10374 }
10375
10376
10378 {
10379 super.EEDelete(parent);
10380 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10381 if (player)
10382 {
10384
10385 if (player.IsAlive())
10386 {
10387 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10388 if (r_index >= 0)
10389 {
10390 InventoryLocation r_il = new InventoryLocation;
10391 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10392
10393 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10396 {
10397 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10398 }
10400 {
10401 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10402 }
10403
10404 }
10405
10406 player.RemoveQuickBarEntityShortcut(this);
10407 }
10408 }
10409 }
10410
10412 {
10413 super.EEKilled(killer);
10414
10417 {
10418 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10419 {
10420 if (IsMagazine())
10421 {
10422 if (Magazine.Cast(this).GetAmmoCount() > 0)
10423 {
10425 }
10426 }
10427 else
10428 {
10430 }
10431 }
10432 }
10433 }
10434
10436 {
10437 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10438
10439 super.OnWasAttached(parent, slot_id);
10440
10443
10446 }
10447
10449 {
10450 super.OnWasDetached(parent, slot_id);
10451
10454
10457 }
10458
10460 {
10461 int idx;
10464
10465 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10466 if (inventory_slots.Count() < 1)
10467 {
10468 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10469 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10470 }
10471 else
10472 {
10473 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10474 }
10475
10476 idx = inventory_slots.Find(slot);
10477 if (idx < 0)
10478 return "";
10479
10480 return attach_types.Get(idx);
10481 }
10482
10484 {
10485 int idx = -1;
10486 string slot;
10487
10490
10491 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10492 if (inventory_slots.Count() < 1)
10493 {
10494 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10495 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10496 }
10497 else
10498 {
10499 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10500 if (detach_types.Count() < 1)
10501 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10502 }
10503
10504 for (int i = 0; i < inventory_slots.Count(); i++)
10505 {
10506 slot = inventory_slots.Get(i);
10507 }
10508
10509 if (slot != "")
10510 {
10511 if (detach_types.Count() == 1)
10512 idx = 0;
10513 else
10514 idx = inventory_slots.Find(slot);
10515 }
10516 if (idx < 0)
10517 return "";
10518
10519 return detach_types.Get(idx);
10520 }
10521
10523 {
10524
10526
10527
10528 float min_time = 1;
10529 float max_time = 3;
10530 float delay = Math.RandomFloat(min_time, max_time);
10531
10532 explode_timer.Run(delay, this, "DoAmmoExplosion");
10533 }
10534
10536 {
10537 Magazine magazine = Magazine.Cast(this);
10538 int pop_sounds_count = 6;
10539 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10540
10541
10542 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10543 string sound_name = pop_sounds[ sound_idx ];
10544 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10545
10546
10547 magazine.ServerAddAmmoCount(-1);
10548
10549
10550 float min_temp_to_explode = 100;
10551
10552 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10553 {
10555 }
10556 }
10557
10558
10559 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10560 {
10561 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10562
10563 const int CHANCE_DAMAGE_CARGO = 4;
10564 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10565 const int CHANCE_DAMAGE_NOTHING = 2;
10566
10568 {
10569 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10570 int chances;
10571 int rnd;
10572
10573 if (GetInventory().GetCargo())
10574 {
10575 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10576 rnd = Math.RandomInt(0,chances);
10577
10578 if (rnd < CHANCE_DAMAGE_CARGO)
10579 {
10581 }
10582 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10583 {
10585 }
10586 }
10587 else
10588 {
10589 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10590 rnd = Math.RandomInt(0,chances);
10591
10592 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10593 {
10595 }
10596 }
10597 }
10598 }
10599
10601 {
10602 CargoBase cargo = GetInventory().GetCargo();
10603 if (cargo)
10604 {
10606 if (item_count > 0)
10607 {
10608 int random_pick = Math.RandomInt(0, item_count);
10610 if (!item.IsExplosive())
10611 {
10612 item.AddHealth("","",damage);
10613 return true;
10614 }
10615 }
10616 }
10617 return false;
10618 }
10619
10621 {
10622 GameInventory inventory = GetInventory();
10624 if (attachment_count > 0)
10625 {
10626 int random_pick = Math.RandomInt(0, attachment_count);
10628 if (!attachment.IsExplosive())
10629 {
10630 attachment.AddHealth("","",damage);
10631 return true;
10632 }
10633 }
10634 return false;
10635 }
10636
10638 {
10640 }
10641
10643 {
10645 return GetInventory().CanRemoveEntity();
10646
10647 return false;
10648 }
10649
10651 {
10652
10654 return false;
10655
10656
10658 return false;
10659
10660
10661
10663 if (delta == 0)
10664 return false;
10665
10666
10667 return true;
10668 }
10669
10671 {
10673 {
10674 if (ScriptInputUserData.CanStoreInputUserData())
10675 {
10676 ScriptInputUserData ctx = new ScriptInputUserData;
10681 ctx.
Write(destination_entity);
10683 ctx.
Write(slot_id);
10685 }
10686 }
10687 else if (!
g_Game.IsMultiplayer())
10688 {
10690 }
10691 }
10692
10694 {
10695 float split_quantity_new;
10699 InventoryLocation loc = new InventoryLocation;
10700
10701 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10702 {
10704 split_quantity_new = stack_max;
10705 else
10707
10709 {
10710 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10711 if (new_item)
10712 {
10713 new_item.SetResultOfSplit(true);
10714 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10716 new_item.
SetQuantity(split_quantity_new,
false,
true);
10717 }
10718 }
10719 }
10720 else if (destination_entity && slot_id == -1)
10721 {
10722 if (quantity > stack_max)
10723 split_quantity_new = stack_max;
10724 else
10725 split_quantity_new = quantity;
10726
10728 {
10729 GameInventory destinationInventory = destination_entity.GetInventory();
10731 {
10734 }
10735
10736 if (new_item)
10737 {
10738 new_item.SetResultOfSplit(true);
10739 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10741 new_item.
SetQuantity(split_quantity_new,
false,
true);
10742 }
10743 }
10744 }
10745 else
10746 {
10747 if (stack_max != 0)
10748 {
10750 {
10752 }
10753
10754 if (split_quantity_new == 0)
10755 {
10756 if (!
g_Game.IsMultiplayer())
10757 player.PhysicalPredictiveDropItem(this);
10758 else
10759 player.ServerDropEntity(this);
10760 return;
10761 }
10762
10764 {
10766
10767 if (new_item)
10768 {
10769 new_item.SetResultOfSplit(true);
10770 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10773 new_item.PlaceOnSurface();
10774 }
10775 }
10776 }
10777 }
10778 }
10779
10781 {
10782 float split_quantity_new;
10786 InventoryLocation loc = new InventoryLocation;
10787
10788 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10789 {
10791 split_quantity_new = stack_max;
10792 else
10794
10796 {
10797 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10798 if (new_item)
10799 {
10800 new_item.SetResultOfSplit(true);
10801 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10803 new_item.
SetQuantity(split_quantity_new,
false,
true);
10804 }
10805 }
10806 }
10807 else if (destination_entity && slot_id == -1)
10808 {
10809 if (quantity > stack_max)
10810 split_quantity_new = stack_max;
10811 else
10812 split_quantity_new = quantity;
10813
10815 {
10816 GameInventory destinationInventory = destination_entity.GetInventory();
10818 {
10821 }
10822
10823 if (new_item)
10824 {
10825 new_item.SetResultOfSplit(true);
10826 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10828 new_item.
SetQuantity(split_quantity_new,
false,
true);
10829 }
10830 }
10831 }
10832 else
10833 {
10834 if (stack_max != 0)
10835 {
10837 {
10839 }
10840
10842 {
10844
10845 if (new_item)
10846 {
10847 new_item.SetResultOfSplit(true);
10848 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10851 new_item.PlaceOnSurface();
10852 }
10853 }
10854 }
10855 }
10856 }
10857
10859 {
10861 {
10862 if (ScriptInputUserData.CanStoreInputUserData())
10863 {
10864 ScriptInputUserData ctx = new ScriptInputUserData;
10869 dst.WriteToContext(ctx);
10871 }
10872 }
10873 else if (!
g_Game.IsMultiplayer())
10874 {
10876 }
10877 }
10878
10880 {
10882 {
10883 if (ScriptInputUserData.CanStoreInputUserData())
10884 {
10885 ScriptInputUserData ctx = new ScriptInputUserData;
10890 ctx.
Write(destination_entity);
10896 }
10897 }
10898 else if (!
g_Game.IsMultiplayer())
10899 {
10901 }
10902 }
10903
10905 {
10907 }
10908
10910 {
10912 float split_quantity_new;
10914 if (dst.IsValid())
10915 {
10916 int slot_id = dst.GetSlot();
10918
10919 if (quantity > stack_max)
10920 split_quantity_new = stack_max;
10921 else
10922 split_quantity_new = quantity;
10923
10925 {
10927
10928 if (new_item)
10929 {
10930 new_item.SetResultOfSplit(true);
10931 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10933 new_item.
SetQuantity(split_quantity_new,
false,
true);
10934 }
10935
10936 return new_item;
10937 }
10938 }
10939
10940 return null;
10941 }
10942
10944 {
10946 float split_quantity_new;
10948 if (destination_entity)
10949 {
10951 if (quantity > stackable)
10952 split_quantity_new = stackable;
10953 else
10954 split_quantity_new = quantity;
10955
10957 {
10958 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10959 if (new_item)
10960 {
10961 new_item.SetResultOfSplit(true);
10962 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10964 new_item.
SetQuantity(split_quantity_new,
false,
true);
10965 }
10966 }
10967 }
10968 }
10969
10971 {
10973 {
10974 if (ScriptInputUserData.CanStoreInputUserData())
10975 {
10976 ScriptInputUserData ctx = new ScriptInputUserData;
10981 ItemBase destination_entity =
this;
10982 ctx.
Write(destination_entity);
10986 }
10987 }
10988 else if (!
g_Game.IsMultiplayer())
10989 {
10991 }
10992 }
10993
10995 {
10997 float split_quantity_new;
10999 if (player)
11000 {
11002 if (quantity > stackable)
11003 split_quantity_new = stackable;
11004 else
11005 split_quantity_new = quantity;
11006
11008 {
11009 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11010 new_item =
ItemBase.Cast(in_hands);
11011 if (new_item)
11012 {
11013 new_item.SetResultOfSplit(true);
11014 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11016 new_item.SetQuantity(split_quantity_new, false, true);
11017 }
11018 }
11019 }
11020 }
11021
11023 {
11025 float split_quantity_new = Math.Floor(quantity * 0.5);
11026
11028 return;
11029
11031
11032 if (new_item)
11033 {
11034 if (new_item.GetQuantityMax() < split_quantity_new)
11035 {
11036 split_quantity_new = new_item.GetQuantityMax();
11037 }
11038
11039 new_item.SetResultOfSplit(true);
11040 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11041
11043 {
11046 }
11047 else
11048 {
11050 new_item.
SetQuantity(split_quantity_new,
false,
true);
11051 }
11052 }
11053 }
11054
11056 {
11058 float split_quantity_new = Math.Floor(quantity / 2);
11059
11061 return;
11062
11063 InventoryLocation invloc = new InventoryLocation;
11065
11067 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11068
11069 if (new_item)
11070 {
11071 if (new_item.GetQuantityMax() < split_quantity_new)
11072 {
11073 split_quantity_new = new_item.GetQuantityMax();
11074 }
11076 {
11079 }
11080 else if (split_quantity_new > 1)
11081 {
11083 new_item.
SetQuantity(split_quantity_new,
false,
true);
11084 }
11085 }
11086 }
11087
11090 {
11091 SetWeightDirty();
11093
11094 if (parent)
11095 parent.OnAttachmentQuantityChangedEx(this, delta);
11096
11098 {
11100 {
11102 }
11104 {
11105 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11107 }
11108 }
11109 }
11110
11113 {
11114
11115 }
11116
11119 {
11121 }
11122
11124 {
11125 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11126
11128 {
11129 if (newLevel == GameConstants.STATE_RUINED)
11130 {
11132 EntityAI parent = GetHierarchyParent();
11133 if (parent && parent.IsFireplace())
11134 {
11135 CargoBase cargo = GetInventory().GetCargo();
11136 if (cargo)
11137 {
11139 {
11141 }
11142 }
11143 }
11144 }
11145
11147 {
11148
11150 return;
11151 }
11152
11153 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11154 {
11156 }
11157 }
11158 }
11159
11160
11162 {
11163 super.OnRightClick();
11164
11166 {
11168 {
11169 if (ScriptInputUserData.CanStoreInputUserData())
11170 {
11171 EntityAI root = GetHierarchyRoot();
11172 Man playerOwner = GetHierarchyRootPlayer();
11173 InventoryLocation dst = new InventoryLocation;
11174
11175
11176 if (!playerOwner && root && root == this)
11177 {
11179 }
11180 else
11181 {
11182
11183 GetInventory().GetCurrentInventoryLocation(dst);
11185 {
11186 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11188 {
11190 }
11191 else
11192 {
11194
11195
11196 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11197 {
11199 }
11200 else
11201 {
11202 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11203 }
11204 }
11205 }
11206 }
11207
11208 ScriptInputUserData ctx = new ScriptInputUserData;
11216 }
11217 }
11218 else if (!
g_Game.IsMultiplayer())
11219 {
11221 }
11222 }
11223 }
11224
11226 {
11227 if (root)
11228 {
11229 vector m4[4];
11230 root.GetTransform(m4);
11231 dst.SetGround(this, m4);
11232 }
11233 else
11234 {
11235 GetInventory().GetCurrentInventoryLocation(dst);
11236 }
11237 }
11238
11239 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11240 {
11241
11242 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11243 return false;
11244
11245 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11246 return false;
11247
11248
11250 return false;
11251
11252
11253 Magazine mag = Magazine.Cast(this);
11254 if (mag)
11255 {
11256 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11257 return false;
11258
11259 if (stack_max_limit)
11260 {
11261 Magazine other_mag = Magazine.Cast(other_item);
11262 if (other_item)
11263 {
11264 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11265 return false;
11266 }
11267
11268 }
11269 }
11270 else
11271 {
11272
11274 return false;
11275
11277 return false;
11278 }
11279
11280 PlayerBase player = null;
11281 if (CastTo(player, GetHierarchyRootPlayer()))
11282 {
11283 if (player.GetInventory().HasAttachment(this))
11284 return false;
11285
11286 if (player.IsItemsToDelete())
11287 return false;
11288 }
11289
11290 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11291 return false;
11292
11293 int slotID;
11295 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11296 return false;
11297
11298 return true;
11299 }
11300
11302 {
11304 }
11305
11307 {
11308 return m_IsResultOfSplit;
11309 }
11310
11312 {
11313 m_IsResultOfSplit = value;
11314 }
11315
11317 {
11319 }
11320
11322 {
11323 float other_item_quantity = other_item.GetQuantity();
11324 float this_free_space;
11325
11327
11329
11330 if (other_item_quantity > this_free_space)
11331 {
11332 return this_free_space;
11333 }
11334 else
11335 {
11336 return other_item_quantity;
11337 }
11338 }
11339
11341 {
11343 }
11344
11346 {
11348 return;
11349
11350 if (!IsMagazine() && other_item)
11351 {
11353 if (quantity_used != 0)
11354 {
11355 float hp1 = GetHealth01("","");
11356 float hp2 = other_item.GetHealth01("","");
11357 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11358 hpResult = hpResult / (
GetQuantity() + quantity_used);
11359
11360 hpResult *= GetMaxHealth();
11361 Math.Round(hpResult);
11362 SetHealth("", "Health", hpResult);
11363
11365 other_item.AddQuantity(-quantity_used);
11366 }
11367 }
11369 }
11370
11372 {
11373 #ifdef SERVER
11374 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11375 GetHierarchyParent().IncreaseLifetimeUp();
11376 #endif
11377 };
11378
11380 {
11381 PlayerBase p = PlayerBase.Cast(player);
11382
11383 array<int> recipesIds = p.m_Recipes;
11384 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11385 if (moduleRecipesManager)
11386 {
11387 EntityAI itemInHands = player.GetEntityInHands();
11388 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11389 }
11390
11391 for (int i = 0;i < recipesIds.Count(); i++)
11392 {
11393 int key = recipesIds.Get(i);
11394 string recipeName = moduleRecipesManager.GetRecipeName(key);
11396 }
11397 }
11398
11399
11400 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11401 {
11402 super.GetDebugActions(outputList);
11403
11404
11410
11411
11416
11421
11422
11426
11427
11429 {
11433 }
11434
11437
11438
11442
11444
11445 InventoryLocation loc = new InventoryLocation();
11446 GetInventory().GetCurrentInventoryLocation(loc);
11448 {
11449 if (Gizmo_IsSupported())
11452 }
11453
11455 }
11456
11457
11458
11459
11461 {
11462 super.OnAction(action_id, player, ctx);
11463
11465 {
11466 switch (action_id)
11467 {
11471 return true;
11475 return true;
11476 }
11477 }
11478
11480 {
11481 switch (action_id)
11482 {
11484 Delete();
11485 return true;
11486 }
11487 }
11488
11489 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11490 {
11491 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11492 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11493 PlayerBase p = PlayerBase.Cast(player);
11494 if (
EActions.RECIPES_RANGE_START < 1000)
11495 {
11496 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11497 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11498 }
11499 }
11500 #ifndef SERVER
11501 else if (action_id ==
EActions.WATCH_PLAYER)
11502 {
11503 PluginDeveloper.SetDeveloperItemClientEx(player);
11504 }
11505 #endif
11507 {
11508 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11509 {
11510 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11511 OnDebugButtonPressServer(id + 1);
11512 }
11513
11514 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11515 {
11516 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11518 }
11519
11520 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11521 {
11522 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11524 }
11525
11526 else if (action_id ==
EActions.ADD_QUANTITY)
11527 {
11528 if (IsMagazine())
11529 {
11530 Magazine mag = Magazine.Cast(this);
11531 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11532 }
11533 else
11534 {
11536 }
11537
11538 if (m_EM)
11539 {
11540 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11541 }
11542
11543 }
11544
11545 else if (action_id ==
EActions.REMOVE_QUANTITY)
11546 {
11547 if (IsMagazine())
11548 {
11549 Magazine mag2 = Magazine.Cast(this);
11550 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11551 }
11552 else
11553 {
11555 }
11556 if (m_EM)
11557 {
11558 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11559 }
11560
11561 }
11562
11563 else if (action_id ==
EActions.SET_QUANTITY_0)
11564 {
11566
11567 if (m_EM)
11568 {
11569 m_EM.SetEnergy(0);
11570 }
11571 }
11572
11573 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11574 {
11576
11577 if (m_EM)
11578 {
11579 m_EM.SetEnergy(m_EM.GetEnergyMax());
11580 }
11581 }
11582
11583 else if (action_id ==
EActions.ADD_HEALTH)
11584 {
11585 AddHealth("","",GetMaxHealth("","Health")/5);
11586 }
11587 else if (action_id ==
EActions.REMOVE_HEALTH)
11588 {
11589 AddHealth("","",-GetMaxHealth("","Health")/5);
11590 }
11591 else if (action_id ==
EActions.DESTROY_HEALTH)
11592 {
11593 SetHealth01("","",0);
11594 }
11595 else if (action_id ==
EActions.WATCH_ITEM)
11596 {
11598 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11599 #ifdef DEVELOPER
11600 SetDebugDeveloper_item(this);
11601 #endif
11602 }
11603
11604 else if (action_id ==
EActions.ADD_TEMPERATURE)
11605 {
11606 AddTemperature(20);
11607
11608 }
11609
11610 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11611 {
11612 AddTemperature(-20);
11613
11614 }
11615
11616 else if (action_id ==
EActions.FLIP_FROZEN)
11617 {
11618 SetFrozen(!GetIsFrozen());
11619
11620 }
11621
11622 else if (action_id ==
EActions.ADD_WETNESS)
11623 {
11625
11626 }
11627
11628 else if (action_id ==
EActions.REMOVE_WETNESS)
11629 {
11631
11632 }
11633
11634 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11635 {
11638
11639
11640 }
11641
11642 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11643 {
11646 }
11647
11648 else if (action_id ==
EActions.MAKE_SPECIAL)
11649 {
11650 auto debugParams = DebugSpawnParams.WithPlayer(player);
11651 OnDebugSpawnEx(debugParams);
11652 }
11653
11654 }
11655
11656
11657 return false;
11658 }
11659
11660
11661
11662
11666
11669
11670
11671
11673 {
11674 return false;
11675 }
11676
11677
11679 {
11680 return true;
11681 }
11682
11683
11685 {
11686 return true;
11687 }
11688
11689
11690
11692 {
11693 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11694 return g_Game.ConfigIsExisting(config_path);
11695 }
11696
11699 {
11700 return null;
11701 }
11702
11704 {
11705 return false;
11706 }
11707
11709 {
11710 return false;
11711 }
11712
11716
11717
11719 {
11720 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11721 return module_repairing.CanRepair(this, item_repair_kit);
11722 }
11723
11724
11725 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11726 {
11727 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11728 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11729 }
11730
11731
11733 {
11734
11735
11736
11737
11738
11739
11740
11741
11742 return 1;
11743 }
11744
11745
11746
11748 {
11750 }
11751
11752
11753
11755 {
11757 }
11758
11759
11768 {
11769 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11770
11771 if (player)
11772 {
11773 player.MessageStatus(text);
11774 }
11775 }
11776
11777
11786 {
11787 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11788
11789 if (player)
11790 {
11791 player.MessageAction(text);
11792 }
11793 }
11794
11795
11804 {
11805 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11806
11807 if (player)
11808 {
11809 player.MessageFriendly(text);
11810 }
11811 }
11812
11813
11822 {
11823 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11824
11825 if (player)
11826 {
11827 player.MessageImportant(text);
11828 }
11829 }
11830
11832 {
11833 return true;
11834 }
11835
11836
11837 override bool KindOf(
string tag)
11838 {
11839 bool found = false;
11840 string item_name = this.
GetType();
11842 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11843
11844 int array_size = item_tag_array.Count();
11845 for (int i = 0; i < array_size; i++)
11846 {
11847 if (item_tag_array.Get(i) == tag)
11848 {
11849 found = true;
11850 break;
11851 }
11852 }
11853 return found;
11854 }
11855
11856
11858 {
11859
11860 super.OnRPC(sender, rpc_type,ctx);
11861
11862
11863 switch (rpc_type)
11864 {
11865 #ifndef SERVER
11866 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11867 Param2<bool, string> p = new Param2<bool, string>(false, "");
11868
11870 return;
11871
11872 bool play = p.param1;
11873 string soundSet = p.param2;
11874
11875 if (play)
11876 {
11878 {
11880 {
11882 }
11883 }
11884 else
11885 {
11887 }
11888 }
11889 else
11890 {
11892 }
11893
11894 break;
11895 #endif
11896
11897 }
11898
11900 {
11902 }
11903 }
11904
11905
11906
11907
11909 {
11910 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11911 return plugin.GetID(
name);
11912 }
11913
11915 {
11916 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11917 return plugin.GetName(id);
11918 }
11919
11922 {
11923
11924
11925 int varFlags;
11926 if (!ctx.
Read(varFlags))
11927 return;
11928
11929 if (varFlags & ItemVariableFlags.FLOAT)
11930 {
11932 }
11933 }
11934
11936 {
11937
11938 super.SerializeNumericalVars(floats_out);
11939
11940
11941
11943 {
11945 }
11946
11948 {
11950 }
11951
11953 {
11955 }
11956
11958 {
11963 }
11964
11966 {
11968 }
11969 }
11970
11972 {
11973
11974 super.DeSerializeNumericalVars(floats);
11975
11976
11977 int index = 0;
11978 int mask = Math.Round(floats.Get(index));
11979
11980 index++;
11981
11983 {
11985 {
11987 }
11988 else
11989 {
11990 float quantity = floats.Get(index);
11991 SetQuantity(quantity,
true,
false,
false,
false);
11992 }
11993 index++;
11994 }
11995
11997 {
11998 float wet = floats.Get(index);
12000 index++;
12001 }
12002
12004 {
12005 int liquidtype = Math.Round(floats.Get(index));
12007 index++;
12008 }
12009
12011 {
12013 index++;
12015 index++;
12017 index++;
12019 index++;
12020 }
12021
12023 {
12024 int cleanness = Math.Round(floats.Get(index));
12026 index++;
12027 }
12028 }
12029
12031 {
12032 super.WriteVarsToCTX(ctx);
12033
12034
12036 {
12038 }
12039
12041 {
12043 }
12044
12046 {
12048 }
12049
12051 {
12052 int r,g,b,a;
12058 }
12059
12061 {
12063 }
12064 }
12065
12067 {
12068 if (!super.ReadVarsFromCTX(ctx,version))
12069 return false;
12070
12071 int intValue;
12072 float value;
12073
12074 if (version < 140)
12075 {
12076 if (!ctx.
Read(intValue))
12077 return false;
12078
12079 m_VariablesMask = intValue;
12080 }
12081
12083 {
12084 if (!ctx.
Read(value))
12085 return false;
12086
12088 {
12090 }
12091 else
12092 {
12094 }
12095 }
12096
12097 if (version < 140)
12098 {
12100 {
12101 if (!ctx.
Read(value))
12102 return false;
12103 SetTemperatureDirect(value);
12104 }
12105 }
12106
12108 {
12109 if (!ctx.
Read(value))
12110 return false;
12112 }
12113
12115 {
12116 if (!ctx.
Read(intValue))
12117 return false;
12119 }
12120
12122 {
12123 int r,g,b,a;
12125 return false;
12127 return false;
12129 return false;
12131 return false;
12132
12134 }
12135
12137 {
12138 if (!ctx.
Read(intValue))
12139 return false;
12141 }
12142
12143 if (version >= 138 && version < 140)
12144 {
12146 {
12147 if (!ctx.
Read(intValue))
12148 return false;
12149 SetFrozen(intValue);
12150 }
12151 }
12152
12153 return true;
12154 }
12155
12156
12158 {
12161 {
12163 }
12164
12165 if (!super.OnStoreLoad(ctx, version))
12166 {
12168 return false;
12169 }
12170
12171 if (version >= 114)
12172 {
12173 bool hasQuickBarIndexSaved;
12174
12175 if (!ctx.
Read(hasQuickBarIndexSaved))
12176 {
12178 return false;
12179 }
12180
12181 if (hasQuickBarIndexSaved)
12182 {
12183 int itmQBIndex;
12184
12185
12186 if (!ctx.
Read(itmQBIndex))
12187 {
12189 return false;
12190 }
12191
12192 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12193 if (itmQBIndex != -1 && parentPlayer)
12194 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12195 }
12196 }
12197 else
12198 {
12199
12200 PlayerBase player;
12201 int itemQBIndex;
12202 if (version ==
int.
MAX)
12203 {
12204 if (!ctx.
Read(itemQBIndex))
12205 {
12207 return false;
12208 }
12209 }
12210 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12211 {
12212
12213 if (!ctx.
Read(itemQBIndex))
12214 {
12216 return false;
12217 }
12218 if (itemQBIndex != -1 && player)
12219 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12220 }
12221 }
12222
12223 if (version < 140)
12224 {
12225
12226 if (!LoadVariables(ctx, version))
12227 {
12229 return false;
12230 }
12231 }
12232
12233
12235 {
12237 return false;
12238 }
12239 if (version >= 132)
12240 {
12242 if (raib)
12243 {
12245 {
12247 return false;
12248 }
12249 }
12250 }
12251
12253 return true;
12254 }
12255
12256
12257
12259 {
12260 super.OnStoreSave(ctx);
12261
12262 PlayerBase player;
12263 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12264 {
12266
12267 int itemQBIndex = -1;
12268 itemQBIndex = player.FindQuickBarEntityIndex(this);
12269 ctx.
Write(itemQBIndex);
12270 }
12271 else
12272 {
12274 }
12275
12277
12279 if (raib)
12280 {
12282 }
12283 }
12284
12285
12287 {
12288 super.AfterStoreLoad();
12289
12291 {
12293 }
12294
12296 {
12299 }
12300 }
12301
12303 {
12304 super.EEOnAfterLoad();
12305
12307 {
12309 }
12310
12313 }
12314
12316 {
12317 return false;
12318 }
12319
12320
12321
12323 {
12325 {
12326 #ifdef PLATFORM_CONSOLE
12327
12329 {
12331 if (menu)
12332 {
12334 }
12335 }
12336 #endif
12337 }
12338
12340 {
12343 }
12344
12346 {
12347 SetWeightDirty();
12349 }
12351 {
12354 }
12355
12357 {
12360
12363 }
12365 {
12369 }
12370
12371 super.OnVariablesSynchronized();
12372 }
12373
12374
12375
12377 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12378 {
12379 if (!IsServerCheck(allow_client))
12380 return false;
12381
12383 return false;
12384
12387
12388 if (value <= (min + 0.001))
12389 value = min;
12390
12391 if (value == min)
12392 {
12393 if (destroy_config)
12394 {
12395 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12396 if (dstr)
12397 {
12399 this.Delete();
12400 return true;
12401 }
12402 }
12403 else if (destroy_forced)
12404 {
12406 this.Delete();
12407 return true;
12408 }
12409
12411 }
12412
12415
12417 {
12418 EntityAI parent = GetHierarchyRoot();
12419 InventoryLocation iLoc = new InventoryLocation();
12420 GetInventory().GetCurrentInventoryLocation(iLoc);
12422 {
12423 int iLocSlot = iLoc.
GetSlot();
12425 {
12427 }
12429 {
12431 }
12432 }
12433 }
12434
12436 {
12438
12439 if (delta)
12441 }
12442
12444
12445 return false;
12446 }
12447
12448
12450 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12451 {
12453 }
12454
12456 {
12459 }
12460
12462 {
12465 }
12466
12468 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12469 {
12470 float value_clamped = Math.Clamp(value, 0, 1);
12472 SetQuantity(result, destroy_config, destroy_forced);
12473 }
12474
12475
12478 {
12480 }
12481
12483 {
12485 }
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12497 {
12498 int slot = -1;
12499 GameInventory inventory = GetInventory();
12500 if (inventory)
12501 {
12502 InventoryLocation il = new InventoryLocation;
12505 }
12506
12508 }
12509
12511 {
12512 float quantity_max = 0;
12513
12515 {
12516 if (attSlotID != -1)
12517 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12518
12519 if (quantity_max <= 0)
12521 }
12522
12523 if (quantity_max <= 0)
12525
12526 return quantity_max;
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 }
12538
12539
12541 {
12543 }
12544
12546 {
12548 }
12549
12551 {
12553 }
12554
12555
12557 {
12558
12559 float weightEx = GetWeightEx();
12560 float special = GetInventoryAndCargoWeight();
12561 return weightEx - special;
12562 }
12563
12564
12566 {
12568 }
12569
12571 {
12573 {
12574 #ifdef DEVELOPER
12575 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12576 {
12577 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12579 }
12580 #endif
12581
12582 return GetQuantity() * GetConfigWeightModified();
12583 }
12584 else if (HasEnergyManager())
12585 {
12586 #ifdef DEVELOPER
12587 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12588 {
12589 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12590 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12591 }
12592 #endif
12593 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12594 }
12595 else
12596 {
12597 #ifdef DEVELOPER
12598 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12599 {
12600 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12601 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12602 }
12603 #endif
12604 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12605 }
12606 }
12607
12610 {
12611 int item_count = 0;
12613
12614 GameInventory inventory = GetInventory();
12615 CargoBase cargo = inventory.
GetCargo();
12616 if (cargo != NULL)
12617 {
12619 }
12620
12622 for (int i = 0; i < nAttachments; ++i)
12623 {
12625 if (item)
12626 item_count += item.GetNumberOfItems();
12627 }
12628 return item_count;
12629 }
12630
12633 {
12634 float weight = 0;
12635 float wetness = 1;
12636 if (include_wetness)
12639 {
12640 weight = wetness * m_ConfigWeight;
12641 }
12643 {
12644 weight = 1;
12645 }
12646 return weight;
12647 }
12648
12649
12650
12652 {
12653 GameInventory inventory = GetInventory();
12654 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12655 {
12656 array<EntityAI> items = new array<EntityAI>;
12658 for (int i = 0; i < items.Count(); ++i)
12659 {
12661 if (item)
12662 {
12663 g_Game.ObjectDelete(item);
12664 }
12665 }
12666 }
12667 }
12668
12669
12670
12671
12673 {
12674 float energy = 0;
12675 if (HasEnergyManager())
12676 {
12677 energy = GetCompEM().GetEnergy();
12678 }
12679 return energy;
12680 }
12681
12682
12684 {
12685 super.OnEnergyConsumed();
12686
12688 }
12689
12691 {
12692 super.OnEnergyAdded();
12693
12695 }
12696
12697
12699 {
12700 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12701 {
12703 {
12704 float energy_0to1 = GetCompEM().GetEnergy0To1();
12706 }
12707 }
12708 }
12709
12710
12712 {
12713 return ConfigGetFloat("heatIsolation");
12714 }
12715
12717 {
12719 }
12720
12722 {
12723 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12724 if (
g_Game.ConfigIsExisting(paramPath))
12725 return g_Game.ConfigGetFloat(paramPath);
12726
12727 return 0.0;
12728 }
12729
12731 {
12732 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12733 if (
g_Game.ConfigIsExisting(paramPath))
12734 return g_Game.ConfigGetFloat(paramPath);
12735
12736 return 0.0;
12737 }
12738
12739 override void SetWet(
float value,
bool allow_client =
false)
12740 {
12741 if (!IsServerCheck(allow_client))
12742 return;
12743
12746
12748
12749 m_VarWet = Math.Clamp(value, min, max);
12750
12752 {
12755 }
12756 }
12757
12758 override void AddWet(
float value)
12759 {
12761 }
12762
12764 {
12766 }
12767
12769 {
12771 }
12772
12774 {
12776 }
12777
12779 {
12781 }
12782
12784 {
12786 }
12787
12788 override void OnWetChanged(
float newVal,
float oldVal)
12789 {
12792 if (newLevel != oldLevel)
12793 {
12795 }
12796 }
12797
12799 {
12800 SetWeightDirty();
12801 }
12802
12804 {
12805 return GetWetLevelInternal(
m_VarWet);
12806 }
12807
12808
12809
12811 {
12813 }
12814
12816 {
12818 }
12819
12821 {
12823 }
12824
12826 {
12828 }
12829
12830
12831
12833 {
12834 if (ConfigIsExisting("itemModelLength"))
12835 {
12836 return ConfigGetFloat("itemModelLength");
12837 }
12838 return 0;
12839 }
12840
12842 {
12843 if (ConfigIsExisting("itemAttachOffset"))
12844 {
12845 return ConfigGetFloat("itemAttachOffset");
12846 }
12847 return 0;
12848 }
12849
12850 override void SetCleanness(
int value,
bool allow_client =
false)
12851 {
12852 if (!IsServerCheck(allow_client))
12853 return;
12854
12856
12858
12861 }
12862
12864 {
12866 }
12867
12869 {
12870 return true;
12871 }
12872
12873
12874
12875
12877 {
12879 }
12880
12882 {
12884 }
12885
12886
12887
12888
12889 override void SetColor(
int r,
int g,
int b,
int a)
12890 {
12896 }
12898 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12899 {
12904 }
12905
12907 {
12909 }
12910
12913 {
12914 int r,g,b,a;
12916 r = r/255;
12917 g = g/255;
12918 b = b/255;
12919 a = a/255;
12920 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12921 }
12922
12923
12924
12925 override void SetLiquidType(
int value,
bool allow_client =
false)
12926 {
12927 if (!IsServerCheck(allow_client))
12928 return;
12929
12934 }
12935
12937 {
12938 return ConfigGetInt("varLiquidTypeInit");
12939 }
12940
12942 {
12944 }
12945
12947 {
12949 SetFrozen(false);
12950 }
12951
12954 {
12955 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12956 }
12957
12958
12961 {
12962 PlayerBase nplayer;
12963 if (PlayerBase.CastTo(nplayer, player))
12964 {
12966 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12967 }
12968 }
12969
12970
12973 {
12974 PlayerBase nplayer;
12975 if (PlayerBase.CastTo(nplayer,player))
12976 {
12977 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12978 }
12979
12980 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12981
12982 if (HasEnergyManager())
12983 {
12984 GetCompEM().UpdatePlugState();
12985 }
12986 }
12987
12988
12990 {
12991 super.OnPlacementStarted(player);
12992
12994 }
12995
12996 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12997 {
12999 {
13000 m_AdminLog.OnPlacementComplete(player,
this);
13001 }
13002
13003 super.OnPlacementComplete(player, position, orientation);
13004 }
13005
13006
13007
13008
13009
13011 {
13013 {
13014 return true;
13015 }
13016 else
13017 {
13018 return false;
13019 }
13020 }
13021
13022
13024 {
13026 {
13028 }
13029 }
13030
13031
13033 {
13035 }
13036
13038 {
13040 }
13041
13042 override void InsertAgent(
int agent,
float count = 1)
13043 {
13044 if (count < 1)
13045 return;
13046
13048 }
13049
13052 {
13054 }
13055
13056
13058 {
13060 }
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13104 {
13106 return false;
13107 return true;
13108 }
13109
13111 {
13112
13114 }
13115
13116
13119 {
13120 super.CheckForRoofLimited(timeTresholdMS);
13121
13122 float time =
g_Game.GetTime();
13123 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13124 {
13125 m_PreviousRoofTestTime = time;
13126 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13127 }
13128 }
13129
13130
13132 {
13134 {
13135 return 0;
13136 }
13137
13138 if (GetInventory().GetAttachmentSlotsCount() != 0)
13139 {
13140 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13141 if (filter)
13142 return filter.GetProtectionLevel(type, false, system);
13143 else
13144 return 0;
13145 }
13146
13147 string subclassPath, entryName;
13148
13149 switch (type)
13150 {
13152 entryName = "biological";
13153 break;
13155 entryName = "chemical";
13156 break;
13157 default:
13158 entryName = "biological";
13159 break;
13160 }
13161
13162 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13163
13164 return g_Game.ConfigGetFloat(subclassPath + entryName);
13165 }
13166
13167
13168
13171 {
13172 if (!IsMagazine())
13174
13176 }
13177
13178
13179
13180
13181
13186 {
13187 return true;
13188 }
13189
13191 {
13193 }
13194
13195
13196
13197
13198
13200 {
13201 if (parent)
13202 {
13203 if (parent.IsInherited(DayZInfected))
13204 return true;
13205
13206 if (!parent.IsRuined())
13207 return true;
13208 }
13209
13210 return true;
13211 }
13212
13214 {
13215 if (!super.CanPutAsAttachment(parent))
13216 {
13217 return false;
13218 }
13219
13220 if (!IsRuined() && !parent.IsRuined())
13221 {
13222 return true;
13223 }
13224
13225 return false;
13226 }
13227
13229 {
13230
13231
13232
13233
13234 return super.CanReceiveItemIntoCargo(item);
13235 }
13236
13238 {
13239
13240
13241
13242
13243 GameInventory attachmentInv = attachment.GetInventory();
13245 {
13246 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13247 return false;
13248 }
13249
13250 InventoryLocation loc = new InventoryLocation();
13251 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13252 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13253 return false;
13254
13255 return super.CanReceiveAttachment(attachment, slotId);
13256 }
13257
13259 {
13260 if (!super.CanReleaseAttachment(attachment))
13261 return false;
13262
13263 return GetInventory().AreChildrenAccessible();
13264 }
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13287 {
13288 int id = muzzle_owner.GetMuzzleID();
13289 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13290
13291 if (WPOF_array)
13292 {
13293 for (int i = 0; i < WPOF_array.Count(); i++)
13294 {
13295 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13296
13297 if (WPOF)
13298 {
13299 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13300 }
13301 }
13302 }
13303 }
13304
13305
13307 {
13308 int id = muzzle_owner.GetMuzzleID();
13310
13311 if (WPOBE_array)
13312 {
13313 for (int i = 0; i < WPOBE_array.Count(); i++)
13314 {
13315 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13316
13317 if (WPOBE)
13318 {
13319 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13320 }
13321 }
13322 }
13323 }
13324
13325
13327 {
13328 int id = muzzle_owner.GetMuzzleID();
13329 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13330
13331 if (WPOOH_array)
13332 {
13333 for (int i = 0; i < WPOOH_array.Count(); i++)
13334 {
13335 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13336
13337 if (WPOOH)
13338 {
13339 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13340 }
13341 }
13342 }
13343 }
13344
13345
13347 {
13348 int id = muzzle_owner.GetMuzzleID();
13349 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13350
13351 if (WPOOH_array)
13352 {
13353 for (int i = 0; i < WPOOH_array.Count(); i++)
13354 {
13355 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13356
13357 if (WPOOH)
13358 {
13359 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13360 }
13361 }
13362 }
13363 }
13364
13365
13367 {
13368 int id = muzzle_owner.GetMuzzleID();
13369 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13370
13371 if (WPOOH_array)
13372 {
13373 for (int i = 0; i < WPOOH_array.Count(); i++)
13374 {
13375 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13376
13377 if (WPOOH)
13378 {
13379 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13380 }
13381 }
13382 }
13383 }
13384
13385
13386
13388 {
13390 {
13391 return true;
13392 }
13393
13394 return false;
13395 }
13396
13398 {
13400 {
13401 return true;
13402 }
13403
13404 return false;
13405 }
13406
13408 {
13410 {
13411 return true;
13412 }
13413
13414 return false;
13415 }
13416
13418 {
13419 return false;
13420 }
13421
13424 {
13425 return UATimeSpent.DEFAULT_DEPLOY;
13426 }
13427
13428
13429
13430
13432 {
13434 SetSynchDirty();
13435 }
13436
13438 {
13440 }
13441
13442
13444 {
13445 return false;
13446 }
13447
13450 {
13451 string att_type = "None";
13452
13453 if (ConfigIsExisting("soundAttType"))
13454 {
13455 att_type = ConfigGetString("soundAttType");
13456 }
13457
13459 }
13460
13462 {
13464 }
13465
13466
13467
13468
13469
13475
13477 {
13480
13482 }
13483
13484
13486 {
13488 return;
13489
13491
13494
13497
13498 SoundParameters params = new SoundParameters();
13502 }
13503
13504
13506 {
13508 {
13511
13512 SetSynchDirty();
13513
13516 }
13517 }
13518
13520 {
13522 }
13523
13524
13526 {
13528 return;
13529
13531 SetSynchDirty();
13532
13535 }
13536
13538 {
13541 }
13542
13544 {
13546 }
13547
13548 void OnApply(PlayerBase player);
13549
13551 {
13552 return 1.0;
13553 };
13554
13556 {
13558 }
13559
13561 {
13563 }
13564
13566
13568 {
13569 SetDynamicPhysicsLifeTime(0.01);
13571 }
13572
13574 {
13575 array<string> zone_names = new array<string>;
13576 GetDamageZones(zone_names);
13577 for (int i = 0; i < zone_names.Count(); i++)
13578 {
13579 SetHealthMax(zone_names.Get(i),"Health");
13580 }
13581 SetHealthMax("","Health");
13582 }
13583
13586 {
13587 float global_health = GetHealth01("","Health");
13588 array<string> zones = new array<string>;
13589 GetDamageZones(zones);
13590
13591 for (int i = 0; i < zones.Count(); i++)
13592 {
13593 SetHealth01(zones.Get(i),"Health",global_health);
13594 }
13595 }
13596
13599 {
13600 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13601 }
13602
13604 {
13605 if (!hasRootAsPlayer)
13606 {
13607 if (refParentIB)
13608 {
13609
13610 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13611 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13612
13613 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13614 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13615
13618 }
13619 else
13620 {
13621
13624 }
13625 }
13626 }
13627
13629 {
13631 {
13632 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13633 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13634 {
13635 float heatPermCoef = 1.0;
13637 while (ent)
13638 {
13639 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13640 ent = ent.GetHierarchyParent();
13641 }
13642
13643 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13644 }
13645 }
13646 }
13647
13649 {
13650
13651 EntityAI parent = GetHierarchyParent();
13652 if (!parent)
13653 {
13654 hasParent = false;
13655 hasRootAsPlayer = false;
13656 }
13657 else
13658 {
13659 hasParent = true;
13660 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13661 refParentIB =
ItemBase.Cast(parent);
13662 }
13663 }
13664
13665 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13666 {
13667
13668 }
13669
13671 {
13672
13673 return false;
13674 }
13675
13677 {
13678
13679
13680 return false;
13681 }
13682
13684 {
13685
13686 return false;
13687 }
13688
13691 {
13692 return !GetIsFrozen() &&
IsOpen();
13693 }
13694
13696 {
13697 bool hasParent = false, hasRootAsPlayer = false;
13699
13700 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13701 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13702
13703 if (wwtu || foodDecay)
13704 {
13708
13709 if (processWetness || processTemperature || processDecay)
13710 {
13712
13713 if (processWetness)
13714 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13715
13716 if (processTemperature)
13718
13719 if (processDecay)
13720 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13721 }
13722 }
13723 }
13724
13727 {
13729 }
13730
13732 {
13735
13736 return super.GetTemperatureFreezeThreshold();
13737 }
13738
13740 {
13743
13744 return super.GetTemperatureThawThreshold();
13745 }
13746
13748 {
13751
13752 return super.GetItemOverheatThreshold();
13753 }
13754
13756 {
13758 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13759
13760 return super.GetTemperatureFreezeTime();
13761 }
13762
13764 {
13766 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13767
13768 return super.GetTemperatureThawTime();
13769 }
13770
13775
13777 {
13778 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13779 }
13780
13782 {
13783 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13784 }
13785
13788 {
13790 }
13791
13793 {
13795 }
13796
13798 {
13800 }
13801
13804 {
13805 return null;
13806 }
13807
13810 {
13811 return false;
13812 }
13813
13815 {
13817 {
13820 if (!trg)
13821 {
13823 explosive = this;
13824 }
13825
13826 explosive.PairRemote(trg);
13828
13829 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13830 trg.SetPersistentPairID(persistentID);
13831 explosive.SetPersistentPairID(persistentID);
13832
13833 return true;
13834 }
13835 return false;
13836 }
13837
13840 {
13841 float ret = 1.0;
13844 ret *= GetHealth01();
13845
13846 return ret;
13847 }
13848
13849 #ifdef DEVELOPER
13850 override void SetDebugItem()
13851 {
13852 super.SetDebugItem();
13853 _itemBase = this;
13854 }
13855
13857 {
13858 string text = super.GetDebugText();
13859
13861 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13862
13863 return text;
13864 }
13865 #endif
13866
13868 {
13869 return true;
13870 }
13871
13873
13875
13877 {
13880 }
13881
13882
13890
13906
13907 [
Obsolete(
"Use ItemSoundHandler instead")]
13910 {
13911 if (!
g_Game.IsDedicatedServer())
13912 {
13913 if (ConfigIsExisting("attachSoundSet"))
13914 {
13915 string cfg_path = "";
13916 string soundset = "";
13917 string type_name =
GetType();
13918
13921 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13922 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13923
13924 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13925 {
13926 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13927 {
13928 if (cfg_slot_array[i] == slot_type)
13929 {
13930 soundset = cfg_soundset_array[i];
13931 break;
13932 }
13933 }
13934 }
13935
13936 if (soundset != "")
13937 {
13938 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13940 }
13941 }
13942 }
13943 }
13944
13946}
13947
13949{
13951 if (entity)
13952 {
13953 bool is_item = entity.IsInherited(
ItemBase);
13954 if (is_item && full_quantity)
13955 {
13958 }
13959 }
13960 else
13961 {
13963 return NULL;
13964 }
13965 return entity;
13966}
13967
13969{
13970 if (item)
13971 {
13972 if (health > 0)
13973 item.SetHealth("", "", health);
13974
13975 if (item.CanHaveTemperature())
13976 {
13978 if (item.CanFreeze())
13979 item.SetFrozen(false);
13980 }
13981
13982 if (item.HasEnergyManager())
13983 {
13984 if (quantity >= 0)
13985 {
13986 item.GetCompEM().SetEnergy0To1(quantity);
13987 }
13988 else
13989 {
13991 }
13992 }
13993 else if (item.IsMagazine())
13994 {
13995 Magazine mag = Magazine.Cast(item);
13996 if (quantity >= 0)
13997 {
13998 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13999 }
14000 else
14001 {
14003 }
14004
14005 }
14006 else
14007 {
14008 if (quantity >= 0)
14009 {
14010 item.SetQuantityNormalized(quantity, false);
14011 }
14012 else
14013 {
14015 }
14016
14017 }
14018 }
14019}
14020
14021#ifdef DEVELOPER
14023#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.