9086{
9088 {
9089 return true;
9090 }
9091};
9092
9094{
9095
9096};
9097
9098
9099
9101{
9105
9107
9110
9111
9112
9113
9114
9123
9129
9134
9139
9160 protected bool m_IsResultOfSplit
9161
9163
9168
9169
9170
9172
9176
9177
9178
9180
9183
9184
9185
9191
9192
9200
9203
9204
9206
9207
9209
9210
9215
9216
9221
9223
9224
9226
9227
9229 {
9234
9235 if (!
g_Game.IsDedicatedServer())
9236 {
9238 {
9240
9242 {
9244 }
9245 }
9246
9249 }
9250
9251 m_OldLocation = null;
9252
9254 {
9256 }
9257
9258 if (ConfigIsExisting("headSelectionsToHide"))
9259 {
9262 }
9263
9265 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9266 {
9268 }
9269
9271
9272 m_IsResultOfSplit = false;
9273
9275 }
9276
9278 {
9279 super.InitItemVariables();
9280
9286 m_Count = ConfigGetInt(
"count");
9287
9290
9295
9298
9303
9315
9319
9320
9323 if (ConfigIsExisting("canBeSplit"))
9324 {
9327 }
9328
9330 if (ConfigIsExisting("itemBehaviour"))
9332
9333
9336 RegisterNetSyncVariableInt("m_VarLiquidType");
9337 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9338
9339 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9340 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9341 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9342
9343 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9344 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9345 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9346 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9347
9348 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9349 RegisterNetSyncVariableBool("m_IsTakeable");
9350 RegisterNetSyncVariableBool("m_IsHologram");
9351
9354 {
9357 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9358 }
9359
9361
9363 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9365
9367 }
9368
9370 {
9372 }
9373
9375 {
9378 {
9383 }
9384 }
9385
9386 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9387 {
9389 {
9392 }
9393
9395 }
9396
9398 {
9404 }
9405
9407
9409 {
9411
9412 if (!action)
9413 {
9414 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9415 return;
9416 }
9417
9419 if (!ai)
9420 {
9422 return;
9423 }
9424
9426 if (!action_array)
9427 {
9428 action_array = new array<ActionBase_Basic>;
9430 }
9431 if (LogManager.IsActionLogEnable())
9432 {
9433 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9434 }
9435
9436 if (action_array.Find(action) != -1)
9437 {
9438 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9439 }
9440 else
9441 {
9442 action_array.Insert(action);
9443 }
9444 }
9445
9447 {
9448 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9449 ActionBase action = player.GetActionManager().GetAction(actionName);
9452
9453 if (action_array)
9454 {
9455 action_array.RemoveItem(action);
9456 }
9457 }
9458
9459
9460
9462 {
9463 ActionOverrideData overrideData = new ActionOverrideData();
9467
9469 if (!actionMap)
9470 {
9473 }
9474
9475 actionMap.Insert(this.
Type(), overrideData);
9476
9477 }
9478
9480
9482
9483
9485 {
9488
9491
9492 string config_to_search = "CfgVehicles";
9493 string muzzle_owner_config;
9494
9496 {
9497 if (IsInherited(Weapon))
9498 config_to_search = "CfgWeapons";
9499
9500 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9501
9502 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9503
9504 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9505
9506 if (config_OnFire_subclass_count > 0)
9507 {
9508 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9509
9510 for (int i = 0; i < config_OnFire_subclass_count; i++)
9511 {
9512 string particle_class = "";
9513 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9514 string config_OnFire_entry = config_OnFire_class + particle_class;
9515 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9516 WPOF_array.Insert(WPOF);
9517 }
9518
9519
9521 }
9522 }
9523
9525 {
9526 config_to_search = "CfgWeapons";
9527 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9528
9529 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9530
9531 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9532
9533 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9534 {
9535 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9536
9537 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9538 {
9539 string particle_class2 = "";
9540 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9541 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9542 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9543 WPOBE_array.Insert(WPOBE);
9544 }
9545
9546
9548 }
9549 }
9550 }
9551
9552
9554 {
9557
9559 {
9560 string config_to_search = "CfgVehicles";
9561
9562 if (IsInherited(Weapon))
9563 config_to_search = "CfgWeapons";
9564
9565 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9566 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9567
9568 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9569 {
9570
9572
9574 {
9576 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9578 return;
9579 }
9580
9583
9584
9585
9586 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9587 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9588
9589 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9590 {
9591 string particle_class = "";
9592 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9593 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9594 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9595
9596 if (entry_type == CT_CLASS)
9597 {
9598 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9599 WPOOH_array.Insert(WPOF);
9600 }
9601 }
9602
9603
9605 }
9606 }
9607 }
9608
9610 {
9612 }
9613
9615 {
9617 {
9619
9622
9625
9626 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9627 }
9628 }
9629
9631 {
9633 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9634
9636 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9637
9639 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9640
9642 {
9644 }
9645 }
9646
9648 {
9650 }
9651
9653 {
9656 else
9658
9660 {
9663 }
9664 else
9665 {
9668
9671 }
9672
9674 }
9675
9677 {
9679 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9680 }
9681
9683 {
9685 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9687 }
9688
9690 {
9692 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9693 }
9694
9696 {
9699
9700 OverheatingParticle OP = new OverheatingParticle();
9705
9707 }
9708
9710 {
9713
9714 return -1;
9715 }
9716
9718 {
9720 {
9723
9724 for (int i = count; i > 0; --i)
9725 {
9726 int id = i - 1;
9729
9732
9733 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9734 {
9735 if (p)
9736 {
9739 }
9740 }
9741 }
9742 }
9743 }
9744
9746 {
9748 {
9750 {
9751 int id = i - 1;
9753
9754 if (OP)
9755 {
9757
9758 if (p)
9759 {
9761 }
9762
9763 delete OP;
9764 }
9765 }
9766
9769 }
9770 }
9771
9774 {
9775 return 0.0;
9776 }
9777
9778
9780 {
9781 return 250;
9782 }
9783
9785 {
9786 return 0;
9787 }
9788
9791 {
9793 return true;
9794
9795 return false;
9796 }
9797
9800 {
9803
9805 {
9807 }
9808 else
9809 {
9810
9812 }
9813
9815 }
9816
9823 {
9824 return -1;
9825 }
9826
9827
9828
9829
9831 {
9833 {
9834 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9835 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9836
9837 if (r_index >= 0)
9838 {
9839 InventoryLocation r_il = new InventoryLocation;
9840 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9841
9842 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9845 {
9846 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9847 }
9849 {
9850 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9851 }
9852
9853 }
9854
9855 player.GetHumanInventory().ClearUserReservedLocation(this);
9856 }
9857
9860 }
9861
9862
9863
9864
9866 {
9867 return ItemBase.m_DebugActionsMask;
9868 }
9869
9871 {
9872 return ItemBase.m_DebugActionsMask & mask;
9873 }
9874
9876 {
9877 ItemBase.m_DebugActionsMask = mask;
9878 }
9879
9881 {
9882 ItemBase.m_DebugActionsMask |= mask;
9883 }
9884
9886 {
9887 ItemBase.m_DebugActionsMask &= ~mask;
9888 }
9889
9891 {
9893 {
9895 }
9896 else
9897 {
9899 }
9900 }
9901
9902
9904 {
9905 if (GetEconomyProfile())
9906 {
9907 float q_max = GetEconomyProfile().GetQuantityMax();
9908 if (q_max > 0)
9909 {
9910 float q_min = GetEconomyProfile().GetQuantityMin();
9911 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9912
9914 {
9915 ComponentEnergyManager comp = GetCompEM();
9917 {
9919 }
9920 }
9922 {
9924
9925 }
9926
9927 }
9928 }
9929 }
9930
9933 {
9934 EntityAI parent = GetHierarchyParent();
9935
9936 if (parent)
9937 {
9938 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9939 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9940 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9941 }
9942 }
9943
9946 {
9947 EntityAI parent = GetHierarchyParent();
9948
9949 if (parent)
9950 {
9951 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9952 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9953 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9954 }
9955 }
9956
9958 {
9959
9960
9961
9962
9964
9966 {
9967 if (ScriptInputUserData.CanStoreInputUserData())
9968 {
9969 ScriptInputUserData ctx = new ScriptInputUserData;
9975 ctx.
Write(use_stack_max);
9978
9980 {
9981 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9982 }
9983 }
9984 }
9985 else if (!
g_Game.IsMultiplayer())
9986 {
9988 }
9989 }
9990
9992 {
9994 }
9995
9997 {
9999 }
10000
10002 {
10004 }
10005
10007 {
10008
10009 return false;
10010 }
10011
10013 {
10014 return false;
10015 }
10016
10020 {
10021 return false;
10022 }
10023
10025 {
10026 return "";
10027 }
10028
10030
10032 {
10033 return false;
10034 }
10035
10037 {
10038 return true;
10039 }
10040
10041
10042
10044 {
10045 return true;
10046 }
10047
10049 {
10050 return true;
10051 }
10052
10054 {
10055 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10057 }
10058
10060 {
10062 }
10063
10065 {
10067 if (!is_being_placed)
10069 SetSynchDirty();
10070 }
10071
10072
10074
10076 {
10078 }
10079
10081 {
10083 }
10084
10086 {
10087 return 1;
10088 }
10089
10091 {
10092 return false;
10093 }
10094
10096 {
10098 SetSynchDirty();
10099 }
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10136 {
10137 super.OnMovedInsideCargo(container);
10138
10139 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10140 }
10141
10142 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10143 {
10144 super.EEItemLocationChanged(oldLoc, newLoc);
10145
10146 PlayerBase newPlayer = null;
10147 PlayerBase oldPlayer = null;
10148
10149 if (newLoc.GetParent())
10150 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10151
10152 if (oldLoc.GetParent())
10153 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10154
10156 {
10157 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10158
10159 if (rIndex >= 0)
10160 {
10161 InventoryLocation rIl = new InventoryLocation;
10162 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10163
10164 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10167 {
10168 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10169 }
10171 {
10173 }
10174
10175 }
10176 }
10177
10179 {
10180 if (newPlayer)
10181 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10182
10183 if (newPlayer == oldPlayer)
10184 {
10185 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10186 {
10188 {
10189 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10190 {
10191 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10192 }
10193 }
10194 else
10195 {
10196 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10197 }
10198 }
10199
10200 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10201 {
10202 int type = oldLoc.GetType();
10204 {
10205 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10206 }
10208 {
10209 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10210 }
10211 }
10212 if (!m_OldLocation)
10213 {
10214 m_OldLocation = new InventoryLocation;
10215 }
10216 m_OldLocation.Copy(oldLoc);
10217 }
10218 else
10219 {
10220 if (m_OldLocation)
10221 {
10222 m_OldLocation.Reset();
10223 }
10224 }
10225
10226 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10227 }
10228 else
10229 {
10230 if (newPlayer)
10231 {
10232 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10233 if (resIndex >= 0)
10234 {
10235 InventoryLocation il = new InventoryLocation;
10236 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10238 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10241 {
10242 il.
GetParent().GetOnReleaseLock().Invoke(it);
10243 }
10245 {
10247 }
10248
10249 }
10250 }
10252 {
10253
10255 }
10256
10257 if (m_OldLocation)
10258 {
10259 m_OldLocation.Reset();
10260 }
10261 }
10262
10264 {
10265 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10266 }
10267
10269 {
10270 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10271 }
10272 }
10273
10274 override void EOnContact(IEntity other, Contact extra)
10275 {
10277 {
10278 int liquidType = -1;
10280 if (impactSpeed > 0.0)
10281 {
10283 #ifndef SERVER
10285 #else
10287 SetSynchDirty();
10288 #endif
10290 }
10291 }
10292
10293 #ifdef SERVER
10294 if (GetCompEM() && GetCompEM().IsPlugged())
10295 {
10296 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10297 GetCompEM().UnplugThis();
10298 }
10299 #endif
10300 }
10301
10303
10305 {
10307 }
10308
10310 {
10311
10312 }
10313
10315 {
10316 super.OnItemLocationChanged(old_owner, new_owner);
10317
10318 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10319 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10320
10321 if (!relatedPlayer && playerNew)
10322 relatedPlayer = playerNew;
10323
10324 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10325 {
10327 if (actionMgr)
10328 {
10329 ActionBase currentAction = actionMgr.GetRunningAction();
10330 if (currentAction)
10332 }
10333 }
10334
10335 Man ownerPlayerOld = null;
10336 Man ownerPlayerNew = null;
10337
10338 if (old_owner)
10339 {
10340 if (old_owner.
IsMan())
10341 {
10342 ownerPlayerOld = Man.Cast(old_owner);
10343 }
10344 else
10345 {
10346 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10347 }
10348 }
10349 else
10350 {
10352 {
10354
10355 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10356 {
10357 GetCompEM().UnplugThis();
10358 }
10359 }
10360 }
10361
10362 if (new_owner)
10363 {
10364 if (new_owner.
IsMan())
10365 {
10366 ownerPlayerNew = Man.Cast(new_owner);
10367 }
10368 else
10369 {
10370 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10371 }
10372 }
10373
10374 if (ownerPlayerOld != ownerPlayerNew)
10375 {
10376 if (ownerPlayerOld)
10377 {
10378 array<EntityAI> subItemsExit = new array<EntityAI>;
10380 for (int i = 0; i < subItemsExit.Count(); i++)
10381 {
10384 }
10385 }
10386
10387 if (ownerPlayerNew)
10388 {
10389 array<EntityAI> subItemsEnter = new array<EntityAI>;
10391 for (int j = 0; j < subItemsEnter.Count(); j++)
10392 {
10395 }
10396 }
10397 }
10398 else if (ownerPlayerNew != null)
10399 {
10400 PlayerBase nplayer;
10401 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10402 {
10403 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10405 for (int k = 0; k < subItemsUpdate.Count(); k++)
10406 {
10408 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10409 }
10410 }
10411 }
10412
10413 if (old_owner)
10414 old_owner.OnChildItemRemoved(this);
10415 if (new_owner)
10416 new_owner.OnChildItemReceived(this);
10417 }
10418
10419
10421 {
10422 super.EEDelete(parent);
10423 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10424 if (player)
10425 {
10427
10428 if (player.IsAlive())
10429 {
10430 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10431 if (r_index >= 0)
10432 {
10433 InventoryLocation r_il = new InventoryLocation;
10434 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10435
10436 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10439 {
10440 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10441 }
10443 {
10444 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10445 }
10446
10447 }
10448
10449 player.RemoveQuickBarEntityShortcut(this);
10450 }
10451 }
10452 }
10453
10455 {
10456 super.EEKilled(killer);
10457
10460 {
10461 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10462 {
10463 if (IsMagazine())
10464 {
10465 if (Magazine.Cast(this).GetAmmoCount() > 0)
10466 {
10468 }
10469 }
10470 else
10471 {
10473 }
10474 }
10475 }
10476 }
10477
10479 {
10480 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10481
10482 super.OnWasAttached(parent, slot_id);
10483
10486
10489 }
10490
10492 {
10493 super.OnWasDetached(parent, slot_id);
10494
10497
10500 }
10501
10503 {
10504 int idx;
10507
10508 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10509 if (inventory_slots.Count() < 1)
10510 {
10511 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10512 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10513 }
10514 else
10515 {
10516 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10517 }
10518
10519 idx = inventory_slots.Find(slot);
10520 if (idx < 0)
10521 return "";
10522
10523 return attach_types.Get(idx);
10524 }
10525
10527 {
10528 int idx = -1;
10529 string slot;
10530
10533
10534 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10535 if (inventory_slots.Count() < 1)
10536 {
10537 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10538 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10539 }
10540 else
10541 {
10542 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10543 if (detach_types.Count() < 1)
10544 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10545 }
10546
10547 for (int i = 0; i < inventory_slots.Count(); i++)
10548 {
10549 slot = inventory_slots.Get(i);
10550 }
10551
10552 if (slot != "")
10553 {
10554 if (detach_types.Count() == 1)
10555 idx = 0;
10556 else
10557 idx = inventory_slots.Find(slot);
10558 }
10559 if (idx < 0)
10560 return "";
10561
10562 return detach_types.Get(idx);
10563 }
10564
10566 {
10567
10569
10570
10571 float min_time = 1;
10572 float max_time = 3;
10573 float delay = Math.RandomFloat(min_time, max_time);
10574
10575 explode_timer.Run(delay, this, "DoAmmoExplosion");
10576 }
10577
10579 {
10580 Magazine magazine = Magazine.Cast(this);
10581 int pop_sounds_count = 6;
10582 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10583
10584
10585 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10586 string sound_name = pop_sounds[ sound_idx ];
10587 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10588
10589
10590 magazine.ServerAddAmmoCount(-1);
10591
10592
10593 float min_temp_to_explode = 100;
10594
10595 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10596 {
10598 }
10599 }
10600
10601
10602 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10603 {
10604 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10605
10606 const int CHANCE_DAMAGE_CARGO = 4;
10607 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10608 const int CHANCE_DAMAGE_NOTHING = 2;
10609
10611 {
10612 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10613 int chances;
10614 int rnd;
10615
10616 if (GetInventory().GetCargo())
10617 {
10618 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10619 rnd = Math.RandomInt(0,chances);
10620
10621 if (rnd < CHANCE_DAMAGE_CARGO)
10622 {
10624 }
10625 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10626 {
10628 }
10629 }
10630 else
10631 {
10632 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10633 rnd = Math.RandomInt(0,chances);
10634
10635 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10636 {
10638 }
10639 }
10640 }
10641 }
10642
10644 {
10645 CargoBase cargo = GetInventory().GetCargo();
10646 if (cargo)
10647 {
10649 if (item_count > 0)
10650 {
10651 int random_pick = Math.RandomInt(0, item_count);
10653 if (!item.IsExplosive())
10654 {
10655 item.AddHealth("","",damage);
10656 return true;
10657 }
10658 }
10659 }
10660 return false;
10661 }
10662
10664 {
10665 GameInventory inventory = GetInventory();
10667 if (attachment_count > 0)
10668 {
10669 int random_pick = Math.RandomInt(0, attachment_count);
10671 if (!attachment.IsExplosive())
10672 {
10673 attachment.AddHealth("","",damage);
10674 return true;
10675 }
10676 }
10677 return false;
10678 }
10679
10681 {
10683 }
10684
10686 {
10688 return GetInventory().CanRemoveEntity();
10689
10690 return false;
10691 }
10692
10694 {
10695
10697 return false;
10698
10699
10701 return false;
10702
10703
10704
10706 if (delta == 0)
10707 return false;
10708
10709
10710 return true;
10711 }
10712
10714 {
10716 {
10717 if (ScriptInputUserData.CanStoreInputUserData())
10718 {
10719 ScriptInputUserData ctx = new ScriptInputUserData;
10724 ctx.
Write(destination_entity);
10726 ctx.
Write(slot_id);
10728 }
10729 }
10730 else if (!
g_Game.IsMultiplayer())
10731 {
10733 }
10734 }
10735
10737 {
10738 float split_quantity_new;
10742 InventoryLocation loc = new InventoryLocation;
10743
10744 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10745 {
10747 split_quantity_new = stack_max;
10748 else
10750
10752 {
10753 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10754 if (new_item)
10755 {
10756 new_item.SetResultOfSplit(true);
10757 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10759 new_item.
SetQuantity(split_quantity_new,
false,
true);
10760 }
10761 }
10762 }
10763 else if (destination_entity && slot_id == -1)
10764 {
10765 if (quantity > stack_max)
10766 split_quantity_new = stack_max;
10767 else
10768 split_quantity_new = quantity;
10769
10771 {
10772 GameInventory destinationInventory = destination_entity.GetInventory();
10774 {
10777 }
10778
10779 if (new_item)
10780 {
10781 new_item.SetResultOfSplit(true);
10782 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10784 new_item.
SetQuantity(split_quantity_new,
false,
true);
10785 }
10786 }
10787 }
10788 else
10789 {
10790 if (stack_max != 0)
10791 {
10793 {
10795 }
10796
10797 if (split_quantity_new == 0)
10798 {
10799 if (!
g_Game.IsMultiplayer())
10800 player.PhysicalPredictiveDropItem(this);
10801 else
10802 player.ServerDropEntity(this);
10803 return;
10804 }
10805
10807 {
10809
10810 if (new_item)
10811 {
10812 new_item.SetResultOfSplit(true);
10813 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10816 new_item.PlaceOnSurface();
10817 }
10818 }
10819 }
10820 }
10821 }
10822
10824 {
10825 float split_quantity_new;
10829 InventoryLocation loc = new InventoryLocation;
10830
10831 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10832 {
10834 split_quantity_new = stack_max;
10835 else
10837
10839 {
10840 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10841 if (new_item)
10842 {
10843 new_item.SetResultOfSplit(true);
10844 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10846 new_item.
SetQuantity(split_quantity_new,
false,
true);
10847 }
10848 }
10849 }
10850 else if (destination_entity && slot_id == -1)
10851 {
10852 if (quantity > stack_max)
10853 split_quantity_new = stack_max;
10854 else
10855 split_quantity_new = quantity;
10856
10858 {
10859 GameInventory destinationInventory = destination_entity.GetInventory();
10861 {
10864 }
10865
10866 if (new_item)
10867 {
10868 new_item.SetResultOfSplit(true);
10869 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10871 new_item.
SetQuantity(split_quantity_new,
false,
true);
10872 }
10873 }
10874 }
10875 else
10876 {
10877 if (stack_max != 0)
10878 {
10880 {
10882 }
10883
10885 {
10887
10888 if (new_item)
10889 {
10890 new_item.SetResultOfSplit(true);
10891 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10894 new_item.PlaceOnSurface();
10895 }
10896 }
10897 }
10898 }
10899 }
10900
10902 {
10904 {
10905 if (ScriptInputUserData.CanStoreInputUserData())
10906 {
10907 ScriptInputUserData ctx = new ScriptInputUserData;
10912 dst.WriteToContext(ctx);
10914 }
10915 }
10916 else if (!
g_Game.IsMultiplayer())
10917 {
10919 }
10920 }
10921
10923 {
10925 {
10926 if (ScriptInputUserData.CanStoreInputUserData())
10927 {
10928 ScriptInputUserData ctx = new ScriptInputUserData;
10933 ctx.
Write(destination_entity);
10939 }
10940 }
10941 else if (!
g_Game.IsMultiplayer())
10942 {
10944 }
10945 }
10946
10948 {
10950 }
10951
10953 {
10955 float split_quantity_new;
10957 if (dst.IsValid())
10958 {
10959 int slot_id = dst.GetSlot();
10961
10962 if (quantity > stack_max)
10963 split_quantity_new = stack_max;
10964 else
10965 split_quantity_new = quantity;
10966
10968 {
10970
10971 if (new_item)
10972 {
10973 new_item.SetResultOfSplit(true);
10974 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10976 new_item.
SetQuantity(split_quantity_new,
false,
true);
10977 }
10978
10979 return new_item;
10980 }
10981 }
10982
10983 return null;
10984 }
10985
10987 {
10989 float split_quantity_new;
10991 if (destination_entity)
10992 {
10994 if (quantity > stackable)
10995 split_quantity_new = stackable;
10996 else
10997 split_quantity_new = quantity;
10998
11000 {
11001 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11002 if (new_item)
11003 {
11004 new_item.SetResultOfSplit(true);
11005 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11007 new_item.
SetQuantity(split_quantity_new,
false,
true);
11008 }
11009 }
11010 }
11011 }
11012
11014 {
11016 {
11017 if (ScriptInputUserData.CanStoreInputUserData())
11018 {
11019 ScriptInputUserData ctx = new ScriptInputUserData;
11024 ItemBase destination_entity =
this;
11025 ctx.
Write(destination_entity);
11029 }
11030 }
11031 else if (!
g_Game.IsMultiplayer())
11032 {
11034 }
11035 }
11036
11038 {
11040 float split_quantity_new;
11042 if (player)
11043 {
11045 if (quantity > stackable)
11046 split_quantity_new = stackable;
11047 else
11048 split_quantity_new = quantity;
11049
11051 {
11052 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11053 new_item =
ItemBase.Cast(in_hands);
11054 if (new_item)
11055 {
11056 new_item.SetResultOfSplit(true);
11057 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11059 new_item.SetQuantity(split_quantity_new, false, true);
11060 }
11061 }
11062 }
11063 }
11064
11066 {
11068 float split_quantity_new = Math.Floor(quantity * 0.5);
11069
11071 return;
11072
11074
11075 if (new_item)
11076 {
11077 if (new_item.GetQuantityMax() < split_quantity_new)
11078 {
11079 split_quantity_new = new_item.GetQuantityMax();
11080 }
11081
11082 new_item.SetResultOfSplit(true);
11083 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11084
11086 {
11089 }
11090 else
11091 {
11093 new_item.
SetQuantity(split_quantity_new,
false,
true);
11094 }
11095 }
11096 }
11097
11099 {
11101 float split_quantity_new = Math.Floor(quantity / 2);
11102
11104 return;
11105
11106 InventoryLocation invloc = new InventoryLocation;
11108
11110 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11111
11112 if (new_item)
11113 {
11114 if (new_item.GetQuantityMax() < split_quantity_new)
11115 {
11116 split_quantity_new = new_item.GetQuantityMax();
11117 }
11119 {
11122 }
11123 else if (split_quantity_new > 1)
11124 {
11126 new_item.
SetQuantity(split_quantity_new,
false,
true);
11127 }
11128 }
11129 }
11130
11133 {
11134 SetWeightDirty();
11136
11137 if (parent)
11138 parent.OnAttachmentQuantityChangedEx(this, delta);
11139
11141 {
11143 {
11145 }
11147 {
11148 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11150 }
11151 }
11152 }
11153
11156 {
11157
11158 }
11159
11162 {
11164 }
11165
11167 {
11168 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11169
11171 {
11172 if (newLevel == GameConstants.STATE_RUINED)
11173 {
11175 EntityAI parent = GetHierarchyParent();
11176 if (parent && parent.IsFireplace())
11177 {
11178 CargoBase cargo = GetInventory().GetCargo();
11179 if (cargo)
11180 {
11182 {
11184 }
11185 }
11186 }
11187 }
11188
11190 {
11191
11193 return;
11194 }
11195
11196 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11197 {
11199 }
11200 }
11201 }
11202
11203
11205 {
11206 super.OnRightClick();
11207
11209 {
11211 {
11212 if (ScriptInputUserData.CanStoreInputUserData())
11213 {
11214 EntityAI root = GetHierarchyRoot();
11215 Man playerOwner = GetHierarchyRootPlayer();
11216 InventoryLocation dst = new InventoryLocation;
11217
11218
11219 if (!playerOwner && root && root == this)
11220 {
11222 }
11223 else
11224 {
11225
11226 GetInventory().GetCurrentInventoryLocation(dst);
11228 {
11229 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11231 {
11233 }
11234 else
11235 {
11237
11238
11239 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11240 {
11242 }
11243 else
11244 {
11245 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11246 }
11247 }
11248 }
11249 }
11250
11251 ScriptInputUserData ctx = new ScriptInputUserData;
11259 }
11260 }
11261 else if (!
g_Game.IsMultiplayer())
11262 {
11264 }
11265 }
11266 }
11267
11269 {
11270 if (root)
11271 {
11272 vector m4[4];
11273 root.GetTransform(m4);
11274 dst.SetGround(this, m4);
11275 }
11276 else
11277 {
11278 GetInventory().GetCurrentInventoryLocation(dst);
11279 }
11280 }
11281
11282 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11283 {
11284
11285 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11286 return false;
11287
11288 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11289 return false;
11290
11291
11293 return false;
11294
11295
11296 Magazine mag = Magazine.Cast(this);
11297 if (mag)
11298 {
11299 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11300 return false;
11301
11302 if (stack_max_limit)
11303 {
11304 Magazine other_mag = Magazine.Cast(other_item);
11305 if (other_item)
11306 {
11307 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11308 return false;
11309 }
11310
11311 }
11312 }
11313 else
11314 {
11315
11317 return false;
11318
11320 return false;
11321 }
11322
11323 PlayerBase player = null;
11324 if (CastTo(player, GetHierarchyRootPlayer()))
11325 {
11326 if (player.GetInventory().HasAttachment(this))
11327 return false;
11328
11329 if (player.IsItemsToDelete())
11330 return false;
11331 }
11332
11333 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11334 return false;
11335
11336 int slotID;
11338 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11339 return false;
11340
11341 return true;
11342 }
11343
11345 {
11347 }
11348
11350 {
11351 return m_IsResultOfSplit;
11352 }
11353
11355 {
11356 m_IsResultOfSplit = value;
11357 }
11358
11360 {
11362 }
11363
11365 {
11366 float other_item_quantity = other_item.GetQuantity();
11367 float this_free_space;
11368
11370
11372
11373 if (other_item_quantity > this_free_space)
11374 {
11375 return this_free_space;
11376 }
11377 else
11378 {
11379 return other_item_quantity;
11380 }
11381 }
11382
11384 {
11386 }
11387
11389 {
11391 return;
11392
11393 if (!IsMagazine() && other_item)
11394 {
11396 if (quantity_used != 0)
11397 {
11398 float hp1 = GetHealth01("","");
11399 float hp2 = other_item.GetHealth01("","");
11400 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11401 hpResult = hpResult / (
GetQuantity() + quantity_used);
11402
11403 hpResult *= GetMaxHealth();
11404 Math.Round(hpResult);
11405 SetHealth("", "Health", hpResult);
11406
11408 other_item.AddQuantity(-quantity_used);
11409 }
11410 }
11412 }
11413
11415 {
11416 #ifdef SERVER
11417 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11418 GetHierarchyParent().IncreaseLifetimeUp();
11419 #endif
11420 };
11421
11423 {
11424 PlayerBase p = PlayerBase.Cast(player);
11425
11426 array<int> recipesIds = p.m_Recipes;
11427 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11428 if (moduleRecipesManager)
11429 {
11430 EntityAI itemInHands = player.GetEntityInHands();
11431 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11432 }
11433
11434 for (int i = 0;i < recipesIds.Count(); i++)
11435 {
11436 int key = recipesIds.Get(i);
11437 string recipeName = moduleRecipesManager.GetRecipeName(key);
11439 }
11440 }
11441
11442
11443 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11444 {
11445 super.GetDebugActions(outputList);
11446
11447
11453
11454
11459
11464
11465
11469
11470
11472 {
11476 }
11477
11480
11481
11485
11487
11488 InventoryLocation loc = new InventoryLocation();
11489 GetInventory().GetCurrentInventoryLocation(loc);
11491 {
11492 if (Gizmo_IsSupported())
11495 }
11496
11498 }
11499
11500
11501
11502
11504 {
11505 super.OnAction(action_id, player, ctx);
11506
11508 {
11509 switch (action_id)
11510 {
11514 return true;
11518 return true;
11519 }
11520 }
11521
11523 {
11524 switch (action_id)
11525 {
11527 Delete();
11528 return true;
11529 }
11530 }
11531
11532 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11533 {
11534 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11535 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11536 PlayerBase p = PlayerBase.Cast(player);
11537 if (
EActions.RECIPES_RANGE_START < 1000)
11538 {
11539 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11540 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11541 }
11542 }
11543 #ifndef SERVER
11544 else if (action_id ==
EActions.WATCH_PLAYER)
11545 {
11546 PluginDeveloper.SetDeveloperItemClientEx(player);
11547 }
11548 #endif
11550 {
11551 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11552 {
11553 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11554 OnDebugButtonPressServer(id + 1);
11555 }
11556
11557 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11558 {
11559 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11561 }
11562
11563 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11564 {
11565 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11567 }
11568
11569 else if (action_id ==
EActions.ADD_QUANTITY)
11570 {
11571 if (IsMagazine())
11572 {
11573 Magazine mag = Magazine.Cast(this);
11574 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11575 }
11576 else
11577 {
11579 }
11580
11581 if (m_EM)
11582 {
11583 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11584 }
11585
11586 }
11587
11588 else if (action_id ==
EActions.REMOVE_QUANTITY)
11589 {
11590 if (IsMagazine())
11591 {
11592 Magazine mag2 = Magazine.Cast(this);
11593 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11594 }
11595 else
11596 {
11598 }
11599 if (m_EM)
11600 {
11601 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11602 }
11603
11604 }
11605
11606 else if (action_id ==
EActions.SET_QUANTITY_0)
11607 {
11609
11610 if (m_EM)
11611 {
11612 m_EM.SetEnergy(0);
11613 }
11614 }
11615
11616 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11617 {
11619
11620 if (m_EM)
11621 {
11622 m_EM.SetEnergy(m_EM.GetEnergyMax());
11623 }
11624 }
11625
11626 else if (action_id ==
EActions.ADD_HEALTH)
11627 {
11628 AddHealth("","",GetMaxHealth("","Health")/5);
11629 }
11630 else if (action_id ==
EActions.REMOVE_HEALTH)
11631 {
11632 AddHealth("","",-GetMaxHealth("","Health")/5);
11633 }
11634 else if (action_id ==
EActions.DESTROY_HEALTH)
11635 {
11636 SetHealth01("","",0);
11637 }
11638 else if (action_id ==
EActions.WATCH_ITEM)
11639 {
11641 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11642 #ifdef DEVELOPER
11643 SetDebugDeveloper_item(this);
11644 #endif
11645 }
11646
11647 else if (action_id ==
EActions.ADD_TEMPERATURE)
11648 {
11649 AddTemperature(20);
11650
11651 }
11652
11653 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11654 {
11655 AddTemperature(-20);
11656
11657 }
11658
11659 else if (action_id ==
EActions.FLIP_FROZEN)
11660 {
11661 SetFrozen(!GetIsFrozen());
11662
11663 }
11664
11665 else if (action_id ==
EActions.ADD_WETNESS)
11666 {
11668
11669 }
11670
11671 else if (action_id ==
EActions.REMOVE_WETNESS)
11672 {
11674
11675 }
11676
11677 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11678 {
11681
11682
11683 }
11684
11685 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11686 {
11689 }
11690
11691 else if (action_id ==
EActions.MAKE_SPECIAL)
11692 {
11693 auto debugParams = DebugSpawnParams.WithPlayer(player);
11694 OnDebugSpawnEx(debugParams);
11695 }
11696
11697 }
11698
11699
11700 return false;
11701 }
11702
11703
11704
11705
11709
11712
11713
11714
11716 {
11717 return false;
11718 }
11719
11720
11722 {
11723 return true;
11724 }
11725
11726
11728 {
11729 return true;
11730 }
11731
11732
11733
11735 {
11736 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11737 return g_Game.ConfigIsExisting(config_path);
11738 }
11739
11742 {
11743 return null;
11744 }
11745
11747 {
11748 return false;
11749 }
11750
11752 {
11753 return false;
11754 }
11755
11759
11760
11762 {
11763 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11764 return module_repairing.CanRepair(this, item_repair_kit);
11765 }
11766
11767
11768 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11769 {
11770 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11771 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11772 }
11773
11774
11776 {
11777
11778
11779
11780
11781
11782
11783
11784
11785 return 1;
11786 }
11787
11788
11789
11791 {
11793 }
11794
11795
11796
11798 {
11800 }
11801
11802
11811 {
11812 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11813
11814 if (player)
11815 {
11816 player.MessageStatus(text);
11817 }
11818 }
11819
11820
11829 {
11830 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11831
11832 if (player)
11833 {
11834 player.MessageAction(text);
11835 }
11836 }
11837
11838
11847 {
11848 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11849
11850 if (player)
11851 {
11852 player.MessageFriendly(text);
11853 }
11854 }
11855
11856
11865 {
11866 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11867
11868 if (player)
11869 {
11870 player.MessageImportant(text);
11871 }
11872 }
11873
11875 {
11876 return true;
11877 }
11878
11879
11880 override bool KindOf(
string tag)
11881 {
11882 bool found = false;
11883 string item_name = this.
GetType();
11885 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11886
11887 int array_size = item_tag_array.Count();
11888 for (int i = 0; i < array_size; i++)
11889 {
11890 if (item_tag_array.Get(i) == tag)
11891 {
11892 found = true;
11893 break;
11894 }
11895 }
11896 return found;
11897 }
11898
11899
11901 {
11902
11903 super.OnRPC(sender, rpc_type,ctx);
11904
11905
11906 switch (rpc_type)
11907 {
11908 #ifndef SERVER
11909 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11910 Param2<bool, string> p = new Param2<bool, string>(false, "");
11911
11913 return;
11914
11915 bool play = p.param1;
11916 string soundSet = p.param2;
11917
11918 if (play)
11919 {
11921 {
11923 {
11925 }
11926 }
11927 else
11928 {
11930 }
11931 }
11932 else
11933 {
11935 }
11936
11937 break;
11938 #endif
11939
11940 }
11941
11943 {
11945 }
11946 }
11947
11948
11949
11950
11952 {
11953 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11954 return plugin.GetID(
name);
11955 }
11956
11958 {
11959 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11960 return plugin.GetName(id);
11961 }
11962
11965 {
11966
11967
11968 int varFlags;
11969 if (!ctx.
Read(varFlags))
11970 return;
11971
11972 if (varFlags & ItemVariableFlags.FLOAT)
11973 {
11975 }
11976 }
11977
11979 {
11980
11981 super.SerializeNumericalVars(floats_out);
11982
11983
11984
11986 {
11988 }
11989
11991 {
11993 }
11994
11996 {
11998 }
11999
12001 {
12006 }
12007
12009 {
12011 }
12012 }
12013
12015 {
12016
12017 super.DeSerializeNumericalVars(floats);
12018
12019
12020 int index = 0;
12021 int mask = Math.Round(floats.Get(index));
12022
12023 index++;
12024
12026 {
12028 {
12030 }
12031 else
12032 {
12033 float quantity = floats.Get(index);
12034 SetQuantity(quantity,
true,
false,
false,
false);
12035 }
12036 index++;
12037 }
12038
12040 {
12041 float wet = floats.Get(index);
12043 index++;
12044 }
12045
12047 {
12048 int liquidtype = Math.Round(floats.Get(index));
12050 index++;
12051 }
12052
12054 {
12056 index++;
12058 index++;
12060 index++;
12062 index++;
12063 }
12064
12066 {
12067 int cleanness = Math.Round(floats.Get(index));
12069 index++;
12070 }
12071 }
12072
12074 {
12075 super.WriteVarsToCTX(ctx);
12076
12077
12079 {
12081 }
12082
12084 {
12086 }
12087
12089 {
12091 }
12092
12094 {
12095 int r,g,b,a;
12101 }
12102
12104 {
12106 }
12107 }
12108
12110 {
12111 if (!super.ReadVarsFromCTX(ctx,version))
12112 return false;
12113
12114 int intValue;
12115 float value;
12116
12117 if (version < 140)
12118 {
12119 if (!ctx.
Read(intValue))
12120 return false;
12121
12122 m_VariablesMask = intValue;
12123 }
12124
12126 {
12127 if (!ctx.
Read(value))
12128 return false;
12129
12131 {
12133 }
12134 else
12135 {
12137 }
12138 }
12139
12140 if (version < 140)
12141 {
12143 {
12144 if (!ctx.
Read(value))
12145 return false;
12146 SetTemperatureDirect(value);
12147 }
12148 }
12149
12151 {
12152 if (!ctx.
Read(value))
12153 return false;
12155 }
12156
12158 {
12159 if (!ctx.
Read(intValue))
12160 return false;
12162 }
12163
12165 {
12166 int r,g,b,a;
12168 return false;
12170 return false;
12172 return false;
12174 return false;
12175
12177 }
12178
12180 {
12181 if (!ctx.
Read(intValue))
12182 return false;
12184 }
12185
12186 if (version >= 138 && version < 140)
12187 {
12189 {
12190 if (!ctx.
Read(intValue))
12191 return false;
12192 SetFrozen(intValue);
12193 }
12194 }
12195
12196 return true;
12197 }
12198
12199
12201 {
12204 {
12206 }
12207
12208 if (!super.OnStoreLoad(ctx, version))
12209 {
12211 return false;
12212 }
12213
12214 if (version >= 114)
12215 {
12216 bool hasQuickBarIndexSaved;
12217
12218 if (!ctx.
Read(hasQuickBarIndexSaved))
12219 {
12221 return false;
12222 }
12223
12224 if (hasQuickBarIndexSaved)
12225 {
12226 int itmQBIndex;
12227
12228
12229 if (!ctx.
Read(itmQBIndex))
12230 {
12232 return false;
12233 }
12234
12235 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12236 if (itmQBIndex != -1 && parentPlayer)
12237 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12238 }
12239 }
12240 else
12241 {
12242
12243 PlayerBase player;
12244 int itemQBIndex;
12245 if (version ==
int.
MAX)
12246 {
12247 if (!ctx.
Read(itemQBIndex))
12248 {
12250 return false;
12251 }
12252 }
12253 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12254 {
12255
12256 if (!ctx.
Read(itemQBIndex))
12257 {
12259 return false;
12260 }
12261 if (itemQBIndex != -1 && player)
12262 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12263 }
12264 }
12265
12266 if (version < 140)
12267 {
12268
12269 if (!LoadVariables(ctx, version))
12270 {
12272 return false;
12273 }
12274 }
12275
12276
12278 {
12280 return false;
12281 }
12282 if (version >= 132)
12283 {
12285 if (raib)
12286 {
12288 {
12290 return false;
12291 }
12292 }
12293 }
12294
12296 return true;
12297 }
12298
12299
12300
12302 {
12303 super.OnStoreSave(ctx);
12304
12305 PlayerBase player;
12306 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12307 {
12309
12310 int itemQBIndex = -1;
12311 itemQBIndex = player.FindQuickBarEntityIndex(this);
12312 ctx.
Write(itemQBIndex);
12313 }
12314 else
12315 {
12317 }
12318
12320
12322 if (raib)
12323 {
12325 }
12326 }
12327
12328
12330 {
12331 super.AfterStoreLoad();
12332
12334 {
12336 }
12337
12339 {
12342 }
12343 }
12344
12346 {
12347 super.EEOnAfterLoad();
12348
12350 {
12352 }
12353
12356 }
12357
12359 {
12360 return false;
12361 }
12362
12363
12364
12366 {
12368 {
12369 #ifdef PLATFORM_CONSOLE
12370
12372 {
12374 if (menu)
12375 {
12377 }
12378 }
12379 #endif
12380 }
12381
12383 {
12386 }
12387
12389 {
12390 SetWeightDirty();
12392 }
12394 {
12397 }
12398
12400 {
12403
12406 }
12408 {
12412 }
12413
12414 super.OnVariablesSynchronized();
12415 }
12416
12417
12418
12420 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12421 {
12422 if (!IsServerCheck(allow_client))
12423 return false;
12424
12426 return false;
12427
12430
12431 if (value <= (min + 0.001))
12432 value = min;
12433
12434 if (value == min)
12435 {
12436 if (destroy_config)
12437 {
12438 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12439 if (dstr)
12440 {
12442 this.Delete();
12443 return true;
12444 }
12445 }
12446 else if (destroy_forced)
12447 {
12449 this.Delete();
12450 return true;
12451 }
12452
12454 }
12455
12458
12460 {
12461 EntityAI parent = GetHierarchyRoot();
12462 InventoryLocation iLoc = new InventoryLocation();
12463 GetInventory().GetCurrentInventoryLocation(iLoc);
12465 {
12466 int iLocSlot = iLoc.
GetSlot();
12468 {
12470 }
12472 {
12474 }
12475 }
12476 }
12477
12479 {
12481
12482 if (delta)
12484 }
12485
12487
12488 return false;
12489 }
12490
12491
12493 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12494 {
12496 }
12497
12499 {
12502 }
12503
12505 {
12508 }
12509
12511 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12512 {
12513 float value_clamped = Math.Clamp(value, 0, 1);
12515 SetQuantity(result, destroy_config, destroy_forced);
12516 }
12517
12518
12521 {
12523 }
12524
12526 {
12528 }
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12540 {
12541 int slot = -1;
12542 GameInventory inventory = GetInventory();
12543 if (inventory)
12544 {
12545 InventoryLocation il = new InventoryLocation;
12548 }
12549
12551 }
12552
12554 {
12555 float quantity_max = 0;
12556
12558 {
12559 if (attSlotID != -1)
12560 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12561
12562 if (quantity_max <= 0)
12564 }
12565
12566 if (quantity_max <= 0)
12568
12569 return quantity_max;
12570 }
12571
12573 {
12575 }
12576
12578 {
12580 }
12581
12582
12584 {
12586 }
12587
12589 {
12591 }
12592
12594 {
12596 }
12597
12598
12600 {
12601
12602 float weightEx = GetWeightEx();
12603 float special = GetInventoryAndCargoWeight();
12604 return weightEx - special;
12605 }
12606
12607
12609 {
12611 }
12612
12614 {
12616 {
12617 #ifdef DEVELOPER
12618 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12619 {
12620 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12622 }
12623 #endif
12624
12625 return GetQuantity() * GetConfigWeightModified();
12626 }
12627 else if (HasEnergyManager())
12628 {
12629 #ifdef DEVELOPER
12630 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12631 {
12632 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12633 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12634 }
12635 #endif
12636 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12637 }
12638 else
12639 {
12640 #ifdef DEVELOPER
12641 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12642 {
12643 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12644 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12645 }
12646 #endif
12647 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12648 }
12649 }
12650
12653 {
12654 int item_count = 0;
12656
12657 GameInventory inventory = GetInventory();
12658 CargoBase cargo = inventory.
GetCargo();
12659 if (cargo != NULL)
12660 {
12662 }
12663
12665 for (int i = 0; i < nAttachments; ++i)
12666 {
12668 if (item)
12669 item_count += item.GetNumberOfItems();
12670 }
12671 return item_count;
12672 }
12673
12676 {
12677 float weight = 0;
12678 float wetness = 1;
12679 if (include_wetness)
12682 {
12683 weight = wetness * m_ConfigWeight;
12684 }
12686 {
12687 weight = 1;
12688 }
12689 return weight;
12690 }
12691
12692
12693
12695 {
12696 GameInventory inventory = GetInventory();
12697 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12698 {
12699 array<EntityAI> items = new array<EntityAI>;
12701 for (int i = 0; i < items.Count(); ++i)
12702 {
12704 if (item)
12705 {
12706 g_Game.ObjectDelete(item);
12707 }
12708 }
12709 }
12710 }
12711
12712
12713
12714
12716 {
12717 float energy = 0;
12718 if (HasEnergyManager())
12719 {
12720 energy = GetCompEM().GetEnergy();
12721 }
12722 return energy;
12723 }
12724
12725
12727 {
12728 super.OnEnergyConsumed();
12729
12731 }
12732
12734 {
12735 super.OnEnergyAdded();
12736
12738 }
12739
12740
12742 {
12743 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12744 {
12746 {
12747 float energy_0to1 = GetCompEM().GetEnergy0To1();
12749 }
12750 }
12751 }
12752
12753
12755 {
12756 return ConfigGetFloat("heatIsolation");
12757 }
12758
12760 {
12762 }
12763
12765 {
12766 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12767 if (
g_Game.ConfigIsExisting(paramPath))
12768 return g_Game.ConfigGetFloat(paramPath);
12769
12770 return 0.0;
12771 }
12772
12774 {
12775 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12776 if (
g_Game.ConfigIsExisting(paramPath))
12777 return g_Game.ConfigGetFloat(paramPath);
12778
12779 return 0.0;
12780 }
12781
12782 override void SetWet(
float value,
bool allow_client =
false)
12783 {
12784 if (!IsServerCheck(allow_client))
12785 return;
12786
12789
12791
12792 m_VarWet = Math.Clamp(value, min, max);
12793
12795 {
12798 }
12799 }
12800
12801 override void AddWet(
float value)
12802 {
12804 }
12805
12807 {
12809 }
12810
12812 {
12814 }
12815
12817 {
12819 }
12820
12822 {
12824 }
12825
12827 {
12829 }
12830
12831 override void OnWetChanged(
float newVal,
float oldVal)
12832 {
12835 if (newLevel != oldLevel)
12836 {
12838 }
12839 }
12840
12842 {
12843 SetWeightDirty();
12844 }
12845
12847 {
12848 return GetWetLevelInternal(
m_VarWet);
12849 }
12850
12851
12852
12854 {
12856 }
12857
12859 {
12861 }
12862
12864 {
12866 }
12867
12869 {
12871 }
12872
12873
12874
12876 {
12877 if (ConfigIsExisting("itemModelLength"))
12878 {
12879 return ConfigGetFloat("itemModelLength");
12880 }
12881 return 0;
12882 }
12883
12885 {
12886 if (ConfigIsExisting("itemAttachOffset"))
12887 {
12888 return ConfigGetFloat("itemAttachOffset");
12889 }
12890 return 0;
12891 }
12892
12893 override void SetCleanness(
int value,
bool allow_client =
false)
12894 {
12895 if (!IsServerCheck(allow_client))
12896 return;
12897
12899
12901
12904 }
12905
12907 {
12909 }
12910
12912 {
12913 return true;
12914 }
12915
12916
12917
12918
12920 {
12922 }
12923
12925 {
12927 }
12928
12929
12930
12931
12932 override void SetColor(
int r,
int g,
int b,
int a)
12933 {
12939 }
12941 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12942 {
12947 }
12948
12950 {
12952 }
12953
12956 {
12957 int r,g,b,a;
12959 r = r/255;
12960 g = g/255;
12961 b = b/255;
12962 a = a/255;
12963 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12964 }
12965
12966
12967
12968 override void SetLiquidType(
int value,
bool allow_client =
false)
12969 {
12970 if (!IsServerCheck(allow_client))
12971 return;
12972
12977 }
12978
12980 {
12981 return ConfigGetInt("varLiquidTypeInit");
12982 }
12983
12985 {
12987 }
12988
12990 {
12992 SetFrozen(false);
12993 }
12994
12997 {
12998 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12999 }
13000
13001
13004 {
13005 PlayerBase nplayer;
13006 if (PlayerBase.CastTo(nplayer, player))
13007 {
13009 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13010 }
13011 }
13012
13013
13016 {
13017 PlayerBase nplayer;
13018 if (PlayerBase.CastTo(nplayer,player))
13019 {
13020 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13021 }
13022
13023 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13024
13025 if (HasEnergyManager())
13026 {
13027 GetCompEM().UpdatePlugState();
13028 }
13029 }
13030
13031
13033 {
13034 super.OnPlacementStarted(player);
13035
13037 }
13038
13039 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13040 {
13042 {
13043 m_AdminLog.OnPlacementComplete(player,
this);
13044 }
13045
13046 super.OnPlacementComplete(player, position, orientation);
13047 }
13048
13049
13050
13051
13052
13054 {
13056 {
13057 return true;
13058 }
13059 else
13060 {
13061 return false;
13062 }
13063 }
13064
13065
13067 {
13069 {
13071 }
13072 }
13073
13074
13076 {
13078 }
13079
13081 {
13083 }
13084
13085 override void InsertAgent(
int agent,
float count = 1)
13086 {
13087 if (count < 1)
13088 return;
13089
13091 }
13092
13095 {
13097 }
13098
13099
13101 {
13103 }
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13147 {
13149 return false;
13150 return true;
13151 }
13152
13154 {
13155
13157 }
13158
13159
13162 {
13163 super.CheckForRoofLimited(timeTresholdMS);
13164
13165 float time =
g_Game.GetTime();
13166 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13167 {
13168 m_PreviousRoofTestTime = time;
13169 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13170 }
13171 }
13172
13173
13175 {
13177 {
13178 return 0;
13179 }
13180
13181 if (GetInventory().GetAttachmentSlotsCount() != 0)
13182 {
13183 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13184 if (filter)
13185 return filter.GetProtectionLevel(type, false, system);
13186 else
13187 return 0;
13188 }
13189
13190 string subclassPath, entryName;
13191
13192 switch (type)
13193 {
13195 entryName = "biological";
13196 break;
13198 entryName = "chemical";
13199 break;
13200 default:
13201 entryName = "biological";
13202 break;
13203 }
13204
13205 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13206
13207 return g_Game.ConfigGetFloat(subclassPath + entryName);
13208 }
13209
13210
13211
13214 {
13215 if (!IsMagazine())
13217
13219 }
13220
13221
13222
13223
13224
13229 {
13230 return true;
13231 }
13232
13234 {
13236 }
13237
13238
13239
13240
13241
13243 {
13244 if (parent)
13245 {
13246 if (parent.IsInherited(DayZInfected))
13247 return true;
13248
13249 if (!parent.IsRuined())
13250 return true;
13251 }
13252
13253 return true;
13254 }
13255
13257 {
13258 if (!super.CanPutAsAttachment(parent))
13259 {
13260 return false;
13261 }
13262
13263 if (!IsRuined() && !parent.IsRuined())
13264 {
13265 return true;
13266 }
13267
13268 return false;
13269 }
13270
13272 {
13273
13274
13275
13276
13277 return super.CanReceiveItemIntoCargo(item);
13278 }
13279
13281 {
13282
13283
13284
13285
13286 GameInventory attachmentInv = attachment.GetInventory();
13288 {
13289 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13290 return false;
13291 }
13292
13293 InventoryLocation loc = new InventoryLocation();
13294 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13295 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13296 return false;
13297
13298 return super.CanReceiveAttachment(attachment, slotId);
13299 }
13300
13302 {
13303 if (!super.CanReleaseAttachment(attachment))
13304 return false;
13305
13306 return GetInventory().AreChildrenAccessible();
13307 }
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13330 {
13331 int id = muzzle_owner.GetMuzzleID();
13332 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13333
13334 if (WPOF_array)
13335 {
13336 for (int i = 0; i < WPOF_array.Count(); i++)
13337 {
13338 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13339
13340 if (WPOF)
13341 {
13342 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13343 }
13344 }
13345 }
13346 }
13347
13348
13350 {
13351 int id = muzzle_owner.GetMuzzleID();
13353
13354 if (WPOBE_array)
13355 {
13356 for (int i = 0; i < WPOBE_array.Count(); i++)
13357 {
13358 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13359
13360 if (WPOBE)
13361 {
13362 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13363 }
13364 }
13365 }
13366 }
13367
13368
13370 {
13371 int id = muzzle_owner.GetMuzzleID();
13372 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13373
13374 if (WPOOH_array)
13375 {
13376 for (int i = 0; i < WPOOH_array.Count(); i++)
13377 {
13378 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13379
13380 if (WPOOH)
13381 {
13382 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13383 }
13384 }
13385 }
13386 }
13387
13388
13390 {
13391 int id = muzzle_owner.GetMuzzleID();
13392 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13393
13394 if (WPOOH_array)
13395 {
13396 for (int i = 0; i < WPOOH_array.Count(); i++)
13397 {
13398 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13399
13400 if (WPOOH)
13401 {
13402 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13403 }
13404 }
13405 }
13406 }
13407
13408
13410 {
13411 int id = muzzle_owner.GetMuzzleID();
13412 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13413
13414 if (WPOOH_array)
13415 {
13416 for (int i = 0; i < WPOOH_array.Count(); i++)
13417 {
13418 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13419
13420 if (WPOOH)
13421 {
13422 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13423 }
13424 }
13425 }
13426 }
13427
13428
13429
13431 {
13433 {
13434 return true;
13435 }
13436
13437 return false;
13438 }
13439
13441 {
13443 {
13444 return true;
13445 }
13446
13447 return false;
13448 }
13449
13451 {
13453 {
13454 return true;
13455 }
13456
13457 return false;
13458 }
13459
13461 {
13462 return false;
13463 }
13464
13467 {
13468 return UATimeSpent.DEFAULT_DEPLOY;
13469 }
13470
13471
13472
13473
13475 {
13477 SetSynchDirty();
13478 }
13479
13481 {
13483 }
13484
13485
13487 {
13488 return false;
13489 }
13490
13493 {
13494 string att_type = "None";
13495
13496 if (ConfigIsExisting("soundAttType"))
13497 {
13498 att_type = ConfigGetString("soundAttType");
13499 }
13500
13502 }
13503
13505 {
13507 }
13508
13509
13510
13511
13512
13518
13520 {
13523
13525 }
13526
13527
13529 {
13531 return;
13532
13534
13537
13540
13541 SoundParameters params = new SoundParameters();
13545 }
13546
13547
13549 {
13551 {
13554
13555 SetSynchDirty();
13556
13559 }
13560 }
13561
13563 {
13565 }
13566
13567
13569 {
13571 return;
13572
13574 SetSynchDirty();
13575
13578 }
13579
13581 {
13584 }
13585
13587 {
13589 }
13590
13591 void OnApply(PlayerBase player);
13592
13594 {
13595 return 1.0;
13596 };
13597
13599 {
13601 }
13602
13604 {
13606 }
13607
13609
13611 {
13612 SetDynamicPhysicsLifeTime(0.01);
13614 }
13615
13617 {
13618 array<string> zone_names = new array<string>;
13619 GetDamageZones(zone_names);
13620 for (int i = 0; i < zone_names.Count(); i++)
13621 {
13622 SetHealthMax(zone_names.Get(i),"Health");
13623 }
13624 SetHealthMax("","Health");
13625 }
13626
13629 {
13630 float global_health = GetHealth01("","Health");
13631 array<string> zones = new array<string>;
13632 GetDamageZones(zones);
13633
13634 for (int i = 0; i < zones.Count(); i++)
13635 {
13636 SetHealth01(zones.Get(i),"Health",global_health);
13637 }
13638 }
13639
13642 {
13643 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13644 }
13645
13647 {
13648 if (!hasRootAsPlayer)
13649 {
13650 if (refParentIB)
13651 {
13652
13653 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13654 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13655
13656 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13657 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13658
13661 }
13662 else
13663 {
13664
13667 }
13668 }
13669 }
13670
13672 {
13674 {
13675 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13676 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13677 {
13678 float heatPermCoef = 1.0;
13680 while (ent)
13681 {
13682 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13683 ent = ent.GetHierarchyParent();
13684 }
13685
13686 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13687 }
13688 }
13689 }
13690
13692 {
13693
13694 EntityAI parent = GetHierarchyParent();
13695 if (!parent)
13696 {
13697 hasParent = false;
13698 hasRootAsPlayer = false;
13699 }
13700 else
13701 {
13702 hasParent = true;
13703 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13704 refParentIB =
ItemBase.Cast(parent);
13705 }
13706 }
13707
13708 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13709 {
13710
13711 }
13712
13714 {
13715
13716 return false;
13717 }
13718
13720 {
13721
13722
13723 return false;
13724 }
13725
13727 {
13728
13729 return false;
13730 }
13731
13734 {
13735 return !GetIsFrozen() &&
IsOpen();
13736 }
13737
13739 {
13740 bool hasParent = false, hasRootAsPlayer = false;
13742
13743 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13744 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13745
13746 if (wwtu || foodDecay)
13747 {
13751
13752 if (processWetness || processTemperature || processDecay)
13753 {
13755
13756 if (processWetness)
13757 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13758
13759 if (processTemperature)
13761
13762 if (processDecay)
13763 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13764 }
13765 }
13766 }
13767
13770 {
13772 }
13773
13775 {
13778
13779 return super.GetTemperatureFreezeThreshold();
13780 }
13781
13783 {
13786
13787 return super.GetTemperatureThawThreshold();
13788 }
13789
13791 {
13794
13795 return super.GetItemOverheatThreshold();
13796 }
13797
13799 {
13801 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13802
13803 return super.GetTemperatureFreezeTime();
13804 }
13805
13807 {
13809 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13810
13811 return super.GetTemperatureThawTime();
13812 }
13813
13818
13820 {
13821 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13822 }
13823
13825 {
13826 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13827 }
13828
13831 {
13833 }
13834
13836 {
13838 }
13839
13841 {
13843 }
13844
13847 {
13848 return null;
13849 }
13850
13853 {
13854 return false;
13855 }
13856
13858 {
13860 {
13863 if (!trg)
13864 {
13866 explosive = this;
13867 }
13868
13869 explosive.PairRemote(trg);
13871
13872 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13873 trg.SetPersistentPairID(persistentID);
13874 explosive.SetPersistentPairID(persistentID);
13875
13876 return true;
13877 }
13878 return false;
13879 }
13880
13883 {
13884 float ret = 1.0;
13887 ret *= GetHealth01();
13888
13889 return ret;
13890 }
13891
13892 #ifdef DEVELOPER
13893 override void SetDebugItem()
13894 {
13895 super.SetDebugItem();
13896 _itemBase = this;
13897 }
13898
13900 {
13901 string text = super.GetDebugText();
13902
13904 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13905
13906 return text;
13907 }
13908 #endif
13909
13911 {
13912 return true;
13913 }
13914
13916
13918
13920 {
13923 }
13924
13925
13933
13949
13950 [
Obsolete(
"Use ItemSoundHandler instead")]
13953 {
13954 if (!
g_Game.IsDedicatedServer())
13955 {
13956 if (ConfigIsExisting("attachSoundSet"))
13957 {
13958 string cfg_path = "";
13959 string soundset = "";
13960 string type_name =
GetType();
13961
13964 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13965 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13966
13967 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13968 {
13969 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13970 {
13971 if (cfg_slot_array[i] == slot_type)
13972 {
13973 soundset = cfg_soundset_array[i];
13974 break;
13975 }
13976 }
13977 }
13978
13979 if (soundset != "")
13980 {
13981 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13983 }
13984 }
13985 }
13986 }
13987
13989}
13990
13992{
13994 if (entity)
13995 {
13996 bool is_item = entity.IsInherited(
ItemBase);
13997 if (is_item && full_quantity)
13998 {
14001 }
14002 }
14003 else
14004 {
14006 return NULL;
14007 }
14008 return entity;
14009}
14010
14012{
14013 if (item)
14014 {
14015 if (health > 0)
14016 item.SetHealth("", "", health);
14017
14018 if (item.CanHaveTemperature())
14019 {
14021 if (item.CanFreeze())
14022 item.SetFrozen(false);
14023 }
14024
14025 if (item.HasEnergyManager())
14026 {
14027 if (quantity >= 0)
14028 {
14029 item.GetCompEM().SetEnergy0To1(quantity);
14030 }
14031 else
14032 {
14034 }
14035 }
14036 else if (item.IsMagazine())
14037 {
14038 Magazine mag = Magazine.Cast(item);
14039 if (quantity >= 0)
14040 {
14041 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14042 }
14043 else
14044 {
14046 }
14047
14048 }
14049 else
14050 {
14051 if (quantity >= 0)
14052 {
14053 item.SetQuantityNormalized(quantity, false);
14054 }
14055 else
14056 {
14058 }
14059
14060 }
14061 }
14062}
14063
14064#ifdef DEVELOPER
14066#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.