8994{
8996 {
8997 return true;
8998 }
8999};
9000
9001
9002
9004{
9008
9010
9013
9014
9015
9016
9017
9026
9032
9037
9042
9063 protected bool m_IsResultOfSplit
9064
9066
9071
9072
9073
9075
9079
9080
9081
9083
9086
9087
9088
9094
9095
9103
9106
9107
9109
9110
9112
9113
9118
9119
9124
9125
9127
9128
9130 {
9135
9136 if (!
GetGame().IsDedicatedServer())
9137 {
9139 {
9141
9143 {
9145 }
9146 }
9147
9150 }
9151
9152 m_OldLocation = null;
9153
9155 {
9157 }
9158
9159 if (ConfigIsExisting("headSelectionsToHide"))
9160 {
9163 }
9164
9166 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9167 {
9169 }
9170
9172
9173 m_IsResultOfSplit = false;
9174
9176 }
9177
9179 {
9180 super.InitItemVariables();
9181
9187 m_Count = ConfigGetInt(
"count");
9188
9191
9196
9199
9204
9216
9220
9221
9224 if (ConfigIsExisting("canBeSplit"))
9225 {
9228 }
9229
9231 if (ConfigIsExisting("itemBehaviour"))
9233
9234
9237 RegisterNetSyncVariableInt("m_VarLiquidType");
9238 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9239
9240 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9241 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9242 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9243
9244 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9245 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9246 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9247 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9248
9249 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9250 RegisterNetSyncVariableBool("m_IsTakeable");
9251 RegisterNetSyncVariableBool("m_IsHologram");
9252
9255 {
9258 }
9259
9261
9263 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9265
9266 }
9267
9269 {
9271 }
9272
9274 {
9277 {
9282 }
9283 }
9284
9285 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9286 {
9288 {
9291 }
9292
9294 }
9295
9297 {
9303 }
9304
9306
9308 {
9310
9311 if (!action)
9312 {
9313 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9314 return;
9315 }
9316
9318 if (!ai)
9319 {
9321 return;
9322 }
9323
9325 if (!action_array)
9326 {
9327 action_array = new array<ActionBase_Basic>;
9329 }
9330 if (LogManager.IsActionLogEnable())
9331 {
9332 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9333 }
9334
9335 if (action_array.Find(action) != -1)
9336 {
9337 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9338 }
9339 else
9340 {
9341 action_array.Insert(action);
9342 }
9343 }
9344
9346 {
9348 ActionBase action = player.GetActionManager().GetAction(actionName);
9351
9352 if (action_array)
9353 {
9354 action_array.RemoveItem(action);
9355 }
9356 }
9357
9358
9359
9361 {
9362 ActionOverrideData overrideData = new ActionOverrideData();
9366
9368 if (!actionMap)
9369 {
9372 }
9373
9374 actionMap.Insert(this.
Type(), overrideData);
9375
9376 }
9377
9379
9381
9382
9384 {
9387
9390
9391 string config_to_search = "CfgVehicles";
9392 string muzzle_owner_config;
9393
9395 {
9396 if (IsInherited(Weapon))
9397 config_to_search = "CfgWeapons";
9398
9399 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9400
9401 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9402
9404
9405 if (config_OnFire_subclass_count > 0)
9406 {
9407 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9408
9409 for (int i = 0; i < config_OnFire_subclass_count; i++)
9410 {
9411 string particle_class = "";
9413 string config_OnFire_entry = config_OnFire_class + particle_class;
9414 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9415 WPOF_array.Insert(WPOF);
9416 }
9417
9418
9420 }
9421 }
9422
9424 {
9425 config_to_search = "CfgWeapons";
9426 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9427
9428 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9429
9431
9432 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9433 {
9434 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9435
9436 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9437 {
9438 string particle_class2 = "";
9440 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9441 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9442 WPOBE_array.Insert(WPOBE);
9443 }
9444
9445
9447 }
9448 }
9449 }
9450
9451
9453 {
9456
9458 {
9459 string config_to_search = "CfgVehicles";
9460
9461 if (IsInherited(Weapon))
9462 config_to_search = "CfgWeapons";
9463
9464 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9465 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9466
9467 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9468 {
9469
9471
9473 {
9475 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9477 return;
9478 }
9479
9482
9483
9484
9486 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9487
9488 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9489 {
9490 string particle_class = "";
9492 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9494
9495 if (entry_type == CT_CLASS)
9496 {
9497 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9498 WPOOH_array.Insert(WPOF);
9499 }
9500 }
9501
9502
9504 }
9505 }
9506 }
9507
9509 {
9511 }
9512
9514 {
9516 {
9518
9521
9524
9525 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9526 }
9527 }
9528
9530 {
9532 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9533
9535 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9536
9538 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9539
9541 {
9543 }
9544 }
9545
9547 {
9549 }
9550
9552 {
9555 else
9557
9559 {
9562 }
9563 else
9564 {
9567
9570 }
9571
9573 }
9574
9576 {
9578 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9579 }
9580
9582 {
9584 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9586 }
9587
9589 {
9591 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9592 }
9593
9595 {
9598
9599 OverheatingParticle OP = new OverheatingParticle();
9604
9606 }
9607
9609 {
9612
9613 return -1;
9614 }
9615
9617 {
9619 {
9622
9623 for (int i = count; i > 0; --i)
9624 {
9625 int id = i - 1;
9628
9631
9632 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9633 {
9634 if (p)
9635 {
9638 }
9639 }
9640 }
9641 }
9642 }
9643
9645 {
9647 {
9649 {
9650 int id = i - 1;
9652
9653 if (OP)
9654 {
9656
9657 if (p)
9658 {
9660 }
9661
9662 delete OP;
9663 }
9664 }
9665
9668 }
9669 }
9670
9673 {
9674 return 0.0;
9675 }
9676
9677
9679 {
9680 return 250;
9681 }
9682
9684 {
9685 return 0;
9686 }
9687
9690 {
9692 return true;
9693
9694 return false;
9695 }
9696
9699 {
9702
9704 {
9706 }
9707 else
9708 {
9709
9711 }
9712
9714 }
9715
9722 {
9723 return -1;
9724 }
9725
9726
9727
9728
9730 {
9732 {
9734 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9735
9736 if (r_index >= 0)
9737 {
9738 InventoryLocation r_il = new InventoryLocation;
9739 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9740
9741 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9744 {
9745 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9746 }
9748 {
9749 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9750 }
9751
9752 }
9753
9754 player.GetHumanInventory().ClearUserReservedLocation(this);
9755 }
9756
9759 }
9760
9761
9762
9763
9765 {
9766 return ItemBase.m_DebugActionsMask;
9767 }
9768
9770 {
9771 return ItemBase.m_DebugActionsMask & mask;
9772 }
9773
9775 {
9776 ItemBase.m_DebugActionsMask = mask;
9777 }
9778
9780 {
9781 ItemBase.m_DebugActionsMask |= mask;
9782 }
9783
9785 {
9786 ItemBase.m_DebugActionsMask &= ~mask;
9787 }
9788
9790 {
9792 {
9794 }
9795 else
9796 {
9798 }
9799 }
9800
9801
9803 {
9804 if (GetEconomyProfile())
9805 {
9806 float q_max = GetEconomyProfile().GetQuantityMax();
9807 if (q_max > 0)
9808 {
9809 float q_min = GetEconomyProfile().GetQuantityMin();
9810 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9811
9813 {
9814 ComponentEnergyManager comp = GetCompEM();
9816 {
9818 }
9819 }
9821 {
9823
9824 }
9825
9826 }
9827 }
9828 }
9829
9832 {
9833 EntityAI parent = GetHierarchyParent();
9834
9835 if (parent)
9836 {
9837 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9838 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9839 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9840 }
9841 }
9842
9845 {
9846 EntityAI parent = GetHierarchyParent();
9847
9848 if (parent)
9849 {
9850 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9851 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9852 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9853 }
9854 }
9855
9857 {
9858
9859
9860
9861
9863
9865 {
9866 if (ScriptInputUserData.CanStoreInputUserData())
9867 {
9868 ScriptInputUserData ctx = new ScriptInputUserData;
9874 ctx.
Write(use_stack_max);
9877
9879 {
9880 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9881 }
9882 }
9883 }
9884 else if (!
GetGame().IsMultiplayer())
9885 {
9887 }
9888 }
9889
9891 {
9893 }
9894
9896 {
9898 }
9899
9901 {
9903 }
9904
9906 {
9907
9908 return false;
9909 }
9910
9912 {
9913 return false;
9914 }
9915
9919 {
9920 return false;
9921 }
9922
9924 {
9925 return "";
9926 }
9927
9929
9931 {
9932 return false;
9933 }
9934
9936 {
9937 return true;
9938 }
9939
9940
9941
9943 {
9944 return true;
9945 }
9946
9948 {
9949 return true;
9950 }
9951
9953 {
9954 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9956 }
9957
9959 {
9961 }
9962
9964 {
9966 if (!is_being_placed)
9968 SetSynchDirty();
9969 }
9970
9971
9973
9975 {
9977 }
9978
9980 {
9982 }
9983
9985 {
9986 return 1;
9987 }
9988
9990 {
9991 return false;
9992 }
9993
9995 {
9997 SetSynchDirty();
9998 }
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10035 {
10036 super.OnMovedInsideCargo(container);
10037
10038 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10039 }
10040
10041 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10042 {
10043 super.EEItemLocationChanged(oldLoc,newLoc);
10044
10045 PlayerBase new_player = null;
10046 PlayerBase old_player = null;
10047
10048 if (newLoc.GetParent())
10049 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10050
10051 if (oldLoc.GetParent())
10052 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10053
10055 {
10056 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10057
10058 if (r_index >= 0)
10059 {
10060 InventoryLocation r_il = new InventoryLocation;
10061 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10062
10063 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10066 {
10067 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10068 }
10070 {
10071 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10072 }
10073
10074 }
10075 }
10076
10078 {
10079 if (new_player)
10080 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10081
10082 if (new_player == old_player)
10083 {
10084
10085 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10086 {
10088 {
10089 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10090 {
10091 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10092 }
10093 }
10094 else
10095 {
10096 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10097 }
10098 }
10099
10100 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10101 {
10102 int type = oldLoc.GetType();
10104 {
10105 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10106 }
10108 {
10109 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10110 }
10111 }
10112 if (!m_OldLocation)
10113 {
10114 m_OldLocation = new InventoryLocation;
10115 }
10116 m_OldLocation.Copy(oldLoc);
10117 }
10118 else
10119 {
10120 if (m_OldLocation)
10121 {
10122 m_OldLocation.Reset();
10123 }
10124 }
10125
10127 }
10128 else
10129 {
10130 if (new_player)
10131 {
10132 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10133 if (res_index >= 0)
10134 {
10135 InventoryLocation il = new InventoryLocation;
10136 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10138 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10141 {
10142 il.
GetParent().GetOnReleaseLock().Invoke(it);
10143 }
10145 {
10147 }
10148
10149 }
10150 }
10152 {
10153
10155 }
10156
10157 if (m_OldLocation)
10158 {
10159 m_OldLocation.Reset();
10160 }
10161 }
10162 }
10163
10164 override void EOnContact(IEntity other, Contact extra)
10165 {
10167 {
10168 int liquidType = -1;
10170 if (impactSpeed > 0.0)
10171 {
10173 #ifndef SERVER
10175 #else
10177 SetSynchDirty();
10178 #endif
10180 }
10181 }
10182
10183 #ifdef SERVER
10184 if (GetCompEM() && GetCompEM().IsPlugged())
10185 {
10186 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10187 GetCompEM().UnplugThis();
10188 }
10189 #endif
10190 }
10191
10193
10195 {
10197 }
10198
10200 {
10201
10202 }
10203
10205 {
10206 super.OnItemLocationChanged(old_owner, new_owner);
10207
10208 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10209 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10210
10211 if (!relatedPlayer && playerNew)
10212 relatedPlayer = playerNew;
10213
10214 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10215 {
10217 if (actionMgr)
10218 {
10219 ActionBase currentAction = actionMgr.GetRunningAction();
10220 if (currentAction)
10222 }
10223 }
10224
10225 Man ownerPlayerOld = null;
10226 Man ownerPlayerNew = null;
10227
10228 if (old_owner)
10229 {
10230 if (old_owner.
IsMan())
10231 {
10232 ownerPlayerOld = Man.Cast(old_owner);
10233 }
10234 else
10235 {
10236 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10237 }
10238 }
10239 else
10240 {
10242 {
10244
10245 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10246 {
10247 GetCompEM().UnplugThis();
10248 }
10249 }
10250 }
10251
10252 if (new_owner)
10253 {
10254 if (new_owner.
IsMan())
10255 {
10256 ownerPlayerNew = Man.Cast(new_owner);
10257 }
10258 else
10259 {
10260 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10261 }
10262 }
10263
10264 if (ownerPlayerOld != ownerPlayerNew)
10265 {
10266 if (ownerPlayerOld)
10267 {
10268 array<EntityAI> subItemsExit = new array<EntityAI>;
10270 for (int i = 0; i < subItemsExit.Count(); i++)
10271 {
10274 }
10275 }
10276
10277 if (ownerPlayerNew)
10278 {
10279 array<EntityAI> subItemsEnter = new array<EntityAI>;
10281 for (int j = 0; j < subItemsEnter.Count(); j++)
10282 {
10285 }
10286 }
10287 }
10288 else if (ownerPlayerNew != null)
10289 {
10290 PlayerBase nplayer;
10291 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10292 {
10293 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10295 for (int k = 0; k < subItemsUpdate.Count(); k++)
10296 {
10298 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10299 }
10300 }
10301 }
10302
10303 if (old_owner)
10304 old_owner.OnChildItemRemoved(this);
10305 if (new_owner)
10306 new_owner.OnChildItemReceived(this);
10307 }
10308
10309
10311 {
10312 super.EEDelete(parent);
10313 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10314 if (player)
10315 {
10317
10318 if (player.IsAlive())
10319 {
10320 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10321 if (r_index >= 0)
10322 {
10323 InventoryLocation r_il = new InventoryLocation;
10324 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10325
10326 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10329 {
10330 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10331 }
10333 {
10334 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10335 }
10336
10337 }
10338
10339 player.RemoveQuickBarEntityShortcut(this);
10340 }
10341 }
10342 }
10343
10345 {
10346 super.EEKilled(killer);
10347
10350 {
10351 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10352 {
10353 if (IsMagazine())
10354 {
10355 if (Magazine.Cast(this).GetAmmoCount() > 0)
10356 {
10358 }
10359 }
10360 else
10361 {
10363 }
10364 }
10365 }
10366 }
10367
10369 {
10370 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10371
10372 super.OnWasAttached(parent, slot_id);
10373
10376
10378 }
10379
10381 {
10382 super.OnWasDetached(parent, slot_id);
10383
10386 }
10387
10389 {
10390 int idx;
10393
10394 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10395 if (inventory_slots.Count() < 1)
10396 {
10397 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10398 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10399 }
10400 else
10401 {
10402 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10403 }
10404
10405 idx = inventory_slots.Find(slot);
10406 if (idx < 0)
10407 return "";
10408
10409 return attach_types.Get(idx);
10410 }
10411
10413 {
10414 int idx = -1;
10415 string slot;
10416
10419
10420 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10421 if (inventory_slots.Count() < 1)
10422 {
10423 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10424 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10425 }
10426 else
10427 {
10428 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10429 if (detach_types.Count() < 1)
10430 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10431 }
10432
10433 for (int i = 0; i < inventory_slots.Count(); i++)
10434 {
10435 slot = inventory_slots.Get(i);
10436 }
10437
10438 if (slot != "")
10439 {
10440 if (detach_types.Count() == 1)
10441 idx = 0;
10442 else
10443 idx = inventory_slots.Find(slot);
10444 }
10445 if (idx < 0)
10446 return "";
10447
10448 return detach_types.Get(idx);
10449 }
10450
10452 {
10453
10455
10456
10457 float min_time = 1;
10458 float max_time = 3;
10459 float delay = Math.RandomFloat(min_time, max_time);
10460
10461 explode_timer.Run(delay, this, "DoAmmoExplosion");
10462 }
10463
10465 {
10466 Magazine magazine = Magazine.Cast(this);
10467 int pop_sounds_count = 6;
10468 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10469
10470
10471 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10472 string sound_name = pop_sounds[ sound_idx ];
10474
10475
10476 magazine.ServerAddAmmoCount(-1);
10477
10478
10479 float min_temp_to_explode = 100;
10480
10481 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10482 {
10484 }
10485 }
10486
10487
10488 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10489 {
10490 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10491
10492 const int CHANCE_DAMAGE_CARGO = 4;
10493 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10494 const int CHANCE_DAMAGE_NOTHING = 2;
10495
10497 {
10498 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10499 int chances;
10500 int rnd;
10501
10502 if (GetInventory().GetCargo())
10503 {
10504 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10505 rnd = Math.RandomInt(0,chances);
10506
10507 if (rnd < CHANCE_DAMAGE_CARGO)
10508 {
10510 }
10511 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10512 {
10514 }
10515 }
10516 else
10517 {
10518 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10519 rnd = Math.RandomInt(0,chances);
10520
10521 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10522 {
10524 }
10525 }
10526 }
10527 }
10528
10530 {
10531 if (GetInventory().GetCargo())
10532 {
10533 int item_count = GetInventory().GetCargo().GetItemCount();
10534 if (item_count > 0)
10535 {
10536 int random_pick = Math.RandomInt(0, item_count);
10538 if (!item.IsExplosive())
10539 {
10540 item.AddHealth("","",damage);
10541 return true;
10542 }
10543 }
10544 }
10545 return false;
10546 }
10547
10549 {
10550 int attachment_count = GetInventory().AttachmentCount();
10551 if (attachment_count > 0)
10552 {
10553 int random_pick = Math.RandomInt(0, attachment_count);
10554 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10555 if (!attachment.IsExplosive())
10556 {
10557 attachment.AddHealth("","",damage);
10558 return true;
10559 }
10560 }
10561 return false;
10562 }
10563
10565 {
10567 }
10568
10570 {
10572 return GetInventory().CanRemoveEntity();
10573
10574 return false;
10575 }
10576
10578 {
10579
10581 return false;
10582
10583
10585 return false;
10586
10587
10588
10590 if (delta == 0)
10591 return false;
10592
10593
10594 return true;
10595 }
10596
10598 {
10600 {
10601 if (ScriptInputUserData.CanStoreInputUserData())
10602 {
10603 ScriptInputUserData ctx = new ScriptInputUserData;
10608 ctx.
Write(destination_entity);
10610 ctx.
Write(slot_id);
10612 }
10613 }
10614 else if (!
GetGame().IsMultiplayer())
10615 {
10617 }
10618 }
10619
10621 {
10622 float split_quantity_new;
10626 InventoryLocation loc = new InventoryLocation;
10627
10628 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10629 {
10631 split_quantity_new = stack_max;
10632 else
10634
10636 {
10637 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10638 if (new_item)
10639 {
10640 new_item.SetResultOfSplit(true);
10641 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10643 new_item.
SetQuantity(split_quantity_new,
false,
true);
10644 }
10645 }
10646 }
10647 else if (destination_entity && slot_id == -1)
10648 {
10649 if (quantity > stack_max)
10650 split_quantity_new = stack_max;
10651 else
10652 split_quantity_new = quantity;
10653
10655 {
10657 {
10660 }
10661
10662 if (new_item)
10663 {
10664 new_item.SetResultOfSplit(true);
10665 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10667 new_item.
SetQuantity(split_quantity_new,
false,
true);
10668 }
10669 }
10670 }
10671 else
10672 {
10673 if (stack_max != 0)
10674 {
10676 {
10678 }
10679
10680 if (split_quantity_new == 0)
10681 {
10682 if (!
GetGame().IsMultiplayer())
10683 player.PhysicalPredictiveDropItem(this);
10684 else
10685 player.ServerDropEntity(this);
10686 return;
10687 }
10688
10690 {
10692
10693 if (new_item)
10694 {
10695 new_item.SetResultOfSplit(true);
10696 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10699 new_item.PlaceOnSurface();
10700 }
10701 }
10702 }
10703 }
10704 }
10705
10707 {
10708 float split_quantity_new;
10712 InventoryLocation loc = new InventoryLocation;
10713
10714 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10715 {
10717 split_quantity_new = stack_max;
10718 else
10720
10722 {
10723 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10724 if (new_item)
10725 {
10726 new_item.SetResultOfSplit(true);
10727 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10729 new_item.
SetQuantity(split_quantity_new,
false,
true);
10730 }
10731 }
10732 }
10733 else if (destination_entity && slot_id == -1)
10734 {
10735 if (quantity > stack_max)
10736 split_quantity_new = stack_max;
10737 else
10738 split_quantity_new = quantity;
10739
10741 {
10743 {
10746 }
10747
10748 if (new_item)
10749 {
10750 new_item.SetResultOfSplit(true);
10751 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10753 new_item.
SetQuantity(split_quantity_new,
false,
true);
10754 }
10755 }
10756 }
10757 else
10758 {
10759 if (stack_max != 0)
10760 {
10762 {
10764 }
10765
10767 {
10769
10770 if (new_item)
10771 {
10772 new_item.SetResultOfSplit(true);
10773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10776 new_item.PlaceOnSurface();
10777 }
10778 }
10779 }
10780 }
10781 }
10782
10784 {
10786 {
10787 if (ScriptInputUserData.CanStoreInputUserData())
10788 {
10789 ScriptInputUserData ctx = new ScriptInputUserData;
10794 dst.WriteToContext(ctx);
10796 }
10797 }
10798 else if (!
GetGame().IsMultiplayer())
10799 {
10801 }
10802 }
10803
10805 {
10807 {
10808 if (ScriptInputUserData.CanStoreInputUserData())
10809 {
10810 ScriptInputUserData ctx = new ScriptInputUserData;
10815 ctx.
Write(destination_entity);
10821 }
10822 }
10823 else if (!
GetGame().IsMultiplayer())
10824 {
10826 }
10827 }
10828
10830 {
10832 }
10833
10835 {
10837 float split_quantity_new;
10839 if (dst.IsValid())
10840 {
10841 int slot_id = dst.GetSlot();
10843
10844 if (quantity > stack_max)
10845 split_quantity_new = stack_max;
10846 else
10847 split_quantity_new = quantity;
10848
10850 {
10852
10853 if (new_item)
10854 {
10855 new_item.SetResultOfSplit(true);
10856 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10858 new_item.
SetQuantity(split_quantity_new,
false,
true);
10859 }
10860
10861 return new_item;
10862 }
10863 }
10864
10865 return null;
10866 }
10867
10869 {
10871 float split_quantity_new;
10873 if (destination_entity)
10874 {
10876 if (quantity > stackable)
10877 split_quantity_new = stackable;
10878 else
10879 split_quantity_new = quantity;
10880
10882 {
10883 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10884 if (new_item)
10885 {
10886 new_item.SetResultOfSplit(true);
10887 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10889 new_item.
SetQuantity(split_quantity_new,
false,
true);
10890 }
10891 }
10892 }
10893 }
10894
10896 {
10898 {
10899 if (ScriptInputUserData.CanStoreInputUserData())
10900 {
10901 ScriptInputUserData ctx = new ScriptInputUserData;
10906 ItemBase destination_entity =
this;
10907 ctx.
Write(destination_entity);
10911 }
10912 }
10913 else if (!
GetGame().IsMultiplayer())
10914 {
10916 }
10917 }
10918
10920 {
10922 float split_quantity_new;
10924 if (player)
10925 {
10927 if (quantity > stackable)
10928 split_quantity_new = stackable;
10929 else
10930 split_quantity_new = quantity;
10931
10933 {
10934 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10935 new_item =
ItemBase.Cast(in_hands);
10936 if (new_item)
10937 {
10938 new_item.SetResultOfSplit(true);
10939 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10941 new_item.SetQuantity(split_quantity_new, false, true);
10942 }
10943 }
10944 }
10945 }
10946
10948 {
10950 float split_quantity_new = Math.Floor(quantity * 0.5);
10951
10953 return;
10954
10956
10957 if (new_item)
10958 {
10959 if (new_item.GetQuantityMax() < split_quantity_new)
10960 {
10961 split_quantity_new = new_item.GetQuantityMax();
10962 }
10963
10964 new_item.SetResultOfSplit(true);
10965 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10966
10968 {
10971 }
10972 else
10973 {
10975 new_item.
SetQuantity(split_quantity_new,
false,
true);
10976 }
10977 }
10978 }
10979
10981 {
10983 float split_quantity_new = Math.Floor(quantity / 2);
10984
10986 return;
10987
10988 InventoryLocation invloc = new InventoryLocation;
10990
10992 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10993
10994 if (new_item)
10995 {
10996 if (new_item.GetQuantityMax() < split_quantity_new)
10997 {
10998 split_quantity_new = new_item.GetQuantityMax();
10999 }
11001 {
11004 }
11005 else if (split_quantity_new > 1)
11006 {
11008 new_item.
SetQuantity(split_quantity_new,
false,
true);
11009 }
11010 }
11011 }
11012
11015 {
11016 SetWeightDirty();
11018
11019 if (parent)
11020 parent.OnAttachmentQuantityChangedEx(this, delta);
11021
11023 {
11025 {
11027 }
11029 {
11030 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11032 }
11033 }
11034
11035 }
11036
11039 {
11040
11041 }
11042
11045 {
11047 }
11048
11050 {
11051 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11052
11054 {
11055 if (newLevel == GameConstants.STATE_RUINED)
11056 {
11058 EntityAI parent = GetHierarchyParent();
11059 if (parent && parent.IsFireplace())
11060 {
11061 CargoBase cargo = GetInventory().GetCargo();
11062 if (cargo)
11063 {
11065 {
11067 }
11068 }
11069 }
11070 }
11071
11073 {
11074
11076 return;
11077 }
11078
11079 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11080 {
11082 }
11083 }
11084 }
11085
11086
11088 {
11089 super.OnRightClick();
11090
11092 {
11094 {
11095 if (ScriptInputUserData.CanStoreInputUserData())
11096 {
11097 EntityAI root = GetHierarchyRoot();
11098 Man playerOwner = GetHierarchyRootPlayer();
11099 InventoryLocation dst = new InventoryLocation;
11100
11101
11102 if (!playerOwner && root && root == this)
11103 {
11105 }
11106 else
11107 {
11108
11109 GetInventory().GetCurrentInventoryLocation(dst);
11111 {
11114 {
11116 }
11117 else
11118 {
11120
11121
11122 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11123 {
11125 }
11126 else
11127 {
11128 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11129 }
11130 }
11131 }
11132 }
11133
11134 ScriptInputUserData ctx = new ScriptInputUserData;
11142 }
11143 }
11144 else if (!
GetGame().IsMultiplayer())
11145 {
11147 }
11148 }
11149 }
11150
11152 {
11153 if (root)
11154 {
11155 vector m4[4];
11156 root.GetTransform(m4);
11157 dst.SetGround(this, m4);
11158 }
11159 else
11160 {
11161 GetInventory().GetCurrentInventoryLocation(dst);
11162 }
11163 }
11164
11165 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11166 {
11167
11168 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11169 return false;
11170
11171 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11172 return false;
11173
11174
11176 return false;
11177
11178
11179 Magazine mag = Magazine.Cast(this);
11180 if (mag)
11181 {
11182 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11183 return false;
11184
11185 if (stack_max_limit)
11186 {
11187 Magazine other_mag = Magazine.Cast(other_item);
11188 if (other_item)
11189 {
11190 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11191 return false;
11192 }
11193
11194 }
11195 }
11196 else
11197 {
11198
11200 return false;
11201
11203 return false;
11204 }
11205
11206 PlayerBase player = null;
11207 if (CastTo(player, GetHierarchyRootPlayer()))
11208 {
11209 if (player.GetInventory().HasAttachment(this))
11210 return false;
11211
11212 if (player.IsItemsToDelete())
11213 return false;
11214 }
11215
11216 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11217 return false;
11218
11219 int slotID;
11221 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11222 return false;
11223
11224 return true;
11225 }
11226
11228 {
11230 }
11231
11233 {
11234 return m_IsResultOfSplit;
11235 }
11236
11238 {
11239 m_IsResultOfSplit = value;
11240 }
11241
11243 {
11245 }
11246
11248 {
11249 float other_item_quantity = other_item.GetQuantity();
11250 float this_free_space;
11251
11253
11255
11256 if (other_item_quantity > this_free_space)
11257 {
11258 return this_free_space;
11259 }
11260 else
11261 {
11262 return other_item_quantity;
11263 }
11264 }
11265
11267 {
11269 }
11270
11272 {
11274 return;
11275
11276 if (!IsMagazine() && other_item)
11277 {
11279 if (quantity_used != 0)
11280 {
11281 float hp1 = GetHealth01("","");
11282 float hp2 = other_item.GetHealth01("","");
11283 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11284 hpResult = hpResult / (
GetQuantity() + quantity_used);
11285
11286 hpResult *= GetMaxHealth();
11287 Math.Round(hpResult);
11288 SetHealth("", "Health", hpResult);
11289
11291 other_item.AddQuantity(-quantity_used);
11292 }
11293 }
11295 }
11296
11298 {
11299 #ifdef SERVER
11300 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11301 GetHierarchyParent().IncreaseLifetimeUp();
11302 #endif
11303 };
11304
11306 {
11307 PlayerBase p = PlayerBase.Cast(player);
11308
11309 array<int> recipesIds = p.m_Recipes;
11310 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11311 if (moduleRecipesManager)
11312 {
11313 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11314 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11315 }
11316
11317 for (int i = 0;i < recipesIds.Count(); i++)
11318 {
11319 int key = recipesIds.Get(i);
11320 string recipeName = moduleRecipesManager.GetRecipeName(key);
11322 }
11323 }
11324
11325
11326 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11327 {
11328 super.GetDebugActions(outputList);
11329
11330
11336
11337
11342
11347
11348
11352
11353
11355 {
11359 }
11360
11363
11364
11368
11370
11371 InventoryLocation loc = new InventoryLocation();
11372 GetInventory().GetCurrentInventoryLocation(loc);
11374 {
11375 if (Gizmo_IsSupported())
11378 }
11379
11381 }
11382
11383
11384
11385
11387 {
11388 super.OnAction(action_id, player, ctx);
11389
11391 {
11392 switch (action_id)
11393 {
11396 return true;
11399 return true;
11400 }
11401 }
11402
11404 {
11405 switch (action_id)
11406 {
11408 Delete();
11409 return true;
11410 }
11411 }
11412
11413 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11414 {
11415 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11416 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11417 PlayerBase p = PlayerBase.Cast(player);
11418 if (
EActions.RECIPES_RANGE_START < 1000)
11419 {
11420 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11421 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11422 }
11423 }
11424 #ifndef SERVER
11425 else if (action_id ==
EActions.WATCH_PLAYER)
11426 {
11427 PluginDeveloper.SetDeveloperItemClientEx(player);
11428 }
11429 #endif
11431 {
11432 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11433 {
11434 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11435 OnDebugButtonPressServer(id + 1);
11436 }
11437
11438 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11439 {
11440 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11442 }
11443
11444 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11445 {
11446 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11448 }
11449
11450 else if (action_id ==
EActions.ADD_QUANTITY)
11451 {
11452 if (IsMagazine())
11453 {
11454 Magazine mag = Magazine.Cast(this);
11455 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11456 }
11457 else
11458 {
11460 }
11461
11462 if (m_EM)
11463 {
11464 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11465 }
11466
11467 }
11468
11469 else if (action_id ==
EActions.REMOVE_QUANTITY)
11470 {
11471 if (IsMagazine())
11472 {
11473 Magazine mag2 = Magazine.Cast(this);
11474 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11475 }
11476 else
11477 {
11479 }
11480 if (m_EM)
11481 {
11482 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11483 }
11484
11485 }
11486
11487 else if (action_id ==
EActions.SET_QUANTITY_0)
11488 {
11490
11491 if (m_EM)
11492 {
11493 m_EM.SetEnergy(0);
11494 }
11495 }
11496
11497 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11498 {
11500
11501 if (m_EM)
11502 {
11503 m_EM.SetEnergy(m_EM.GetEnergyMax());
11504 }
11505 }
11506
11507 else if (action_id ==
EActions.ADD_HEALTH)
11508 {
11509 AddHealth("","",GetMaxHealth("","Health")/5);
11510 }
11511 else if (action_id ==
EActions.REMOVE_HEALTH)
11512 {
11513 AddHealth("","",-GetMaxHealth("","Health")/5);
11514 }
11515 else if (action_id ==
EActions.DESTROY_HEALTH)
11516 {
11517 SetHealth01("","",0);
11518 }
11519 else if (action_id ==
EActions.WATCH_ITEM)
11520 {
11522 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11523 #ifdef DEVELOPER
11524 SetDebugDeveloper_item(this);
11525 #endif
11526 }
11527
11528 else if (action_id ==
EActions.ADD_TEMPERATURE)
11529 {
11530 AddTemperature(20);
11531
11532 }
11533
11534 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11535 {
11536 AddTemperature(-20);
11537
11538 }
11539
11540 else if (action_id ==
EActions.FLIP_FROZEN)
11541 {
11542 SetFrozen(!GetIsFrozen());
11543
11544 }
11545
11546 else if (action_id ==
EActions.ADD_WETNESS)
11547 {
11549
11550 }
11551
11552 else if (action_id ==
EActions.REMOVE_WETNESS)
11553 {
11555
11556 }
11557
11558 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11559 {
11562
11563
11564 }
11565
11566 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11567 {
11570 }
11571
11572 else if (action_id ==
EActions.MAKE_SPECIAL)
11573 {
11574 auto debugParams = DebugSpawnParams.WithPlayer(player);
11575 OnDebugSpawnEx(debugParams);
11576 }
11577
11578 }
11579
11580
11581 return false;
11582 }
11583
11584
11585
11586
11590
11593
11594
11595
11597 {
11598 return false;
11599 }
11600
11601
11603 {
11604 return true;
11605 }
11606
11607
11609 {
11610 return true;
11611 }
11612
11613
11614
11616 {
11617 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11619 }
11620
11623 {
11624 return null;
11625 }
11626
11628 {
11629 return false;
11630 }
11631
11633 {
11634 return false;
11635 }
11636
11640
11641
11643 {
11644 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11645 return module_repairing.CanRepair(this, item_repair_kit);
11646 }
11647
11648
11649 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11650 {
11651 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11652 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11653 }
11654
11655
11657 {
11658
11659
11660
11661
11662
11663
11664
11665
11666 return 1;
11667 }
11668
11669
11670
11672 {
11674 }
11675
11676
11677
11679 {
11681 }
11682
11683
11692 {
11693 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11694
11695 if (player)
11696 {
11697 player.MessageStatus(text);
11698 }
11699 }
11700
11701
11710 {
11711 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11712
11713 if (player)
11714 {
11715 player.MessageAction(text);
11716 }
11717 }
11718
11719
11728 {
11729 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11730
11731 if (player)
11732 {
11733 player.MessageFriendly(text);
11734 }
11735 }
11736
11737
11746 {
11747 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11748
11749 if (player)
11750 {
11751 player.MessageImportant(text);
11752 }
11753 }
11754
11756 {
11757 return true;
11758 }
11759
11760
11761 override bool KindOf(
string tag)
11762 {
11763 bool found = false;
11764 string item_name = this.
GetType();
11767
11768 int array_size = item_tag_array.Count();
11769 for (int i = 0; i < array_size; i++)
11770 {
11771 if (item_tag_array.Get(i) == tag)
11772 {
11773 found = true;
11774 break;
11775 }
11776 }
11777 return found;
11778 }
11779
11780
11782 {
11783
11784 super.OnRPC(sender, rpc_type,ctx);
11785
11786
11787 switch (rpc_type)
11788 {
11789 #ifndef SERVER
11790 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11791 Param2<bool, string> p = new Param2<bool, string>(false, "");
11792
11794 return;
11795
11796 bool play = p.param1;
11797 string soundSet = p.param2;
11798
11799 if (play)
11800 {
11802 {
11804 {
11806 }
11807 }
11808 else
11809 {
11811 }
11812 }
11813 else
11814 {
11816 }
11817
11818 break;
11819 #endif
11820
11821 }
11822
11824 {
11826 }
11827 }
11828
11829
11830
11831
11833 {
11834 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11835 return plugin.GetID(
name);
11836 }
11837
11839 {
11840 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11841 return plugin.GetName(id);
11842 }
11843
11846 {
11847
11848
11849 int varFlags;
11850 if (!ctx.
Read(varFlags))
11851 return;
11852
11853 if (varFlags & ItemVariableFlags.FLOAT)
11854 {
11856 }
11857 }
11858
11860 {
11861
11862 super.SerializeNumericalVars(floats_out);
11863
11864
11865
11867 {
11869 }
11870
11872 {
11874 }
11875
11877 {
11879 }
11880
11882 {
11887 }
11888
11890 {
11892 }
11893 }
11894
11896 {
11897
11898 super.DeSerializeNumericalVars(floats);
11899
11900
11901 int index = 0;
11902 int mask = Math.Round(floats.Get(index));
11903
11904 index++;
11905
11907 {
11909 {
11911 }
11912 else
11913 {
11914 float quantity = floats.Get(index);
11915 SetQuantity(quantity,
true,
false,
false,
false);
11916 }
11917 index++;
11918 }
11919
11921 {
11922 float wet = floats.Get(index);
11924 index++;
11925 }
11926
11928 {
11929 int liquidtype = Math.Round(floats.Get(index));
11931 index++;
11932 }
11933
11935 {
11937 index++;
11939 index++;
11941 index++;
11943 index++;
11944 }
11945
11947 {
11948 int cleanness = Math.Round(floats.Get(index));
11950 index++;
11951 }
11952 }
11953
11955 {
11956 super.WriteVarsToCTX(ctx);
11957
11958
11960 {
11962 }
11963
11965 {
11967 }
11968
11970 {
11972 }
11973
11975 {
11976 int r,g,b,a;
11982 }
11983
11985 {
11987 }
11988 }
11989
11991 {
11992 if (!super.ReadVarsFromCTX(ctx,version))
11993 return false;
11994
11995 int intValue;
11996 float value;
11997
11998 if (version < 140)
11999 {
12000 if (!ctx.
Read(intValue))
12001 return false;
12002
12003 m_VariablesMask = intValue;
12004 }
12005
12007 {
12008 if (!ctx.
Read(value))
12009 return false;
12010
12012 {
12014 }
12015 else
12016 {
12018 }
12019 }
12020
12021 if (version < 140)
12022 {
12024 {
12025 if (!ctx.
Read(value))
12026 return false;
12027 SetTemperatureDirect(value);
12028 }
12029 }
12030
12032 {
12033 if (!ctx.
Read(value))
12034 return false;
12036 }
12037
12039 {
12040 if (!ctx.
Read(intValue))
12041 return false;
12043 }
12044
12046 {
12047 int r,g,b,a;
12049 return false;
12051 return false;
12053 return false;
12055 return false;
12056
12058 }
12059
12061 {
12062 if (!ctx.
Read(intValue))
12063 return false;
12065 }
12066
12067 if (version >= 138 && version < 140)
12068 {
12070 {
12071 if (!ctx.
Read(intValue))
12072 return false;
12073 SetFrozen(intValue);
12074 }
12075 }
12076
12077 return true;
12078 }
12079
12080
12082 {
12085 {
12087 }
12088
12089 if (!super.OnStoreLoad(ctx, version))
12090 {
12092 return false;
12093 }
12094
12095 if (version >= 114)
12096 {
12097 bool hasQuickBarIndexSaved;
12098
12099 if (!ctx.
Read(hasQuickBarIndexSaved))
12100 {
12102 return false;
12103 }
12104
12105 if (hasQuickBarIndexSaved)
12106 {
12107 int itmQBIndex;
12108
12109
12110 if (!ctx.
Read(itmQBIndex))
12111 {
12113 return false;
12114 }
12115
12116 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12117 if (itmQBIndex != -1 && parentPlayer)
12118 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12119 }
12120 }
12121 else
12122 {
12123
12124 PlayerBase player;
12125 int itemQBIndex;
12126 if (version ==
int.
MAX)
12127 {
12128 if (!ctx.
Read(itemQBIndex))
12129 {
12131 return false;
12132 }
12133 }
12134 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12135 {
12136
12137 if (!ctx.
Read(itemQBIndex))
12138 {
12140 return false;
12141 }
12142 if (itemQBIndex != -1 && player)
12143 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12144 }
12145 }
12146
12147 if (version < 140)
12148 {
12149
12150 if (!LoadVariables(ctx, version))
12151 {
12153 return false;
12154 }
12155 }
12156
12157
12159 {
12161 return false;
12162 }
12163 if (version >= 132)
12164 {
12166 if (raib)
12167 {
12169 {
12171 return false;
12172 }
12173 }
12174 }
12175
12177 return true;
12178 }
12179
12180
12181
12183 {
12184 super.OnStoreSave(ctx);
12185
12186 PlayerBase player;
12187 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12188 {
12190
12191 int itemQBIndex = -1;
12192 itemQBIndex = player.FindQuickBarEntityIndex(this);
12193 ctx.
Write(itemQBIndex);
12194 }
12195 else
12196 {
12198 }
12199
12201
12203 if (raib)
12204 {
12206 }
12207 }
12208
12209
12211 {
12212 super.AfterStoreLoad();
12213
12215 {
12217 }
12218
12220 {
12223 }
12224 }
12225
12227 {
12228 super.EEOnAfterLoad();
12229
12231 {
12233 }
12234
12237 }
12238
12240 {
12241 return false;
12242 }
12243
12244
12245
12247 {
12249 {
12250 #ifdef PLATFORM_CONSOLE
12251
12253 {
12255 if (menu)
12256 {
12258 }
12259 }
12260 #endif
12261 }
12262
12264 {
12267 }
12268
12270 {
12271 SetWeightDirty();
12273 }
12275 {
12278 }
12279
12281 {
12284 }
12286 {
12289 }
12290
12291 super.OnVariablesSynchronized();
12292 }
12293
12294
12295
12297 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12298 {
12299 if (!IsServerCheck(allow_client))
12300 return false;
12301
12303 return false;
12304
12307
12308 if (value <= (min + 0.001))
12309 value = min;
12310
12311 if (value == min)
12312 {
12313 if (destroy_config)
12314 {
12315 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12316 if (dstr)
12317 {
12319 this.Delete();
12320 return true;
12321 }
12322 }
12323 else if (destroy_forced)
12324 {
12326 this.Delete();
12327 return true;
12328 }
12329
12331 }
12332
12335
12337 {
12339
12340 if (delta)
12342 }
12343
12345
12346 return false;
12347 }
12348
12349
12351 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12352 {
12354 }
12355
12357 {
12360 }
12361
12363 {
12366 }
12367
12369 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12370 {
12371 float value_clamped = Math.Clamp(value, 0, 1);
12373 SetQuantity(result, destroy_config, destroy_forced);
12374 }
12375
12376
12379 {
12381 }
12382
12384 {
12386 }
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12398 {
12399 int slot = -1;
12400 if (GetInventory())
12401 {
12402 InventoryLocation il = new InventoryLocation;
12403 GetInventory().GetCurrentInventoryLocation(il);
12405 }
12406
12408 }
12409
12411 {
12412 float quantity_max = 0;
12413
12415 {
12416 if (attSlotID != -1)
12417 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12418
12419 if (quantity_max <= 0)
12421 }
12422
12423 if (quantity_max <= 0)
12425
12426 return quantity_max;
12427 }
12428
12430 {
12432 }
12433
12435 {
12437 }
12438
12439
12441 {
12443 }
12444
12446 {
12448 }
12449
12451 {
12453 }
12454
12455
12457 {
12458
12459 float weightEx = GetWeightEx();
12460 float special = GetInventoryAndCargoWeight();
12461 return weightEx - special;
12462 }
12463
12464
12466 {
12468 }
12469
12471 {
12473 {
12474 #ifdef DEVELOPER
12475 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12476 {
12477 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12479 }
12480 #endif
12481
12482 return GetQuantity() * GetConfigWeightModified();
12483 }
12484 else if (HasEnergyManager())
12485 {
12486 #ifdef DEVELOPER
12487 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12488 {
12489 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12490 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12491 }
12492 #endif
12493 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12494 }
12495 else
12496 {
12497 #ifdef DEVELOPER
12498 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12499 {
12500 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12501 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12502 }
12503 #endif
12504 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12505 }
12506 }
12507
12510 {
12511 int item_count = 0;
12513
12514 if (GetInventory().GetCargo() != NULL)
12515 {
12516 item_count = GetInventory().GetCargo().GetItemCount();
12517 }
12518
12519 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12520 {
12521 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12522 if (item)
12523 item_count += item.GetNumberOfItems();
12524 }
12525 return item_count;
12526 }
12527
12530 {
12531 float weight = 0;
12532 float wetness = 1;
12533 if (include_wetness)
12536 {
12537 weight = wetness * m_ConfigWeight;
12538 }
12540 {
12541 weight = 1;
12542 }
12543 return weight;
12544 }
12545
12546
12547
12549 {
12550 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12551 {
12552 GameInventory inv = GetInventory();
12553 array<EntityAI> items = new array<EntityAI>;
12555 for (int i = 0; i < items.Count(); i++)
12556 {
12558 if (item)
12559 {
12561 }
12562 }
12563 }
12564 }
12565
12566
12567
12568
12570 {
12571 float energy = 0;
12572 if (HasEnergyManager())
12573 {
12574 energy = GetCompEM().GetEnergy();
12575 }
12576 return energy;
12577 }
12578
12579
12581 {
12582 super.OnEnergyConsumed();
12583
12585 }
12586
12588 {
12589 super.OnEnergyAdded();
12590
12592 }
12593
12594
12596 {
12597 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12598 {
12600 {
12601 float energy_0to1 = GetCompEM().GetEnergy0To1();
12603 }
12604 }
12605 }
12606
12607
12609 {
12610 return ConfigGetFloat("heatIsolation");
12611 }
12612
12614 {
12616 }
12617
12619 {
12620 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12621 if (
GetGame().ConfigIsExisting(paramPath))
12623
12624 return 0.0;
12625 }
12626
12628 {
12629 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12630 if (
GetGame().ConfigIsExisting(paramPath))
12632
12633 return 0.0;
12634 }
12635
12636 override void SetWet(
float value,
bool allow_client =
false)
12637 {
12638 if (!IsServerCheck(allow_client))
12639 return;
12640
12643
12645
12646 m_VarWet = Math.Clamp(value, min, max);
12647
12649 {
12652 }
12653 }
12654
12655 override void AddWet(
float value)
12656 {
12658 }
12659
12661 {
12663 }
12664
12666 {
12668 }
12669
12671 {
12673 }
12674
12676 {
12678 }
12679
12681 {
12683 }
12684
12685 override void OnWetChanged(
float newVal,
float oldVal)
12686 {
12689 if (newLevel != oldLevel)
12690 {
12692 }
12693 }
12694
12696 {
12697 SetWeightDirty();
12698 }
12699
12701 {
12702 return GetWetLevelInternal(
m_VarWet);
12703 }
12704
12705
12706
12708 {
12710 }
12711
12713 {
12715 }
12716
12718 {
12720 }
12721
12723 {
12725 }
12726
12727
12728
12730 {
12731 if (ConfigIsExisting("itemModelLength"))
12732 {
12733 return ConfigGetFloat("itemModelLength");
12734 }
12735 return 0;
12736 }
12737
12739 {
12740 if (ConfigIsExisting("itemAttachOffset"))
12741 {
12742 return ConfigGetFloat("itemAttachOffset");
12743 }
12744 return 0;
12745 }
12746
12747 override void SetCleanness(
int value,
bool allow_client =
false)
12748 {
12749 if (!IsServerCheck(allow_client))
12750 return;
12751
12753
12755
12758 }
12759
12761 {
12763 }
12764
12766 {
12767 return true;
12768 }
12769
12770
12771
12772
12774 {
12776 }
12777
12779 {
12781 }
12782
12783
12784
12785
12786 override void SetColor(
int r,
int g,
int b,
int a)
12787 {
12793 }
12795 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12796 {
12801 }
12802
12804 {
12806 }
12807
12810 {
12811 int r,g,b,a;
12813 r = r/255;
12814 g = g/255;
12815 b = b/255;
12816 a = a/255;
12817 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12818 }
12819
12820
12821
12822 override void SetLiquidType(
int value,
bool allow_client =
false)
12823 {
12824 if (!IsServerCheck(allow_client))
12825 return;
12826
12831 }
12832
12834 {
12835 return ConfigGetInt("varLiquidTypeInit");
12836 }
12837
12839 {
12841 }
12842
12844 {
12846 SetFrozen(false);
12847 }
12848
12851 {
12852 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12853 }
12854
12855
12858 {
12859 PlayerBase nplayer;
12860 if (PlayerBase.CastTo(nplayer, player))
12861 {
12863
12864 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12865 }
12866 }
12867
12868
12871 {
12872 PlayerBase nplayer;
12873 if (PlayerBase.CastTo(nplayer,player))
12874 {
12875
12876 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12877
12878 }
12879
12880
12881 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12882
12883
12884 if (HasEnergyManager())
12885 {
12886 GetCompEM().UpdatePlugState();
12887 }
12888 }
12889
12890
12892 {
12893 super.OnPlacementStarted(player);
12894
12896 }
12897
12898 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12899 {
12901 {
12902 m_AdminLog.OnPlacementComplete(player,
this);
12903 }
12904
12905 super.OnPlacementComplete(player, position, orientation);
12906 }
12907
12908
12909
12910
12911
12913 {
12915 {
12916 return true;
12917 }
12918 else
12919 {
12920 return false;
12921 }
12922 }
12923
12924
12926 {
12928 {
12930 }
12931 }
12932
12933
12935 {
12937 }
12938
12940 {
12942 }
12943
12944 override void InsertAgent(
int agent,
float count = 1)
12945 {
12946 if (count < 1)
12947 return;
12948
12950 }
12951
12954 {
12956 }
12957
12958
12960 {
12962 }
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13006 {
13008 return false;
13009 return true;
13010 }
13011
13013 {
13014
13016 }
13017
13018
13021 {
13022 super.CheckForRoofLimited(timeTresholdMS);
13023
13025 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13026 {
13027 m_PreviousRoofTestTime = time;
13028 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13029 }
13030 }
13031
13032
13034 {
13036 {
13037 return 0;
13038 }
13039
13040 if (GetInventory().GetAttachmentSlotsCount() != 0)
13041 {
13042 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13043 if (filter)
13044 return filter.GetProtectionLevel(type, false, system);
13045 else
13046 return 0;
13047 }
13048
13049 string subclassPath, entryName;
13050
13051 switch (type)
13052 {
13054 entryName = "biological";
13055 break;
13057 entryName = "chemical";
13058 break;
13059 default:
13060 entryName = "biological";
13061 break;
13062 }
13063
13064 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13065
13067 }
13068
13069
13070
13073 {
13074 if (!IsMagazine())
13076
13078 }
13079
13080
13081
13082
13083
13088 {
13089 return true;
13090 }
13091
13093 {
13095 }
13096
13097
13098
13099
13100
13102 {
13103 if (parent)
13104 {
13105 if (parent.IsInherited(DayZInfected))
13106 return true;
13107
13108 if (!parent.IsRuined())
13109 return true;
13110 }
13111
13112 return true;
13113 }
13114
13116 {
13117 if (!super.CanPutAsAttachment(parent))
13118 {
13119 return false;
13120 }
13121
13122 if (!IsRuined() && !parent.IsRuined())
13123 {
13124 return true;
13125 }
13126
13127 return false;
13128 }
13129
13131 {
13132
13133
13134
13135
13136 return super.CanReceiveItemIntoCargo(item);
13137 }
13138
13140 {
13141
13142
13143
13144
13145 GameInventory attachmentInv = attachment.GetInventory();
13147 {
13148 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13149 return false;
13150 }
13151
13152 InventoryLocation loc = new InventoryLocation();
13153 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13154 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13155 return false;
13156
13157 return super.CanReceiveAttachment(attachment, slotId);
13158 }
13159
13161 {
13162 if (!super.CanReleaseAttachment(attachment))
13163 return false;
13164
13165 return GetInventory().AreChildrenAccessible();
13166 }
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13189 {
13190 int id = muzzle_owner.GetMuzzleID();
13191 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13192
13193 if (WPOF_array)
13194 {
13195 for (int i = 0; i < WPOF_array.Count(); i++)
13196 {
13197 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13198
13199 if (WPOF)
13200 {
13201 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13202 }
13203 }
13204 }
13205 }
13206
13207
13209 {
13210 int id = muzzle_owner.GetMuzzleID();
13212
13213 if (WPOBE_array)
13214 {
13215 for (int i = 0; i < WPOBE_array.Count(); i++)
13216 {
13217 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13218
13219 if (WPOBE)
13220 {
13221 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13222 }
13223 }
13224 }
13225 }
13226
13227
13229 {
13230 int id = muzzle_owner.GetMuzzleID();
13231 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13232
13233 if (WPOOH_array)
13234 {
13235 for (int i = 0; i < WPOOH_array.Count(); i++)
13236 {
13237 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13238
13239 if (WPOOH)
13240 {
13241 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13242 }
13243 }
13244 }
13245 }
13246
13247
13249 {
13250 int id = muzzle_owner.GetMuzzleID();
13251 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13252
13253 if (WPOOH_array)
13254 {
13255 for (int i = 0; i < WPOOH_array.Count(); i++)
13256 {
13257 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13258
13259 if (WPOOH)
13260 {
13261 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13262 }
13263 }
13264 }
13265 }
13266
13267
13269 {
13270 int id = muzzle_owner.GetMuzzleID();
13271 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13272
13273 if (WPOOH_array)
13274 {
13275 for (int i = 0; i < WPOOH_array.Count(); i++)
13276 {
13277 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13278
13279 if (WPOOH)
13280 {
13281 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13282 }
13283 }
13284 }
13285 }
13286
13287
13288
13290 {
13292 {
13293 return true;
13294 }
13295
13296 return false;
13297 }
13298
13300 {
13302 {
13303 return true;
13304 }
13305
13306 return false;
13307 }
13308
13310 {
13312 {
13313 return true;
13314 }
13315
13316 return false;
13317 }
13318
13320 {
13321 return false;
13322 }
13323
13326 {
13327 return UATimeSpent.DEFAULT_DEPLOY;
13328 }
13329
13330
13331
13332
13334 {
13336 SetSynchDirty();
13337 }
13338
13340 {
13342 }
13343
13344
13346 {
13347 return false;
13348 }
13349
13352 {
13353 string att_type = "None";
13354
13355 if (ConfigIsExisting("soundAttType"))
13356 {
13357 att_type = ConfigGetString("soundAttType");
13358 }
13359
13361 }
13362
13364 {
13366 }
13367
13368
13369
13370
13371
13377
13379 {
13382
13384 }
13385
13386
13388 {
13390 return;
13391
13393
13396
13399
13400 SoundParameters params = new SoundParameters();
13404 }
13405
13406
13408 {
13410 return;
13411
13413 SetSynchDirty();
13414
13417 }
13418
13419
13421 {
13423 return;
13424
13426 SetSynchDirty();
13427
13430 }
13431
13433 {
13435 }
13436
13438 {
13440 }
13441
13444 {
13445 if (!
GetGame().IsDedicatedServer())
13446 {
13447 if (ConfigIsExisting("attachSoundSet"))
13448 {
13449 string cfg_path = "";
13450 string soundset = "";
13451 string type_name =
GetType();
13452
13455 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13456 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13457
13458 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13459 {
13460 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13461 {
13462 if (cfg_slot_array[i] == slot_type)
13463 {
13464 soundset = cfg_soundset_array[i];
13465 break;
13466 }
13467 }
13468 }
13469
13470 if (soundset != "")
13471 {
13472 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13474 }
13475 }
13476 }
13477 }
13478
13480 {
13481
13482 }
13483
13484 void OnApply(PlayerBase player);
13485
13487 {
13488 return 1.0;
13489 };
13490
13492 {
13494 }
13495
13497 {
13499 }
13500
13502
13504 {
13505 SetDynamicPhysicsLifeTime(0.01);
13507 }
13508
13510 {
13511 array<string> zone_names = new array<string>;
13512 GetDamageZones(zone_names);
13513 for (int i = 0; i < zone_names.Count(); i++)
13514 {
13515 SetHealthMax(zone_names.Get(i),"Health");
13516 }
13517 SetHealthMax("","Health");
13518 }
13519
13522 {
13523 float global_health = GetHealth01("","Health");
13524 array<string> zones = new array<string>;
13525 GetDamageZones(zones);
13526
13527 for (int i = 0; i < zones.Count(); i++)
13528 {
13529 SetHealth01(zones.Get(i),"Health",global_health);
13530 }
13531 }
13532
13535 {
13536 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13537 }
13538
13540 {
13541 if (!hasRootAsPlayer)
13542 {
13543 if (refParentIB)
13544 {
13545
13546 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13547 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13548
13549 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13550 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13551
13554 }
13555 else
13556 {
13557
13560 }
13561 }
13562 }
13563
13565 {
13567 {
13568 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13569 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13570 {
13571 float heatPermCoef = 1.0;
13573 while (ent)
13574 {
13575 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13576 ent = ent.GetHierarchyParent();
13577 }
13578
13579 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13580 }
13581 }
13582 }
13583
13585 {
13586
13587 EntityAI parent = GetHierarchyParent();
13588 if (!parent)
13589 {
13590 hasParent = false;
13591 hasRootAsPlayer = false;
13592 }
13593 else
13594 {
13595 hasParent = true;
13596 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13597 refParentIB =
ItemBase.Cast(parent);
13598 }
13599 }
13600
13601 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13602 {
13603
13604 }
13605
13607 {
13608
13609 return false;
13610 }
13611
13613 {
13614
13615
13616 return false;
13617 }
13618
13620 {
13621
13622 return false;
13623 }
13624
13627 {
13628 return !GetIsFrozen() &&
IsOpen();
13629 }
13630
13632 {
13633 bool hasParent = false, hasRootAsPlayer = false;
13635
13636 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13637 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13638
13639 if (wwtu || foodDecay)
13640 {
13644
13645 if (processWetness || processTemperature || processDecay)
13646 {
13648
13649 if (processWetness)
13650 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13651
13652 if (processTemperature)
13654
13655 if (processDecay)
13656 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13657 }
13658 }
13659 }
13660
13663 {
13665 }
13666
13668 {
13671
13672 return super.GetTemperatureFreezeThreshold();
13673 }
13674
13676 {
13679
13680 return super.GetTemperatureThawThreshold();
13681 }
13682
13684 {
13687
13688 return super.GetItemOverheatThreshold();
13689 }
13690
13692 {
13694 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13695
13696 return super.GetTemperatureFreezeTime();
13697 }
13698
13700 {
13702 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13703
13704 return super.GetTemperatureThawTime();
13705 }
13706
13711
13713 {
13714 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13715 }
13716
13718 {
13719 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13720 }
13721
13724 {
13726 }
13727
13729 {
13731 }
13732
13734 {
13736 }
13737
13740 {
13741 return null;
13742 }
13743
13746 {
13747 return false;
13748 }
13749
13751 {
13753 {
13756 if (!trg)
13757 {
13759 explosive = this;
13760 }
13761
13762 explosive.PairRemote(trg);
13764
13765 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13766 trg.SetPersistentPairID(persistentID);
13767 explosive.SetPersistentPairID(persistentID);
13768
13769 return true;
13770 }
13771 return false;
13772 }
13773
13776 {
13777 float ret = 1.0;
13780 ret *= GetHealth01();
13781
13782 return ret;
13783 }
13784
13785 #ifdef DEVELOPER
13786 override void SetDebugItem()
13787 {
13788 super.SetDebugItem();
13789 _itemBase = this;
13790 }
13791
13793 {
13794 string text = super.GetDebugText();
13795
13797 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13798
13799 return text;
13800 }
13801 #endif
13802
13804 {
13805 return true;
13806 }
13807
13809
13811
13813 {
13816 }
13817
13818
13826
13842}
13843
13845{
13847 if (entity)
13848 {
13849 bool is_item = entity.IsInherited(
ItemBase);
13850 if (is_item && full_quantity)
13851 {
13854 }
13855 }
13856 else
13857 {
13859 return NULL;
13860 }
13861 return entity;
13862}
13863
13865{
13866 if (item)
13867 {
13868 if (health > 0)
13869 item.SetHealth("", "", health);
13870
13871 if (item.CanHaveTemperature())
13872 {
13874 if (item.CanFreeze())
13875 item.SetFrozen(false);
13876 }
13877
13878 if (item.HasEnergyManager())
13879 {
13880 if (quantity >= 0)
13881 {
13882 item.GetCompEM().SetEnergy0To1(quantity);
13883 }
13884 else
13885 {
13887 }
13888 }
13889 else if (item.IsMagazine())
13890 {
13891 Magazine mag = Magazine.Cast(item);
13892 if (quantity >= 0)
13893 {
13894 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13895 }
13896 else
13897 {
13899 }
13900
13901 }
13902 else
13903 {
13904 if (quantity >= 0)
13905 {
13906 item.SetQuantityNormalized(quantity, false);
13907 }
13908 else
13909 {
13911 }
13912
13913 }
13914 }
13915}
13916
13917#ifdef DEVELOPER
13919#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.