9103{
9105 {
9106 return true;
9107 }
9108};
9109
9110
9111
9113{
9117
9119
9122
9123
9124
9125
9126
9135
9141
9146
9151
9172 protected bool m_IsResultOfSplit
9173
9175
9180
9181
9182
9184
9188
9189
9190
9192
9195
9196
9197
9203
9204
9212
9215
9216
9218
9219
9221
9222
9227
9228
9233
9234
9236
9237
9239 {
9244
9245 if (!
GetGame().IsDedicatedServer())
9246 {
9248 {
9250
9252 {
9254 }
9255 }
9256
9259 }
9260
9261 m_OldLocation = null;
9262
9264 {
9266 }
9267
9268 if (ConfigIsExisting("headSelectionsToHide"))
9269 {
9272 }
9273
9275 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9276 {
9278 }
9279
9281
9282 m_IsResultOfSplit = false;
9283
9285 }
9286
9288 {
9289 super.InitItemVariables();
9290
9296 m_Count = ConfigGetInt(
"count");
9297
9300
9305
9308
9313
9325
9329
9330
9333 if (ConfigIsExisting("canBeSplit"))
9334 {
9337 }
9338
9340 if (ConfigIsExisting("itemBehaviour"))
9342
9343
9346 RegisterNetSyncVariableInt("m_VarLiquidType");
9347 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9348
9349 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9350 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9351 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9352
9353 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9354 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9355 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9356 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9357
9358 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9359 RegisterNetSyncVariableBool("m_IsTakeable");
9360 RegisterNetSyncVariableBool("m_IsHologram");
9361
9364 {
9367 }
9368
9370
9372 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9374
9375 }
9376
9378 {
9380 }
9381
9383 {
9386 {
9391 }
9392 }
9393
9394 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9395 {
9397 {
9400 }
9401
9403 }
9404
9406 {
9412 }
9413
9415
9417 {
9419
9420 if (!action)
9421 {
9422 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9423 return;
9424 }
9425
9427 if (!ai)
9428 {
9430 return;
9431 }
9432
9434 if (!action_array)
9435 {
9436 action_array = new array<ActionBase_Basic>;
9438 }
9439 if (LogManager.IsActionLogEnable())
9440 {
9441 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9442 }
9443
9444 if (action_array.Find(action) != -1)
9445 {
9446 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9447 }
9448 else
9449 {
9450 action_array.Insert(action);
9451 }
9452 }
9453
9455 {
9457 ActionBase action = player.GetActionManager().GetAction(actionName);
9460
9461 if (action_array)
9462 {
9463 action_array.RemoveItem(action);
9464 }
9465 }
9466
9467
9468
9470 {
9471 ActionOverrideData overrideData = new ActionOverrideData();
9475
9477 if (!actionMap)
9478 {
9481 }
9482
9483 actionMap.Insert(this.
Type(), overrideData);
9484
9485 }
9486
9488
9490
9491
9493 {
9496
9499
9500 string config_to_search = "CfgVehicles";
9501 string muzzle_owner_config;
9502
9504 {
9505 if (IsInherited(Weapon))
9506 config_to_search = "CfgWeapons";
9507
9508 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9509
9510 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9511
9513
9514 if (config_OnFire_subclass_count > 0)
9515 {
9516 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9517
9518 for (int i = 0; i < config_OnFire_subclass_count; i++)
9519 {
9520 string particle_class = "";
9522 string config_OnFire_entry = config_OnFire_class + particle_class;
9523 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9524 WPOF_array.Insert(WPOF);
9525 }
9526
9527
9529 }
9530 }
9531
9533 {
9534 config_to_search = "CfgWeapons";
9535 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9536
9537 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9538
9540
9541 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9542 {
9543 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9544
9545 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9546 {
9547 string particle_class2 = "";
9549 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9550 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9551 WPOBE_array.Insert(WPOBE);
9552 }
9553
9554
9556 }
9557 }
9558 }
9559
9560
9562 {
9565
9567 {
9568 string config_to_search = "CfgVehicles";
9569
9570 if (IsInherited(Weapon))
9571 config_to_search = "CfgWeapons";
9572
9573 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9574 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9575
9576 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9577 {
9578
9580
9582 {
9584 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9586 return;
9587 }
9588
9591
9592
9593
9595 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9596
9597 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9598 {
9599 string particle_class = "";
9601 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9603
9604 if (entry_type == CT_CLASS)
9605 {
9606 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9607 WPOOH_array.Insert(WPOF);
9608 }
9609 }
9610
9611
9613 }
9614 }
9615 }
9616
9618 {
9620 }
9621
9623 {
9625 {
9627
9630
9633
9634 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9635 }
9636 }
9637
9639 {
9641 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9642
9644 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9645
9647 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9648
9650 {
9652 }
9653 }
9654
9656 {
9658 }
9659
9661 {
9664 else
9666
9668 {
9671 }
9672 else
9673 {
9676
9679 }
9680
9682 }
9683
9685 {
9687 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9688 }
9689
9691 {
9693 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9695 }
9696
9698 {
9700 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9701 }
9702
9704 {
9707
9708 OverheatingParticle OP = new OverheatingParticle();
9713
9715 }
9716
9718 {
9721
9722 return -1;
9723 }
9724
9726 {
9728 {
9731
9732 for (int i = count; i > 0; --i)
9733 {
9734 int id = i - 1;
9737
9740
9741 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9742 {
9743 if (p)
9744 {
9747 }
9748 }
9749 }
9750 }
9751 }
9752
9754 {
9756 {
9758 {
9759 int id = i - 1;
9761
9762 if (OP)
9763 {
9765
9766 if (p)
9767 {
9769 }
9770
9771 delete OP;
9772 }
9773 }
9774
9777 }
9778 }
9779
9782 {
9783 return 0.0;
9784 }
9785
9786
9788 {
9789 return 250;
9790 }
9791
9793 {
9794 return 0;
9795 }
9796
9799 {
9801 return true;
9802
9803 return false;
9804 }
9805
9808 {
9811
9813 {
9815 }
9816 else
9817 {
9818
9820 }
9821
9823 }
9824
9831 {
9832 return -1;
9833 }
9834
9835
9836
9837
9839 {
9841 {
9843 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9844
9845 if (r_index >= 0)
9846 {
9847 InventoryLocation r_il = new InventoryLocation;
9848 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9849
9850 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9853 {
9854 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9855 }
9857 {
9858 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9859 }
9860
9861 }
9862
9863 player.GetHumanInventory().ClearUserReservedLocation(this);
9864 }
9865
9868 }
9869
9870
9871
9872
9874 {
9875 return ItemBase.m_DebugActionsMask;
9876 }
9877
9879 {
9880 return ItemBase.m_DebugActionsMask & mask;
9881 }
9882
9884 {
9885 ItemBase.m_DebugActionsMask = mask;
9886 }
9887
9889 {
9890 ItemBase.m_DebugActionsMask |= mask;
9891 }
9892
9894 {
9895 ItemBase.m_DebugActionsMask &= ~mask;
9896 }
9897
9899 {
9901 {
9903 }
9904 else
9905 {
9907 }
9908 }
9909
9910
9912 {
9913 if (GetEconomyProfile())
9914 {
9915 float q_max = GetEconomyProfile().GetQuantityMax();
9916 if (q_max > 0)
9917 {
9918 float q_min = GetEconomyProfile().GetQuantityMin();
9919 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9920
9922 {
9923 ComponentEnergyManager comp = GetCompEM();
9925 {
9927 }
9928 }
9930 {
9932
9933 }
9934
9935 }
9936 }
9937 }
9938
9941 {
9942 EntityAI parent = GetHierarchyParent();
9943
9944 if (parent)
9945 {
9946 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9947 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9948 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9949 }
9950 }
9951
9954 {
9955 EntityAI parent = GetHierarchyParent();
9956
9957 if (parent)
9958 {
9959 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9960 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9961 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9962 }
9963 }
9964
9966 {
9967
9968
9969
9970
9972
9974 {
9975 if (ScriptInputUserData.CanStoreInputUserData())
9976 {
9977 ScriptInputUserData ctx = new ScriptInputUserData;
9983 ctx.
Write(use_stack_max);
9986
9988 {
9989 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9990 }
9991 }
9992 }
9993 else if (!
GetGame().IsMultiplayer())
9994 {
9996 }
9997 }
9998
10000 {
10002 }
10003
10005 {
10007 }
10008
10010 {
10012 }
10013
10015 {
10016
10017 return false;
10018 }
10019
10021 {
10022 return false;
10023 }
10024
10028 {
10029 return false;
10030 }
10031
10033 {
10034 return "";
10035 }
10036
10038
10040 {
10041 return false;
10042 }
10043
10045 {
10046 return true;
10047 }
10048
10049
10050
10052 {
10053 return true;
10054 }
10055
10057 {
10058 return true;
10059 }
10060
10062 {
10063 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10065 }
10066
10068 {
10070 }
10071
10073 {
10075 if (!is_being_placed)
10077 SetSynchDirty();
10078 }
10079
10080
10082
10084 {
10086 }
10087
10089 {
10091 }
10092
10094 {
10095 return 1;
10096 }
10097
10099 {
10100 return false;
10101 }
10102
10104 {
10106 SetSynchDirty();
10107 }
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10144 {
10145 super.OnMovedInsideCargo(container);
10146
10147 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10148 }
10149
10150 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10151 {
10152 super.EEItemLocationChanged(oldLoc,newLoc);
10153
10154 PlayerBase new_player = null;
10155 PlayerBase old_player = null;
10156
10157 if (newLoc.GetParent())
10158 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10159
10160 if (oldLoc.GetParent())
10161 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10162
10164 {
10165 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10166
10167 if (r_index >= 0)
10168 {
10169 InventoryLocation r_il = new InventoryLocation;
10170 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10171
10172 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10175 {
10176 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10177 }
10179 {
10180 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10181 }
10182
10183 }
10184 }
10185
10187 {
10188 if (new_player)
10189 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10190
10191 if (new_player == old_player)
10192 {
10193
10194 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10195 {
10197 {
10198 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10199 {
10200 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10201 }
10202 }
10203 else
10204 {
10205 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10206 }
10207 }
10208
10209 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10210 {
10211 int type = oldLoc.GetType();
10213 {
10214 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10215 }
10217 {
10218 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10219 }
10220 }
10221 if (!m_OldLocation)
10222 {
10223 m_OldLocation = new InventoryLocation;
10224 }
10225 m_OldLocation.Copy(oldLoc);
10226 }
10227 else
10228 {
10229 if (m_OldLocation)
10230 {
10231 m_OldLocation.Reset();
10232 }
10233 }
10234
10236 }
10237 else
10238 {
10239 if (new_player)
10240 {
10241 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10242 if (res_index >= 0)
10243 {
10244 InventoryLocation il = new InventoryLocation;
10245 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10247 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10250 {
10251 il.
GetParent().GetOnReleaseLock().Invoke(it);
10252 }
10254 {
10256 }
10257
10258 }
10259 }
10261 {
10262
10264 }
10265
10266 if (m_OldLocation)
10267 {
10268 m_OldLocation.Reset();
10269 }
10270 }
10271 }
10272
10273 override void EOnContact(IEntity other, Contact extra)
10274 {
10276 {
10277 int liquidType = -1;
10279 if (impactSpeed > 0.0)
10280 {
10282 #ifndef SERVER
10284 #else
10286 SetSynchDirty();
10287 #endif
10289 }
10290 }
10291
10292 #ifdef SERVER
10293 if (GetCompEM() && GetCompEM().IsPlugged())
10294 {
10295 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10296 GetCompEM().UnplugThis();
10297 }
10298 #endif
10299 }
10300
10302
10304 {
10306 }
10307
10309 {
10310
10311 }
10312
10314 {
10315 super.OnItemLocationChanged(old_owner, new_owner);
10316
10317 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10318 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10319
10320 if (!relatedPlayer && playerNew)
10321 relatedPlayer = playerNew;
10322
10323 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10324 {
10326 if (actionMgr)
10327 {
10328 ActionBase currentAction = actionMgr.GetRunningAction();
10329 if (currentAction)
10331 }
10332 }
10333
10334 Man ownerPlayerOld = null;
10335 Man ownerPlayerNew = null;
10336
10337 if (old_owner)
10338 {
10339 if (old_owner.
IsMan())
10340 {
10341 ownerPlayerOld = Man.Cast(old_owner);
10342 }
10343 else
10344 {
10345 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10346 }
10347 }
10348 else
10349 {
10351 {
10353
10354 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10355 {
10356 GetCompEM().UnplugThis();
10357 }
10358 }
10359 }
10360
10361 if (new_owner)
10362 {
10363 if (new_owner.
IsMan())
10364 {
10365 ownerPlayerNew = Man.Cast(new_owner);
10366 }
10367 else
10368 {
10369 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10370 }
10371 }
10372
10373 if (ownerPlayerOld != ownerPlayerNew)
10374 {
10375 if (ownerPlayerOld)
10376 {
10377 array<EntityAI> subItemsExit = new array<EntityAI>;
10379 for (int i = 0; i < subItemsExit.Count(); i++)
10380 {
10383 }
10384 }
10385
10386 if (ownerPlayerNew)
10387 {
10388 array<EntityAI> subItemsEnter = new array<EntityAI>;
10390 for (int j = 0; j < subItemsEnter.Count(); j++)
10391 {
10394 }
10395 }
10396 }
10397 else if (ownerPlayerNew != null)
10398 {
10399 PlayerBase nplayer;
10400 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10401 {
10402 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10404 for (int k = 0; k < subItemsUpdate.Count(); k++)
10405 {
10407 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10408 }
10409 }
10410 }
10411
10412 if (old_owner)
10413 old_owner.OnChildItemRemoved(this);
10414 if (new_owner)
10415 new_owner.OnChildItemReceived(this);
10416 }
10417
10418
10420 {
10421 super.EEDelete(parent);
10422 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10423 if (player)
10424 {
10426
10427 if (player.IsAlive())
10428 {
10429 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10430 if (r_index >= 0)
10431 {
10432 InventoryLocation r_il = new InventoryLocation;
10433 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10434
10435 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10438 {
10439 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10440 }
10442 {
10443 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10444 }
10445
10446 }
10447
10448 player.RemoveQuickBarEntityShortcut(this);
10449 }
10450 }
10451 }
10452
10454 {
10455 super.EEKilled(killer);
10456
10459 {
10460 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10461 {
10462 if (IsMagazine())
10463 {
10464 if (Magazine.Cast(this).GetAmmoCount() > 0)
10465 {
10467 }
10468 }
10469 else
10470 {
10472 }
10473 }
10474 }
10475 }
10476
10478 {
10479 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10480
10481 super.OnWasAttached(parent, slot_id);
10482
10485
10487 }
10488
10490 {
10491 super.OnWasDetached(parent, slot_id);
10492
10495 }
10496
10498 {
10499 int idx;
10502
10503 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10504 if (inventory_slots.Count() < 1)
10505 {
10506 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10507 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10508 }
10509 else
10510 {
10511 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10512 }
10513
10514 idx = inventory_slots.Find(slot);
10515 if (idx < 0)
10516 return "";
10517
10518 return attach_types.Get(idx);
10519 }
10520
10522 {
10523 int idx = -1;
10524 string slot;
10525
10528
10529 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10530 if (inventory_slots.Count() < 1)
10531 {
10532 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10533 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10534 }
10535 else
10536 {
10537 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10538 if (detach_types.Count() < 1)
10539 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10540 }
10541
10542 for (int i = 0; i < inventory_slots.Count(); i++)
10543 {
10544 slot = inventory_slots.Get(i);
10545 }
10546
10547 if (slot != "")
10548 {
10549 if (detach_types.Count() == 1)
10550 idx = 0;
10551 else
10552 idx = inventory_slots.Find(slot);
10553 }
10554 if (idx < 0)
10555 return "";
10556
10557 return detach_types.Get(idx);
10558 }
10559
10561 {
10562
10564
10565
10566 float min_time = 1;
10567 float max_time = 3;
10568 float delay = Math.RandomFloat(min_time, max_time);
10569
10570 explode_timer.Run(delay, this, "DoAmmoExplosion");
10571 }
10572
10574 {
10575 Magazine magazine = Magazine.Cast(this);
10576 int pop_sounds_count = 6;
10577 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10578
10579
10580 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10581 string sound_name = pop_sounds[ sound_idx ];
10583
10584
10585 magazine.ServerAddAmmoCount(-1);
10586
10587
10588 float min_temp_to_explode = 100;
10589
10590 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10591 {
10593 }
10594 }
10595
10596
10597 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10598 {
10599 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10600
10601 const int CHANCE_DAMAGE_CARGO = 4;
10602 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10603 const int CHANCE_DAMAGE_NOTHING = 2;
10604
10606 {
10607 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10608 int chances;
10609 int rnd;
10610
10611 if (GetInventory().GetCargo())
10612 {
10613 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10614 rnd = Math.RandomInt(0,chances);
10615
10616 if (rnd < CHANCE_DAMAGE_CARGO)
10617 {
10619 }
10620 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10621 {
10623 }
10624 }
10625 else
10626 {
10627 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10628 rnd = Math.RandomInt(0,chances);
10629
10630 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10631 {
10633 }
10634 }
10635 }
10636 }
10637
10639 {
10640 if (GetInventory().GetCargo())
10641 {
10642 int item_count = GetInventory().GetCargo().GetItemCount();
10643 if (item_count > 0)
10644 {
10645 int random_pick = Math.RandomInt(0, item_count);
10647 if (!item.IsExplosive())
10648 {
10649 item.AddHealth("","",damage);
10650 return true;
10651 }
10652 }
10653 }
10654 return false;
10655 }
10656
10658 {
10659 int attachment_count = GetInventory().AttachmentCount();
10660 if (attachment_count > 0)
10661 {
10662 int random_pick = Math.RandomInt(0, attachment_count);
10663 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10664 if (!attachment.IsExplosive())
10665 {
10666 attachment.AddHealth("","",damage);
10667 return true;
10668 }
10669 }
10670 return false;
10671 }
10672
10674 {
10676 }
10677
10679 {
10681 return GetInventory().CanRemoveEntity();
10682
10683 return false;
10684 }
10685
10687 {
10688
10690 return false;
10691
10692
10694 return false;
10695
10696
10697
10699 if (delta == 0)
10700 return false;
10701
10702
10703 return true;
10704 }
10705
10707 {
10709 {
10710 if (ScriptInputUserData.CanStoreInputUserData())
10711 {
10712 ScriptInputUserData ctx = new ScriptInputUserData;
10717 ctx.
Write(destination_entity);
10719 ctx.
Write(slot_id);
10721 }
10722 }
10723 else if (!
GetGame().IsMultiplayer())
10724 {
10726 }
10727 }
10728
10730 {
10731 float split_quantity_new;
10735 InventoryLocation loc = new InventoryLocation;
10736
10737 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10738 {
10740 split_quantity_new = stack_max;
10741 else
10743
10745 {
10746 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10747 if (new_item)
10748 {
10749 new_item.SetResultOfSplit(true);
10750 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10752 new_item.
SetQuantity(split_quantity_new,
false,
true);
10753 }
10754 }
10755 }
10756 else if (destination_entity && slot_id == -1)
10757 {
10758 if (quantity > stack_max)
10759 split_quantity_new = stack_max;
10760 else
10761 split_quantity_new = quantity;
10762
10764 {
10766 {
10769 }
10770
10771 if (new_item)
10772 {
10773 new_item.SetResultOfSplit(true);
10774 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10776 new_item.
SetQuantity(split_quantity_new,
false,
true);
10777 }
10778 }
10779 }
10780 else
10781 {
10782 if (stack_max != 0)
10783 {
10785 {
10787 }
10788
10789 if (split_quantity_new == 0)
10790 {
10791 if (!
GetGame().IsMultiplayer())
10792 player.PhysicalPredictiveDropItem(this);
10793 else
10794 player.ServerDropEntity(this);
10795 return;
10796 }
10797
10799 {
10801
10802 if (new_item)
10803 {
10804 new_item.SetResultOfSplit(true);
10805 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10808 new_item.PlaceOnSurface();
10809 }
10810 }
10811 }
10812 }
10813 }
10814
10816 {
10817 float split_quantity_new;
10821 InventoryLocation loc = new InventoryLocation;
10822
10823 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10824 {
10826 split_quantity_new = stack_max;
10827 else
10829
10831 {
10832 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10833 if (new_item)
10834 {
10835 new_item.SetResultOfSplit(true);
10836 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10838 new_item.
SetQuantity(split_quantity_new,
false,
true);
10839 }
10840 }
10841 }
10842 else if (destination_entity && slot_id == -1)
10843 {
10844 if (quantity > stack_max)
10845 split_quantity_new = stack_max;
10846 else
10847 split_quantity_new = quantity;
10848
10850 {
10852 {
10855 }
10856
10857 if (new_item)
10858 {
10859 new_item.SetResultOfSplit(true);
10860 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10862 new_item.
SetQuantity(split_quantity_new,
false,
true);
10863 }
10864 }
10865 }
10866 else
10867 {
10868 if (stack_max != 0)
10869 {
10871 {
10873 }
10874
10876 {
10878
10879 if (new_item)
10880 {
10881 new_item.SetResultOfSplit(true);
10882 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10885 new_item.PlaceOnSurface();
10886 }
10887 }
10888 }
10889 }
10890 }
10891
10893 {
10895 {
10896 if (ScriptInputUserData.CanStoreInputUserData())
10897 {
10898 ScriptInputUserData ctx = new ScriptInputUserData;
10903 dst.WriteToContext(ctx);
10905 }
10906 }
10907 else if (!
GetGame().IsMultiplayer())
10908 {
10910 }
10911 }
10912
10914 {
10916 {
10917 if (ScriptInputUserData.CanStoreInputUserData())
10918 {
10919 ScriptInputUserData ctx = new ScriptInputUserData;
10924 ctx.
Write(destination_entity);
10930 }
10931 }
10932 else if (!
GetGame().IsMultiplayer())
10933 {
10935 }
10936 }
10937
10939 {
10941 }
10942
10944 {
10946 float split_quantity_new;
10948 if (dst.IsValid())
10949 {
10950 int slot_id = dst.GetSlot();
10952
10953 if (quantity > stack_max)
10954 split_quantity_new = stack_max;
10955 else
10956 split_quantity_new = quantity;
10957
10959 {
10961
10962 if (new_item)
10963 {
10964 new_item.SetResultOfSplit(true);
10965 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10967 new_item.
SetQuantity(split_quantity_new,
false,
true);
10968 }
10969
10970 return new_item;
10971 }
10972 }
10973
10974 return null;
10975 }
10976
10978 {
10980 float split_quantity_new;
10982 if (destination_entity)
10983 {
10985 if (quantity > stackable)
10986 split_quantity_new = stackable;
10987 else
10988 split_quantity_new = quantity;
10989
10991 {
10992 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10993 if (new_item)
10994 {
10995 new_item.SetResultOfSplit(true);
10996 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10998 new_item.
SetQuantity(split_quantity_new,
false,
true);
10999 }
11000 }
11001 }
11002 }
11003
11005 {
11007 {
11008 if (ScriptInputUserData.CanStoreInputUserData())
11009 {
11010 ScriptInputUserData ctx = new ScriptInputUserData;
11015 ItemBase destination_entity =
this;
11016 ctx.
Write(destination_entity);
11020 }
11021 }
11022 else if (!
GetGame().IsMultiplayer())
11023 {
11025 }
11026 }
11027
11029 {
11031 float split_quantity_new;
11033 if (player)
11034 {
11036 if (quantity > stackable)
11037 split_quantity_new = stackable;
11038 else
11039 split_quantity_new = quantity;
11040
11042 {
11043 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11044 new_item =
ItemBase.Cast(in_hands);
11045 if (new_item)
11046 {
11047 new_item.SetResultOfSplit(true);
11048 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11050 new_item.SetQuantity(split_quantity_new, false, true);
11051 }
11052 }
11053 }
11054 }
11055
11057 {
11059 float split_quantity_new = Math.Floor(quantity * 0.5);
11060
11062 return;
11063
11065
11066 if (new_item)
11067 {
11068 if (new_item.GetQuantityMax() < split_quantity_new)
11069 {
11070 split_quantity_new = new_item.GetQuantityMax();
11071 }
11072
11073 new_item.SetResultOfSplit(true);
11074 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11075
11077 {
11080 }
11081 else
11082 {
11084 new_item.
SetQuantity(split_quantity_new,
false,
true);
11085 }
11086 }
11087 }
11088
11090 {
11092 float split_quantity_new = Math.Floor(quantity / 2);
11093
11095 return;
11096
11097 InventoryLocation invloc = new InventoryLocation;
11099
11101 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11102
11103 if (new_item)
11104 {
11105 if (new_item.GetQuantityMax() < split_quantity_new)
11106 {
11107 split_quantity_new = new_item.GetQuantityMax();
11108 }
11110 {
11113 }
11114 else if (split_quantity_new > 1)
11115 {
11117 new_item.
SetQuantity(split_quantity_new,
false,
true);
11118 }
11119 }
11120 }
11121
11124 {
11125 SetWeightDirty();
11127
11128 if (parent)
11129 parent.OnAttachmentQuantityChangedEx(this, delta);
11130
11132 {
11134 {
11136 }
11138 {
11139 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11141 }
11142 }
11143
11144 }
11145
11148 {
11149
11150 }
11151
11154 {
11156 }
11157
11159 {
11160 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11161
11163 {
11164 if (newLevel == GameConstants.STATE_RUINED)
11165 {
11167 EntityAI parent = GetHierarchyParent();
11168 if (parent && parent.IsFireplace())
11169 {
11170 CargoBase cargo = GetInventory().GetCargo();
11171 if (cargo)
11172 {
11174 {
11176 }
11177 }
11178 }
11179 }
11180
11182 {
11183
11185 return;
11186 }
11187
11188 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11189 {
11191 }
11192 }
11193 }
11194
11195
11197 {
11198 super.OnRightClick();
11199
11201 {
11203 {
11204 if (ScriptInputUserData.CanStoreInputUserData())
11205 {
11206 EntityAI root = GetHierarchyRoot();
11207 Man playerOwner = GetHierarchyRootPlayer();
11208 InventoryLocation dst = new InventoryLocation;
11209
11210
11211 if (!playerOwner && root && root == this)
11212 {
11214 }
11215 else
11216 {
11217
11218 GetInventory().GetCurrentInventoryLocation(dst);
11220 {
11223 {
11225 }
11226 else
11227 {
11229
11230
11231 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11232 {
11234 }
11235 else
11236 {
11237 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11238 }
11239 }
11240 }
11241 }
11242
11243 ScriptInputUserData ctx = new ScriptInputUserData;
11251 }
11252 }
11253 else if (!
GetGame().IsMultiplayer())
11254 {
11256 }
11257 }
11258 }
11259
11261 {
11262 if (root)
11263 {
11264 vector m4[4];
11265 root.GetTransform(m4);
11266 dst.SetGround(this, m4);
11267 }
11268 else
11269 {
11270 GetInventory().GetCurrentInventoryLocation(dst);
11271 }
11272 }
11273
11274 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11275 {
11276
11277 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11278 return false;
11279
11280 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11281 return false;
11282
11283
11285 return false;
11286
11287
11288 Magazine mag = Magazine.Cast(this);
11289 if (mag)
11290 {
11291 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11292 return false;
11293
11294 if (stack_max_limit)
11295 {
11296 Magazine other_mag = Magazine.Cast(other_item);
11297 if (other_item)
11298 {
11299 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11300 return false;
11301 }
11302
11303 }
11304 }
11305 else
11306 {
11307
11309 return false;
11310
11312 return false;
11313 }
11314
11315 PlayerBase player = null;
11316 if (CastTo(player, GetHierarchyRootPlayer()))
11317 {
11318 if (player.GetInventory().HasAttachment(this))
11319 return false;
11320
11321 if (player.IsItemsToDelete())
11322 return false;
11323 }
11324
11325 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11326 return false;
11327
11328 int slotID;
11330 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11331 return false;
11332
11333 return true;
11334 }
11335
11337 {
11339 }
11340
11342 {
11343 return m_IsResultOfSplit;
11344 }
11345
11347 {
11348 m_IsResultOfSplit = value;
11349 }
11350
11352 {
11354 }
11355
11357 {
11358 float other_item_quantity = other_item.GetQuantity();
11359 float this_free_space;
11360
11362
11364
11365 if (other_item_quantity > this_free_space)
11366 {
11367 return this_free_space;
11368 }
11369 else
11370 {
11371 return other_item_quantity;
11372 }
11373 }
11374
11376 {
11378 }
11379
11381 {
11383 return;
11384
11385 if (!IsMagazine() && other_item)
11386 {
11388 if (quantity_used != 0)
11389 {
11390 float hp1 = GetHealth01("","");
11391 float hp2 = other_item.GetHealth01("","");
11392 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11393 hpResult = hpResult / (
GetQuantity() + quantity_used);
11394
11395 hpResult *= GetMaxHealth();
11396 Math.Round(hpResult);
11397 SetHealth("", "Health", hpResult);
11398
11400 other_item.AddQuantity(-quantity_used);
11401 }
11402 }
11404 }
11405
11407 {
11408 #ifdef SERVER
11409 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11410 GetHierarchyParent().IncreaseLifetimeUp();
11411 #endif
11412 };
11413
11415 {
11416 PlayerBase p = PlayerBase.Cast(player);
11417
11418 array<int> recipesIds = p.m_Recipes;
11419 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11420 if (moduleRecipesManager)
11421 {
11422 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11423 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11424 }
11425
11426 for (int i = 0;i < recipesIds.Count(); i++)
11427 {
11428 int key = recipesIds.Get(i);
11429 string recipeName = moduleRecipesManager.GetRecipeName(key);
11431 }
11432 }
11433
11434
11435 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11436 {
11437 super.GetDebugActions(outputList);
11438
11439
11445
11446
11451
11456
11457
11461
11462
11464 {
11468 }
11469
11472
11473
11477
11479
11480 InventoryLocation loc = new InventoryLocation();
11481 GetInventory().GetCurrentInventoryLocation(loc);
11483 {
11484 if (Gizmo_IsSupported())
11487 }
11488
11490 }
11491
11492
11493
11494
11496 {
11497 super.OnAction(action_id, player, ctx);
11498
11500 {
11501 switch (action_id)
11502 {
11505 return true;
11508 return true;
11509 }
11510 }
11511
11513 {
11514 switch (action_id)
11515 {
11517 Delete();
11518 return true;
11519 }
11520 }
11521
11522 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11523 {
11524 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11525 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11526 PlayerBase p = PlayerBase.Cast(player);
11527 if (
EActions.RECIPES_RANGE_START < 1000)
11528 {
11529 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11530 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11531 }
11532 }
11533 #ifndef SERVER
11534 else if (action_id ==
EActions.WATCH_PLAYER)
11535 {
11536 PluginDeveloper.SetDeveloperItemClientEx(player);
11537 }
11538 #endif
11540 {
11541 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11542 {
11543 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11544 OnDebugButtonPressServer(id + 1);
11545 }
11546
11547 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11548 {
11549 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11551 }
11552
11553 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11554 {
11555 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11557 }
11558
11559 else if (action_id ==
EActions.ADD_QUANTITY)
11560 {
11561 if (IsMagazine())
11562 {
11563 Magazine mag = Magazine.Cast(this);
11564 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11565 }
11566 else
11567 {
11569 }
11570
11571 if (m_EM)
11572 {
11573 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11574 }
11575
11576 }
11577
11578 else if (action_id ==
EActions.REMOVE_QUANTITY)
11579 {
11580 if (IsMagazine())
11581 {
11582 Magazine mag2 = Magazine.Cast(this);
11583 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11584 }
11585 else
11586 {
11588 }
11589 if (m_EM)
11590 {
11591 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11592 }
11593
11594 }
11595
11596 else if (action_id ==
EActions.SET_QUANTITY_0)
11597 {
11599
11600 if (m_EM)
11601 {
11602 m_EM.SetEnergy(0);
11603 }
11604 }
11605
11606 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11607 {
11609
11610 if (m_EM)
11611 {
11612 m_EM.SetEnergy(m_EM.GetEnergyMax());
11613 }
11614 }
11615
11616 else if (action_id ==
EActions.ADD_HEALTH)
11617 {
11618 AddHealth("","",GetMaxHealth("","Health")/5);
11619 }
11620 else if (action_id ==
EActions.REMOVE_HEALTH)
11621 {
11622 AddHealth("","",-GetMaxHealth("","Health")/5);
11623 }
11624 else if (action_id ==
EActions.DESTROY_HEALTH)
11625 {
11626 SetHealth01("","",0);
11627 }
11628 else if (action_id ==
EActions.WATCH_ITEM)
11629 {
11631 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11632 #ifdef DEVELOPER
11633 SetDebugDeveloper_item(this);
11634 #endif
11635 }
11636
11637 else if (action_id ==
EActions.ADD_TEMPERATURE)
11638 {
11639 AddTemperature(20);
11640
11641 }
11642
11643 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11644 {
11645 AddTemperature(-20);
11646
11647 }
11648
11649 else if (action_id ==
EActions.FLIP_FROZEN)
11650 {
11651 SetFrozen(!GetIsFrozen());
11652
11653 }
11654
11655 else if (action_id ==
EActions.ADD_WETNESS)
11656 {
11658
11659 }
11660
11661 else if (action_id ==
EActions.REMOVE_WETNESS)
11662 {
11664
11665 }
11666
11667 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11668 {
11671
11672
11673 }
11674
11675 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11676 {
11679 }
11680
11681 else if (action_id ==
EActions.MAKE_SPECIAL)
11682 {
11683 auto debugParams = DebugSpawnParams.WithPlayer(player);
11684 OnDebugSpawnEx(debugParams);
11685 }
11686
11687 }
11688
11689
11690 return false;
11691 }
11692
11693
11694
11695
11699
11702
11703
11704
11706 {
11707 return false;
11708 }
11709
11710
11712 {
11713 return true;
11714 }
11715
11716
11718 {
11719 return true;
11720 }
11721
11722
11723
11725 {
11726 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11728 }
11729
11732 {
11733 return null;
11734 }
11735
11737 {
11738 return false;
11739 }
11740
11742 {
11743 return false;
11744 }
11745
11749
11750
11752 {
11753 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11754 return module_repairing.CanRepair(this, item_repair_kit);
11755 }
11756
11757
11758 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11759 {
11760 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11761 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11762 }
11763
11764
11766 {
11767
11768
11769
11770
11771
11772
11773
11774
11775 return 1;
11776 }
11777
11778
11779
11781 {
11783 }
11784
11785
11786
11788 {
11790 }
11791
11792
11801 {
11802 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11803
11804 if (player)
11805 {
11806 player.MessageStatus(text);
11807 }
11808 }
11809
11810
11819 {
11820 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11821
11822 if (player)
11823 {
11824 player.MessageAction(text);
11825 }
11826 }
11827
11828
11837 {
11838 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11839
11840 if (player)
11841 {
11842 player.MessageFriendly(text);
11843 }
11844 }
11845
11846
11855 {
11856 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11857
11858 if (player)
11859 {
11860 player.MessageImportant(text);
11861 }
11862 }
11863
11865 {
11866 return true;
11867 }
11868
11869
11870 override bool KindOf(
string tag)
11871 {
11872 bool found = false;
11873 string item_name = this.
GetType();
11876
11877 int array_size = item_tag_array.Count();
11878 for (int i = 0; i < array_size; i++)
11879 {
11880 if (item_tag_array.Get(i) == tag)
11881 {
11882 found = true;
11883 break;
11884 }
11885 }
11886 return found;
11887 }
11888
11889
11891 {
11892
11893 super.OnRPC(sender, rpc_type,ctx);
11894
11895
11896 switch (rpc_type)
11897 {
11898 #ifndef SERVER
11899 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11900 Param2<bool, string> p = new Param2<bool, string>(false, "");
11901
11903 return;
11904
11905 bool play = p.param1;
11906 string soundSet = p.param2;
11907
11908 if (play)
11909 {
11911 {
11913 {
11915 }
11916 }
11917 else
11918 {
11920 }
11921 }
11922 else
11923 {
11925 }
11926
11927 break;
11928 #endif
11929
11930 }
11931
11933 {
11935 }
11936 }
11937
11938
11939
11940
11942 {
11943 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11944 return plugin.GetID(
name);
11945 }
11946
11948 {
11949 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11950 return plugin.GetName(id);
11951 }
11952
11955 {
11956
11957
11958 int varFlags;
11959 if (!ctx.
Read(varFlags))
11960 return;
11961
11962 if (varFlags & ItemVariableFlags.FLOAT)
11963 {
11965 }
11966 }
11967
11969 {
11970
11971 super.SerializeNumericalVars(floats_out);
11972
11973
11974
11976 {
11978 }
11979
11981 {
11983 }
11984
11986 {
11988 }
11989
11991 {
11996 }
11997
11999 {
12001 }
12002 }
12003
12005 {
12006
12007 super.DeSerializeNumericalVars(floats);
12008
12009
12010 int index = 0;
12011 int mask = Math.Round(floats.Get(index));
12012
12013 index++;
12014
12016 {
12018 {
12020 }
12021 else
12022 {
12023 float quantity = floats.Get(index);
12024 SetQuantity(quantity,
true,
false,
false,
false);
12025 }
12026 index++;
12027 }
12028
12030 {
12031 float wet = floats.Get(index);
12033 index++;
12034 }
12035
12037 {
12038 int liquidtype = Math.Round(floats.Get(index));
12040 index++;
12041 }
12042
12044 {
12046 index++;
12048 index++;
12050 index++;
12052 index++;
12053 }
12054
12056 {
12057 int cleanness = Math.Round(floats.Get(index));
12059 index++;
12060 }
12061 }
12062
12064 {
12065 super.WriteVarsToCTX(ctx);
12066
12067
12069 {
12071 }
12072
12074 {
12076 }
12077
12079 {
12081 }
12082
12084 {
12085 int r,g,b,a;
12091 }
12092
12094 {
12096 }
12097 }
12098
12100 {
12101 if (!super.ReadVarsFromCTX(ctx,version))
12102 return false;
12103
12104 int intValue;
12105 float value;
12106
12107 if (version < 140)
12108 {
12109 if (!ctx.
Read(intValue))
12110 return false;
12111
12112 m_VariablesMask = intValue;
12113 }
12114
12116 {
12117 if (!ctx.
Read(value))
12118 return false;
12119
12121 {
12123 }
12124 else
12125 {
12127 }
12128 }
12129
12130 if (version < 140)
12131 {
12133 {
12134 if (!ctx.
Read(value))
12135 return false;
12136 SetTemperatureDirect(value);
12137 }
12138 }
12139
12141 {
12142 if (!ctx.
Read(value))
12143 return false;
12145 }
12146
12148 {
12149 if (!ctx.
Read(intValue))
12150 return false;
12152 }
12153
12155 {
12156 int r,g,b,a;
12158 return false;
12160 return false;
12162 return false;
12164 return false;
12165
12167 }
12168
12170 {
12171 if (!ctx.
Read(intValue))
12172 return false;
12174 }
12175
12176 if (version >= 138 && version < 140)
12177 {
12179 {
12180 if (!ctx.
Read(intValue))
12181 return false;
12182 SetFrozen(intValue);
12183 }
12184 }
12185
12186 return true;
12187 }
12188
12189
12191 {
12194 {
12196 }
12197
12198 if (!super.OnStoreLoad(ctx, version))
12199 {
12201 return false;
12202 }
12203
12204 if (version >= 114)
12205 {
12206 bool hasQuickBarIndexSaved;
12207
12208 if (!ctx.
Read(hasQuickBarIndexSaved))
12209 {
12211 return false;
12212 }
12213
12214 if (hasQuickBarIndexSaved)
12215 {
12216 int itmQBIndex;
12217
12218
12219 if (!ctx.
Read(itmQBIndex))
12220 {
12222 return false;
12223 }
12224
12225 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12226 if (itmQBIndex != -1 && parentPlayer)
12227 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12228 }
12229 }
12230 else
12231 {
12232
12233 PlayerBase player;
12234 int itemQBIndex;
12235 if (version ==
int.
MAX)
12236 {
12237 if (!ctx.
Read(itemQBIndex))
12238 {
12240 return false;
12241 }
12242 }
12243 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12244 {
12245
12246 if (!ctx.
Read(itemQBIndex))
12247 {
12249 return false;
12250 }
12251 if (itemQBIndex != -1 && player)
12252 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12253 }
12254 }
12255
12256 if (version < 140)
12257 {
12258
12259 if (!LoadVariables(ctx, version))
12260 {
12262 return false;
12263 }
12264 }
12265
12266
12268 {
12270 return false;
12271 }
12272 if (version >= 132)
12273 {
12275 if (raib)
12276 {
12278 {
12280 return false;
12281 }
12282 }
12283 }
12284
12286 return true;
12287 }
12288
12289
12290
12292 {
12293 super.OnStoreSave(ctx);
12294
12295 PlayerBase player;
12296 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12297 {
12299
12300 int itemQBIndex = -1;
12301 itemQBIndex = player.FindQuickBarEntityIndex(this);
12302 ctx.
Write(itemQBIndex);
12303 }
12304 else
12305 {
12307 }
12308
12310
12312 if (raib)
12313 {
12315 }
12316 }
12317
12318
12320 {
12321 super.AfterStoreLoad();
12322
12324 {
12326 }
12327
12329 {
12332 }
12333 }
12334
12336 {
12337 super.EEOnAfterLoad();
12338
12340 {
12342 }
12343
12346 }
12347
12349 {
12350 return false;
12351 }
12352
12353
12354
12356 {
12358 {
12359 #ifdef PLATFORM_CONSOLE
12360
12362 {
12364 if (menu)
12365 {
12367 }
12368 }
12369 #endif
12370 }
12371
12373 {
12376 }
12377
12379 {
12380 SetWeightDirty();
12382 }
12384 {
12387 }
12388
12390 {
12393 }
12395 {
12398 }
12399
12400 super.OnVariablesSynchronized();
12401 }
12402
12403
12404
12406 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12407 {
12408 if (!IsServerCheck(allow_client))
12409 return false;
12410
12412 return false;
12413
12416
12417 if (value <= (min + 0.001))
12418 value = min;
12419
12420 if (value == min)
12421 {
12422 if (destroy_config)
12423 {
12424 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12425 if (dstr)
12426 {
12428 this.Delete();
12429 return true;
12430 }
12431 }
12432 else if (destroy_forced)
12433 {
12435 this.Delete();
12436 return true;
12437 }
12438
12440 }
12441
12444
12446 {
12448
12449 if (delta)
12451 }
12452
12454
12455 return false;
12456 }
12457
12458
12460 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12461 {
12463 }
12464
12466 {
12469 }
12470
12472 {
12475 }
12476
12478 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12479 {
12480 float value_clamped = Math.Clamp(value, 0, 1);
12482 SetQuantity(result, destroy_config, destroy_forced);
12483 }
12484
12485
12488 {
12490 }
12491
12493 {
12495 }
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12507 {
12508 int slot = -1;
12509 if (GetInventory())
12510 {
12511 InventoryLocation il = new InventoryLocation;
12512 GetInventory().GetCurrentInventoryLocation(il);
12514 }
12515
12517 }
12518
12520 {
12521 float quantity_max = 0;
12522
12524 {
12525 if (attSlotID != -1)
12526 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12527
12528 if (quantity_max <= 0)
12530 }
12531
12532 if (quantity_max <= 0)
12534
12535 return quantity_max;
12536 }
12537
12539 {
12541 }
12542
12544 {
12546 }
12547
12548
12550 {
12552 }
12553
12555 {
12557 }
12558
12560 {
12562 }
12563
12564
12566 {
12567
12568 float weightEx = GetWeightEx();
12569 float special = GetInventoryAndCargoWeight();
12570 return weightEx - special;
12571 }
12572
12573
12575 {
12577 }
12578
12580 {
12582 {
12583 #ifdef DEVELOPER
12584 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12585 {
12586 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12588 }
12589 #endif
12590
12591 return GetQuantity() * GetConfigWeightModified();
12592 }
12593 else if (HasEnergyManager())
12594 {
12595 #ifdef DEVELOPER
12596 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12597 {
12598 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12599 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12600 }
12601 #endif
12602 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12603 }
12604 else
12605 {
12606 #ifdef DEVELOPER
12607 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12608 {
12609 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12610 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12611 }
12612 #endif
12613 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12614 }
12615 }
12616
12619 {
12620 int item_count = 0;
12622
12623 if (GetInventory().GetCargo() != NULL)
12624 {
12625 item_count = GetInventory().GetCargo().GetItemCount();
12626 }
12627
12628 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12629 {
12630 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12631 if (item)
12632 item_count += item.GetNumberOfItems();
12633 }
12634 return item_count;
12635 }
12636
12639 {
12640 float weight = 0;
12641 float wetness = 1;
12642 if (include_wetness)
12645 {
12646 weight = wetness * m_ConfigWeight;
12647 }
12649 {
12650 weight = 1;
12651 }
12652 return weight;
12653 }
12654
12655
12656
12658 {
12659 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12660 {
12661 GameInventory inv = GetInventory();
12662 array<EntityAI> items = new array<EntityAI>;
12664 for (int i = 0; i < items.Count(); i++)
12665 {
12667 if (item)
12668 {
12670 }
12671 }
12672 }
12673 }
12674
12675
12676
12677
12679 {
12680 float energy = 0;
12681 if (HasEnergyManager())
12682 {
12683 energy = GetCompEM().GetEnergy();
12684 }
12685 return energy;
12686 }
12687
12688
12690 {
12691 super.OnEnergyConsumed();
12692
12694 }
12695
12697 {
12698 super.OnEnergyAdded();
12699
12701 }
12702
12703
12705 {
12706 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12707 {
12709 {
12710 float energy_0to1 = GetCompEM().GetEnergy0To1();
12712 }
12713 }
12714 }
12715
12716
12718 {
12719 return ConfigGetFloat("heatIsolation");
12720 }
12721
12723 {
12725 }
12726
12728 {
12729 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12730 if (
GetGame().ConfigIsExisting(paramPath))
12732
12733 return 0.0;
12734 }
12735
12737 {
12738 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12739 if (
GetGame().ConfigIsExisting(paramPath))
12741
12742 return 0.0;
12743 }
12744
12745 override void SetWet(
float value,
bool allow_client =
false)
12746 {
12747 if (!IsServerCheck(allow_client))
12748 return;
12749
12752
12754
12755 m_VarWet = Math.Clamp(value, min, max);
12756
12758 {
12761 }
12762 }
12763
12764 override void AddWet(
float value)
12765 {
12767 }
12768
12770 {
12772 }
12773
12775 {
12777 }
12778
12780 {
12782 }
12783
12785 {
12787 }
12788
12790 {
12792 }
12793
12794 override void OnWetChanged(
float newVal,
float oldVal)
12795 {
12798 if (newLevel != oldLevel)
12799 {
12801 }
12802 }
12803
12805 {
12806 SetWeightDirty();
12807 }
12808
12810 {
12811 return GetWetLevelInternal(
m_VarWet);
12812 }
12813
12814
12815
12817 {
12819 }
12820
12822 {
12824 }
12825
12827 {
12829 }
12830
12832 {
12834 }
12835
12836
12837
12839 {
12840 if (ConfigIsExisting("itemModelLength"))
12841 {
12842 return ConfigGetFloat("itemModelLength");
12843 }
12844 return 0;
12845 }
12846
12848 {
12849 if (ConfigIsExisting("itemAttachOffset"))
12850 {
12851 return ConfigGetFloat("itemAttachOffset");
12852 }
12853 return 0;
12854 }
12855
12856 override void SetCleanness(
int value,
bool allow_client =
false)
12857 {
12858 if (!IsServerCheck(allow_client))
12859 return;
12860
12862
12864
12867 }
12868
12870 {
12872 }
12873
12875 {
12876 return true;
12877 }
12878
12879
12880
12881
12883 {
12885 }
12886
12888 {
12890 }
12891
12892
12893
12894
12895 override void SetColor(
int r,
int g,
int b,
int a)
12896 {
12902 }
12904 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12905 {
12910 }
12911
12913 {
12915 }
12916
12919 {
12920 int r,g,b,a;
12922 r = r/255;
12923 g = g/255;
12924 b = b/255;
12925 a = a/255;
12926 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12927 }
12928
12929
12930
12931 override void SetLiquidType(
int value,
bool allow_client =
false)
12932 {
12933 if (!IsServerCheck(allow_client))
12934 return;
12935
12940 }
12941
12943 {
12944 return ConfigGetInt("varLiquidTypeInit");
12945 }
12946
12948 {
12950 }
12951
12953 {
12955 SetFrozen(false);
12956 }
12957
12960 {
12961 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12962 }
12963
12964
12967 {
12968 PlayerBase nplayer;
12969 if (PlayerBase.CastTo(nplayer, player))
12970 {
12972
12973 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12974 }
12975 }
12976
12977
12980 {
12981 PlayerBase nplayer;
12982 if (PlayerBase.CastTo(nplayer,player))
12983 {
12984
12985 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12986
12987 }
12988
12989
12990 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12991
12992
12993 if (HasEnergyManager())
12994 {
12995 GetCompEM().UpdatePlugState();
12996 }
12997 }
12998
12999
13001 {
13002 super.OnPlacementStarted(player);
13003
13005 }
13006
13007 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13008 {
13010 {
13011 m_AdminLog.OnPlacementComplete(player,
this);
13012 }
13013
13014 super.OnPlacementComplete(player, position, orientation);
13015 }
13016
13017
13018
13019
13020
13022 {
13024 {
13025 return true;
13026 }
13027 else
13028 {
13029 return false;
13030 }
13031 }
13032
13033
13035 {
13037 {
13039 }
13040 }
13041
13042
13044 {
13046 }
13047
13049 {
13051 }
13052
13053 override void InsertAgent(
int agent,
float count = 1)
13054 {
13055 if (count < 1)
13056 return;
13057
13059 }
13060
13063 {
13065 }
13066
13067
13069 {
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
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13115 {
13117 return false;
13118 return true;
13119 }
13120
13122 {
13123
13125 }
13126
13127
13130 {
13131 super.CheckForRoofLimited(timeTresholdMS);
13132
13134 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13135 {
13136 m_PreviousRoofTestTime = time;
13137 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13138 }
13139 }
13140
13141
13143 {
13145 {
13146 return 0;
13147 }
13148
13149 if (GetInventory().GetAttachmentSlotsCount() != 0)
13150 {
13151 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13152 if (filter)
13153 return filter.GetProtectionLevel(type, false, system);
13154 else
13155 return 0;
13156 }
13157
13158 string subclassPath, entryName;
13159
13160 switch (type)
13161 {
13163 entryName = "biological";
13164 break;
13166 entryName = "chemical";
13167 break;
13168 default:
13169 entryName = "biological";
13170 break;
13171 }
13172
13173 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13174
13176 }
13177
13178
13179
13182 {
13183 if (!IsMagazine())
13185
13187 }
13188
13189
13190
13191
13192
13197 {
13198 return true;
13199 }
13200
13202 {
13204 }
13205
13206
13207
13208
13209
13211 {
13212 if (parent)
13213 {
13214 if (parent.IsInherited(DayZInfected))
13215 return true;
13216
13217 if (!parent.IsRuined())
13218 return true;
13219 }
13220
13221 return true;
13222 }
13223
13225 {
13226 if (!super.CanPutAsAttachment(parent))
13227 {
13228 return false;
13229 }
13230
13231 if (!IsRuined() && !parent.IsRuined())
13232 {
13233 return true;
13234 }
13235
13236 return false;
13237 }
13238
13240 {
13241
13242
13243
13244
13245 return super.CanReceiveItemIntoCargo(item);
13246 }
13247
13249 {
13250
13251
13252
13253
13254 GameInventory attachmentInv = attachment.GetInventory();
13256 {
13257 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13258 return false;
13259 }
13260
13261 InventoryLocation loc = new InventoryLocation();
13262 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13263 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13264 return false;
13265
13266 return super.CanReceiveAttachment(attachment, slotId);
13267 }
13268
13270 {
13271 if (!super.CanReleaseAttachment(attachment))
13272 return false;
13273
13274 return GetInventory().AreChildrenAccessible();
13275 }
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13298 {
13299 int id = muzzle_owner.GetMuzzleID();
13300 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13301
13302 if (WPOF_array)
13303 {
13304 for (int i = 0; i < WPOF_array.Count(); i++)
13305 {
13306 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13307
13308 if (WPOF)
13309 {
13310 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13311 }
13312 }
13313 }
13314 }
13315
13316
13318 {
13319 int id = muzzle_owner.GetMuzzleID();
13321
13322 if (WPOBE_array)
13323 {
13324 for (int i = 0; i < WPOBE_array.Count(); i++)
13325 {
13326 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13327
13328 if (WPOBE)
13329 {
13330 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13331 }
13332 }
13333 }
13334 }
13335
13336
13338 {
13339 int id = muzzle_owner.GetMuzzleID();
13340 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13341
13342 if (WPOOH_array)
13343 {
13344 for (int i = 0; i < WPOOH_array.Count(); i++)
13345 {
13346 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13347
13348 if (WPOOH)
13349 {
13350 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13351 }
13352 }
13353 }
13354 }
13355
13356
13358 {
13359 int id = muzzle_owner.GetMuzzleID();
13360 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13361
13362 if (WPOOH_array)
13363 {
13364 for (int i = 0; i < WPOOH_array.Count(); i++)
13365 {
13366 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13367
13368 if (WPOOH)
13369 {
13370 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13371 }
13372 }
13373 }
13374 }
13375
13376
13378 {
13379 int id = muzzle_owner.GetMuzzleID();
13380 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13381
13382 if (WPOOH_array)
13383 {
13384 for (int i = 0; i < WPOOH_array.Count(); i++)
13385 {
13386 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13387
13388 if (WPOOH)
13389 {
13390 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13391 }
13392 }
13393 }
13394 }
13395
13396
13397
13399 {
13401 {
13402 return true;
13403 }
13404
13405 return false;
13406 }
13407
13409 {
13411 {
13412 return true;
13413 }
13414
13415 return false;
13416 }
13417
13419 {
13421 {
13422 return true;
13423 }
13424
13425 return false;
13426 }
13427
13429 {
13430 return false;
13431 }
13432
13435 {
13436 return UATimeSpent.DEFAULT_DEPLOY;
13437 }
13438
13439
13440
13441
13443 {
13445 SetSynchDirty();
13446 }
13447
13449 {
13451 }
13452
13453
13455 {
13456 return false;
13457 }
13458
13461 {
13462 string att_type = "None";
13463
13464 if (ConfigIsExisting("soundAttType"))
13465 {
13466 att_type = ConfigGetString("soundAttType");
13467 }
13468
13470 }
13471
13473 {
13475 }
13476
13477
13478
13479
13480
13486
13488 {
13491
13493 }
13494
13495
13497 {
13499 return;
13500
13502
13505
13508
13509 SoundParameters params = new SoundParameters();
13513 }
13514
13515
13517 {
13519 return;
13520
13522 SetSynchDirty();
13523
13526 }
13527
13528
13530 {
13532 return;
13533
13535 SetSynchDirty();
13536
13539 }
13540
13542 {
13544 }
13545
13547 {
13549 }
13550
13553 {
13554 if (!
GetGame().IsDedicatedServer())
13555 {
13556 if (ConfigIsExisting("attachSoundSet"))
13557 {
13558 string cfg_path = "";
13559 string soundset = "";
13560 string type_name =
GetType();
13561
13564 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13565 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13566
13567 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13568 {
13569 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13570 {
13571 if (cfg_slot_array[i] == slot_type)
13572 {
13573 soundset = cfg_soundset_array[i];
13574 break;
13575 }
13576 }
13577 }
13578
13579 if (soundset != "")
13580 {
13581 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13583 }
13584 }
13585 }
13586 }
13587
13589 {
13590
13591 }
13592
13593 void OnApply(PlayerBase player);
13594
13596 {
13597 return 1.0;
13598 };
13599
13601 {
13603 }
13604
13606 {
13608 }
13609
13611
13613 {
13614 SetDynamicPhysicsLifeTime(0.01);
13616 }
13617
13619 {
13620 array<string> zone_names = new array<string>;
13621 GetDamageZones(zone_names);
13622 for (int i = 0; i < zone_names.Count(); i++)
13623 {
13624 SetHealthMax(zone_names.Get(i),"Health");
13625 }
13626 SetHealthMax("","Health");
13627 }
13628
13631 {
13632 float global_health = GetHealth01("","Health");
13633 array<string> zones = new array<string>;
13634 GetDamageZones(zones);
13635
13636 for (int i = 0; i < zones.Count(); i++)
13637 {
13638 SetHealth01(zones.Get(i),"Health",global_health);
13639 }
13640 }
13641
13644 {
13645 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13646 }
13647
13649 {
13650 if (!hasRootAsPlayer)
13651 {
13652 if (refParentIB)
13653 {
13654
13655 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13656 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13657
13658 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13659 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13660
13663 }
13664 else
13665 {
13666
13669 }
13670 }
13671 }
13672
13674 {
13676 {
13677 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13678 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13679 {
13680 float heatPermCoef = 1.0;
13682 while (ent)
13683 {
13684 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13685 ent = ent.GetHierarchyParent();
13686 }
13687
13688 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13689 }
13690 }
13691 }
13692
13694 {
13695
13696 EntityAI parent = GetHierarchyParent();
13697 if (!parent)
13698 {
13699 hasParent = false;
13700 hasRootAsPlayer = false;
13701 }
13702 else
13703 {
13704 hasParent = true;
13705 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13706 refParentIB =
ItemBase.Cast(parent);
13707 }
13708 }
13709
13710 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13711 {
13712
13713 }
13714
13716 {
13717
13718 return false;
13719 }
13720
13722 {
13723
13724
13725 return false;
13726 }
13727
13729 {
13730
13731 return false;
13732 }
13733
13736 {
13737 return !GetIsFrozen() &&
IsOpen();
13738 }
13739
13741 {
13742 bool hasParent = false, hasRootAsPlayer = false;
13744
13745 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13746 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13747
13748 if (wwtu || foodDecay)
13749 {
13753
13754 if (processWetness || processTemperature || processDecay)
13755 {
13757
13758 if (processWetness)
13759 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13760
13761 if (processTemperature)
13763
13764 if (processDecay)
13765 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13766 }
13767 }
13768 }
13769
13772 {
13774 }
13775
13777 {
13780
13781 return super.GetTemperatureFreezeThreshold();
13782 }
13783
13785 {
13788
13789 return super.GetTemperatureThawThreshold();
13790 }
13791
13793 {
13796
13797 return super.GetItemOverheatThreshold();
13798 }
13799
13801 {
13803 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13804
13805 return super.GetTemperatureFreezeTime();
13806 }
13807
13809 {
13811 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13812
13813 return super.GetTemperatureThawTime();
13814 }
13815
13820
13822 {
13823 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13824 }
13825
13827 {
13828 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13829 }
13830
13833 {
13835 }
13836
13838 {
13840 }
13841
13843 {
13845 }
13846
13849 {
13850 return null;
13851 }
13852
13855 {
13856 return false;
13857 }
13858
13860 {
13862 {
13865 if (!trg)
13866 {
13868 explosive = this;
13869 }
13870
13871 explosive.PairRemote(trg);
13873
13874 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13875 trg.SetPersistentPairID(persistentID);
13876 explosive.SetPersistentPairID(persistentID);
13877
13878 return true;
13879 }
13880 return false;
13881 }
13882
13885 {
13886 float ret = 1.0;
13889 ret *= GetHealth01();
13890
13891 return ret;
13892 }
13893
13894 #ifdef DEVELOPER
13895 override void SetDebugItem()
13896 {
13897 super.SetDebugItem();
13898 _itemBase = this;
13899 }
13900
13902 {
13903 string text = super.GetDebugText();
13904
13906 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13907
13908 return text;
13909 }
13910 #endif
13911
13913 {
13914 return true;
13915 }
13916
13918
13920
13922 {
13925 }
13926
13927
13935
13951}
13952
13954{
13956 if (entity)
13957 {
13958 bool is_item = entity.IsInherited(
ItemBase);
13959 if (is_item && full_quantity)
13960 {
13963 }
13964 }
13965 else
13966 {
13968 return NULL;
13969 }
13970 return entity;
13971}
13972
13974{
13975 if (item)
13976 {
13977 if (health > 0)
13978 item.SetHealth("", "", health);
13979
13980 if (item.CanHaveTemperature())
13981 {
13983 if (item.CanFreeze())
13984 item.SetFrozen(false);
13985 }
13986
13987 if (item.HasEnergyManager())
13988 {
13989 if (quantity >= 0)
13990 {
13991 item.GetCompEM().SetEnergy0To1(quantity);
13992 }
13993 else
13994 {
13996 }
13997 }
13998 else if (item.IsMagazine())
13999 {
14000 Magazine mag = Magazine.Cast(item);
14001 if (quantity >= 0)
14002 {
14003 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14004 }
14005 else
14006 {
14008 }
14009
14010 }
14011 else
14012 {
14013 if (quantity >= 0)
14014 {
14015 item.SetQuantityNormalized(quantity, false);
14016 }
14017 else
14018 {
14020 }
14021
14022 }
14023 }
14024}
14025
14026#ifdef DEVELOPER
14028#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.