9063{
9065 {
9066 return true;
9067 }
9068};
9069
9070
9071
9073{
9077
9079
9082
9083
9084
9085
9086
9095
9101
9106
9111
9132 protected bool m_IsResultOfSplit
9133
9135
9140
9141
9142
9144
9148
9149
9150
9152
9155
9156
9157
9163
9164
9172
9175
9176
9178
9179
9181
9182
9187
9188
9193
9194
9196
9197
9199 {
9204
9205 if (!
GetGame().IsDedicatedServer())
9206 {
9208 {
9210
9212 {
9214 }
9215 }
9216
9219 }
9220
9221 m_OldLocation = null;
9222
9224 {
9226 }
9227
9228 if (ConfigIsExisting("headSelectionsToHide"))
9229 {
9232 }
9233
9235 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9236 {
9238 }
9239
9241
9242 m_IsResultOfSplit = false;
9243
9245 }
9246
9248 {
9249 super.InitItemVariables();
9250
9256 m_Count = ConfigGetInt(
"count");
9257
9260
9265
9268
9273
9285
9289
9290
9293 if (ConfigIsExisting("canBeSplit"))
9294 {
9297 }
9298
9300 if (ConfigIsExisting("itemBehaviour"))
9302
9303
9306 RegisterNetSyncVariableInt("m_VarLiquidType");
9307 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9308
9309 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9310 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9311 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9312
9313 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9314 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9315 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9316 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9317
9318 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9319 RegisterNetSyncVariableBool("m_IsTakeable");
9320 RegisterNetSyncVariableBool("m_IsHologram");
9321
9324 {
9327 }
9328
9330
9332 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9334
9335 }
9336
9338 {
9340 }
9341
9343 {
9346 {
9351 }
9352 }
9353
9354 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9355 {
9357 {
9360 }
9361
9363 }
9364
9366 {
9372 }
9373
9375
9377 {
9379
9380 if (!action)
9381 {
9382 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9383 return;
9384 }
9385
9387 if (!ai)
9388 {
9390 return;
9391 }
9392
9394 if (!action_array)
9395 {
9396 action_array = new array<ActionBase_Basic>;
9398 }
9399 if (LogManager.IsActionLogEnable())
9400 {
9401 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9402 }
9403
9404 if (action_array.Find(action) != -1)
9405 {
9406 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9407 }
9408 else
9409 {
9410 action_array.Insert(action);
9411 }
9412 }
9413
9415 {
9417 ActionBase action = player.GetActionManager().GetAction(actionName);
9420
9421 if (action_array)
9422 {
9423 action_array.RemoveItem(action);
9424 }
9425 }
9426
9427
9428
9430 {
9431 ActionOverrideData overrideData = new ActionOverrideData();
9435
9437 if (!actionMap)
9438 {
9441 }
9442
9443 actionMap.Insert(this.
Type(), overrideData);
9444
9445 }
9446
9448
9450
9451
9453 {
9456
9459
9460 string config_to_search = "CfgVehicles";
9461 string muzzle_owner_config;
9462
9464 {
9465 if (IsInherited(Weapon))
9466 config_to_search = "CfgWeapons";
9467
9468 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9469
9470 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9471
9473
9474 if (config_OnFire_subclass_count > 0)
9475 {
9476 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9477
9478 for (int i = 0; i < config_OnFire_subclass_count; i++)
9479 {
9480 string particle_class = "";
9482 string config_OnFire_entry = config_OnFire_class + particle_class;
9483 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9484 WPOF_array.Insert(WPOF);
9485 }
9486
9487
9489 }
9490 }
9491
9493 {
9494 config_to_search = "CfgWeapons";
9495 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9496
9497 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9498
9500
9501 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9502 {
9503 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9504
9505 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9506 {
9507 string particle_class2 = "";
9509 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9510 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9511 WPOBE_array.Insert(WPOBE);
9512 }
9513
9514
9516 }
9517 }
9518 }
9519
9520
9522 {
9525
9527 {
9528 string config_to_search = "CfgVehicles";
9529
9530 if (IsInherited(Weapon))
9531 config_to_search = "CfgWeapons";
9532
9533 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9534 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9535
9536 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9537 {
9538
9540
9542 {
9544 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9546 return;
9547 }
9548
9551
9552
9553
9555 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9556
9557 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9558 {
9559 string particle_class = "";
9561 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9563
9564 if (entry_type == CT_CLASS)
9565 {
9566 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9567 WPOOH_array.Insert(WPOF);
9568 }
9569 }
9570
9571
9573 }
9574 }
9575 }
9576
9578 {
9580 }
9581
9583 {
9585 {
9587
9590
9593
9594 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9595 }
9596 }
9597
9599 {
9601 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9602
9604 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9605
9607 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9608
9610 {
9612 }
9613 }
9614
9616 {
9618 }
9619
9621 {
9624 else
9626
9628 {
9631 }
9632 else
9633 {
9636
9639 }
9640
9642 }
9643
9645 {
9647 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9648 }
9649
9651 {
9653 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9655 }
9656
9658 {
9660 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9661 }
9662
9664 {
9667
9668 OverheatingParticle OP = new OverheatingParticle();
9673
9675 }
9676
9678 {
9681
9682 return -1;
9683 }
9684
9686 {
9688 {
9691
9692 for (int i = count; i > 0; --i)
9693 {
9694 int id = i - 1;
9697
9700
9701 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9702 {
9703 if (p)
9704 {
9707 }
9708 }
9709 }
9710 }
9711 }
9712
9714 {
9716 {
9718 {
9719 int id = i - 1;
9721
9722 if (OP)
9723 {
9725
9726 if (p)
9727 {
9729 }
9730
9731 delete OP;
9732 }
9733 }
9734
9737 }
9738 }
9739
9742 {
9743 return 0.0;
9744 }
9745
9746
9748 {
9749 return 250;
9750 }
9751
9753 {
9754 return 0;
9755 }
9756
9759 {
9761 return true;
9762
9763 return false;
9764 }
9765
9768 {
9771
9773 {
9775 }
9776 else
9777 {
9778
9780 }
9781
9783 }
9784
9791 {
9792 return -1;
9793 }
9794
9795
9796
9797
9799 {
9801 {
9803 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9804
9805 if (r_index >= 0)
9806 {
9807 InventoryLocation r_il = new InventoryLocation;
9808 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9809
9810 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9813 {
9814 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9815 }
9817 {
9818 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9819 }
9820
9821 }
9822
9823 player.GetHumanInventory().ClearUserReservedLocation(this);
9824 }
9825
9828 }
9829
9830
9831
9832
9834 {
9835 return ItemBase.m_DebugActionsMask;
9836 }
9837
9839 {
9840 return ItemBase.m_DebugActionsMask & mask;
9841 }
9842
9844 {
9845 ItemBase.m_DebugActionsMask = mask;
9846 }
9847
9849 {
9850 ItemBase.m_DebugActionsMask |= mask;
9851 }
9852
9854 {
9855 ItemBase.m_DebugActionsMask &= ~mask;
9856 }
9857
9859 {
9861 {
9863 }
9864 else
9865 {
9867 }
9868 }
9869
9870
9872 {
9873 if (GetEconomyProfile())
9874 {
9875 float q_max = GetEconomyProfile().GetQuantityMax();
9876 if (q_max > 0)
9877 {
9878 float q_min = GetEconomyProfile().GetQuantityMin();
9879 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9880
9882 {
9883 ComponentEnergyManager comp = GetCompEM();
9885 {
9887 }
9888 }
9890 {
9892
9893 }
9894
9895 }
9896 }
9897 }
9898
9901 {
9902 EntityAI parent = GetHierarchyParent();
9903
9904 if (parent)
9905 {
9906 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9907 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9908 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9909 }
9910 }
9911
9914 {
9915 EntityAI parent = GetHierarchyParent();
9916
9917 if (parent)
9918 {
9919 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9920 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9921 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9922 }
9923 }
9924
9926 {
9927
9928
9929
9930
9932
9934 {
9935 if (ScriptInputUserData.CanStoreInputUserData())
9936 {
9937 ScriptInputUserData ctx = new ScriptInputUserData;
9943 ctx.
Write(use_stack_max);
9946
9948 {
9949 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9950 }
9951 }
9952 }
9953 else if (!
GetGame().IsMultiplayer())
9954 {
9956 }
9957 }
9958
9960 {
9962 }
9963
9965 {
9967 }
9968
9970 {
9972 }
9973
9975 {
9976
9977 return false;
9978 }
9979
9981 {
9982 return false;
9983 }
9984
9988 {
9989 return false;
9990 }
9991
9993 {
9994 return "";
9995 }
9996
9998
10000 {
10001 return false;
10002 }
10003
10005 {
10006 return true;
10007 }
10008
10009
10010
10012 {
10013 return true;
10014 }
10015
10017 {
10018 return true;
10019 }
10020
10022 {
10023 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10025 }
10026
10028 {
10030 }
10031
10033 {
10035 if (!is_being_placed)
10037 SetSynchDirty();
10038 }
10039
10040
10042
10044 {
10046 }
10047
10049 {
10051 }
10052
10054 {
10055 return 1;
10056 }
10057
10059 {
10060 return false;
10061 }
10062
10064 {
10066 SetSynchDirty();
10067 }
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10104 {
10105 super.OnMovedInsideCargo(container);
10106
10107 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10108 }
10109
10110 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10111 {
10112 super.EEItemLocationChanged(oldLoc,newLoc);
10113
10114 PlayerBase new_player = null;
10115 PlayerBase old_player = null;
10116
10117 if (newLoc.GetParent())
10118 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10119
10120 if (oldLoc.GetParent())
10121 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10122
10124 {
10125 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10126
10127 if (r_index >= 0)
10128 {
10129 InventoryLocation r_il = new InventoryLocation;
10130 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10131
10132 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10135 {
10136 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10137 }
10139 {
10140 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10141 }
10142
10143 }
10144 }
10145
10147 {
10148 if (new_player)
10149 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10150
10151 if (new_player == old_player)
10152 {
10153
10154 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10155 {
10157 {
10158 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10159 {
10160 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10161 }
10162 }
10163 else
10164 {
10165 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10166 }
10167 }
10168
10169 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10170 {
10171 int type = oldLoc.GetType();
10173 {
10174 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10175 }
10177 {
10178 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10179 }
10180 }
10181 if (!m_OldLocation)
10182 {
10183 m_OldLocation = new InventoryLocation;
10184 }
10185 m_OldLocation.Copy(oldLoc);
10186 }
10187 else
10188 {
10189 if (m_OldLocation)
10190 {
10191 m_OldLocation.Reset();
10192 }
10193 }
10194
10196 }
10197 else
10198 {
10199 if (new_player)
10200 {
10201 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10202 if (res_index >= 0)
10203 {
10204 InventoryLocation il = new InventoryLocation;
10205 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10207 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10210 {
10211 il.
GetParent().GetOnReleaseLock().Invoke(it);
10212 }
10214 {
10216 }
10217
10218 }
10219 }
10221 {
10222
10224 }
10225
10226 if (m_OldLocation)
10227 {
10228 m_OldLocation.Reset();
10229 }
10230 }
10231 }
10232
10233 override void EOnContact(IEntity other, Contact extra)
10234 {
10236 {
10237 int liquidType = -1;
10239 if (impactSpeed > 0.0)
10240 {
10242 #ifndef SERVER
10244 #else
10246 SetSynchDirty();
10247 #endif
10249 }
10250 }
10251
10252 #ifdef SERVER
10253 if (GetCompEM() && GetCompEM().IsPlugged())
10254 {
10255 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10256 GetCompEM().UnplugThis();
10257 }
10258 #endif
10259 }
10260
10262
10264 {
10266 }
10267
10269 {
10270
10271 }
10272
10274 {
10275 super.OnItemLocationChanged(old_owner, new_owner);
10276
10277 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10278 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10279
10280 if (!relatedPlayer && playerNew)
10281 relatedPlayer = playerNew;
10282
10283 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10284 {
10286 if (actionMgr)
10287 {
10288 ActionBase currentAction = actionMgr.GetRunningAction();
10289 if (currentAction)
10291 }
10292 }
10293
10294 Man ownerPlayerOld = null;
10295 Man ownerPlayerNew = null;
10296
10297 if (old_owner)
10298 {
10299 if (old_owner.
IsMan())
10300 {
10301 ownerPlayerOld = Man.Cast(old_owner);
10302 }
10303 else
10304 {
10305 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10306 }
10307 }
10308 else
10309 {
10311 {
10313
10314 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10315 {
10316 GetCompEM().UnplugThis();
10317 }
10318 }
10319 }
10320
10321 if (new_owner)
10322 {
10323 if (new_owner.
IsMan())
10324 {
10325 ownerPlayerNew = Man.Cast(new_owner);
10326 }
10327 else
10328 {
10329 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10330 }
10331 }
10332
10333 if (ownerPlayerOld != ownerPlayerNew)
10334 {
10335 if (ownerPlayerOld)
10336 {
10337 array<EntityAI> subItemsExit = new array<EntityAI>;
10339 for (int i = 0; i < subItemsExit.Count(); i++)
10340 {
10343 }
10344 }
10345
10346 if (ownerPlayerNew)
10347 {
10348 array<EntityAI> subItemsEnter = new array<EntityAI>;
10350 for (int j = 0; j < subItemsEnter.Count(); j++)
10351 {
10354 }
10355 }
10356 }
10357 else if (ownerPlayerNew != null)
10358 {
10359 PlayerBase nplayer;
10360 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10361 {
10362 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10364 for (int k = 0; k < subItemsUpdate.Count(); k++)
10365 {
10367 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10368 }
10369 }
10370 }
10371
10372 if (old_owner)
10373 old_owner.OnChildItemRemoved(this);
10374 if (new_owner)
10375 new_owner.OnChildItemReceived(this);
10376 }
10377
10378
10380 {
10381 super.EEDelete(parent);
10382 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10383 if (player)
10384 {
10386
10387 if (player.IsAlive())
10388 {
10389 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10390 if (r_index >= 0)
10391 {
10392 InventoryLocation r_il = new InventoryLocation;
10393 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10394
10395 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10398 {
10399 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10400 }
10402 {
10403 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10404 }
10405
10406 }
10407
10408 player.RemoveQuickBarEntityShortcut(this);
10409 }
10410 }
10411 }
10412
10414 {
10415 super.EEKilled(killer);
10416
10419 {
10420 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10421 {
10422 if (IsMagazine())
10423 {
10424 if (Magazine.Cast(this).GetAmmoCount() > 0)
10425 {
10427 }
10428 }
10429 else
10430 {
10432 }
10433 }
10434 }
10435 }
10436
10438 {
10439 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10440
10441 super.OnWasAttached(parent, slot_id);
10442
10445
10447 }
10448
10450 {
10451 super.OnWasDetached(parent, slot_id);
10452
10455 }
10456
10458 {
10459 int idx;
10462
10463 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10464 if (inventory_slots.Count() < 1)
10465 {
10466 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10467 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10468 }
10469 else
10470 {
10471 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10472 }
10473
10474 idx = inventory_slots.Find(slot);
10475 if (idx < 0)
10476 return "";
10477
10478 return attach_types.Get(idx);
10479 }
10480
10482 {
10483 int idx = -1;
10484 string slot;
10485
10488
10489 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10490 if (inventory_slots.Count() < 1)
10491 {
10492 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10493 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10494 }
10495 else
10496 {
10497 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10498 if (detach_types.Count() < 1)
10499 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10500 }
10501
10502 for (int i = 0; i < inventory_slots.Count(); i++)
10503 {
10504 slot = inventory_slots.Get(i);
10505 }
10506
10507 if (slot != "")
10508 {
10509 if (detach_types.Count() == 1)
10510 idx = 0;
10511 else
10512 idx = inventory_slots.Find(slot);
10513 }
10514 if (idx < 0)
10515 return "";
10516
10517 return detach_types.Get(idx);
10518 }
10519
10521 {
10522
10524
10525
10526 float min_time = 1;
10527 float max_time = 3;
10528 float delay = Math.RandomFloat(min_time, max_time);
10529
10530 explode_timer.Run(delay, this, "DoAmmoExplosion");
10531 }
10532
10534 {
10535 Magazine magazine = Magazine.Cast(this);
10536 int pop_sounds_count = 6;
10537 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10538
10539
10540 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10541 string sound_name = pop_sounds[ sound_idx ];
10543
10544
10545 magazine.ServerAddAmmoCount(-1);
10546
10547
10548 float min_temp_to_explode = 100;
10549
10550 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10551 {
10553 }
10554 }
10555
10556
10557 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10558 {
10559 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10560
10561 const int CHANCE_DAMAGE_CARGO = 4;
10562 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10563 const int CHANCE_DAMAGE_NOTHING = 2;
10564
10566 {
10567 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10568 int chances;
10569 int rnd;
10570
10571 if (GetInventory().GetCargo())
10572 {
10573 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10574 rnd = Math.RandomInt(0,chances);
10575
10576 if (rnd < CHANCE_DAMAGE_CARGO)
10577 {
10579 }
10580 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10581 {
10583 }
10584 }
10585 else
10586 {
10587 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10588 rnd = Math.RandomInt(0,chances);
10589
10590 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10591 {
10593 }
10594 }
10595 }
10596 }
10597
10599 {
10600 if (GetInventory().GetCargo())
10601 {
10602 int item_count = GetInventory().GetCargo().GetItemCount();
10603 if (item_count > 0)
10604 {
10605 int random_pick = Math.RandomInt(0, item_count);
10607 if (!item.IsExplosive())
10608 {
10609 item.AddHealth("","",damage);
10610 return true;
10611 }
10612 }
10613 }
10614 return false;
10615 }
10616
10618 {
10619 int attachment_count = GetInventory().AttachmentCount();
10620 if (attachment_count > 0)
10621 {
10622 int random_pick = Math.RandomInt(0, attachment_count);
10623 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10624 if (!attachment.IsExplosive())
10625 {
10626 attachment.AddHealth("","",damage);
10627 return true;
10628 }
10629 }
10630 return false;
10631 }
10632
10634 {
10636 }
10637
10639 {
10641 return GetInventory().CanRemoveEntity();
10642
10643 return false;
10644 }
10645
10647 {
10648
10650 return false;
10651
10652
10654 return false;
10655
10656
10657
10659 if (delta == 0)
10660 return false;
10661
10662
10663 return true;
10664 }
10665
10667 {
10669 {
10670 if (ScriptInputUserData.CanStoreInputUserData())
10671 {
10672 ScriptInputUserData ctx = new ScriptInputUserData;
10677 ctx.
Write(destination_entity);
10679 ctx.
Write(slot_id);
10681 }
10682 }
10683 else if (!
GetGame().IsMultiplayer())
10684 {
10686 }
10687 }
10688
10690 {
10691 float split_quantity_new;
10695 InventoryLocation loc = new InventoryLocation;
10696
10697 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10698 {
10700 split_quantity_new = stack_max;
10701 else
10703
10705 {
10706 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10707 if (new_item)
10708 {
10709 new_item.SetResultOfSplit(true);
10710 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10712 new_item.
SetQuantity(split_quantity_new,
false,
true);
10713 }
10714 }
10715 }
10716 else if (destination_entity && slot_id == -1)
10717 {
10718 if (quantity > stack_max)
10719 split_quantity_new = stack_max;
10720 else
10721 split_quantity_new = quantity;
10722
10724 {
10726 {
10729 }
10730
10731 if (new_item)
10732 {
10733 new_item.SetResultOfSplit(true);
10734 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10736 new_item.
SetQuantity(split_quantity_new,
false,
true);
10737 }
10738 }
10739 }
10740 else
10741 {
10742 if (stack_max != 0)
10743 {
10745 {
10747 }
10748
10749 if (split_quantity_new == 0)
10750 {
10751 if (!
GetGame().IsMultiplayer())
10752 player.PhysicalPredictiveDropItem(this);
10753 else
10754 player.ServerDropEntity(this);
10755 return;
10756 }
10757
10759 {
10761
10762 if (new_item)
10763 {
10764 new_item.SetResultOfSplit(true);
10765 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10768 new_item.PlaceOnSurface();
10769 }
10770 }
10771 }
10772 }
10773 }
10774
10776 {
10777 float split_quantity_new;
10781 InventoryLocation loc = new InventoryLocation;
10782
10783 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10784 {
10786 split_quantity_new = stack_max;
10787 else
10789
10791 {
10792 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10793 if (new_item)
10794 {
10795 new_item.SetResultOfSplit(true);
10796 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10798 new_item.
SetQuantity(split_quantity_new,
false,
true);
10799 }
10800 }
10801 }
10802 else if (destination_entity && slot_id == -1)
10803 {
10804 if (quantity > stack_max)
10805 split_quantity_new = stack_max;
10806 else
10807 split_quantity_new = quantity;
10808
10810 {
10812 {
10815 }
10816
10817 if (new_item)
10818 {
10819 new_item.SetResultOfSplit(true);
10820 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10822 new_item.
SetQuantity(split_quantity_new,
false,
true);
10823 }
10824 }
10825 }
10826 else
10827 {
10828 if (stack_max != 0)
10829 {
10831 {
10833 }
10834
10836 {
10838
10839 if (new_item)
10840 {
10841 new_item.SetResultOfSplit(true);
10842 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10845 new_item.PlaceOnSurface();
10846 }
10847 }
10848 }
10849 }
10850 }
10851
10853 {
10855 {
10856 if (ScriptInputUserData.CanStoreInputUserData())
10857 {
10858 ScriptInputUserData ctx = new ScriptInputUserData;
10863 dst.WriteToContext(ctx);
10865 }
10866 }
10867 else if (!
GetGame().IsMultiplayer())
10868 {
10870 }
10871 }
10872
10874 {
10876 {
10877 if (ScriptInputUserData.CanStoreInputUserData())
10878 {
10879 ScriptInputUserData ctx = new ScriptInputUserData;
10884 ctx.
Write(destination_entity);
10890 }
10891 }
10892 else if (!
GetGame().IsMultiplayer())
10893 {
10895 }
10896 }
10897
10899 {
10901 }
10902
10904 {
10906 float split_quantity_new;
10908 if (dst.IsValid())
10909 {
10910 int slot_id = dst.GetSlot();
10912
10913 if (quantity > stack_max)
10914 split_quantity_new = stack_max;
10915 else
10916 split_quantity_new = quantity;
10917
10919 {
10921
10922 if (new_item)
10923 {
10924 new_item.SetResultOfSplit(true);
10925 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10927 new_item.
SetQuantity(split_quantity_new,
false,
true);
10928 }
10929
10930 return new_item;
10931 }
10932 }
10933
10934 return null;
10935 }
10936
10938 {
10940 float split_quantity_new;
10942 if (destination_entity)
10943 {
10945 if (quantity > stackable)
10946 split_quantity_new = stackable;
10947 else
10948 split_quantity_new = quantity;
10949
10951 {
10952 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10953 if (new_item)
10954 {
10955 new_item.SetResultOfSplit(true);
10956 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10958 new_item.
SetQuantity(split_quantity_new,
false,
true);
10959 }
10960 }
10961 }
10962 }
10963
10965 {
10967 {
10968 if (ScriptInputUserData.CanStoreInputUserData())
10969 {
10970 ScriptInputUserData ctx = new ScriptInputUserData;
10975 ItemBase destination_entity =
this;
10976 ctx.
Write(destination_entity);
10980 }
10981 }
10982 else if (!
GetGame().IsMultiplayer())
10983 {
10985 }
10986 }
10987
10989 {
10991 float split_quantity_new;
10993 if (player)
10994 {
10996 if (quantity > stackable)
10997 split_quantity_new = stackable;
10998 else
10999 split_quantity_new = quantity;
11000
11002 {
11003 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11004 new_item =
ItemBase.Cast(in_hands);
11005 if (new_item)
11006 {
11007 new_item.SetResultOfSplit(true);
11008 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11010 new_item.SetQuantity(split_quantity_new, false, true);
11011 }
11012 }
11013 }
11014 }
11015
11017 {
11019 float split_quantity_new = Math.Floor(quantity * 0.5);
11020
11022 return;
11023
11025
11026 if (new_item)
11027 {
11028 if (new_item.GetQuantityMax() < split_quantity_new)
11029 {
11030 split_quantity_new = new_item.GetQuantityMax();
11031 }
11032
11033 new_item.SetResultOfSplit(true);
11034 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11035
11037 {
11040 }
11041 else
11042 {
11044 new_item.
SetQuantity(split_quantity_new,
false,
true);
11045 }
11046 }
11047 }
11048
11050 {
11052 float split_quantity_new = Math.Floor(quantity / 2);
11053
11055 return;
11056
11057 InventoryLocation invloc = new InventoryLocation;
11059
11061 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11062
11063 if (new_item)
11064 {
11065 if (new_item.GetQuantityMax() < split_quantity_new)
11066 {
11067 split_quantity_new = new_item.GetQuantityMax();
11068 }
11070 {
11073 }
11074 else if (split_quantity_new > 1)
11075 {
11077 new_item.
SetQuantity(split_quantity_new,
false,
true);
11078 }
11079 }
11080 }
11081
11084 {
11085 SetWeightDirty();
11087
11088 if (parent)
11089 parent.OnAttachmentQuantityChangedEx(this, delta);
11090
11092 {
11094 {
11096 }
11098 {
11099 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11101 }
11102 }
11103
11104 }
11105
11108 {
11109
11110 }
11111
11114 {
11116 }
11117
11119 {
11120 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11121
11123 {
11124 if (newLevel == GameConstants.STATE_RUINED)
11125 {
11127 EntityAI parent = GetHierarchyParent();
11128 if (parent && parent.IsFireplace())
11129 {
11130 CargoBase cargo = GetInventory().GetCargo();
11131 if (cargo)
11132 {
11134 {
11136 }
11137 }
11138 }
11139 }
11140
11142 {
11143
11145 return;
11146 }
11147
11148 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11149 {
11151 }
11152 }
11153 }
11154
11155
11157 {
11158 super.OnRightClick();
11159
11161 {
11163 {
11164 if (ScriptInputUserData.CanStoreInputUserData())
11165 {
11166 EntityAI root = GetHierarchyRoot();
11167 Man playerOwner = GetHierarchyRootPlayer();
11168 InventoryLocation dst = new InventoryLocation;
11169
11170
11171 if (!playerOwner && root && root == this)
11172 {
11174 }
11175 else
11176 {
11177
11178 GetInventory().GetCurrentInventoryLocation(dst);
11180 {
11183 {
11185 }
11186 else
11187 {
11189
11190
11191 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11192 {
11194 }
11195 else
11196 {
11197 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11198 }
11199 }
11200 }
11201 }
11202
11203 ScriptInputUserData ctx = new ScriptInputUserData;
11211 }
11212 }
11213 else if (!
GetGame().IsMultiplayer())
11214 {
11216 }
11217 }
11218 }
11219
11221 {
11222 if (root)
11223 {
11224 vector m4[4];
11225 root.GetTransform(m4);
11226 dst.SetGround(this, m4);
11227 }
11228 else
11229 {
11230 GetInventory().GetCurrentInventoryLocation(dst);
11231 }
11232 }
11233
11234 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11235 {
11236
11237 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11238 return false;
11239
11240 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11241 return false;
11242
11243
11245 return false;
11246
11247
11248 Magazine mag = Magazine.Cast(this);
11249 if (mag)
11250 {
11251 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11252 return false;
11253
11254 if (stack_max_limit)
11255 {
11256 Magazine other_mag = Magazine.Cast(other_item);
11257 if (other_item)
11258 {
11259 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11260 return false;
11261 }
11262
11263 }
11264 }
11265 else
11266 {
11267
11269 return false;
11270
11272 return false;
11273 }
11274
11275 PlayerBase player = null;
11276 if (CastTo(player, GetHierarchyRootPlayer()))
11277 {
11278 if (player.GetInventory().HasAttachment(this))
11279 return false;
11280
11281 if (player.IsItemsToDelete())
11282 return false;
11283 }
11284
11285 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11286 return false;
11287
11288 int slotID;
11290 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11291 return false;
11292
11293 return true;
11294 }
11295
11297 {
11299 }
11300
11302 {
11303 return m_IsResultOfSplit;
11304 }
11305
11307 {
11308 m_IsResultOfSplit = value;
11309 }
11310
11312 {
11314 }
11315
11317 {
11318 float other_item_quantity = other_item.GetQuantity();
11319 float this_free_space;
11320
11322
11324
11325 if (other_item_quantity > this_free_space)
11326 {
11327 return this_free_space;
11328 }
11329 else
11330 {
11331 return other_item_quantity;
11332 }
11333 }
11334
11336 {
11338 }
11339
11341 {
11343 return;
11344
11345 if (!IsMagazine() && other_item)
11346 {
11348 if (quantity_used != 0)
11349 {
11350 float hp1 = GetHealth01("","");
11351 float hp2 = other_item.GetHealth01("","");
11352 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11353 hpResult = hpResult / (
GetQuantity() + quantity_used);
11354
11355 hpResult *= GetMaxHealth();
11356 Math.Round(hpResult);
11357 SetHealth("", "Health", hpResult);
11358
11360 other_item.AddQuantity(-quantity_used);
11361 }
11362 }
11364 }
11365
11367 {
11368 #ifdef SERVER
11369 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11370 GetHierarchyParent().IncreaseLifetimeUp();
11371 #endif
11372 };
11373
11375 {
11376 PlayerBase p = PlayerBase.Cast(player);
11377
11378 array<int> recipesIds = p.m_Recipes;
11379 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11380 if (moduleRecipesManager)
11381 {
11382 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11383 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11384 }
11385
11386 for (int i = 0;i < recipesIds.Count(); i++)
11387 {
11388 int key = recipesIds.Get(i);
11389 string recipeName = moduleRecipesManager.GetRecipeName(key);
11391 }
11392 }
11393
11394
11395 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11396 {
11397 super.GetDebugActions(outputList);
11398
11399
11405
11406
11411
11416
11417
11421
11422
11424 {
11428 }
11429
11432
11433
11437
11439
11440 InventoryLocation loc = new InventoryLocation();
11441 GetInventory().GetCurrentInventoryLocation(loc);
11443 {
11444 if (Gizmo_IsSupported())
11447 }
11448
11450 }
11451
11452
11453
11454
11456 {
11457 super.OnAction(action_id, player, ctx);
11458
11460 {
11461 switch (action_id)
11462 {
11465 return true;
11468 return true;
11469 }
11470 }
11471
11473 {
11474 switch (action_id)
11475 {
11477 Delete();
11478 return true;
11479 }
11480 }
11481
11482 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11483 {
11484 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11485 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11486 PlayerBase p = PlayerBase.Cast(player);
11487 if (
EActions.RECIPES_RANGE_START < 1000)
11488 {
11489 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11490 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11491 }
11492 }
11493 #ifndef SERVER
11494 else if (action_id ==
EActions.WATCH_PLAYER)
11495 {
11496 PluginDeveloper.SetDeveloperItemClientEx(player);
11497 }
11498 #endif
11500 {
11501 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11502 {
11503 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11504 OnDebugButtonPressServer(id + 1);
11505 }
11506
11507 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11508 {
11509 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11511 }
11512
11513 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11514 {
11515 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11517 }
11518
11519 else if (action_id ==
EActions.ADD_QUANTITY)
11520 {
11521 if (IsMagazine())
11522 {
11523 Magazine mag = Magazine.Cast(this);
11524 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11525 }
11526 else
11527 {
11529 }
11530
11531 if (m_EM)
11532 {
11533 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11534 }
11535
11536 }
11537
11538 else if (action_id ==
EActions.REMOVE_QUANTITY)
11539 {
11540 if (IsMagazine())
11541 {
11542 Magazine mag2 = Magazine.Cast(this);
11543 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11544 }
11545 else
11546 {
11548 }
11549 if (m_EM)
11550 {
11551 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11552 }
11553
11554 }
11555
11556 else if (action_id ==
EActions.SET_QUANTITY_0)
11557 {
11559
11560 if (m_EM)
11561 {
11562 m_EM.SetEnergy(0);
11563 }
11564 }
11565
11566 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11567 {
11569
11570 if (m_EM)
11571 {
11572 m_EM.SetEnergy(m_EM.GetEnergyMax());
11573 }
11574 }
11575
11576 else if (action_id ==
EActions.ADD_HEALTH)
11577 {
11578 AddHealth("","",GetMaxHealth("","Health")/5);
11579 }
11580 else if (action_id ==
EActions.REMOVE_HEALTH)
11581 {
11582 AddHealth("","",-GetMaxHealth("","Health")/5);
11583 }
11584 else if (action_id ==
EActions.DESTROY_HEALTH)
11585 {
11586 SetHealth01("","",0);
11587 }
11588 else if (action_id ==
EActions.WATCH_ITEM)
11589 {
11591 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11592 #ifdef DEVELOPER
11593 SetDebugDeveloper_item(this);
11594 #endif
11595 }
11596
11597 else if (action_id ==
EActions.ADD_TEMPERATURE)
11598 {
11599 AddTemperature(20);
11600
11601 }
11602
11603 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11604 {
11605 AddTemperature(-20);
11606
11607 }
11608
11609 else if (action_id ==
EActions.FLIP_FROZEN)
11610 {
11611 SetFrozen(!GetIsFrozen());
11612
11613 }
11614
11615 else if (action_id ==
EActions.ADD_WETNESS)
11616 {
11618
11619 }
11620
11621 else if (action_id ==
EActions.REMOVE_WETNESS)
11622 {
11624
11625 }
11626
11627 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11628 {
11631
11632
11633 }
11634
11635 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11636 {
11639 }
11640
11641 else if (action_id ==
EActions.MAKE_SPECIAL)
11642 {
11643 auto debugParams = DebugSpawnParams.WithPlayer(player);
11644 OnDebugSpawnEx(debugParams);
11645 }
11646
11647 }
11648
11649
11650 return false;
11651 }
11652
11653
11654
11655
11659
11662
11663
11664
11666 {
11667 return false;
11668 }
11669
11670
11672 {
11673 return true;
11674 }
11675
11676
11678 {
11679 return true;
11680 }
11681
11682
11683
11685 {
11686 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11688 }
11689
11692 {
11693 return null;
11694 }
11695
11697 {
11698 return false;
11699 }
11700
11702 {
11703 return false;
11704 }
11705
11709
11710
11712 {
11713 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11714 return module_repairing.CanRepair(this, item_repair_kit);
11715 }
11716
11717
11718 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11719 {
11720 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11721 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11722 }
11723
11724
11726 {
11727
11728
11729
11730
11731
11732
11733
11734
11735 return 1;
11736 }
11737
11738
11739
11741 {
11743 }
11744
11745
11746
11748 {
11750 }
11751
11752
11761 {
11762 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11763
11764 if (player)
11765 {
11766 player.MessageStatus(text);
11767 }
11768 }
11769
11770
11779 {
11780 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11781
11782 if (player)
11783 {
11784 player.MessageAction(text);
11785 }
11786 }
11787
11788
11797 {
11798 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11799
11800 if (player)
11801 {
11802 player.MessageFriendly(text);
11803 }
11804 }
11805
11806
11815 {
11816 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11817
11818 if (player)
11819 {
11820 player.MessageImportant(text);
11821 }
11822 }
11823
11825 {
11826 return true;
11827 }
11828
11829
11830 override bool KindOf(
string tag)
11831 {
11832 bool found = false;
11833 string item_name = this.
GetType();
11836
11837 int array_size = item_tag_array.Count();
11838 for (int i = 0; i < array_size; i++)
11839 {
11840 if (item_tag_array.Get(i) == tag)
11841 {
11842 found = true;
11843 break;
11844 }
11845 }
11846 return found;
11847 }
11848
11849
11851 {
11852
11853 super.OnRPC(sender, rpc_type,ctx);
11854
11855
11856 switch (rpc_type)
11857 {
11858 #ifndef SERVER
11859 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11860 Param2<bool, string> p = new Param2<bool, string>(false, "");
11861
11863 return;
11864
11865 bool play = p.param1;
11866 string soundSet = p.param2;
11867
11868 if (play)
11869 {
11871 {
11873 {
11875 }
11876 }
11877 else
11878 {
11880 }
11881 }
11882 else
11883 {
11885 }
11886
11887 break;
11888 #endif
11889
11890 }
11891
11893 {
11895 }
11896 }
11897
11898
11899
11900
11902 {
11903 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11904 return plugin.GetID(
name);
11905 }
11906
11908 {
11909 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11910 return plugin.GetName(id);
11911 }
11912
11915 {
11916
11917
11918 int varFlags;
11919 if (!ctx.
Read(varFlags))
11920 return;
11921
11922 if (varFlags & ItemVariableFlags.FLOAT)
11923 {
11925 }
11926 }
11927
11929 {
11930
11931 super.SerializeNumericalVars(floats_out);
11932
11933
11934
11936 {
11938 }
11939
11941 {
11943 }
11944
11946 {
11948 }
11949
11951 {
11956 }
11957
11959 {
11961 }
11962 }
11963
11965 {
11966
11967 super.DeSerializeNumericalVars(floats);
11968
11969
11970 int index = 0;
11971 int mask = Math.Round(floats.Get(index));
11972
11973 index++;
11974
11976 {
11978 {
11980 }
11981 else
11982 {
11983 float quantity = floats.Get(index);
11984 SetQuantity(quantity,
true,
false,
false,
false);
11985 }
11986 index++;
11987 }
11988
11990 {
11991 float wet = floats.Get(index);
11993 index++;
11994 }
11995
11997 {
11998 int liquidtype = Math.Round(floats.Get(index));
12000 index++;
12001 }
12002
12004 {
12006 index++;
12008 index++;
12010 index++;
12012 index++;
12013 }
12014
12016 {
12017 int cleanness = Math.Round(floats.Get(index));
12019 index++;
12020 }
12021 }
12022
12024 {
12025 super.WriteVarsToCTX(ctx);
12026
12027
12029 {
12031 }
12032
12034 {
12036 }
12037
12039 {
12041 }
12042
12044 {
12045 int r,g,b,a;
12051 }
12052
12054 {
12056 }
12057 }
12058
12060 {
12061 if (!super.ReadVarsFromCTX(ctx,version))
12062 return false;
12063
12064 int intValue;
12065 float value;
12066
12067 if (version < 140)
12068 {
12069 if (!ctx.
Read(intValue))
12070 return false;
12071
12072 m_VariablesMask = intValue;
12073 }
12074
12076 {
12077 if (!ctx.
Read(value))
12078 return false;
12079
12081 {
12083 }
12084 else
12085 {
12087 }
12088 }
12089
12090 if (version < 140)
12091 {
12093 {
12094 if (!ctx.
Read(value))
12095 return false;
12096 SetTemperatureDirect(value);
12097 }
12098 }
12099
12101 {
12102 if (!ctx.
Read(value))
12103 return false;
12105 }
12106
12108 {
12109 if (!ctx.
Read(intValue))
12110 return false;
12112 }
12113
12115 {
12116 int r,g,b,a;
12118 return false;
12120 return false;
12122 return false;
12124 return false;
12125
12127 }
12128
12130 {
12131 if (!ctx.
Read(intValue))
12132 return false;
12134 }
12135
12136 if (version >= 138 && version < 140)
12137 {
12139 {
12140 if (!ctx.
Read(intValue))
12141 return false;
12142 SetFrozen(intValue);
12143 }
12144 }
12145
12146 return true;
12147 }
12148
12149
12151 {
12154 {
12156 }
12157
12158 if (!super.OnStoreLoad(ctx, version))
12159 {
12161 return false;
12162 }
12163
12164 if (version >= 114)
12165 {
12166 bool hasQuickBarIndexSaved;
12167
12168 if (!ctx.
Read(hasQuickBarIndexSaved))
12169 {
12171 return false;
12172 }
12173
12174 if (hasQuickBarIndexSaved)
12175 {
12176 int itmQBIndex;
12177
12178
12179 if (!ctx.
Read(itmQBIndex))
12180 {
12182 return false;
12183 }
12184
12185 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12186 if (itmQBIndex != -1 && parentPlayer)
12187 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12188 }
12189 }
12190 else
12191 {
12192
12193 PlayerBase player;
12194 int itemQBIndex;
12195 if (version ==
int.
MAX)
12196 {
12197 if (!ctx.
Read(itemQBIndex))
12198 {
12200 return false;
12201 }
12202 }
12203 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12204 {
12205
12206 if (!ctx.
Read(itemQBIndex))
12207 {
12209 return false;
12210 }
12211 if (itemQBIndex != -1 && player)
12212 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12213 }
12214 }
12215
12216 if (version < 140)
12217 {
12218
12219 if (!LoadVariables(ctx, version))
12220 {
12222 return false;
12223 }
12224 }
12225
12226
12228 {
12230 return false;
12231 }
12232 if (version >= 132)
12233 {
12235 if (raib)
12236 {
12238 {
12240 return false;
12241 }
12242 }
12243 }
12244
12246 return true;
12247 }
12248
12249
12250
12252 {
12253 super.OnStoreSave(ctx);
12254
12255 PlayerBase player;
12256 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12257 {
12259
12260 int itemQBIndex = -1;
12261 itemQBIndex = player.FindQuickBarEntityIndex(this);
12262 ctx.
Write(itemQBIndex);
12263 }
12264 else
12265 {
12267 }
12268
12270
12272 if (raib)
12273 {
12275 }
12276 }
12277
12278
12280 {
12281 super.AfterStoreLoad();
12282
12284 {
12286 }
12287
12289 {
12292 }
12293 }
12294
12296 {
12297 super.EEOnAfterLoad();
12298
12300 {
12302 }
12303
12306 }
12307
12309 {
12310 return false;
12311 }
12312
12313
12314
12316 {
12318 {
12319 #ifdef PLATFORM_CONSOLE
12320
12322 {
12324 if (menu)
12325 {
12327 }
12328 }
12329 #endif
12330 }
12331
12333 {
12336 }
12337
12339 {
12340 SetWeightDirty();
12342 }
12344 {
12347 }
12348
12350 {
12353 }
12355 {
12358 }
12359
12360 super.OnVariablesSynchronized();
12361 }
12362
12363
12364
12366 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12367 {
12368 if (!IsServerCheck(allow_client))
12369 return false;
12370
12372 return false;
12373
12376
12377 if (value <= (min + 0.001))
12378 value = min;
12379
12380 if (value == min)
12381 {
12382 if (destroy_config)
12383 {
12384 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12385 if (dstr)
12386 {
12388 this.Delete();
12389 return true;
12390 }
12391 }
12392 else if (destroy_forced)
12393 {
12395 this.Delete();
12396 return true;
12397 }
12398
12400 }
12401
12404
12406 {
12408
12409 if (delta)
12411 }
12412
12414
12415 return false;
12416 }
12417
12418
12420 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12421 {
12423 }
12424
12426 {
12429 }
12430
12432 {
12435 }
12436
12438 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12439 {
12440 float value_clamped = Math.Clamp(value, 0, 1);
12442 SetQuantity(result, destroy_config, destroy_forced);
12443 }
12444
12445
12448 {
12450 }
12451
12453 {
12455 }
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12467 {
12468 int slot = -1;
12469 if (GetInventory())
12470 {
12471 InventoryLocation il = new InventoryLocation;
12472 GetInventory().GetCurrentInventoryLocation(il);
12474 }
12475
12477 }
12478
12480 {
12481 float quantity_max = 0;
12482
12484 {
12485 if (attSlotID != -1)
12486 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12487
12488 if (quantity_max <= 0)
12490 }
12491
12492 if (quantity_max <= 0)
12494
12495 return quantity_max;
12496 }
12497
12499 {
12501 }
12502
12504 {
12506 }
12507
12508
12510 {
12512 }
12513
12515 {
12517 }
12518
12520 {
12522 }
12523
12524
12526 {
12527
12528 float weightEx = GetWeightEx();
12529 float special = GetInventoryAndCargoWeight();
12530 return weightEx - special;
12531 }
12532
12533
12535 {
12537 }
12538
12540 {
12542 {
12543 #ifdef DEVELOPER
12544 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12545 {
12546 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12548 }
12549 #endif
12550
12551 return GetQuantity() * GetConfigWeightModified();
12552 }
12553 else if (HasEnergyManager())
12554 {
12555 #ifdef DEVELOPER
12556 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12557 {
12558 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12559 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12560 }
12561 #endif
12562 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12563 }
12564 else
12565 {
12566 #ifdef DEVELOPER
12567 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12568 {
12569 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12570 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12571 }
12572 #endif
12573 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12574 }
12575 }
12576
12579 {
12580 int item_count = 0;
12582
12583 if (GetInventory().GetCargo() != NULL)
12584 {
12585 item_count = GetInventory().GetCargo().GetItemCount();
12586 }
12587
12588 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12589 {
12590 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12591 if (item)
12592 item_count += item.GetNumberOfItems();
12593 }
12594 return item_count;
12595 }
12596
12599 {
12600 float weight = 0;
12601 float wetness = 1;
12602 if (include_wetness)
12605 {
12606 weight = wetness * m_ConfigWeight;
12607 }
12609 {
12610 weight = 1;
12611 }
12612 return weight;
12613 }
12614
12615
12616
12618 {
12619 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12620 {
12621 GameInventory inv = GetInventory();
12622 array<EntityAI> items = new array<EntityAI>;
12624 for (int i = 0; i < items.Count(); i++)
12625 {
12627 if (item)
12628 {
12630 }
12631 }
12632 }
12633 }
12634
12635
12636
12637
12639 {
12640 float energy = 0;
12641 if (HasEnergyManager())
12642 {
12643 energy = GetCompEM().GetEnergy();
12644 }
12645 return energy;
12646 }
12647
12648
12650 {
12651 super.OnEnergyConsumed();
12652
12654 }
12655
12657 {
12658 super.OnEnergyAdded();
12659
12661 }
12662
12663
12665 {
12666 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12667 {
12669 {
12670 float energy_0to1 = GetCompEM().GetEnergy0To1();
12672 }
12673 }
12674 }
12675
12676
12678 {
12679 return ConfigGetFloat("heatIsolation");
12680 }
12681
12683 {
12685 }
12686
12688 {
12689 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12690 if (
GetGame().ConfigIsExisting(paramPath))
12692
12693 return 0.0;
12694 }
12695
12697 {
12698 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12699 if (
GetGame().ConfigIsExisting(paramPath))
12701
12702 return 0.0;
12703 }
12704
12705 override void SetWet(
float value,
bool allow_client =
false)
12706 {
12707 if (!IsServerCheck(allow_client))
12708 return;
12709
12712
12714
12715 m_VarWet = Math.Clamp(value, min, max);
12716
12718 {
12721 }
12722 }
12723
12724 override void AddWet(
float value)
12725 {
12727 }
12728
12730 {
12732 }
12733
12735 {
12737 }
12738
12740 {
12742 }
12743
12745 {
12747 }
12748
12750 {
12752 }
12753
12754 override void OnWetChanged(
float newVal,
float oldVal)
12755 {
12758 if (newLevel != oldLevel)
12759 {
12761 }
12762 }
12763
12765 {
12766 SetWeightDirty();
12767 }
12768
12770 {
12771 return GetWetLevelInternal(
m_VarWet);
12772 }
12773
12774
12775
12777 {
12779 }
12780
12782 {
12784 }
12785
12787 {
12789 }
12790
12792 {
12794 }
12795
12796
12797
12799 {
12800 if (ConfigIsExisting("itemModelLength"))
12801 {
12802 return ConfigGetFloat("itemModelLength");
12803 }
12804 return 0;
12805 }
12806
12808 {
12809 if (ConfigIsExisting("itemAttachOffset"))
12810 {
12811 return ConfigGetFloat("itemAttachOffset");
12812 }
12813 return 0;
12814 }
12815
12816 override void SetCleanness(
int value,
bool allow_client =
false)
12817 {
12818 if (!IsServerCheck(allow_client))
12819 return;
12820
12822
12824
12827 }
12828
12830 {
12832 }
12833
12835 {
12836 return true;
12837 }
12838
12839
12840
12841
12843 {
12845 }
12846
12848 {
12850 }
12851
12852
12853
12854
12855 override void SetColor(
int r,
int g,
int b,
int a)
12856 {
12862 }
12864 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12865 {
12870 }
12871
12873 {
12875 }
12876
12879 {
12880 int r,g,b,a;
12882 r = r/255;
12883 g = g/255;
12884 b = b/255;
12885 a = a/255;
12886 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12887 }
12888
12889
12890
12891 override void SetLiquidType(
int value,
bool allow_client =
false)
12892 {
12893 if (!IsServerCheck(allow_client))
12894 return;
12895
12900 }
12901
12903 {
12904 return ConfigGetInt("varLiquidTypeInit");
12905 }
12906
12908 {
12910 }
12911
12913 {
12915 SetFrozen(false);
12916 }
12917
12920 {
12921 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12922 }
12923
12924
12927 {
12928 PlayerBase nplayer;
12929 if (PlayerBase.CastTo(nplayer, player))
12930 {
12932
12933 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12934 }
12935 }
12936
12937
12940 {
12941 PlayerBase nplayer;
12942 if (PlayerBase.CastTo(nplayer,player))
12943 {
12944
12945 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12946
12947 }
12948
12949
12950 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12951
12952
12953 if (HasEnergyManager())
12954 {
12955 GetCompEM().UpdatePlugState();
12956 }
12957 }
12958
12959
12961 {
12962 super.OnPlacementStarted(player);
12963
12965 }
12966
12967 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12968 {
12970 {
12971 m_AdminLog.OnPlacementComplete(player,
this);
12972 }
12973
12974 super.OnPlacementComplete(player, position, orientation);
12975 }
12976
12977
12978
12979
12980
12982 {
12984 {
12985 return true;
12986 }
12987 else
12988 {
12989 return false;
12990 }
12991 }
12992
12993
12995 {
12997 {
12999 }
13000 }
13001
13002
13004 {
13006 }
13007
13009 {
13011 }
13012
13013 override void InsertAgent(
int agent,
float count = 1)
13014 {
13015 if (count < 1)
13016 return;
13017
13019 }
13020
13023 {
13025 }
13026
13027
13029 {
13031 }
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13075 {
13077 return false;
13078 return true;
13079 }
13080
13082 {
13083
13085 }
13086
13087
13090 {
13091 super.CheckForRoofLimited(timeTresholdMS);
13092
13094 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13095 {
13096 m_PreviousRoofTestTime = time;
13097 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13098 }
13099 }
13100
13101
13103 {
13105 {
13106 return 0;
13107 }
13108
13109 if (GetInventory().GetAttachmentSlotsCount() != 0)
13110 {
13111 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13112 if (filter)
13113 return filter.GetProtectionLevel(type, false, system);
13114 else
13115 return 0;
13116 }
13117
13118 string subclassPath, entryName;
13119
13120 switch (type)
13121 {
13123 entryName = "biological";
13124 break;
13126 entryName = "chemical";
13127 break;
13128 default:
13129 entryName = "biological";
13130 break;
13131 }
13132
13133 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13134
13136 }
13137
13138
13139
13142 {
13143 if (!IsMagazine())
13145
13147 }
13148
13149
13150
13151
13152
13157 {
13158 return true;
13159 }
13160
13162 {
13164 }
13165
13166
13167
13168
13169
13171 {
13172 if (parent)
13173 {
13174 if (parent.IsInherited(DayZInfected))
13175 return true;
13176
13177 if (!parent.IsRuined())
13178 return true;
13179 }
13180
13181 return true;
13182 }
13183
13185 {
13186 if (!super.CanPutAsAttachment(parent))
13187 {
13188 return false;
13189 }
13190
13191 if (!IsRuined() && !parent.IsRuined())
13192 {
13193 return true;
13194 }
13195
13196 return false;
13197 }
13198
13200 {
13201
13202
13203
13204
13205 return super.CanReceiveItemIntoCargo(item);
13206 }
13207
13209 {
13210
13211
13212
13213
13214 GameInventory attachmentInv = attachment.GetInventory();
13216 {
13217 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13218 return false;
13219 }
13220
13221 InventoryLocation loc = new InventoryLocation();
13222 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13223 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13224 return false;
13225
13226 return super.CanReceiveAttachment(attachment, slotId);
13227 }
13228
13230 {
13231 if (!super.CanReleaseAttachment(attachment))
13232 return false;
13233
13234 return GetInventory().AreChildrenAccessible();
13235 }
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13258 {
13259 int id = muzzle_owner.GetMuzzleID();
13260 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13261
13262 if (WPOF_array)
13263 {
13264 for (int i = 0; i < WPOF_array.Count(); i++)
13265 {
13266 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13267
13268 if (WPOF)
13269 {
13270 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13271 }
13272 }
13273 }
13274 }
13275
13276
13278 {
13279 int id = muzzle_owner.GetMuzzleID();
13281
13282 if (WPOBE_array)
13283 {
13284 for (int i = 0; i < WPOBE_array.Count(); i++)
13285 {
13286 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13287
13288 if (WPOBE)
13289 {
13290 WPOBE.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.OnActivate(weapon, 0, 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.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13331 }
13332 }
13333 }
13334 }
13335
13336
13338 {
13339 int id = muzzle_owner.GetMuzzleID();
13340 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13341
13342 if (WPOOH_array)
13343 {
13344 for (int i = 0; i < WPOOH_array.Count(); i++)
13345 {
13346 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13347
13348 if (WPOOH)
13349 {
13350 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13351 }
13352 }
13353 }
13354 }
13355
13356
13357
13359 {
13361 {
13362 return true;
13363 }
13364
13365 return false;
13366 }
13367
13369 {
13371 {
13372 return true;
13373 }
13374
13375 return false;
13376 }
13377
13379 {
13381 {
13382 return true;
13383 }
13384
13385 return false;
13386 }
13387
13389 {
13390 return false;
13391 }
13392
13395 {
13396 return UATimeSpent.DEFAULT_DEPLOY;
13397 }
13398
13399
13400
13401
13403 {
13405 SetSynchDirty();
13406 }
13407
13409 {
13411 }
13412
13413
13415 {
13416 return false;
13417 }
13418
13421 {
13422 string att_type = "None";
13423
13424 if (ConfigIsExisting("soundAttType"))
13425 {
13426 att_type = ConfigGetString("soundAttType");
13427 }
13428
13430 }
13431
13433 {
13435 }
13436
13437
13438
13439
13440
13446
13448 {
13451
13453 }
13454
13455
13457 {
13459 return;
13460
13462
13465
13468
13469 SoundParameters params = new SoundParameters();
13473 }
13474
13475
13477 {
13479 return;
13480
13482 SetSynchDirty();
13483
13486 }
13487
13488
13490 {
13492 return;
13493
13495 SetSynchDirty();
13496
13499 }
13500
13502 {
13504 }
13505
13507 {
13509 }
13510
13513 {
13514 if (!
GetGame().IsDedicatedServer())
13515 {
13516 if (ConfigIsExisting("attachSoundSet"))
13517 {
13518 string cfg_path = "";
13519 string soundset = "";
13520 string type_name =
GetType();
13521
13524 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13525 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13526
13527 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13528 {
13529 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13530 {
13531 if (cfg_slot_array[i] == slot_type)
13532 {
13533 soundset = cfg_soundset_array[i];
13534 break;
13535 }
13536 }
13537 }
13538
13539 if (soundset != "")
13540 {
13541 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13543 }
13544 }
13545 }
13546 }
13547
13549 {
13550
13551 }
13552
13553 void OnApply(PlayerBase player);
13554
13556 {
13557 return 1.0;
13558 };
13559
13561 {
13563 }
13564
13566 {
13568 }
13569
13571
13573 {
13574 SetDynamicPhysicsLifeTime(0.01);
13576 }
13577
13579 {
13580 array<string> zone_names = new array<string>;
13581 GetDamageZones(zone_names);
13582 for (int i = 0; i < zone_names.Count(); i++)
13583 {
13584 SetHealthMax(zone_names.Get(i),"Health");
13585 }
13586 SetHealthMax("","Health");
13587 }
13588
13591 {
13592 float global_health = GetHealth01("","Health");
13593 array<string> zones = new array<string>;
13594 GetDamageZones(zones);
13595
13596 for (int i = 0; i < zones.Count(); i++)
13597 {
13598 SetHealth01(zones.Get(i),"Health",global_health);
13599 }
13600 }
13601
13604 {
13605 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13606 }
13607
13609 {
13610 if (!hasRootAsPlayer)
13611 {
13612 if (refParentIB)
13613 {
13614
13615 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13616 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13617
13618 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13619 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13620
13623 }
13624 else
13625 {
13626
13629 }
13630 }
13631 }
13632
13634 {
13636 {
13637 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13638 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13639 {
13640 float heatPermCoef = 1.0;
13642 while (ent)
13643 {
13644 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13645 ent = ent.GetHierarchyParent();
13646 }
13647
13648 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13649 }
13650 }
13651 }
13652
13654 {
13655
13656 EntityAI parent = GetHierarchyParent();
13657 if (!parent)
13658 {
13659 hasParent = false;
13660 hasRootAsPlayer = false;
13661 }
13662 else
13663 {
13664 hasParent = true;
13665 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13666 refParentIB =
ItemBase.Cast(parent);
13667 }
13668 }
13669
13670 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13671 {
13672
13673 }
13674
13676 {
13677
13678 return false;
13679 }
13680
13682 {
13683
13684
13685 return false;
13686 }
13687
13689 {
13690
13691 return false;
13692 }
13693
13696 {
13697 return !GetIsFrozen() &&
IsOpen();
13698 }
13699
13701 {
13702 bool hasParent = false, hasRootAsPlayer = false;
13704
13705 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13706 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13707
13708 if (wwtu || foodDecay)
13709 {
13713
13714 if (processWetness || processTemperature || processDecay)
13715 {
13717
13718 if (processWetness)
13719 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13720
13721 if (processTemperature)
13723
13724 if (processDecay)
13725 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13726 }
13727 }
13728 }
13729
13732 {
13734 }
13735
13737 {
13740
13741 return super.GetTemperatureFreezeThreshold();
13742 }
13743
13745 {
13748
13749 return super.GetTemperatureThawThreshold();
13750 }
13751
13753 {
13756
13757 return super.GetItemOverheatThreshold();
13758 }
13759
13761 {
13763 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13764
13765 return super.GetTemperatureFreezeTime();
13766 }
13767
13769 {
13771 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13772
13773 return super.GetTemperatureThawTime();
13774 }
13775
13780
13782 {
13783 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13784 }
13785
13787 {
13788 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13789 }
13790
13793 {
13795 }
13796
13798 {
13800 }
13801
13803 {
13805 }
13806
13809 {
13810 return null;
13811 }
13812
13815 {
13816 return false;
13817 }
13818
13820 {
13822 {
13825 if (!trg)
13826 {
13828 explosive = this;
13829 }
13830
13831 explosive.PairRemote(trg);
13833
13834 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13835 trg.SetPersistentPairID(persistentID);
13836 explosive.SetPersistentPairID(persistentID);
13837
13838 return true;
13839 }
13840 return false;
13841 }
13842
13845 {
13846 float ret = 1.0;
13849 ret *= GetHealth01();
13850
13851 return ret;
13852 }
13853
13854 #ifdef DEVELOPER
13855 override void SetDebugItem()
13856 {
13857 super.SetDebugItem();
13858 _itemBase = this;
13859 }
13860
13862 {
13863 string text = super.GetDebugText();
13864
13866 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13867
13868 return text;
13869 }
13870 #endif
13871
13873 {
13874 return true;
13875 }
13876
13878
13880
13882 {
13885 }
13886
13887
13895
13911}
13912
13914{
13916 if (entity)
13917 {
13918 bool is_item = entity.IsInherited(
ItemBase);
13919 if (is_item && full_quantity)
13920 {
13923 }
13924 }
13925 else
13926 {
13928 return NULL;
13929 }
13930 return entity;
13931}
13932
13934{
13935 if (item)
13936 {
13937 if (health > 0)
13938 item.SetHealth("", "", health);
13939
13940 if (item.CanHaveTemperature())
13941 {
13943 if (item.CanFreeze())
13944 item.SetFrozen(false);
13945 }
13946
13947 if (item.HasEnergyManager())
13948 {
13949 if (quantity >= 0)
13950 {
13951 item.GetCompEM().SetEnergy0To1(quantity);
13952 }
13953 else
13954 {
13956 }
13957 }
13958 else if (item.IsMagazine())
13959 {
13960 Magazine mag = Magazine.Cast(item);
13961 if (quantity >= 0)
13962 {
13963 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13964 }
13965 else
13966 {
13968 }
13969
13970 }
13971 else
13972 {
13973 if (quantity >= 0)
13974 {
13975 item.SetQuantityNormalized(quantity, false);
13976 }
13977 else
13978 {
13980 }
13981
13982 }
13983 }
13984}
13985
13986#ifdef DEVELOPER
13988#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.