9043{
9045 {
9046 return true;
9047 }
9048};
9049
9050
9051
9053{
9057
9059
9062
9063
9064
9065
9066
9075
9081
9086
9091
9112 protected bool m_IsResultOfSplit
9113
9115
9120
9121
9122
9124
9128
9129
9130
9132
9135
9136
9137
9143
9144
9152
9155
9156
9158
9159
9161
9162
9167
9168
9173
9174
9176
9177
9179 {
9184
9185 if (!
GetGame().IsDedicatedServer())
9186 {
9188 {
9190
9192 {
9194 }
9195 }
9196
9199 }
9200
9201 m_OldLocation = null;
9202
9204 {
9206 }
9207
9208 if (ConfigIsExisting("headSelectionsToHide"))
9209 {
9212 }
9213
9215 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9216 {
9218 }
9219
9221
9222 m_IsResultOfSplit = false;
9223
9225 }
9226
9228 {
9229 super.InitItemVariables();
9230
9236 m_Count = ConfigGetInt(
"count");
9237
9240
9245
9248
9253
9265
9269
9270
9273 if (ConfigIsExisting("canBeSplit"))
9274 {
9277 }
9278
9280 if (ConfigIsExisting("itemBehaviour"))
9282
9283
9286 RegisterNetSyncVariableInt("m_VarLiquidType");
9287 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9288
9289 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9290 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9291 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9292
9293 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9294 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9295 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9296 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9297
9298 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9299 RegisterNetSyncVariableBool("m_IsTakeable");
9300 RegisterNetSyncVariableBool("m_IsHologram");
9301
9304 {
9307 }
9308
9310
9312 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9314
9315 }
9316
9318 {
9320 }
9321
9323 {
9326 {
9331 }
9332 }
9333
9334 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9335 {
9337 {
9340 }
9341
9343 }
9344
9346 {
9352 }
9353
9355
9357 {
9359
9360 if (!action)
9361 {
9362 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9363 return;
9364 }
9365
9367 if (!ai)
9368 {
9370 return;
9371 }
9372
9374 if (!action_array)
9375 {
9376 action_array = new array<ActionBase_Basic>;
9378 }
9379 if (LogManager.IsActionLogEnable())
9380 {
9381 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9382 }
9383
9384 if (action_array.Find(action) != -1)
9385 {
9386 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9387 }
9388 else
9389 {
9390 action_array.Insert(action);
9391 }
9392 }
9393
9395 {
9397 ActionBase action = player.GetActionManager().GetAction(actionName);
9400
9401 if (action_array)
9402 {
9403 action_array.RemoveItem(action);
9404 }
9405 }
9406
9407
9408
9410 {
9411 ActionOverrideData overrideData = new ActionOverrideData();
9415
9417 if (!actionMap)
9418 {
9421 }
9422
9423 actionMap.Insert(this.
Type(), overrideData);
9424
9425 }
9426
9428
9430
9431
9433 {
9436
9439
9440 string config_to_search = "CfgVehicles";
9441 string muzzle_owner_config;
9442
9444 {
9445 if (IsInherited(Weapon))
9446 config_to_search = "CfgWeapons";
9447
9448 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9449
9450 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9451
9453
9454 if (config_OnFire_subclass_count > 0)
9455 {
9456 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9457
9458 for (int i = 0; i < config_OnFire_subclass_count; i++)
9459 {
9460 string particle_class = "";
9462 string config_OnFire_entry = config_OnFire_class + particle_class;
9463 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9464 WPOF_array.Insert(WPOF);
9465 }
9466
9467
9469 }
9470 }
9471
9473 {
9474 config_to_search = "CfgWeapons";
9475 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9476
9477 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9478
9480
9481 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9482 {
9483 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9484
9485 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9486 {
9487 string particle_class2 = "";
9489 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9490 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9491 WPOBE_array.Insert(WPOBE);
9492 }
9493
9494
9496 }
9497 }
9498 }
9499
9500
9502 {
9505
9507 {
9508 string config_to_search = "CfgVehicles";
9509
9510 if (IsInherited(Weapon))
9511 config_to_search = "CfgWeapons";
9512
9513 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9514 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9515
9516 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9517 {
9518
9520
9522 {
9524 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9526 return;
9527 }
9528
9531
9532
9533
9535 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9536
9537 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9538 {
9539 string particle_class = "";
9541 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9543
9544 if (entry_type == CT_CLASS)
9545 {
9546 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9547 WPOOH_array.Insert(WPOF);
9548 }
9549 }
9550
9551
9553 }
9554 }
9555 }
9556
9558 {
9560 }
9561
9563 {
9565 {
9567
9570
9573
9574 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9575 }
9576 }
9577
9579 {
9581 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9582
9584 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9585
9587 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9588
9590 {
9592 }
9593 }
9594
9596 {
9598 }
9599
9601 {
9604 else
9606
9608 {
9611 }
9612 else
9613 {
9616
9619 }
9620
9622 }
9623
9625 {
9627 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9628 }
9629
9631 {
9633 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9635 }
9636
9638 {
9640 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9641 }
9642
9644 {
9647
9648 OverheatingParticle OP = new OverheatingParticle();
9653
9655 }
9656
9658 {
9661
9662 return -1;
9663 }
9664
9666 {
9668 {
9671
9672 for (int i = count; i > 0; --i)
9673 {
9674 int id = i - 1;
9677
9680
9681 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9682 {
9683 if (p)
9684 {
9687 }
9688 }
9689 }
9690 }
9691 }
9692
9694 {
9696 {
9698 {
9699 int id = i - 1;
9701
9702 if (OP)
9703 {
9705
9706 if (p)
9707 {
9709 }
9710
9711 delete OP;
9712 }
9713 }
9714
9717 }
9718 }
9719
9722 {
9723 return 0.0;
9724 }
9725
9726
9728 {
9729 return 250;
9730 }
9731
9733 {
9734 return 0;
9735 }
9736
9739 {
9741 return true;
9742
9743 return false;
9744 }
9745
9748 {
9751
9753 {
9755 }
9756 else
9757 {
9758
9760 }
9761
9763 }
9764
9771 {
9772 return -1;
9773 }
9774
9775
9776
9777
9779 {
9781 {
9783 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9784
9785 if (r_index >= 0)
9786 {
9787 InventoryLocation r_il = new InventoryLocation;
9788 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9789
9790 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9793 {
9794 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9795 }
9797 {
9798 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9799 }
9800
9801 }
9802
9803 player.GetHumanInventory().ClearUserReservedLocation(this);
9804 }
9805
9808 }
9809
9810
9811
9812
9814 {
9815 return ItemBase.m_DebugActionsMask;
9816 }
9817
9819 {
9820 return ItemBase.m_DebugActionsMask & mask;
9821 }
9822
9824 {
9825 ItemBase.m_DebugActionsMask = mask;
9826 }
9827
9829 {
9830 ItemBase.m_DebugActionsMask |= mask;
9831 }
9832
9834 {
9835 ItemBase.m_DebugActionsMask &= ~mask;
9836 }
9837
9839 {
9841 {
9843 }
9844 else
9845 {
9847 }
9848 }
9849
9850
9852 {
9853 if (GetEconomyProfile())
9854 {
9855 float q_max = GetEconomyProfile().GetQuantityMax();
9856 if (q_max > 0)
9857 {
9858 float q_min = GetEconomyProfile().GetQuantityMin();
9859 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9860
9862 {
9863 ComponentEnergyManager comp = GetCompEM();
9865 {
9867 }
9868 }
9870 {
9872
9873 }
9874
9875 }
9876 }
9877 }
9878
9881 {
9882 EntityAI parent = GetHierarchyParent();
9883
9884 if (parent)
9885 {
9886 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9887 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9888 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9889 }
9890 }
9891
9894 {
9895 EntityAI parent = GetHierarchyParent();
9896
9897 if (parent)
9898 {
9899 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9900 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9901 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9902 }
9903 }
9904
9906 {
9907
9908
9909
9910
9912
9914 {
9915 if (ScriptInputUserData.CanStoreInputUserData())
9916 {
9917 ScriptInputUserData ctx = new ScriptInputUserData;
9923 ctx.
Write(use_stack_max);
9926
9928 {
9929 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9930 }
9931 }
9932 }
9933 else if (!
GetGame().IsMultiplayer())
9934 {
9936 }
9937 }
9938
9940 {
9942 }
9943
9945 {
9947 }
9948
9950 {
9952 }
9953
9955 {
9956
9957 return false;
9958 }
9959
9961 {
9962 return false;
9963 }
9964
9968 {
9969 return false;
9970 }
9971
9973 {
9974 return "";
9975 }
9976
9978
9980 {
9981 return false;
9982 }
9983
9985 {
9986 return true;
9987 }
9988
9989
9990
9992 {
9993 return true;
9994 }
9995
9997 {
9998 return true;
9999 }
10000
10002 {
10003 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10005 }
10006
10008 {
10010 }
10011
10013 {
10015 if (!is_being_placed)
10017 SetSynchDirty();
10018 }
10019
10020
10022
10024 {
10026 }
10027
10029 {
10031 }
10032
10034 {
10035 return 1;
10036 }
10037
10039 {
10040 return false;
10041 }
10042
10044 {
10046 SetSynchDirty();
10047 }
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10084 {
10085 super.OnMovedInsideCargo(container);
10086
10087 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10088 }
10089
10090 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10091 {
10092 super.EEItemLocationChanged(oldLoc,newLoc);
10093
10094 PlayerBase new_player = null;
10095 PlayerBase old_player = null;
10096
10097 if (newLoc.GetParent())
10098 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10099
10100 if (oldLoc.GetParent())
10101 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10102
10104 {
10105 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10106
10107 if (r_index >= 0)
10108 {
10109 InventoryLocation r_il = new InventoryLocation;
10110 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10111
10112 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10115 {
10116 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10117 }
10119 {
10120 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10121 }
10122
10123 }
10124 }
10125
10127 {
10128 if (new_player)
10129 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10130
10131 if (new_player == old_player)
10132 {
10133
10134 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10135 {
10137 {
10138 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10139 {
10140 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10141 }
10142 }
10143 else
10144 {
10145 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10146 }
10147 }
10148
10149 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10150 {
10151 int type = oldLoc.GetType();
10153 {
10154 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10155 }
10157 {
10158 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10159 }
10160 }
10161 if (!m_OldLocation)
10162 {
10163 m_OldLocation = new InventoryLocation;
10164 }
10165 m_OldLocation.Copy(oldLoc);
10166 }
10167 else
10168 {
10169 if (m_OldLocation)
10170 {
10171 m_OldLocation.Reset();
10172 }
10173 }
10174
10176 }
10177 else
10178 {
10179 if (new_player)
10180 {
10181 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10182 if (res_index >= 0)
10183 {
10184 InventoryLocation il = new InventoryLocation;
10185 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10187 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10190 {
10191 il.
GetParent().GetOnReleaseLock().Invoke(it);
10192 }
10194 {
10196 }
10197
10198 }
10199 }
10201 {
10202
10204 }
10205
10206 if (m_OldLocation)
10207 {
10208 m_OldLocation.Reset();
10209 }
10210 }
10211 }
10212
10213 override void EOnContact(IEntity other, Contact extra)
10214 {
10216 {
10217 int liquidType = -1;
10219 if (impactSpeed > 0.0)
10220 {
10222 #ifndef SERVER
10224 #else
10226 SetSynchDirty();
10227 #endif
10229 }
10230 }
10231
10232 #ifdef SERVER
10233 if (GetCompEM() && GetCompEM().IsPlugged())
10234 {
10235 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10236 GetCompEM().UnplugThis();
10237 }
10238 #endif
10239 }
10240
10242
10244 {
10246 }
10247
10249 {
10250
10251 }
10252
10254 {
10255 super.OnItemLocationChanged(old_owner, new_owner);
10256
10257 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10258 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10259
10260 if (!relatedPlayer && playerNew)
10261 relatedPlayer = playerNew;
10262
10263 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10264 {
10266 if (actionMgr)
10267 {
10268 ActionBase currentAction = actionMgr.GetRunningAction();
10269 if (currentAction)
10271 }
10272 }
10273
10274 Man ownerPlayerOld = null;
10275 Man ownerPlayerNew = null;
10276
10277 if (old_owner)
10278 {
10279 if (old_owner.
IsMan())
10280 {
10281 ownerPlayerOld = Man.Cast(old_owner);
10282 }
10283 else
10284 {
10285 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10286 }
10287 }
10288 else
10289 {
10291 {
10293
10294 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10295 {
10296 GetCompEM().UnplugThis();
10297 }
10298 }
10299 }
10300
10301 if (new_owner)
10302 {
10303 if (new_owner.
IsMan())
10304 {
10305 ownerPlayerNew = Man.Cast(new_owner);
10306 }
10307 else
10308 {
10309 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10310 }
10311 }
10312
10313 if (ownerPlayerOld != ownerPlayerNew)
10314 {
10315 if (ownerPlayerOld)
10316 {
10317 array<EntityAI> subItemsExit = new array<EntityAI>;
10319 for (int i = 0; i < subItemsExit.Count(); i++)
10320 {
10323 }
10324 }
10325
10326 if (ownerPlayerNew)
10327 {
10328 array<EntityAI> subItemsEnter = new array<EntityAI>;
10330 for (int j = 0; j < subItemsEnter.Count(); j++)
10331 {
10334 }
10335 }
10336 }
10337 else if (ownerPlayerNew != null)
10338 {
10339 PlayerBase nplayer;
10340 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10341 {
10342 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10344 for (int k = 0; k < subItemsUpdate.Count(); k++)
10345 {
10347 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10348 }
10349 }
10350 }
10351
10352 if (old_owner)
10353 old_owner.OnChildItemRemoved(this);
10354 if (new_owner)
10355 new_owner.OnChildItemReceived(this);
10356 }
10357
10358
10360 {
10361 super.EEDelete(parent);
10362 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10363 if (player)
10364 {
10366
10367 if (player.IsAlive())
10368 {
10369 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10370 if (r_index >= 0)
10371 {
10372 InventoryLocation r_il = new InventoryLocation;
10373 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10374
10375 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10378 {
10379 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10380 }
10382 {
10383 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10384 }
10385
10386 }
10387
10388 player.RemoveQuickBarEntityShortcut(this);
10389 }
10390 }
10391 }
10392
10394 {
10395 super.EEKilled(killer);
10396
10399 {
10400 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10401 {
10402 if (IsMagazine())
10403 {
10404 if (Magazine.Cast(this).GetAmmoCount() > 0)
10405 {
10407 }
10408 }
10409 else
10410 {
10412 }
10413 }
10414 }
10415 }
10416
10418 {
10419 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10420
10421 super.OnWasAttached(parent, slot_id);
10422
10425
10427 }
10428
10430 {
10431 super.OnWasDetached(parent, slot_id);
10432
10435 }
10436
10438 {
10439 int idx;
10442
10443 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10444 if (inventory_slots.Count() < 1)
10445 {
10446 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10447 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10448 }
10449 else
10450 {
10451 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10452 }
10453
10454 idx = inventory_slots.Find(slot);
10455 if (idx < 0)
10456 return "";
10457
10458 return attach_types.Get(idx);
10459 }
10460
10462 {
10463 int idx = -1;
10464 string slot;
10465
10468
10469 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10470 if (inventory_slots.Count() < 1)
10471 {
10472 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10473 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10474 }
10475 else
10476 {
10477 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10478 if (detach_types.Count() < 1)
10479 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10480 }
10481
10482 for (int i = 0; i < inventory_slots.Count(); i++)
10483 {
10484 slot = inventory_slots.Get(i);
10485 }
10486
10487 if (slot != "")
10488 {
10489 if (detach_types.Count() == 1)
10490 idx = 0;
10491 else
10492 idx = inventory_slots.Find(slot);
10493 }
10494 if (idx < 0)
10495 return "";
10496
10497 return detach_types.Get(idx);
10498 }
10499
10501 {
10502
10504
10505
10506 float min_time = 1;
10507 float max_time = 3;
10508 float delay = Math.RandomFloat(min_time, max_time);
10509
10510 explode_timer.Run(delay, this, "DoAmmoExplosion");
10511 }
10512
10514 {
10515 Magazine magazine = Magazine.Cast(this);
10516 int pop_sounds_count = 6;
10517 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10518
10519
10520 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10521 string sound_name = pop_sounds[ sound_idx ];
10523
10524
10525 magazine.ServerAddAmmoCount(-1);
10526
10527
10528 float min_temp_to_explode = 100;
10529
10530 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10531 {
10533 }
10534 }
10535
10536
10537 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10538 {
10539 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10540
10541 const int CHANCE_DAMAGE_CARGO = 4;
10542 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10543 const int CHANCE_DAMAGE_NOTHING = 2;
10544
10546 {
10547 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10548 int chances;
10549 int rnd;
10550
10551 if (GetInventory().GetCargo())
10552 {
10553 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10554 rnd = Math.RandomInt(0,chances);
10555
10556 if (rnd < CHANCE_DAMAGE_CARGO)
10557 {
10559 }
10560 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10561 {
10563 }
10564 }
10565 else
10566 {
10567 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10568 rnd = Math.RandomInt(0,chances);
10569
10570 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10571 {
10573 }
10574 }
10575 }
10576 }
10577
10579 {
10580 if (GetInventory().GetCargo())
10581 {
10582 int item_count = GetInventory().GetCargo().GetItemCount();
10583 if (item_count > 0)
10584 {
10585 int random_pick = Math.RandomInt(0, item_count);
10587 if (!item.IsExplosive())
10588 {
10589 item.AddHealth("","",damage);
10590 return true;
10591 }
10592 }
10593 }
10594 return false;
10595 }
10596
10598 {
10599 int attachment_count = GetInventory().AttachmentCount();
10600 if (attachment_count > 0)
10601 {
10602 int random_pick = Math.RandomInt(0, attachment_count);
10603 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10604 if (!attachment.IsExplosive())
10605 {
10606 attachment.AddHealth("","",damage);
10607 return true;
10608 }
10609 }
10610 return false;
10611 }
10612
10614 {
10616 }
10617
10619 {
10621 return GetInventory().CanRemoveEntity();
10622
10623 return false;
10624 }
10625
10627 {
10628
10630 return false;
10631
10632
10634 return false;
10635
10636
10637
10639 if (delta == 0)
10640 return false;
10641
10642
10643 return true;
10644 }
10645
10647 {
10649 {
10650 if (ScriptInputUserData.CanStoreInputUserData())
10651 {
10652 ScriptInputUserData ctx = new ScriptInputUserData;
10657 ctx.
Write(destination_entity);
10659 ctx.
Write(slot_id);
10661 }
10662 }
10663 else if (!
GetGame().IsMultiplayer())
10664 {
10666 }
10667 }
10668
10670 {
10671 float split_quantity_new;
10675 InventoryLocation loc = new InventoryLocation;
10676
10677 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10678 {
10680 split_quantity_new = stack_max;
10681 else
10683
10685 {
10686 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10687 if (new_item)
10688 {
10689 new_item.SetResultOfSplit(true);
10690 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10692 new_item.
SetQuantity(split_quantity_new,
false,
true);
10693 }
10694 }
10695 }
10696 else if (destination_entity && slot_id == -1)
10697 {
10698 if (quantity > stack_max)
10699 split_quantity_new = stack_max;
10700 else
10701 split_quantity_new = quantity;
10702
10704 {
10706 {
10709 }
10710
10711 if (new_item)
10712 {
10713 new_item.SetResultOfSplit(true);
10714 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10716 new_item.
SetQuantity(split_quantity_new,
false,
true);
10717 }
10718 }
10719 }
10720 else
10721 {
10722 if (stack_max != 0)
10723 {
10725 {
10727 }
10728
10729 if (split_quantity_new == 0)
10730 {
10731 if (!
GetGame().IsMultiplayer())
10732 player.PhysicalPredictiveDropItem(this);
10733 else
10734 player.ServerDropEntity(this);
10735 return;
10736 }
10737
10739 {
10741
10742 if (new_item)
10743 {
10744 new_item.SetResultOfSplit(true);
10745 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10748 new_item.PlaceOnSurface();
10749 }
10750 }
10751 }
10752 }
10753 }
10754
10756 {
10757 float split_quantity_new;
10761 InventoryLocation loc = new InventoryLocation;
10762
10763 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10764 {
10766 split_quantity_new = stack_max;
10767 else
10769
10771 {
10772 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10773 if (new_item)
10774 {
10775 new_item.SetResultOfSplit(true);
10776 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10778 new_item.
SetQuantity(split_quantity_new,
false,
true);
10779 }
10780 }
10781 }
10782 else if (destination_entity && slot_id == -1)
10783 {
10784 if (quantity > stack_max)
10785 split_quantity_new = stack_max;
10786 else
10787 split_quantity_new = quantity;
10788
10790 {
10792 {
10795 }
10796
10797 if (new_item)
10798 {
10799 new_item.SetResultOfSplit(true);
10800 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10802 new_item.
SetQuantity(split_quantity_new,
false,
true);
10803 }
10804 }
10805 }
10806 else
10807 {
10808 if (stack_max != 0)
10809 {
10811 {
10813 }
10814
10816 {
10818
10819 if (new_item)
10820 {
10821 new_item.SetResultOfSplit(true);
10822 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10825 new_item.PlaceOnSurface();
10826 }
10827 }
10828 }
10829 }
10830 }
10831
10833 {
10835 {
10836 if (ScriptInputUserData.CanStoreInputUserData())
10837 {
10838 ScriptInputUserData ctx = new ScriptInputUserData;
10843 dst.WriteToContext(ctx);
10845 }
10846 }
10847 else if (!
GetGame().IsMultiplayer())
10848 {
10850 }
10851 }
10852
10854 {
10856 {
10857 if (ScriptInputUserData.CanStoreInputUserData())
10858 {
10859 ScriptInputUserData ctx = new ScriptInputUserData;
10864 ctx.
Write(destination_entity);
10870 }
10871 }
10872 else if (!
GetGame().IsMultiplayer())
10873 {
10875 }
10876 }
10877
10879 {
10881 }
10882
10884 {
10886 float split_quantity_new;
10888 if (dst.IsValid())
10889 {
10890 int slot_id = dst.GetSlot();
10892
10893 if (quantity > stack_max)
10894 split_quantity_new = stack_max;
10895 else
10896 split_quantity_new = quantity;
10897
10899 {
10901
10902 if (new_item)
10903 {
10904 new_item.SetResultOfSplit(true);
10905 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10907 new_item.
SetQuantity(split_quantity_new,
false,
true);
10908 }
10909
10910 return new_item;
10911 }
10912 }
10913
10914 return null;
10915 }
10916
10918 {
10920 float split_quantity_new;
10922 if (destination_entity)
10923 {
10925 if (quantity > stackable)
10926 split_quantity_new = stackable;
10927 else
10928 split_quantity_new = quantity;
10929
10931 {
10932 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10933 if (new_item)
10934 {
10935 new_item.SetResultOfSplit(true);
10936 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10938 new_item.
SetQuantity(split_quantity_new,
false,
true);
10939 }
10940 }
10941 }
10942 }
10943
10945 {
10947 {
10948 if (ScriptInputUserData.CanStoreInputUserData())
10949 {
10950 ScriptInputUserData ctx = new ScriptInputUserData;
10955 ItemBase destination_entity =
this;
10956 ctx.
Write(destination_entity);
10960 }
10961 }
10962 else if (!
GetGame().IsMultiplayer())
10963 {
10965 }
10966 }
10967
10969 {
10971 float split_quantity_new;
10973 if (player)
10974 {
10976 if (quantity > stackable)
10977 split_quantity_new = stackable;
10978 else
10979 split_quantity_new = quantity;
10980
10982 {
10983 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10984 new_item =
ItemBase.Cast(in_hands);
10985 if (new_item)
10986 {
10987 new_item.SetResultOfSplit(true);
10988 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10990 new_item.SetQuantity(split_quantity_new, false, true);
10991 }
10992 }
10993 }
10994 }
10995
10997 {
10999 float split_quantity_new = Math.Floor(quantity * 0.5);
11000
11002 return;
11003
11005
11006 if (new_item)
11007 {
11008 if (new_item.GetQuantityMax() < split_quantity_new)
11009 {
11010 split_quantity_new = new_item.GetQuantityMax();
11011 }
11012
11013 new_item.SetResultOfSplit(true);
11014 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11015
11017 {
11020 }
11021 else
11022 {
11024 new_item.
SetQuantity(split_quantity_new,
false,
true);
11025 }
11026 }
11027 }
11028
11030 {
11032 float split_quantity_new = Math.Floor(quantity / 2);
11033
11035 return;
11036
11037 InventoryLocation invloc = new InventoryLocation;
11039
11041 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11042
11043 if (new_item)
11044 {
11045 if (new_item.GetQuantityMax() < split_quantity_new)
11046 {
11047 split_quantity_new = new_item.GetQuantityMax();
11048 }
11050 {
11053 }
11054 else if (split_quantity_new > 1)
11055 {
11057 new_item.
SetQuantity(split_quantity_new,
false,
true);
11058 }
11059 }
11060 }
11061
11064 {
11065 SetWeightDirty();
11067
11068 if (parent)
11069 parent.OnAttachmentQuantityChangedEx(this, delta);
11070
11072 {
11074 {
11076 }
11078 {
11079 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11081 }
11082 }
11083
11084 }
11085
11088 {
11089
11090 }
11091
11094 {
11096 }
11097
11099 {
11100 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11101
11103 {
11104 if (newLevel == GameConstants.STATE_RUINED)
11105 {
11107 EntityAI parent = GetHierarchyParent();
11108 if (parent && parent.IsFireplace())
11109 {
11110 CargoBase cargo = GetInventory().GetCargo();
11111 if (cargo)
11112 {
11114 {
11116 }
11117 }
11118 }
11119 }
11120
11122 {
11123
11125 return;
11126 }
11127
11128 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11129 {
11131 }
11132 }
11133 }
11134
11135
11137 {
11138 super.OnRightClick();
11139
11141 {
11143 {
11144 if (ScriptInputUserData.CanStoreInputUserData())
11145 {
11146 EntityAI root = GetHierarchyRoot();
11147 Man playerOwner = GetHierarchyRootPlayer();
11148 InventoryLocation dst = new InventoryLocation;
11149
11150
11151 if (!playerOwner && root && root == this)
11152 {
11154 }
11155 else
11156 {
11157
11158 GetInventory().GetCurrentInventoryLocation(dst);
11160 {
11163 {
11165 }
11166 else
11167 {
11169
11170
11171 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11172 {
11174 }
11175 else
11176 {
11177 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11178 }
11179 }
11180 }
11181 }
11182
11183 ScriptInputUserData ctx = new ScriptInputUserData;
11191 }
11192 }
11193 else if (!
GetGame().IsMultiplayer())
11194 {
11196 }
11197 }
11198 }
11199
11201 {
11202 if (root)
11203 {
11204 vector m4[4];
11205 root.GetTransform(m4);
11206 dst.SetGround(this, m4);
11207 }
11208 else
11209 {
11210 GetInventory().GetCurrentInventoryLocation(dst);
11211 }
11212 }
11213
11214 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11215 {
11216
11217 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11218 return false;
11219
11220 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11221 return false;
11222
11223
11225 return false;
11226
11227
11228 Magazine mag = Magazine.Cast(this);
11229 if (mag)
11230 {
11231 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11232 return false;
11233
11234 if (stack_max_limit)
11235 {
11236 Magazine other_mag = Magazine.Cast(other_item);
11237 if (other_item)
11238 {
11239 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11240 return false;
11241 }
11242
11243 }
11244 }
11245 else
11246 {
11247
11249 return false;
11250
11252 return false;
11253 }
11254
11255 PlayerBase player = null;
11256 if (CastTo(player, GetHierarchyRootPlayer()))
11257 {
11258 if (player.GetInventory().HasAttachment(this))
11259 return false;
11260
11261 if (player.IsItemsToDelete())
11262 return false;
11263 }
11264
11265 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11266 return false;
11267
11268 int slotID;
11270 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11271 return false;
11272
11273 return true;
11274 }
11275
11277 {
11279 }
11280
11282 {
11283 return m_IsResultOfSplit;
11284 }
11285
11287 {
11288 m_IsResultOfSplit = value;
11289 }
11290
11292 {
11294 }
11295
11297 {
11298 float other_item_quantity = other_item.GetQuantity();
11299 float this_free_space;
11300
11302
11304
11305 if (other_item_quantity > this_free_space)
11306 {
11307 return this_free_space;
11308 }
11309 else
11310 {
11311 return other_item_quantity;
11312 }
11313 }
11314
11316 {
11318 }
11319
11321 {
11323 return;
11324
11325 if (!IsMagazine() && other_item)
11326 {
11328 if (quantity_used != 0)
11329 {
11330 float hp1 = GetHealth01("","");
11331 float hp2 = other_item.GetHealth01("","");
11332 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11333 hpResult = hpResult / (
GetQuantity() + quantity_used);
11334
11335 hpResult *= GetMaxHealth();
11336 Math.Round(hpResult);
11337 SetHealth("", "Health", hpResult);
11338
11340 other_item.AddQuantity(-quantity_used);
11341 }
11342 }
11344 }
11345
11347 {
11348 #ifdef SERVER
11349 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11350 GetHierarchyParent().IncreaseLifetimeUp();
11351 #endif
11352 };
11353
11355 {
11356 PlayerBase p = PlayerBase.Cast(player);
11357
11358 array<int> recipesIds = p.m_Recipes;
11359 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11360 if (moduleRecipesManager)
11361 {
11362 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11363 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11364 }
11365
11366 for (int i = 0;i < recipesIds.Count(); i++)
11367 {
11368 int key = recipesIds.Get(i);
11369 string recipeName = moduleRecipesManager.GetRecipeName(key);
11371 }
11372 }
11373
11374
11375 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11376 {
11377 super.GetDebugActions(outputList);
11378
11379
11385
11386
11391
11396
11397
11401
11402
11404 {
11408 }
11409
11412
11413
11417
11419
11420 InventoryLocation loc = new InventoryLocation();
11421 GetInventory().GetCurrentInventoryLocation(loc);
11423 {
11424 if (Gizmo_IsSupported())
11427 }
11428
11430 }
11431
11432
11433
11434
11436 {
11437 super.OnAction(action_id, player, ctx);
11438
11440 {
11441 switch (action_id)
11442 {
11445 return true;
11448 return true;
11449 }
11450 }
11451
11453 {
11454 switch (action_id)
11455 {
11457 Delete();
11458 return true;
11459 }
11460 }
11461
11462 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11463 {
11464 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11465 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11466 PlayerBase p = PlayerBase.Cast(player);
11467 if (
EActions.RECIPES_RANGE_START < 1000)
11468 {
11469 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11470 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11471 }
11472 }
11473 #ifndef SERVER
11474 else if (action_id ==
EActions.WATCH_PLAYER)
11475 {
11476 PluginDeveloper.SetDeveloperItemClientEx(player);
11477 }
11478 #endif
11480 {
11481 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11482 {
11483 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11484 OnDebugButtonPressServer(id + 1);
11485 }
11486
11487 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11488 {
11489 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11491 }
11492
11493 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11494 {
11495 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11497 }
11498
11499 else if (action_id ==
EActions.ADD_QUANTITY)
11500 {
11501 if (IsMagazine())
11502 {
11503 Magazine mag = Magazine.Cast(this);
11504 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11505 }
11506 else
11507 {
11509 }
11510
11511 if (m_EM)
11512 {
11513 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11514 }
11515
11516 }
11517
11518 else if (action_id ==
EActions.REMOVE_QUANTITY)
11519 {
11520 if (IsMagazine())
11521 {
11522 Magazine mag2 = Magazine.Cast(this);
11523 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11524 }
11525 else
11526 {
11528 }
11529 if (m_EM)
11530 {
11531 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11532 }
11533
11534 }
11535
11536 else if (action_id ==
EActions.SET_QUANTITY_0)
11537 {
11539
11540 if (m_EM)
11541 {
11542 m_EM.SetEnergy(0);
11543 }
11544 }
11545
11546 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11547 {
11549
11550 if (m_EM)
11551 {
11552 m_EM.SetEnergy(m_EM.GetEnergyMax());
11553 }
11554 }
11555
11556 else if (action_id ==
EActions.ADD_HEALTH)
11557 {
11558 AddHealth("","",GetMaxHealth("","Health")/5);
11559 }
11560 else if (action_id ==
EActions.REMOVE_HEALTH)
11561 {
11562 AddHealth("","",-GetMaxHealth("","Health")/5);
11563 }
11564 else if (action_id ==
EActions.DESTROY_HEALTH)
11565 {
11566 SetHealth01("","",0);
11567 }
11568 else if (action_id ==
EActions.WATCH_ITEM)
11569 {
11571 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11572 #ifdef DEVELOPER
11573 SetDebugDeveloper_item(this);
11574 #endif
11575 }
11576
11577 else if (action_id ==
EActions.ADD_TEMPERATURE)
11578 {
11579 AddTemperature(20);
11580
11581 }
11582
11583 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11584 {
11585 AddTemperature(-20);
11586
11587 }
11588
11589 else if (action_id ==
EActions.FLIP_FROZEN)
11590 {
11591 SetFrozen(!GetIsFrozen());
11592
11593 }
11594
11595 else if (action_id ==
EActions.ADD_WETNESS)
11596 {
11598
11599 }
11600
11601 else if (action_id ==
EActions.REMOVE_WETNESS)
11602 {
11604
11605 }
11606
11607 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11608 {
11611
11612
11613 }
11614
11615 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11616 {
11619 }
11620
11621 else if (action_id ==
EActions.MAKE_SPECIAL)
11622 {
11623 auto debugParams = DebugSpawnParams.WithPlayer(player);
11624 OnDebugSpawnEx(debugParams);
11625 }
11626
11627 }
11628
11629
11630 return false;
11631 }
11632
11633
11634
11635
11639
11642
11643
11644
11646 {
11647 return false;
11648 }
11649
11650
11652 {
11653 return true;
11654 }
11655
11656
11658 {
11659 return true;
11660 }
11661
11662
11663
11665 {
11666 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11668 }
11669
11672 {
11673 return null;
11674 }
11675
11677 {
11678 return false;
11679 }
11680
11682 {
11683 return false;
11684 }
11685
11689
11690
11692 {
11693 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11694 return module_repairing.CanRepair(this, item_repair_kit);
11695 }
11696
11697
11698 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11699 {
11700 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11701 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11702 }
11703
11704
11706 {
11707
11708
11709
11710
11711
11712
11713
11714
11715 return 1;
11716 }
11717
11718
11719
11721 {
11723 }
11724
11725
11726
11728 {
11730 }
11731
11732
11741 {
11742 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11743
11744 if (player)
11745 {
11746 player.MessageStatus(text);
11747 }
11748 }
11749
11750
11759 {
11760 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11761
11762 if (player)
11763 {
11764 player.MessageAction(text);
11765 }
11766 }
11767
11768
11777 {
11778 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11779
11780 if (player)
11781 {
11782 player.MessageFriendly(text);
11783 }
11784 }
11785
11786
11795 {
11796 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11797
11798 if (player)
11799 {
11800 player.MessageImportant(text);
11801 }
11802 }
11803
11805 {
11806 return true;
11807 }
11808
11809
11810 override bool KindOf(
string tag)
11811 {
11812 bool found = false;
11813 string item_name = this.
GetType();
11816
11817 int array_size = item_tag_array.Count();
11818 for (int i = 0; i < array_size; i++)
11819 {
11820 if (item_tag_array.Get(i) == tag)
11821 {
11822 found = true;
11823 break;
11824 }
11825 }
11826 return found;
11827 }
11828
11829
11831 {
11832
11833 super.OnRPC(sender, rpc_type,ctx);
11834
11835
11836 switch (rpc_type)
11837 {
11838 #ifndef SERVER
11839 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11840 Param2<bool, string> p = new Param2<bool, string>(false, "");
11841
11843 return;
11844
11845 bool play = p.param1;
11846 string soundSet = p.param2;
11847
11848 if (play)
11849 {
11851 {
11853 {
11855 }
11856 }
11857 else
11858 {
11860 }
11861 }
11862 else
11863 {
11865 }
11866
11867 break;
11868 #endif
11869
11870 }
11871
11873 {
11875 }
11876 }
11877
11878
11879
11880
11882 {
11883 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11884 return plugin.GetID(
name);
11885 }
11886
11888 {
11889 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11890 return plugin.GetName(id);
11891 }
11892
11895 {
11896
11897
11898 int varFlags;
11899 if (!ctx.
Read(varFlags))
11900 return;
11901
11902 if (varFlags & ItemVariableFlags.FLOAT)
11903 {
11905 }
11906 }
11907
11909 {
11910
11911 super.SerializeNumericalVars(floats_out);
11912
11913
11914
11916 {
11918 }
11919
11921 {
11923 }
11924
11926 {
11928 }
11929
11931 {
11936 }
11937
11939 {
11941 }
11942 }
11943
11945 {
11946
11947 super.DeSerializeNumericalVars(floats);
11948
11949
11950 int index = 0;
11951 int mask = Math.Round(floats.Get(index));
11952
11953 index++;
11954
11956 {
11958 {
11960 }
11961 else
11962 {
11963 float quantity = floats.Get(index);
11964 SetQuantity(quantity,
true,
false,
false,
false);
11965 }
11966 index++;
11967 }
11968
11970 {
11971 float wet = floats.Get(index);
11973 index++;
11974 }
11975
11977 {
11978 int liquidtype = Math.Round(floats.Get(index));
11980 index++;
11981 }
11982
11984 {
11986 index++;
11988 index++;
11990 index++;
11992 index++;
11993 }
11994
11996 {
11997 int cleanness = Math.Round(floats.Get(index));
11999 index++;
12000 }
12001 }
12002
12004 {
12005 super.WriteVarsToCTX(ctx);
12006
12007
12009 {
12011 }
12012
12014 {
12016 }
12017
12019 {
12021 }
12022
12024 {
12025 int r,g,b,a;
12031 }
12032
12034 {
12036 }
12037 }
12038
12040 {
12041 if (!super.ReadVarsFromCTX(ctx,version))
12042 return false;
12043
12044 int intValue;
12045 float value;
12046
12047 if (version < 140)
12048 {
12049 if (!ctx.
Read(intValue))
12050 return false;
12051
12052 m_VariablesMask = intValue;
12053 }
12054
12056 {
12057 if (!ctx.
Read(value))
12058 return false;
12059
12061 {
12063 }
12064 else
12065 {
12067 }
12068 }
12069
12070 if (version < 140)
12071 {
12073 {
12074 if (!ctx.
Read(value))
12075 return false;
12076 SetTemperatureDirect(value);
12077 }
12078 }
12079
12081 {
12082 if (!ctx.
Read(value))
12083 return false;
12085 }
12086
12088 {
12089 if (!ctx.
Read(intValue))
12090 return false;
12092 }
12093
12095 {
12096 int r,g,b,a;
12098 return false;
12100 return false;
12102 return false;
12104 return false;
12105
12107 }
12108
12110 {
12111 if (!ctx.
Read(intValue))
12112 return false;
12114 }
12115
12116 if (version >= 138 && version < 140)
12117 {
12119 {
12120 if (!ctx.
Read(intValue))
12121 return false;
12122 SetFrozen(intValue);
12123 }
12124 }
12125
12126 return true;
12127 }
12128
12129
12131 {
12134 {
12136 }
12137
12138 if (!super.OnStoreLoad(ctx, version))
12139 {
12141 return false;
12142 }
12143
12144 if (version >= 114)
12145 {
12146 bool hasQuickBarIndexSaved;
12147
12148 if (!ctx.
Read(hasQuickBarIndexSaved))
12149 {
12151 return false;
12152 }
12153
12154 if (hasQuickBarIndexSaved)
12155 {
12156 int itmQBIndex;
12157
12158
12159 if (!ctx.
Read(itmQBIndex))
12160 {
12162 return false;
12163 }
12164
12165 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12166 if (itmQBIndex != -1 && parentPlayer)
12167 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12168 }
12169 }
12170 else
12171 {
12172
12173 PlayerBase player;
12174 int itemQBIndex;
12175 if (version ==
int.
MAX)
12176 {
12177 if (!ctx.
Read(itemQBIndex))
12178 {
12180 return false;
12181 }
12182 }
12183 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12184 {
12185
12186 if (!ctx.
Read(itemQBIndex))
12187 {
12189 return false;
12190 }
12191 if (itemQBIndex != -1 && player)
12192 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12193 }
12194 }
12195
12196 if (version < 140)
12197 {
12198
12199 if (!LoadVariables(ctx, version))
12200 {
12202 return false;
12203 }
12204 }
12205
12206
12208 {
12210 return false;
12211 }
12212 if (version >= 132)
12213 {
12215 if (raib)
12216 {
12218 {
12220 return false;
12221 }
12222 }
12223 }
12224
12226 return true;
12227 }
12228
12229
12230
12232 {
12233 super.OnStoreSave(ctx);
12234
12235 PlayerBase player;
12236 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12237 {
12239
12240 int itemQBIndex = -1;
12241 itemQBIndex = player.FindQuickBarEntityIndex(this);
12242 ctx.
Write(itemQBIndex);
12243 }
12244 else
12245 {
12247 }
12248
12250
12252 if (raib)
12253 {
12255 }
12256 }
12257
12258
12260 {
12261 super.AfterStoreLoad();
12262
12264 {
12266 }
12267
12269 {
12272 }
12273 }
12274
12276 {
12277 super.EEOnAfterLoad();
12278
12280 {
12282 }
12283
12286 }
12287
12289 {
12290 return false;
12291 }
12292
12293
12294
12296 {
12298 {
12299 #ifdef PLATFORM_CONSOLE
12300
12302 {
12304 if (menu)
12305 {
12307 }
12308 }
12309 #endif
12310 }
12311
12313 {
12316 }
12317
12319 {
12320 SetWeightDirty();
12322 }
12324 {
12327 }
12328
12330 {
12333 }
12335 {
12338 }
12339
12340 super.OnVariablesSynchronized();
12341 }
12342
12343
12344
12346 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12347 {
12348 if (!IsServerCheck(allow_client))
12349 return false;
12350
12352 return false;
12353
12356
12357 if (value <= (min + 0.001))
12358 value = min;
12359
12360 if (value == min)
12361 {
12362 if (destroy_config)
12363 {
12364 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12365 if (dstr)
12366 {
12368 this.Delete();
12369 return true;
12370 }
12371 }
12372 else if (destroy_forced)
12373 {
12375 this.Delete();
12376 return true;
12377 }
12378
12380 }
12381
12384
12386 {
12388
12389 if (delta)
12391 }
12392
12394
12395 return false;
12396 }
12397
12398
12400 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12401 {
12403 }
12404
12406 {
12409 }
12410
12412 {
12415 }
12416
12418 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12419 {
12420 float value_clamped = Math.Clamp(value, 0, 1);
12422 SetQuantity(result, destroy_config, destroy_forced);
12423 }
12424
12425
12428 {
12430 }
12431
12433 {
12435 }
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12447 {
12448 int slot = -1;
12449 if (GetInventory())
12450 {
12451 InventoryLocation il = new InventoryLocation;
12452 GetInventory().GetCurrentInventoryLocation(il);
12454 }
12455
12457 }
12458
12460 {
12461 float quantity_max = 0;
12462
12464 {
12465 if (attSlotID != -1)
12466 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12467
12468 if (quantity_max <= 0)
12470 }
12471
12472 if (quantity_max <= 0)
12474
12475 return quantity_max;
12476 }
12477
12479 {
12481 }
12482
12484 {
12486 }
12487
12488
12490 {
12492 }
12493
12495 {
12497 }
12498
12500 {
12502 }
12503
12504
12506 {
12507
12508 float weightEx = GetWeightEx();
12509 float special = GetInventoryAndCargoWeight();
12510 return weightEx - special;
12511 }
12512
12513
12515 {
12517 }
12518
12520 {
12522 {
12523 #ifdef DEVELOPER
12524 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12525 {
12526 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12528 }
12529 #endif
12530
12531 return GetQuantity() * GetConfigWeightModified();
12532 }
12533 else if (HasEnergyManager())
12534 {
12535 #ifdef DEVELOPER
12536 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12537 {
12538 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12539 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12540 }
12541 #endif
12542 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12543 }
12544 else
12545 {
12546 #ifdef DEVELOPER
12547 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12548 {
12549 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12550 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12551 }
12552 #endif
12553 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12554 }
12555 }
12556
12559 {
12560 int item_count = 0;
12562
12563 if (GetInventory().GetCargo() != NULL)
12564 {
12565 item_count = GetInventory().GetCargo().GetItemCount();
12566 }
12567
12568 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12569 {
12570 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12571 if (item)
12572 item_count += item.GetNumberOfItems();
12573 }
12574 return item_count;
12575 }
12576
12579 {
12580 float weight = 0;
12581 float wetness = 1;
12582 if (include_wetness)
12585 {
12586 weight = wetness * m_ConfigWeight;
12587 }
12589 {
12590 weight = 1;
12591 }
12592 return weight;
12593 }
12594
12595
12596
12598 {
12599 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12600 {
12601 GameInventory inv = GetInventory();
12602 array<EntityAI> items = new array<EntityAI>;
12604 for (int i = 0; i < items.Count(); i++)
12605 {
12607 if (item)
12608 {
12610 }
12611 }
12612 }
12613 }
12614
12615
12616
12617
12619 {
12620 float energy = 0;
12621 if (HasEnergyManager())
12622 {
12623 energy = GetCompEM().GetEnergy();
12624 }
12625 return energy;
12626 }
12627
12628
12630 {
12631 super.OnEnergyConsumed();
12632
12634 }
12635
12637 {
12638 super.OnEnergyAdded();
12639
12641 }
12642
12643
12645 {
12646 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12647 {
12649 {
12650 float energy_0to1 = GetCompEM().GetEnergy0To1();
12652 }
12653 }
12654 }
12655
12656
12658 {
12659 return ConfigGetFloat("heatIsolation");
12660 }
12661
12663 {
12665 }
12666
12668 {
12669 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12670 if (
GetGame().ConfigIsExisting(paramPath))
12672
12673 return 0.0;
12674 }
12675
12677 {
12678 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12679 if (
GetGame().ConfigIsExisting(paramPath))
12681
12682 return 0.0;
12683 }
12684
12685 override void SetWet(
float value,
bool allow_client =
false)
12686 {
12687 if (!IsServerCheck(allow_client))
12688 return;
12689
12692
12694
12695 m_VarWet = Math.Clamp(value, min, max);
12696
12698 {
12701 }
12702 }
12703
12704 override void AddWet(
float value)
12705 {
12707 }
12708
12710 {
12712 }
12713
12715 {
12717 }
12718
12720 {
12722 }
12723
12725 {
12727 }
12728
12730 {
12732 }
12733
12734 override void OnWetChanged(
float newVal,
float oldVal)
12735 {
12738 if (newLevel != oldLevel)
12739 {
12741 }
12742 }
12743
12745 {
12746 SetWeightDirty();
12747 }
12748
12750 {
12751 return GetWetLevelInternal(
m_VarWet);
12752 }
12753
12754
12755
12757 {
12759 }
12760
12762 {
12764 }
12765
12767 {
12769 }
12770
12772 {
12774 }
12775
12776
12777
12779 {
12780 if (ConfigIsExisting("itemModelLength"))
12781 {
12782 return ConfigGetFloat("itemModelLength");
12783 }
12784 return 0;
12785 }
12786
12788 {
12789 if (ConfigIsExisting("itemAttachOffset"))
12790 {
12791 return ConfigGetFloat("itemAttachOffset");
12792 }
12793 return 0;
12794 }
12795
12796 override void SetCleanness(
int value,
bool allow_client =
false)
12797 {
12798 if (!IsServerCheck(allow_client))
12799 return;
12800
12802
12804
12807 }
12808
12810 {
12812 }
12813
12815 {
12816 return true;
12817 }
12818
12819
12820
12821
12823 {
12825 }
12826
12828 {
12830 }
12831
12832
12833
12834
12835 override void SetColor(
int r,
int g,
int b,
int a)
12836 {
12842 }
12844 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12845 {
12850 }
12851
12853 {
12855 }
12856
12859 {
12860 int r,g,b,a;
12862 r = r/255;
12863 g = g/255;
12864 b = b/255;
12865 a = a/255;
12866 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12867 }
12868
12869
12870
12871 override void SetLiquidType(
int value,
bool allow_client =
false)
12872 {
12873 if (!IsServerCheck(allow_client))
12874 return;
12875
12880 }
12881
12883 {
12884 return ConfigGetInt("varLiquidTypeInit");
12885 }
12886
12888 {
12890 }
12891
12893 {
12895 SetFrozen(false);
12896 }
12897
12900 {
12901 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12902 }
12903
12904
12907 {
12908 PlayerBase nplayer;
12909 if (PlayerBase.CastTo(nplayer, player))
12910 {
12912
12913 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12914 }
12915 }
12916
12917
12920 {
12921 PlayerBase nplayer;
12922 if (PlayerBase.CastTo(nplayer,player))
12923 {
12924
12925 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12926
12927 }
12928
12929
12930 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12931
12932
12933 if (HasEnergyManager())
12934 {
12935 GetCompEM().UpdatePlugState();
12936 }
12937 }
12938
12939
12941 {
12942 super.OnPlacementStarted(player);
12943
12945 }
12946
12947 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12948 {
12950 {
12951 m_AdminLog.OnPlacementComplete(player,
this);
12952 }
12953
12954 super.OnPlacementComplete(player, position, orientation);
12955 }
12956
12957
12958
12959
12960
12962 {
12964 {
12965 return true;
12966 }
12967 else
12968 {
12969 return false;
12970 }
12971 }
12972
12973
12975 {
12977 {
12979 }
12980 }
12981
12982
12984 {
12986 }
12987
12989 {
12991 }
12992
12993 override void InsertAgent(
int agent,
float count = 1)
12994 {
12995 if (count < 1)
12996 return;
12997
12999 }
13000
13003 {
13005 }
13006
13007
13009 {
13011 }
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13055 {
13057 return false;
13058 return true;
13059 }
13060
13062 {
13063
13065 }
13066
13067
13070 {
13071 super.CheckForRoofLimited(timeTresholdMS);
13072
13074 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13075 {
13076 m_PreviousRoofTestTime = time;
13077 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13078 }
13079 }
13080
13081
13083 {
13085 {
13086 return 0;
13087 }
13088
13089 if (GetInventory().GetAttachmentSlotsCount() != 0)
13090 {
13091 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13092 if (filter)
13093 return filter.GetProtectionLevel(type, false, system);
13094 else
13095 return 0;
13096 }
13097
13098 string subclassPath, entryName;
13099
13100 switch (type)
13101 {
13103 entryName = "biological";
13104 break;
13106 entryName = "chemical";
13107 break;
13108 default:
13109 entryName = "biological";
13110 break;
13111 }
13112
13113 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13114
13116 }
13117
13118
13119
13122 {
13123 if (!IsMagazine())
13125
13127 }
13128
13129
13130
13131
13132
13137 {
13138 return true;
13139 }
13140
13142 {
13144 }
13145
13146
13147
13148
13149
13151 {
13152 if (parent)
13153 {
13154 if (parent.IsInherited(DayZInfected))
13155 return true;
13156
13157 if (!parent.IsRuined())
13158 return true;
13159 }
13160
13161 return true;
13162 }
13163
13165 {
13166 if (!super.CanPutAsAttachment(parent))
13167 {
13168 return false;
13169 }
13170
13171 if (!IsRuined() && !parent.IsRuined())
13172 {
13173 return true;
13174 }
13175
13176 return false;
13177 }
13178
13180 {
13181
13182
13183
13184
13185 return super.CanReceiveItemIntoCargo(item);
13186 }
13187
13189 {
13190
13191
13192
13193
13194 GameInventory attachmentInv = attachment.GetInventory();
13196 {
13197 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13198 return false;
13199 }
13200
13201 InventoryLocation loc = new InventoryLocation();
13202 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13203 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13204 return false;
13205
13206 return super.CanReceiveAttachment(attachment, slotId);
13207 }
13208
13210 {
13211 if (!super.CanReleaseAttachment(attachment))
13212 return false;
13213
13214 return GetInventory().AreChildrenAccessible();
13215 }
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13238 {
13239 int id = muzzle_owner.GetMuzzleID();
13240 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13241
13242 if (WPOF_array)
13243 {
13244 for (int i = 0; i < WPOF_array.Count(); i++)
13245 {
13246 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13247
13248 if (WPOF)
13249 {
13250 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13251 }
13252 }
13253 }
13254 }
13255
13256
13258 {
13259 int id = muzzle_owner.GetMuzzleID();
13261
13262 if (WPOBE_array)
13263 {
13264 for (int i = 0; i < WPOBE_array.Count(); i++)
13265 {
13266 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13267
13268 if (WPOBE)
13269 {
13270 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13271 }
13272 }
13273 }
13274 }
13275
13276
13278 {
13279 int id = muzzle_owner.GetMuzzleID();
13280 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13281
13282 if (WPOOH_array)
13283 {
13284 for (int i = 0; i < WPOOH_array.Count(); i++)
13285 {
13286 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13287
13288 if (WPOOH)
13289 {
13290 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13291 }
13292 }
13293 }
13294 }
13295
13296
13298 {
13299 int id = muzzle_owner.GetMuzzleID();
13300 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13301
13302 if (WPOOH_array)
13303 {
13304 for (int i = 0; i < WPOOH_array.Count(); i++)
13305 {
13306 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13307
13308 if (WPOOH)
13309 {
13310 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13311 }
13312 }
13313 }
13314 }
13315
13316
13318 {
13319 int id = muzzle_owner.GetMuzzleID();
13320 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13321
13322 if (WPOOH_array)
13323 {
13324 for (int i = 0; i < WPOOH_array.Count(); i++)
13325 {
13326 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13327
13328 if (WPOOH)
13329 {
13330 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13331 }
13332 }
13333 }
13334 }
13335
13336
13337
13339 {
13341 {
13342 return true;
13343 }
13344
13345 return false;
13346 }
13347
13349 {
13351 {
13352 return true;
13353 }
13354
13355 return false;
13356 }
13357
13359 {
13361 {
13362 return true;
13363 }
13364
13365 return false;
13366 }
13367
13369 {
13370 return false;
13371 }
13372
13375 {
13376 return UATimeSpent.DEFAULT_DEPLOY;
13377 }
13378
13379
13380
13381
13383 {
13385 SetSynchDirty();
13386 }
13387
13389 {
13391 }
13392
13393
13395 {
13396 return false;
13397 }
13398
13401 {
13402 string att_type = "None";
13403
13404 if (ConfigIsExisting("soundAttType"))
13405 {
13406 att_type = ConfigGetString("soundAttType");
13407 }
13408
13410 }
13411
13413 {
13415 }
13416
13417
13418
13419
13420
13426
13428 {
13431
13433 }
13434
13435
13437 {
13439 return;
13440
13442
13445
13448
13449 SoundParameters params = new SoundParameters();
13453 }
13454
13455
13457 {
13459 return;
13460
13462 SetSynchDirty();
13463
13466 }
13467
13468
13470 {
13472 return;
13473
13475 SetSynchDirty();
13476
13479 }
13480
13482 {
13484 }
13485
13487 {
13489 }
13490
13493 {
13494 if (!
GetGame().IsDedicatedServer())
13495 {
13496 if (ConfigIsExisting("attachSoundSet"))
13497 {
13498 string cfg_path = "";
13499 string soundset = "";
13500 string type_name =
GetType();
13501
13504 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13505 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13506
13507 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13508 {
13509 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13510 {
13511 if (cfg_slot_array[i] == slot_type)
13512 {
13513 soundset = cfg_soundset_array[i];
13514 break;
13515 }
13516 }
13517 }
13518
13519 if (soundset != "")
13520 {
13521 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13523 }
13524 }
13525 }
13526 }
13527
13529 {
13530
13531 }
13532
13533 void OnApply(PlayerBase player);
13534
13536 {
13537 return 1.0;
13538 };
13539
13541 {
13543 }
13544
13546 {
13548 }
13549
13551
13553 {
13554 SetDynamicPhysicsLifeTime(0.01);
13556 }
13557
13559 {
13560 array<string> zone_names = new array<string>;
13561 GetDamageZones(zone_names);
13562 for (int i = 0; i < zone_names.Count(); i++)
13563 {
13564 SetHealthMax(zone_names.Get(i),"Health");
13565 }
13566 SetHealthMax("","Health");
13567 }
13568
13571 {
13572 float global_health = GetHealth01("","Health");
13573 array<string> zones = new array<string>;
13574 GetDamageZones(zones);
13575
13576 for (int i = 0; i < zones.Count(); i++)
13577 {
13578 SetHealth01(zones.Get(i),"Health",global_health);
13579 }
13580 }
13581
13584 {
13585 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13586 }
13587
13589 {
13590 if (!hasRootAsPlayer)
13591 {
13592 if (refParentIB)
13593 {
13594
13595 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13596 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13597
13598 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13599 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13600
13603 }
13604 else
13605 {
13606
13609 }
13610 }
13611 }
13612
13614 {
13616 {
13617 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13618 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13619 {
13620 float heatPermCoef = 1.0;
13622 while (ent)
13623 {
13624 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13625 ent = ent.GetHierarchyParent();
13626 }
13627
13628 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13629 }
13630 }
13631 }
13632
13634 {
13635
13636 EntityAI parent = GetHierarchyParent();
13637 if (!parent)
13638 {
13639 hasParent = false;
13640 hasRootAsPlayer = false;
13641 }
13642 else
13643 {
13644 hasParent = true;
13645 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13646 refParentIB =
ItemBase.Cast(parent);
13647 }
13648 }
13649
13650 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13651 {
13652
13653 }
13654
13656 {
13657
13658 return false;
13659 }
13660
13662 {
13663
13664
13665 return false;
13666 }
13667
13669 {
13670
13671 return false;
13672 }
13673
13676 {
13677 return !GetIsFrozen() &&
IsOpen();
13678 }
13679
13681 {
13682 bool hasParent = false, hasRootAsPlayer = false;
13684
13685 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13686 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13687
13688 if (wwtu || foodDecay)
13689 {
13693
13694 if (processWetness || processTemperature || processDecay)
13695 {
13697
13698 if (processWetness)
13699 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13700
13701 if (processTemperature)
13703
13704 if (processDecay)
13705 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13706 }
13707 }
13708 }
13709
13712 {
13714 }
13715
13717 {
13720
13721 return super.GetTemperatureFreezeThreshold();
13722 }
13723
13725 {
13728
13729 return super.GetTemperatureThawThreshold();
13730 }
13731
13733 {
13736
13737 return super.GetItemOverheatThreshold();
13738 }
13739
13741 {
13743 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13744
13745 return super.GetTemperatureFreezeTime();
13746 }
13747
13749 {
13751 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13752
13753 return super.GetTemperatureThawTime();
13754 }
13755
13760
13762 {
13763 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13764 }
13765
13767 {
13768 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13769 }
13770
13773 {
13775 }
13776
13778 {
13780 }
13781
13783 {
13785 }
13786
13789 {
13790 return null;
13791 }
13792
13795 {
13796 return false;
13797 }
13798
13800 {
13802 {
13805 if (!trg)
13806 {
13808 explosive = this;
13809 }
13810
13811 explosive.PairRemote(trg);
13813
13814 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13815 trg.SetPersistentPairID(persistentID);
13816 explosive.SetPersistentPairID(persistentID);
13817
13818 return true;
13819 }
13820 return false;
13821 }
13822
13825 {
13826 float ret = 1.0;
13829 ret *= GetHealth01();
13830
13831 return ret;
13832 }
13833
13834 #ifdef DEVELOPER
13835 override void SetDebugItem()
13836 {
13837 super.SetDebugItem();
13838 _itemBase = this;
13839 }
13840
13842 {
13843 string text = super.GetDebugText();
13844
13846 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13847
13848 return text;
13849 }
13850 #endif
13851
13853 {
13854 return true;
13855 }
13856
13858
13860
13862 {
13865 }
13866
13867
13875
13891}
13892
13894{
13896 if (entity)
13897 {
13898 bool is_item = entity.IsInherited(
ItemBase);
13899 if (is_item && full_quantity)
13900 {
13903 }
13904 }
13905 else
13906 {
13908 return NULL;
13909 }
13910 return entity;
13911}
13912
13914{
13915 if (item)
13916 {
13917 if (health > 0)
13918 item.SetHealth("", "", health);
13919
13920 if (item.CanHaveTemperature())
13921 {
13923 if (item.CanFreeze())
13924 item.SetFrozen(false);
13925 }
13926
13927 if (item.HasEnergyManager())
13928 {
13929 if (quantity >= 0)
13930 {
13931 item.GetCompEM().SetEnergy0To1(quantity);
13932 }
13933 else
13934 {
13936 }
13937 }
13938 else if (item.IsMagazine())
13939 {
13940 Magazine mag = Magazine.Cast(item);
13941 if (quantity >= 0)
13942 {
13943 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13944 }
13945 else
13946 {
13948 }
13949
13950 }
13951 else
13952 {
13953 if (quantity >= 0)
13954 {
13955 item.SetQuantityNormalized(quantity, false);
13956 }
13957 else
13958 {
13960 }
13961
13962 }
13963 }
13964}
13965
13966#ifdef DEVELOPER
13968#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.