9028{
9030 {
9031 return true;
9032 }
9033};
9034
9036{
9037
9038};
9039
9040
9041
9043{
9047
9049
9052
9053
9054
9055
9056
9065
9071
9076
9081
9102 protected bool m_IsResultOfSplit
9103
9105
9110
9111
9112
9114
9118
9119
9120
9122
9125
9126
9127
9133
9134
9142
9145
9146
9148
9149
9151
9152
9157
9158
9163
9165
9166
9168
9169
9171 {
9176
9177 if (!
g_Game.IsDedicatedServer())
9178 {
9180 {
9182
9184 {
9186 }
9187 }
9188
9191 }
9192
9193 m_OldLocation = null;
9194
9196 {
9198 }
9199
9200 if (ConfigIsExisting("headSelectionsToHide"))
9201 {
9204 }
9205
9207 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9208 {
9210 }
9211
9213
9214 m_IsResultOfSplit = false;
9215
9217 }
9218
9220 {
9221 super.InitItemVariables();
9222
9228 m_Count = ConfigGetInt(
"count");
9229
9232
9237
9240
9245
9257
9261
9262
9265 if (ConfigIsExisting("canBeSplit"))
9266 {
9269 }
9270
9272 if (ConfigIsExisting("itemBehaviour"))
9274
9275
9278 RegisterNetSyncVariableInt("m_VarLiquidType");
9279 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9280
9281 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9282 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9283 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9284
9285 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9286 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9287 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9288 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9289
9290 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9291 RegisterNetSyncVariableBool("m_IsTakeable");
9292 RegisterNetSyncVariableBool("m_IsHologram");
9293
9296 {
9299 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9300 }
9301
9303
9305 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9307
9309 }
9310
9312 {
9314 }
9315
9317 {
9320 {
9325 }
9326 }
9327
9328 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9329 {
9331 {
9334 }
9335
9337 }
9338
9340 {
9346 }
9347
9349
9351 {
9353
9354 if (!action)
9355 {
9356 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9357 return;
9358 }
9359
9361 if (!ai)
9362 {
9364 return;
9365 }
9366
9368 if (!action_array)
9369 {
9370 action_array = new array<ActionBase_Basic>;
9372 }
9373 if (LogManager.IsActionLogEnable())
9374 {
9375 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9376 }
9377
9378 if (action_array.Find(action) != -1)
9379 {
9380 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9381 }
9382 else
9383 {
9384 action_array.Insert(action);
9385 }
9386 }
9387
9389 {
9390 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9391 ActionBase action = player.GetActionManager().GetAction(actionName);
9394
9395 if (action_array)
9396 {
9397 action_array.RemoveItem(action);
9398 }
9399 }
9400
9401
9402
9404 {
9405 ActionOverrideData overrideData = new ActionOverrideData();
9409
9411 if (!actionMap)
9412 {
9415 }
9416
9417 actionMap.Insert(this.
Type(), overrideData);
9418
9419 }
9420
9422
9424
9425
9427 {
9430
9433
9434 string config_to_search = "CfgVehicles";
9435 string muzzle_owner_config;
9436
9438 {
9439 if (IsInherited(Weapon))
9440 config_to_search = "CfgWeapons";
9441
9442 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9443
9444 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9445
9446 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9447
9448 if (config_OnFire_subclass_count > 0)
9449 {
9450 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9451
9452 for (int i = 0; i < config_OnFire_subclass_count; i++)
9453 {
9454 string particle_class = "";
9455 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9456 string config_OnFire_entry = config_OnFire_class + particle_class;
9457 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9458 WPOF_array.Insert(WPOF);
9459 }
9460
9461
9463 }
9464 }
9465
9467 {
9468 config_to_search = "CfgWeapons";
9469 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9470
9471 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9472
9473 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9474
9475 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9476 {
9477 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9478
9479 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9480 {
9481 string particle_class2 = "";
9482 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9483 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9484 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9485 WPOBE_array.Insert(WPOBE);
9486 }
9487
9488
9490 }
9491 }
9492 }
9493
9494
9496 {
9499
9501 {
9502 string config_to_search = "CfgVehicles";
9503
9504 if (IsInherited(Weapon))
9505 config_to_search = "CfgWeapons";
9506
9507 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9508 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9509
9510 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9511 {
9512
9514
9516 {
9518 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9520 return;
9521 }
9522
9525
9526
9527
9528 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9529 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9530
9531 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9532 {
9533 string particle_class = "";
9534 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9535 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9536 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9537
9538 if (entry_type == CT_CLASS)
9539 {
9540 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9541 WPOOH_array.Insert(WPOF);
9542 }
9543 }
9544
9545
9547 }
9548 }
9549 }
9550
9552 {
9554 }
9555
9557 {
9559 {
9561
9564
9567
9568 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9569 }
9570 }
9571
9573 {
9575 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9576
9578 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9579
9581 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9582
9584 {
9586 }
9587 }
9588
9590 {
9592 }
9593
9595 {
9598 else
9600
9602 {
9605 }
9606 else
9607 {
9610
9613 }
9614
9616 }
9617
9619 {
9621 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9622 }
9623
9625 {
9627 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9629 }
9630
9632 {
9634 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9635 }
9636
9638 {
9641
9642 OverheatingParticle OP = new OverheatingParticle();
9647
9649 }
9650
9652 {
9655
9656 return -1;
9657 }
9658
9660 {
9662 {
9665
9666 for (int i = count; i > 0; --i)
9667 {
9668 int id = i - 1;
9671
9674
9675 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9676 {
9677 if (p)
9678 {
9681 }
9682 }
9683 }
9684 }
9685 }
9686
9688 {
9690 {
9692 {
9693 int id = i - 1;
9695
9696 if (OP)
9697 {
9699
9700 if (p)
9701 {
9703 }
9704
9705 delete OP;
9706 }
9707 }
9708
9711 }
9712 }
9713
9716 {
9717 return 0.0;
9718 }
9719
9720
9722 {
9723 return 250;
9724 }
9725
9727 {
9728 return 0;
9729 }
9730
9733 {
9735 return true;
9736
9737 return false;
9738 }
9739
9742 {
9745
9747 {
9749 }
9750 else
9751 {
9752
9754 }
9755
9757 }
9758
9765 {
9766 return -1;
9767 }
9768
9769
9770
9771
9773 {
9775 {
9776 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9777 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9778
9779 if (r_index >= 0)
9780 {
9781 InventoryLocation r_il = new InventoryLocation;
9782 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9783
9784 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9787 {
9788 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9789 }
9791 {
9792 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9793 }
9794
9795 }
9796
9797 player.GetHumanInventory().ClearUserReservedLocation(this);
9798 }
9799
9802 }
9803
9804
9805
9806
9808 {
9809 return ItemBase.m_DebugActionsMask;
9810 }
9811
9813 {
9814 return ItemBase.m_DebugActionsMask & mask;
9815 }
9816
9818 {
9819 ItemBase.m_DebugActionsMask = mask;
9820 }
9821
9823 {
9824 ItemBase.m_DebugActionsMask |= mask;
9825 }
9826
9828 {
9829 ItemBase.m_DebugActionsMask &= ~mask;
9830 }
9831
9833 {
9835 {
9837 }
9838 else
9839 {
9841 }
9842 }
9843
9844
9846 {
9847 if (GetEconomyProfile())
9848 {
9849 float q_max = GetEconomyProfile().GetQuantityMax();
9850 if (q_max > 0)
9851 {
9852 float q_min = GetEconomyProfile().GetQuantityMin();
9853 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9854
9856 {
9857 ComponentEnergyManager comp = GetCompEM();
9859 {
9861 }
9862 }
9864 {
9866
9867 }
9868
9869 }
9870 }
9871 }
9872
9875 {
9876 EntityAI parent = GetHierarchyParent();
9877
9878 if (parent)
9879 {
9880 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9881 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9882 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9883 }
9884 }
9885
9888 {
9889 EntityAI parent = GetHierarchyParent();
9890
9891 if (parent)
9892 {
9893 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9894 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9895 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9896 }
9897 }
9898
9900 {
9901
9902
9903
9904
9906
9908 {
9909 if (ScriptInputUserData.CanStoreInputUserData())
9910 {
9911 ScriptInputUserData ctx = new ScriptInputUserData;
9917 ctx.
Write(use_stack_max);
9920
9922 {
9923 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9924 }
9925 }
9926 }
9927 else if (!
g_Game.IsMultiplayer())
9928 {
9930 }
9931 }
9932
9934 {
9936 }
9937
9939 {
9941 }
9942
9944 {
9946 }
9947
9949 {
9950
9951 return false;
9952 }
9953
9955 {
9956 return false;
9957 }
9958
9962 {
9963 return false;
9964 }
9965
9967 {
9968 return "";
9969 }
9970
9972
9974 {
9975 return false;
9976 }
9977
9979 {
9980 return true;
9981 }
9982
9983
9984
9986 {
9987 return true;
9988 }
9989
9991 {
9992 return true;
9993 }
9994
9996 {
9997 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9999 }
10000
10002 {
10004 }
10005
10007 {
10009 if (!is_being_placed)
10011 SetSynchDirty();
10012 }
10013
10014
10016
10018 {
10020 }
10021
10023 {
10025 }
10026
10028 {
10029 return 1;
10030 }
10031
10033 {
10034 return false;
10035 }
10036
10038 {
10040 SetSynchDirty();
10041 }
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10078 {
10079 super.OnMovedInsideCargo(container);
10080
10081 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10082 }
10083
10084 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10085 {
10086 super.EEItemLocationChanged(oldLoc, newLoc);
10087
10088 PlayerBase newPlayer = null;
10089 PlayerBase oldPlayer = null;
10090
10091 if (newLoc.GetParent())
10092 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10093
10094 if (oldLoc.GetParent())
10095 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10096
10098 {
10099 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10100
10101 if (rIndex >= 0)
10102 {
10103 InventoryLocation rIl = new InventoryLocation;
10104 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10105
10106 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10109 {
10110 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10111 }
10113 {
10115 }
10116
10117 }
10118 }
10119
10121 {
10122 if (newPlayer)
10123 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10124
10125 if (newPlayer == oldPlayer)
10126 {
10127 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10128 {
10130 {
10131 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10132 {
10133 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10134 }
10135 }
10136 else
10137 {
10138 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10139 }
10140 }
10141
10142 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10143 {
10144 int type = oldLoc.GetType();
10146 {
10147 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10148 }
10150 {
10151 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10152 }
10153 }
10154 if (!m_OldLocation)
10155 {
10156 m_OldLocation = new InventoryLocation;
10157 }
10158 m_OldLocation.Copy(oldLoc);
10159 }
10160 else
10161 {
10162 if (m_OldLocation)
10163 {
10164 m_OldLocation.Reset();
10165 }
10166 }
10167
10168 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10169 }
10170 else
10171 {
10172 if (newPlayer)
10173 {
10174 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10175 if (resIndex >= 0)
10176 {
10177 InventoryLocation il = new InventoryLocation;
10178 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10180 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10183 {
10184 il.
GetParent().GetOnReleaseLock().Invoke(it);
10185 }
10187 {
10189 }
10190
10191 }
10192 }
10194 {
10195
10197 }
10198
10199 if (m_OldLocation)
10200 {
10201 m_OldLocation.Reset();
10202 }
10203 }
10204
10206 {
10207 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10208 }
10209
10211 {
10212 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10213 }
10214 }
10215
10216 override void EOnContact(IEntity other, Contact extra)
10217 {
10219 {
10220 int liquidType = -1;
10222 if (impactSpeed > 0.0)
10223 {
10225 #ifndef SERVER
10227 #else
10229 SetSynchDirty();
10230 #endif
10232 }
10233 }
10234
10235 #ifdef SERVER
10236 if (GetCompEM() && GetCompEM().IsPlugged())
10237 {
10238 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10239 GetCompEM().UnplugThis();
10240 }
10241 #endif
10242 }
10243
10245
10247 {
10249 }
10250
10252 {
10253
10254 }
10255
10257 {
10258 super.OnItemLocationChanged(old_owner, new_owner);
10259
10260 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10261 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10262
10263 if (!relatedPlayer && playerNew)
10264 relatedPlayer = playerNew;
10265
10266 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10267 {
10269 if (actionMgr)
10270 {
10271 ActionBase currentAction = actionMgr.GetRunningAction();
10272 if (currentAction)
10274 }
10275 }
10276
10277 Man ownerPlayerOld = null;
10278 Man ownerPlayerNew = null;
10279
10280 if (old_owner)
10281 {
10282 if (old_owner.
IsMan())
10283 {
10284 ownerPlayerOld = Man.Cast(old_owner);
10285 }
10286 else
10287 {
10288 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10289 }
10290 }
10291 else
10292 {
10294 {
10296
10297 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10298 {
10299 GetCompEM().UnplugThis();
10300 }
10301 }
10302 }
10303
10304 if (new_owner)
10305 {
10306 if (new_owner.
IsMan())
10307 {
10308 ownerPlayerNew = Man.Cast(new_owner);
10309 }
10310 else
10311 {
10312 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10313 }
10314 }
10315
10316 if (ownerPlayerOld != ownerPlayerNew)
10317 {
10318 if (ownerPlayerOld)
10319 {
10320 array<EntityAI> subItemsExit = new array<EntityAI>;
10322 for (int i = 0; i < subItemsExit.Count(); i++)
10323 {
10326 }
10327 }
10328
10329 if (ownerPlayerNew)
10330 {
10331 array<EntityAI> subItemsEnter = new array<EntityAI>;
10333 for (int j = 0; j < subItemsEnter.Count(); j++)
10334 {
10337 }
10338 }
10339 }
10340 else if (ownerPlayerNew != null)
10341 {
10342 PlayerBase nplayer;
10343 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10344 {
10345 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10347 for (int k = 0; k < subItemsUpdate.Count(); k++)
10348 {
10350 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10351 }
10352 }
10353 }
10354
10355 if (old_owner)
10356 old_owner.OnChildItemRemoved(this);
10357 if (new_owner)
10358 new_owner.OnChildItemReceived(this);
10359 }
10360
10361
10363 {
10364 super.EEDelete(parent);
10365 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10366 if (player)
10367 {
10369
10370 if (player.IsAlive())
10371 {
10372 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10373 if (r_index >= 0)
10374 {
10375 InventoryLocation r_il = new InventoryLocation;
10376 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10377
10378 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10381 {
10382 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10383 }
10385 {
10386 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10387 }
10388
10389 }
10390
10391 player.RemoveQuickBarEntityShortcut(this);
10392 }
10393 }
10394 }
10395
10397 {
10398 super.EEKilled(killer);
10399
10402 {
10403 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10404 {
10405 if (IsMagazine())
10406 {
10407 if (Magazine.Cast(this).GetAmmoCount() > 0)
10408 {
10410 }
10411 }
10412 else
10413 {
10415 }
10416 }
10417 }
10418 }
10419
10421 {
10422 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10423
10424 super.OnWasAttached(parent, slot_id);
10425
10428
10431 }
10432
10434 {
10435 super.OnWasDetached(parent, slot_id);
10436
10439
10442 }
10443
10445 {
10446 int idx;
10449
10450 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10451 if (inventory_slots.Count() < 1)
10452 {
10453 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10454 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10455 }
10456 else
10457 {
10458 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10459 }
10460
10461 idx = inventory_slots.Find(slot);
10462 if (idx < 0)
10463 return "";
10464
10465 return attach_types.Get(idx);
10466 }
10467
10469 {
10470 int idx = -1;
10471 string slot;
10472
10475
10476 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10477 if (inventory_slots.Count() < 1)
10478 {
10479 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10480 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10481 }
10482 else
10483 {
10484 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10485 if (detach_types.Count() < 1)
10486 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10487 }
10488
10489 for (int i = 0; i < inventory_slots.Count(); i++)
10490 {
10491 slot = inventory_slots.Get(i);
10492 }
10493
10494 if (slot != "")
10495 {
10496 if (detach_types.Count() == 1)
10497 idx = 0;
10498 else
10499 idx = inventory_slots.Find(slot);
10500 }
10501 if (idx < 0)
10502 return "";
10503
10504 return detach_types.Get(idx);
10505 }
10506
10508 {
10509
10511
10512
10513 float min_time = 1;
10514 float max_time = 3;
10515 float delay = Math.RandomFloat(min_time, max_time);
10516
10517 explode_timer.Run(delay, this, "DoAmmoExplosion");
10518 }
10519
10521 {
10522 Magazine magazine = Magazine.Cast(this);
10523 int pop_sounds_count = 6;
10524 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10525
10526
10527 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10528 string sound_name = pop_sounds[ sound_idx ];
10529 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10530
10531
10532 magazine.ServerAddAmmoCount(-1);
10533
10534
10535 float min_temp_to_explode = 100;
10536
10537 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10538 {
10540 }
10541 }
10542
10543
10544 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10545 {
10546 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10547
10548 const int CHANCE_DAMAGE_CARGO = 4;
10549 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10550 const int CHANCE_DAMAGE_NOTHING = 2;
10551
10553 {
10554 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10555 int chances;
10556 int rnd;
10557
10558 if (GetInventory().GetCargo())
10559 {
10560 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10561 rnd = Math.RandomInt(0,chances);
10562
10563 if (rnd < CHANCE_DAMAGE_CARGO)
10564 {
10566 }
10567 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10568 {
10570 }
10571 }
10572 else
10573 {
10574 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10575 rnd = Math.RandomInt(0,chances);
10576
10577 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10578 {
10580 }
10581 }
10582 }
10583 }
10584
10586 {
10587 CargoBase cargo = GetInventory().GetCargo();
10588 if (cargo)
10589 {
10591 if (item_count > 0)
10592 {
10593 int random_pick = Math.RandomInt(0, item_count);
10595 if (!item.IsExplosive())
10596 {
10597 item.AddHealth("","",damage);
10598 return true;
10599 }
10600 }
10601 }
10602 return false;
10603 }
10604
10606 {
10607 GameInventory inventory = GetInventory();
10609 if (attachment_count > 0)
10610 {
10611 int random_pick = Math.RandomInt(0, attachment_count);
10613 if (!attachment.IsExplosive())
10614 {
10615 attachment.AddHealth("","",damage);
10616 return true;
10617 }
10618 }
10619 return false;
10620 }
10621
10623 {
10625 }
10626
10628 {
10630 return GetInventory().CanRemoveEntity();
10631
10632 return false;
10633 }
10634
10636 {
10637
10639 return false;
10640
10641
10643 return false;
10644
10645
10646
10648 if (delta == 0)
10649 return false;
10650
10651
10652 return true;
10653 }
10654
10656 {
10658 {
10659 if (ScriptInputUserData.CanStoreInputUserData())
10660 {
10661 ScriptInputUserData ctx = new ScriptInputUserData;
10666 ctx.
Write(destination_entity);
10668 ctx.
Write(slot_id);
10670 }
10671 }
10672 else if (!
g_Game.IsMultiplayer())
10673 {
10675 }
10676 }
10677
10679 {
10680 float split_quantity_new;
10684 InventoryLocation loc = new InventoryLocation;
10685
10686 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10687 {
10689 split_quantity_new = stack_max;
10690 else
10692
10694 {
10695 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10696 if (new_item)
10697 {
10698 new_item.SetResultOfSplit(true);
10699 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10701 new_item.
SetQuantity(split_quantity_new,
false,
true);
10702 }
10703 }
10704 }
10705 else if (destination_entity && slot_id == -1)
10706 {
10707 if (quantity > stack_max)
10708 split_quantity_new = stack_max;
10709 else
10710 split_quantity_new = quantity;
10711
10713 {
10714 GameInventory destinationInventory = destination_entity.GetInventory();
10716 {
10719 }
10720
10721 if (new_item)
10722 {
10723 new_item.SetResultOfSplit(true);
10724 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10726 new_item.
SetQuantity(split_quantity_new,
false,
true);
10727 }
10728 }
10729 }
10730 else
10731 {
10732 if (stack_max != 0)
10733 {
10735 {
10737 }
10738
10739 if (split_quantity_new == 0)
10740 {
10741 if (!
g_Game.IsMultiplayer())
10742 player.PhysicalPredictiveDropItem(this);
10743 else
10744 player.ServerDropEntity(this);
10745 return;
10746 }
10747
10749 {
10751
10752 if (new_item)
10753 {
10754 new_item.SetResultOfSplit(true);
10755 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10758 new_item.PlaceOnSurface();
10759 }
10760 }
10761 }
10762 }
10763 }
10764
10766 {
10767 float split_quantity_new;
10771 InventoryLocation loc = new InventoryLocation;
10772
10773 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10774 {
10776 split_quantity_new = stack_max;
10777 else
10779
10781 {
10782 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10783 if (new_item)
10784 {
10785 new_item.SetResultOfSplit(true);
10786 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10788 new_item.
SetQuantity(split_quantity_new,
false,
true);
10789 }
10790 }
10791 }
10792 else if (destination_entity && slot_id == -1)
10793 {
10794 if (quantity > stack_max)
10795 split_quantity_new = stack_max;
10796 else
10797 split_quantity_new = quantity;
10798
10800 {
10801 GameInventory destinationInventory = destination_entity.GetInventory();
10803 {
10806 }
10807
10808 if (new_item)
10809 {
10810 new_item.SetResultOfSplit(true);
10811 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10813 new_item.
SetQuantity(split_quantity_new,
false,
true);
10814 }
10815 }
10816 }
10817 else
10818 {
10819 if (stack_max != 0)
10820 {
10822 {
10824 }
10825
10827 {
10829
10830 if (new_item)
10831 {
10832 new_item.SetResultOfSplit(true);
10833 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10836 new_item.PlaceOnSurface();
10837 }
10838 }
10839 }
10840 }
10841 }
10842
10844 {
10846 {
10847 if (ScriptInputUserData.CanStoreInputUserData())
10848 {
10849 ScriptInputUserData ctx = new ScriptInputUserData;
10854 dst.WriteToContext(ctx);
10856 }
10857 }
10858 else if (!
g_Game.IsMultiplayer())
10859 {
10861 }
10862 }
10863
10865 {
10867 {
10868 if (ScriptInputUserData.CanStoreInputUserData())
10869 {
10870 ScriptInputUserData ctx = new ScriptInputUserData;
10875 ctx.
Write(destination_entity);
10881 }
10882 }
10883 else if (!
g_Game.IsMultiplayer())
10884 {
10886 }
10887 }
10888
10890 {
10892 }
10893
10895 {
10897 float split_quantity_new;
10899 if (dst.IsValid())
10900 {
10901 int slot_id = dst.GetSlot();
10903
10904 if (quantity > stack_max)
10905 split_quantity_new = stack_max;
10906 else
10907 split_quantity_new = quantity;
10908
10910 {
10912
10913 if (new_item)
10914 {
10915 new_item.SetResultOfSplit(true);
10916 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10918 new_item.
SetQuantity(split_quantity_new,
false,
true);
10919 }
10920
10921 return new_item;
10922 }
10923 }
10924
10925 return null;
10926 }
10927
10929 {
10931 float split_quantity_new;
10933 if (destination_entity)
10934 {
10936 if (quantity > stackable)
10937 split_quantity_new = stackable;
10938 else
10939 split_quantity_new = quantity;
10940
10942 {
10943 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10944 if (new_item)
10945 {
10946 new_item.SetResultOfSplit(true);
10947 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10949 new_item.
SetQuantity(split_quantity_new,
false,
true);
10950 }
10951 }
10952 }
10953 }
10954
10956 {
10958 {
10959 if (ScriptInputUserData.CanStoreInputUserData())
10960 {
10961 ScriptInputUserData ctx = new ScriptInputUserData;
10966 ItemBase destination_entity =
this;
10967 ctx.
Write(destination_entity);
10971 }
10972 }
10973 else if (!
g_Game.IsMultiplayer())
10974 {
10976 }
10977 }
10978
10980 {
10982 float split_quantity_new;
10984 if (player)
10985 {
10987 if (quantity > stackable)
10988 split_quantity_new = stackable;
10989 else
10990 split_quantity_new = quantity;
10991
10993 {
10994 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10995 new_item =
ItemBase.Cast(in_hands);
10996 if (new_item)
10997 {
10998 new_item.SetResultOfSplit(true);
10999 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11001 new_item.SetQuantity(split_quantity_new, false, true);
11002 }
11003 }
11004 }
11005 }
11006
11008 {
11010 float split_quantity_new = Math.Floor(quantity * 0.5);
11011
11013 return;
11014
11016
11017 if (new_item)
11018 {
11019 if (new_item.GetQuantityMax() < split_quantity_new)
11020 {
11021 split_quantity_new = new_item.GetQuantityMax();
11022 }
11023
11024 new_item.SetResultOfSplit(true);
11025 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11026
11028 {
11031 }
11032 else
11033 {
11035 new_item.
SetQuantity(split_quantity_new,
false,
true);
11036 }
11037 }
11038 }
11039
11041 {
11043 float split_quantity_new = Math.Floor(quantity / 2);
11044
11046 return;
11047
11048 InventoryLocation invloc = new InventoryLocation;
11050
11052 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11053
11054 if (new_item)
11055 {
11056 if (new_item.GetQuantityMax() < split_quantity_new)
11057 {
11058 split_quantity_new = new_item.GetQuantityMax();
11059 }
11061 {
11064 }
11065 else if (split_quantity_new > 1)
11066 {
11068 new_item.
SetQuantity(split_quantity_new,
false,
true);
11069 }
11070 }
11071 }
11072
11075 {
11076 SetWeightDirty();
11078
11079 if (parent)
11080 parent.OnAttachmentQuantityChangedEx(this, delta);
11081
11083 {
11085 {
11087 }
11089 {
11090 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11092 }
11093 }
11094 }
11095
11098 {
11099
11100 }
11101
11104 {
11106 }
11107
11109 {
11110 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11111
11113 {
11114 if (newLevel == GameConstants.STATE_RUINED)
11115 {
11117 EntityAI parent = GetHierarchyParent();
11118 if (parent && parent.IsFireplace())
11119 {
11120 CargoBase cargo = GetInventory().GetCargo();
11121 if (cargo)
11122 {
11124 {
11126 }
11127 }
11128 }
11129 }
11130
11132 {
11133
11135 return;
11136 }
11137
11138 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11139 {
11141 }
11142 }
11143 }
11144
11145
11147 {
11148 super.OnRightClick();
11149
11151 {
11153 {
11154 if (ScriptInputUserData.CanStoreInputUserData())
11155 {
11156 EntityAI root = GetHierarchyRoot();
11157 Man playerOwner = GetHierarchyRootPlayer();
11158 InventoryLocation dst = new InventoryLocation;
11159
11160
11161 if (!playerOwner && root && root == this)
11162 {
11164 }
11165 else
11166 {
11167
11168 GetInventory().GetCurrentInventoryLocation(dst);
11170 {
11171 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11173 {
11175 }
11176 else
11177 {
11179
11180
11181 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11182 {
11184 }
11185 else
11186 {
11187 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11188 }
11189 }
11190 }
11191 }
11192
11193 ScriptInputUserData ctx = new ScriptInputUserData;
11201 }
11202 }
11203 else if (!
g_Game.IsMultiplayer())
11204 {
11206 }
11207 }
11208 }
11209
11211 {
11212 if (root)
11213 {
11214 vector m4[4];
11215 root.GetTransform(m4);
11216 dst.SetGround(this, m4);
11217 }
11218 else
11219 {
11220 GetInventory().GetCurrentInventoryLocation(dst);
11221 }
11222 }
11223
11224 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11225 {
11226
11227 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11228 return false;
11229
11230 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11231 return false;
11232
11233
11235 return false;
11236
11237
11238 Magazine mag = Magazine.Cast(this);
11239 if (mag)
11240 {
11241 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11242 return false;
11243
11244 if (stack_max_limit)
11245 {
11246 Magazine other_mag = Magazine.Cast(other_item);
11247 if (other_item)
11248 {
11249 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11250 return false;
11251 }
11252
11253 }
11254 }
11255 else
11256 {
11257
11259 return false;
11260
11262 return false;
11263 }
11264
11265 PlayerBase player = null;
11266 if (CastTo(player, GetHierarchyRootPlayer()))
11267 {
11268 if (player.GetInventory().HasAttachment(this))
11269 return false;
11270
11271 if (player.IsItemsToDelete())
11272 return false;
11273 }
11274
11275 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11276 return false;
11277
11278 int slotID;
11280 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11281 return false;
11282
11283 return true;
11284 }
11285
11287 {
11289 }
11290
11292 {
11293 return m_IsResultOfSplit;
11294 }
11295
11297 {
11298 m_IsResultOfSplit = value;
11299 }
11300
11302 {
11304 }
11305
11307 {
11308 float other_item_quantity = other_item.GetQuantity();
11309 float this_free_space;
11310
11312
11314
11315 if (other_item_quantity > this_free_space)
11316 {
11317 return this_free_space;
11318 }
11319 else
11320 {
11321 return other_item_quantity;
11322 }
11323 }
11324
11326 {
11328 }
11329
11331 {
11333 return;
11334
11335 if (!IsMagazine() && other_item)
11336 {
11338 if (quantity_used != 0)
11339 {
11340 float hp1 = GetHealth01("","");
11341 float hp2 = other_item.GetHealth01("","");
11342 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11343 hpResult = hpResult / (
GetQuantity() + quantity_used);
11344
11345 hpResult *= GetMaxHealth();
11346 Math.Round(hpResult);
11347 SetHealth("", "Health", hpResult);
11348
11350 other_item.AddQuantity(-quantity_used);
11351 }
11352 }
11354 }
11355
11357 {
11358 #ifdef SERVER
11359 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11360 GetHierarchyParent().IncreaseLifetimeUp();
11361 #endif
11362 };
11363
11365 {
11366 PlayerBase p = PlayerBase.Cast(player);
11367
11368 array<int> recipesIds = p.m_Recipes;
11369 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11370 if (moduleRecipesManager)
11371 {
11372 EntityAI itemInHands = player.GetEntityInHands();
11373 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11374 }
11375
11376 for (int i = 0;i < recipesIds.Count(); i++)
11377 {
11378 int key = recipesIds.Get(i);
11379 string recipeName = moduleRecipesManager.GetRecipeName(key);
11381 }
11382 }
11383
11384
11385 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11386 {
11387 super.GetDebugActions(outputList);
11388
11389
11395
11396
11401
11406
11407
11411
11412
11414 {
11418 }
11419
11422
11423
11427
11429
11430 InventoryLocation loc = new InventoryLocation();
11431 GetInventory().GetCurrentInventoryLocation(loc);
11433 {
11434 if (Gizmo_IsSupported())
11437 }
11438
11440 }
11441
11442
11443
11444
11446 {
11447 super.OnAction(action_id, player, ctx);
11448
11450 {
11451 switch (action_id)
11452 {
11456 return true;
11460 return true;
11461 }
11462 }
11463
11465 {
11466 switch (action_id)
11467 {
11469 Delete();
11470 return true;
11471 }
11472 }
11473
11474 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11475 {
11476 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11477 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11478 PlayerBase p = PlayerBase.Cast(player);
11479 if (
EActions.RECIPES_RANGE_START < 1000)
11480 {
11481 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11482 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11483 }
11484 }
11485 #ifndef SERVER
11486 else if (action_id ==
EActions.WATCH_PLAYER)
11487 {
11488 PluginDeveloper.SetDeveloperItemClientEx(player);
11489 }
11490 #endif
11492 {
11493 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11494 {
11495 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11496 OnDebugButtonPressServer(id + 1);
11497 }
11498
11499 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11500 {
11501 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11503 }
11504
11505 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11506 {
11507 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11509 }
11510
11511 else if (action_id ==
EActions.ADD_QUANTITY)
11512 {
11513 if (IsMagazine())
11514 {
11515 Magazine mag = Magazine.Cast(this);
11516 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11517 }
11518 else
11519 {
11521 }
11522
11523 if (m_EM)
11524 {
11525 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11526 }
11527
11528 }
11529
11530 else if (action_id ==
EActions.REMOVE_QUANTITY)
11531 {
11532 if (IsMagazine())
11533 {
11534 Magazine mag2 = Magazine.Cast(this);
11535 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11536 }
11537 else
11538 {
11540 }
11541 if (m_EM)
11542 {
11543 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11544 }
11545
11546 }
11547
11548 else if (action_id ==
EActions.SET_QUANTITY_0)
11549 {
11551
11552 if (m_EM)
11553 {
11554 m_EM.SetEnergy(0);
11555 }
11556 }
11557
11558 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11559 {
11561
11562 if (m_EM)
11563 {
11564 m_EM.SetEnergy(m_EM.GetEnergyMax());
11565 }
11566 }
11567
11568 else if (action_id ==
EActions.ADD_HEALTH)
11569 {
11570 AddHealth("","",GetMaxHealth("","Health")/5);
11571 }
11572 else if (action_id ==
EActions.REMOVE_HEALTH)
11573 {
11574 AddHealth("","",-GetMaxHealth("","Health")/5);
11575 }
11576 else if (action_id ==
EActions.DESTROY_HEALTH)
11577 {
11578 SetHealth01("","",0);
11579 }
11580 else if (action_id ==
EActions.WATCH_ITEM)
11581 {
11583 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11584 #ifdef DEVELOPER
11585 SetDebugDeveloper_item(this);
11586 #endif
11587 }
11588
11589 else if (action_id ==
EActions.ADD_TEMPERATURE)
11590 {
11591 AddTemperature(20);
11592
11593 }
11594
11595 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11596 {
11597 AddTemperature(-20);
11598
11599 }
11600
11601 else if (action_id ==
EActions.FLIP_FROZEN)
11602 {
11603 SetFrozen(!GetIsFrozen());
11604
11605 }
11606
11607 else if (action_id ==
EActions.ADD_WETNESS)
11608 {
11610
11611 }
11612
11613 else if (action_id ==
EActions.REMOVE_WETNESS)
11614 {
11616
11617 }
11618
11619 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11620 {
11623
11624
11625 }
11626
11627 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11628 {
11631 }
11632
11633 else if (action_id ==
EActions.MAKE_SPECIAL)
11634 {
11635 auto debugParams = DebugSpawnParams.WithPlayer(player);
11636 OnDebugSpawnEx(debugParams);
11637 }
11638
11639 }
11640
11641
11642 return false;
11643 }
11644
11645
11646
11647
11651
11654
11655
11656
11658 {
11659 return false;
11660 }
11661
11662
11664 {
11665 return true;
11666 }
11667
11668
11670 {
11671 return true;
11672 }
11673
11674
11675
11677 {
11678 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11679 return g_Game.ConfigIsExisting(config_path);
11680 }
11681
11684 {
11685 return null;
11686 }
11687
11689 {
11690 return false;
11691 }
11692
11694 {
11695 return false;
11696 }
11697
11701
11702
11704 {
11705 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11706 return module_repairing.CanRepair(this, item_repair_kit);
11707 }
11708
11709
11710 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11711 {
11712 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11713 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11714 }
11715
11716
11718 {
11719
11720
11721
11722
11723
11724
11725
11726
11727 return 1;
11728 }
11729
11730
11731
11733 {
11735 }
11736
11737
11738
11740 {
11742 }
11743
11744
11753 {
11754 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11755
11756 if (player)
11757 {
11758 player.MessageStatus(text);
11759 }
11760 }
11761
11762
11771 {
11772 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11773
11774 if (player)
11775 {
11776 player.MessageAction(text);
11777 }
11778 }
11779
11780
11789 {
11790 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11791
11792 if (player)
11793 {
11794 player.MessageFriendly(text);
11795 }
11796 }
11797
11798
11807 {
11808 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11809
11810 if (player)
11811 {
11812 player.MessageImportant(text);
11813 }
11814 }
11815
11817 {
11818 return true;
11819 }
11820
11821
11822 override bool KindOf(
string tag)
11823 {
11824 bool found = false;
11825 string item_name = this.
GetType();
11827 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11828
11829 int array_size = item_tag_array.Count();
11830 for (int i = 0; i < array_size; i++)
11831 {
11832 if (item_tag_array.Get(i) == tag)
11833 {
11834 found = true;
11835 break;
11836 }
11837 }
11838 return found;
11839 }
11840
11841
11843 {
11844
11845 super.OnRPC(sender, rpc_type,ctx);
11846
11847
11848 switch (rpc_type)
11849 {
11850 #ifndef SERVER
11851 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11852 Param2<bool, string> p = new Param2<bool, string>(false, "");
11853
11855 return;
11856
11857 bool play = p.param1;
11858 string soundSet = p.param2;
11859
11860 if (play)
11861 {
11863 {
11865 {
11867 }
11868 }
11869 else
11870 {
11872 }
11873 }
11874 else
11875 {
11877 }
11878
11879 break;
11880 #endif
11881
11882 }
11883
11885 {
11887 }
11888 }
11889
11890
11891
11892
11894 {
11895 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11896 return plugin.GetID(
name);
11897 }
11898
11900 {
11901 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11902 return plugin.GetName(id);
11903 }
11904
11907 {
11908
11909
11910 int varFlags;
11911 if (!ctx.
Read(varFlags))
11912 return;
11913
11914 if (varFlags & ItemVariableFlags.FLOAT)
11915 {
11917 }
11918 }
11919
11921 {
11922
11923 super.SerializeNumericalVars(floats_out);
11924
11925
11926
11928 {
11930 }
11931
11933 {
11935 }
11936
11938 {
11940 }
11941
11943 {
11948 }
11949
11951 {
11953 }
11954 }
11955
11957 {
11958
11959 super.DeSerializeNumericalVars(floats);
11960
11961
11962 int index = 0;
11963 int mask = Math.Round(floats.Get(index));
11964
11965 index++;
11966
11968 {
11970 {
11972 }
11973 else
11974 {
11975 float quantity = floats.Get(index);
11976 SetQuantity(quantity,
true,
false,
false,
false);
11977 }
11978 index++;
11979 }
11980
11982 {
11983 float wet = floats.Get(index);
11985 index++;
11986 }
11987
11989 {
11990 int liquidtype = Math.Round(floats.Get(index));
11992 index++;
11993 }
11994
11996 {
11998 index++;
12000 index++;
12002 index++;
12004 index++;
12005 }
12006
12008 {
12009 int cleanness = Math.Round(floats.Get(index));
12011 index++;
12012 }
12013 }
12014
12016 {
12017 super.WriteVarsToCTX(ctx);
12018
12019
12021 {
12023 }
12024
12026 {
12028 }
12029
12031 {
12033 }
12034
12036 {
12037 int r,g,b,a;
12043 }
12044
12046 {
12048 }
12049 }
12050
12052 {
12053 if (!super.ReadVarsFromCTX(ctx,version))
12054 return false;
12055
12056 int intValue;
12057 float value;
12058
12059 if (version < 140)
12060 {
12061 if (!ctx.
Read(intValue))
12062 return false;
12063
12064 m_VariablesMask = intValue;
12065 }
12066
12068 {
12069 if (!ctx.
Read(value))
12070 return false;
12071
12073 {
12075 }
12076 else
12077 {
12079 }
12080 }
12081
12082 if (version < 140)
12083 {
12085 {
12086 if (!ctx.
Read(value))
12087 return false;
12088 SetTemperatureDirect(value);
12089 }
12090 }
12091
12093 {
12094 if (!ctx.
Read(value))
12095 return false;
12097 }
12098
12100 {
12101 if (!ctx.
Read(intValue))
12102 return false;
12104 }
12105
12107 {
12108 int r,g,b,a;
12110 return false;
12112 return false;
12114 return false;
12116 return false;
12117
12119 }
12120
12122 {
12123 if (!ctx.
Read(intValue))
12124 return false;
12126 }
12127
12128 if (version >= 138 && version < 140)
12129 {
12131 {
12132 if (!ctx.
Read(intValue))
12133 return false;
12134 SetFrozen(intValue);
12135 }
12136 }
12137
12138 return true;
12139 }
12140
12141
12143 {
12146 {
12148 }
12149
12150 if (!super.OnStoreLoad(ctx, version))
12151 {
12153 return false;
12154 }
12155
12156 if (version >= 114)
12157 {
12158 bool hasQuickBarIndexSaved;
12159
12160 if (!ctx.
Read(hasQuickBarIndexSaved))
12161 {
12163 return false;
12164 }
12165
12166 if (hasQuickBarIndexSaved)
12167 {
12168 int itmQBIndex;
12169
12170
12171 if (!ctx.
Read(itmQBIndex))
12172 {
12174 return false;
12175 }
12176
12177 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12178 if (itmQBIndex != -1 && parentPlayer)
12179 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12180 }
12181 }
12182 else
12183 {
12184
12185 PlayerBase player;
12186 int itemQBIndex;
12187 if (version ==
int.
MAX)
12188 {
12189 if (!ctx.
Read(itemQBIndex))
12190 {
12192 return false;
12193 }
12194 }
12195 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12196 {
12197
12198 if (!ctx.
Read(itemQBIndex))
12199 {
12201 return false;
12202 }
12203 if (itemQBIndex != -1 && player)
12204 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12205 }
12206 }
12207
12208 if (version < 140)
12209 {
12210
12211 if (!LoadVariables(ctx, version))
12212 {
12214 return false;
12215 }
12216 }
12217
12218
12220 {
12222 return false;
12223 }
12224 if (version >= 132)
12225 {
12227 if (raib)
12228 {
12230 {
12232 return false;
12233 }
12234 }
12235 }
12236
12238 return true;
12239 }
12240
12241
12242
12244 {
12245 super.OnStoreSave(ctx);
12246
12247 PlayerBase player;
12248 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12249 {
12251
12252 int itemQBIndex = -1;
12253 itemQBIndex = player.FindQuickBarEntityIndex(this);
12254 ctx.
Write(itemQBIndex);
12255 }
12256 else
12257 {
12259 }
12260
12262
12264 if (raib)
12265 {
12267 }
12268 }
12269
12270
12272 {
12273 super.AfterStoreLoad();
12274
12276 {
12278 }
12279
12281 {
12284 }
12285 }
12286
12288 {
12289 super.EEOnAfterLoad();
12290
12292 {
12294 }
12295
12298 }
12299
12301 {
12302 return false;
12303 }
12304
12305
12306
12308 {
12310 {
12311 #ifdef PLATFORM_CONSOLE
12312
12314 {
12316 if (menu)
12317 {
12319 }
12320 }
12321 #endif
12322 }
12323
12325 {
12328 }
12329
12331 {
12332 SetWeightDirty();
12334 }
12336 {
12339 }
12340
12342 {
12345
12348 }
12350 {
12354 }
12355
12356 super.OnVariablesSynchronized();
12357 }
12358
12359
12360
12362 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12363 {
12364 if (!IsServerCheck(allow_client))
12365 return false;
12366
12368 return false;
12369
12372
12373 if (value <= (min + 0.001))
12374 value = min;
12375
12376 if (value == min)
12377 {
12378 if (destroy_config)
12379 {
12380 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12381 if (dstr)
12382 {
12384 this.Delete();
12385 return true;
12386 }
12387 }
12388 else if (destroy_forced)
12389 {
12391 this.Delete();
12392 return true;
12393 }
12394
12396 }
12397
12400
12402 {
12403 EntityAI parent = GetHierarchyRoot();
12404 InventoryLocation iLoc = new InventoryLocation();
12405 GetInventory().GetCurrentInventoryLocation(iLoc);
12407 {
12408 int iLocSlot = iLoc.
GetSlot();
12410 {
12412 }
12414 {
12416 }
12417 }
12418 }
12419
12421 {
12423
12424 if (delta)
12426 }
12427
12429
12430 return false;
12431 }
12432
12433
12435 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12436 {
12438 }
12439
12441 {
12444 }
12445
12447 {
12450 }
12451
12453 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12454 {
12455 float value_clamped = Math.Clamp(value, 0, 1);
12457 SetQuantity(result, destroy_config, destroy_forced);
12458 }
12459
12460
12463 {
12465 }
12466
12468 {
12470 }
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12482 {
12483 int slot = -1;
12484 GameInventory inventory = GetInventory();
12485 if (inventory)
12486 {
12487 InventoryLocation il = new InventoryLocation;
12490 }
12491
12493 }
12494
12496 {
12497 float quantity_max = 0;
12498
12500 {
12501 if (attSlotID != -1)
12502 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12503
12504 if (quantity_max <= 0)
12506 }
12507
12508 if (quantity_max <= 0)
12510
12511 return quantity_max;
12512 }
12513
12515 {
12517 }
12518
12520 {
12522 }
12523
12524
12526 {
12528 }
12529
12531 {
12533 }
12534
12536 {
12538 }
12539
12540
12542 {
12543
12544 float weightEx = GetWeightEx();
12545 float special = GetInventoryAndCargoWeight();
12546 return weightEx - special;
12547 }
12548
12549
12551 {
12553 }
12554
12556 {
12558 {
12559 #ifdef DEVELOPER
12560 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12561 {
12562 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12564 }
12565 #endif
12566
12567 return GetQuantity() * GetConfigWeightModified();
12568 }
12569 else if (HasEnergyManager())
12570 {
12571 #ifdef DEVELOPER
12572 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12573 {
12574 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12575 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12576 }
12577 #endif
12578 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12579 }
12580 else
12581 {
12582 #ifdef DEVELOPER
12583 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12584 {
12585 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12586 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12587 }
12588 #endif
12589 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12590 }
12591 }
12592
12595 {
12596 int item_count = 0;
12598
12599 GameInventory inventory = GetInventory();
12600 CargoBase cargo = inventory.
GetCargo();
12601 if (cargo != NULL)
12602 {
12604 }
12605
12607 for (int i = 0; i < nAttachments; ++i)
12608 {
12610 if (item)
12611 item_count += item.GetNumberOfItems();
12612 }
12613 return item_count;
12614 }
12615
12618 {
12619 float weight = 0;
12620 float wetness = 1;
12621 if (include_wetness)
12624 {
12625 weight = wetness * m_ConfigWeight;
12626 }
12628 {
12629 weight = 1;
12630 }
12631 return weight;
12632 }
12633
12634
12635
12637 {
12638 GameInventory inventory = GetInventory();
12639 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12640 {
12641 array<EntityAI> items = new array<EntityAI>;
12643 for (int i = 0; i < items.Count(); ++i)
12644 {
12646 if (item)
12647 {
12648 g_Game.ObjectDelete(item);
12649 }
12650 }
12651 }
12652 }
12653
12654
12655
12656
12658 {
12659 float energy = 0;
12660 if (HasEnergyManager())
12661 {
12662 energy = GetCompEM().GetEnergy();
12663 }
12664 return energy;
12665 }
12666
12667
12669 {
12670 super.OnEnergyConsumed();
12671
12673 }
12674
12676 {
12677 super.OnEnergyAdded();
12678
12680 }
12681
12682
12684 {
12685 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12686 {
12688 {
12689 float energy_0to1 = GetCompEM().GetEnergy0To1();
12691 }
12692 }
12693 }
12694
12695
12697 {
12698 return ConfigGetFloat("heatIsolation");
12699 }
12700
12702 {
12704 }
12705
12707 {
12708 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12709 if (
g_Game.ConfigIsExisting(paramPath))
12710 return g_Game.ConfigGetFloat(paramPath);
12711
12712 return 0.0;
12713 }
12714
12716 {
12717 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12718 if (
g_Game.ConfigIsExisting(paramPath))
12719 return g_Game.ConfigGetFloat(paramPath);
12720
12721 return 0.0;
12722 }
12723
12724 override void SetWet(
float value,
bool allow_client =
false)
12725 {
12726 if (!IsServerCheck(allow_client))
12727 return;
12728
12731
12733
12734 m_VarWet = Math.Clamp(value, min, max);
12735
12737 {
12740 }
12741 }
12742
12743 override void AddWet(
float value)
12744 {
12746 }
12747
12749 {
12751 }
12752
12754 {
12756 }
12757
12759 {
12761 }
12762
12764 {
12766 }
12767
12769 {
12771 }
12772
12773 override void OnWetChanged(
float newVal,
float oldVal)
12774 {
12777 if (newLevel != oldLevel)
12778 {
12780 }
12781 }
12782
12784 {
12785 SetWeightDirty();
12786 }
12787
12789 {
12790 return GetWetLevelInternal(
m_VarWet);
12791 }
12792
12793
12794
12796 {
12798 }
12799
12801 {
12803 }
12804
12806 {
12808 }
12809
12811 {
12813 }
12814
12815
12816
12818 {
12819 if (ConfigIsExisting("itemModelLength"))
12820 {
12821 return ConfigGetFloat("itemModelLength");
12822 }
12823 return 0;
12824 }
12825
12827 {
12828 if (ConfigIsExisting("itemAttachOffset"))
12829 {
12830 return ConfigGetFloat("itemAttachOffset");
12831 }
12832 return 0;
12833 }
12834
12835 override void SetCleanness(
int value,
bool allow_client =
false)
12836 {
12837 if (!IsServerCheck(allow_client))
12838 return;
12839
12841
12843
12846 }
12847
12849 {
12851 }
12852
12854 {
12855 return true;
12856 }
12857
12858
12859
12860
12862 {
12864 }
12865
12867 {
12869 }
12870
12871
12872
12873
12874 override void SetColor(
int r,
int g,
int b,
int a)
12875 {
12881 }
12883 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12884 {
12889 }
12890
12892 {
12894 }
12895
12898 {
12899 int r,g,b,a;
12901 r = r/255;
12902 g = g/255;
12903 b = b/255;
12904 a = a/255;
12905 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12906 }
12907
12908
12909
12910 override void SetLiquidType(
int value,
bool allow_client =
false)
12911 {
12912 if (!IsServerCheck(allow_client))
12913 return;
12914
12919 }
12920
12922 {
12923 return ConfigGetInt("varLiquidTypeInit");
12924 }
12925
12927 {
12929 }
12930
12932 {
12934 SetFrozen(false);
12935 }
12936
12939 {
12940 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12941 }
12942
12943
12946 {
12947 PlayerBase nplayer;
12948 if (PlayerBase.CastTo(nplayer, player))
12949 {
12951 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12952 }
12953 }
12954
12955
12958 {
12959 PlayerBase nplayer;
12960 if (PlayerBase.CastTo(nplayer,player))
12961 {
12962 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12963 }
12964
12965 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12966
12967 if (HasEnergyManager())
12968 {
12969 GetCompEM().UpdatePlugState();
12970 }
12971 }
12972
12973
12975 {
12976 super.OnPlacementStarted(player);
12977
12979 }
12980
12981 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12982 {
12984 {
12985 m_AdminLog.OnPlacementComplete(player,
this);
12986 }
12987
12988 super.OnPlacementComplete(player, position, orientation);
12989 }
12990
12991
12992
12993
12994
12996 {
12998 {
12999 return true;
13000 }
13001 else
13002 {
13003 return false;
13004 }
13005 }
13006
13007
13009 {
13011 {
13013 }
13014 }
13015
13016
13018 {
13020 }
13021
13023 {
13025 }
13026
13027 override void InsertAgent(
int agent,
float count = 1)
13028 {
13029 if (count < 1)
13030 return;
13031
13033 }
13034
13037 {
13039 }
13040
13041
13043 {
13045 }
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13089 {
13091 return false;
13092 return true;
13093 }
13094
13096 {
13097
13099 }
13100
13101
13104 {
13105 super.CheckForRoofLimited(timeTresholdMS);
13106
13107 float time =
g_Game.GetTime();
13108 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13109 {
13110 m_PreviousRoofTestTime = time;
13111 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13112 }
13113 }
13114
13115
13117 {
13119 {
13120 return 0;
13121 }
13122
13123 if (GetInventory().GetAttachmentSlotsCount() != 0)
13124 {
13125 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13126 if (filter)
13127 return filter.GetProtectionLevel(type, false, system);
13128 else
13129 return 0;
13130 }
13131
13132 string subclassPath, entryName;
13133
13134 switch (type)
13135 {
13137 entryName = "biological";
13138 break;
13140 entryName = "chemical";
13141 break;
13142 default:
13143 entryName = "biological";
13144 break;
13145 }
13146
13147 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13148
13149 return g_Game.ConfigGetFloat(subclassPath + entryName);
13150 }
13151
13152
13153
13156 {
13157 if (!IsMagazine())
13159
13161 }
13162
13163
13164
13165
13166
13171 {
13172 return true;
13173 }
13174
13176 {
13178 }
13179
13180
13181
13182
13183
13185 {
13186 if (parent)
13187 {
13188 if (parent.IsInherited(DayZInfected))
13189 return true;
13190
13191 if (!parent.IsRuined())
13192 return true;
13193 }
13194
13195 return true;
13196 }
13197
13199 {
13200 if (!super.CanPutAsAttachment(parent))
13201 {
13202 return false;
13203 }
13204
13205 if (!IsRuined() && !parent.IsRuined())
13206 {
13207 return true;
13208 }
13209
13210 return false;
13211 }
13212
13214 {
13215
13216
13217
13218
13219 return super.CanReceiveItemIntoCargo(item);
13220 }
13221
13223 {
13224
13225
13226
13227
13228 GameInventory attachmentInv = attachment.GetInventory();
13230 {
13231 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13232 return false;
13233 }
13234
13235 InventoryLocation loc = new InventoryLocation();
13236 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13237 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13238 return false;
13239
13240 return super.CanReceiveAttachment(attachment, slotId);
13241 }
13242
13244 {
13245 if (!super.CanReleaseAttachment(attachment))
13246 return false;
13247
13248 return GetInventory().AreChildrenAccessible();
13249 }
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13272 {
13273 int id = muzzle_owner.GetMuzzleID();
13274 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13275
13276 if (WPOF_array)
13277 {
13278 for (int i = 0; i < WPOF_array.Count(); i++)
13279 {
13280 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13281
13282 if (WPOF)
13283 {
13284 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13285 }
13286 }
13287 }
13288 }
13289
13290
13292 {
13293 int id = muzzle_owner.GetMuzzleID();
13295
13296 if (WPOBE_array)
13297 {
13298 for (int i = 0; i < WPOBE_array.Count(); i++)
13299 {
13300 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13301
13302 if (WPOBE)
13303 {
13304 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13305 }
13306 }
13307 }
13308 }
13309
13310
13312 {
13313 int id = muzzle_owner.GetMuzzleID();
13314 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13315
13316 if (WPOOH_array)
13317 {
13318 for (int i = 0; i < WPOOH_array.Count(); i++)
13319 {
13320 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13321
13322 if (WPOOH)
13323 {
13324 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13325 }
13326 }
13327 }
13328 }
13329
13330
13332 {
13333 int id = muzzle_owner.GetMuzzleID();
13334 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13335
13336 if (WPOOH_array)
13337 {
13338 for (int i = 0; i < WPOOH_array.Count(); i++)
13339 {
13340 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13341
13342 if (WPOOH)
13343 {
13344 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13345 }
13346 }
13347 }
13348 }
13349
13350
13352 {
13353 int id = muzzle_owner.GetMuzzleID();
13354 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13355
13356 if (WPOOH_array)
13357 {
13358 for (int i = 0; i < WPOOH_array.Count(); i++)
13359 {
13360 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13361
13362 if (WPOOH)
13363 {
13364 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13365 }
13366 }
13367 }
13368 }
13369
13370
13371
13373 {
13375 {
13376 return true;
13377 }
13378
13379 return false;
13380 }
13381
13383 {
13385 {
13386 return true;
13387 }
13388
13389 return false;
13390 }
13391
13393 {
13395 {
13396 return true;
13397 }
13398
13399 return false;
13400 }
13401
13403 {
13404 return false;
13405 }
13406
13409 {
13410 return UATimeSpent.DEFAULT_DEPLOY;
13411 }
13412
13413
13414
13415
13417 {
13419 SetSynchDirty();
13420 }
13421
13423 {
13425 }
13426
13427
13429 {
13430 return false;
13431 }
13432
13435 {
13436 string att_type = "None";
13437
13438 if (ConfigIsExisting("soundAttType"))
13439 {
13440 att_type = ConfigGetString("soundAttType");
13441 }
13442
13444 }
13445
13447 {
13449 }
13450
13451
13452
13453
13454
13460
13462 {
13465
13467 }
13468
13469
13471 {
13473 return;
13474
13476
13479
13482
13483 SoundParameters params = new SoundParameters();
13487 }
13488
13489
13491 {
13493 {
13496
13497 SetSynchDirty();
13498
13501 }
13502 }
13503
13505 {
13507 }
13508
13509
13511 {
13513 return;
13514
13516 SetSynchDirty();
13517
13520 }
13521
13523 {
13526 }
13527
13529 {
13531 }
13532
13533 void OnApply(PlayerBase player);
13534
13536 {
13537 return 1.0;
13538 };
13539
13541 {
13543 }
13544
13546 {
13548 }
13549
13551
13553 {
13554 SetDynamicPhysicsLifeTime(0.01);
13556 }
13557
13559 {
13560 array<string> zone_names = new array<string>;
13561 GetDamageZones(zone_names);
13562 for (int i = 0; i < zone_names.Count(); i++)
13563 {
13564 SetHealthMax(zone_names.Get(i),"Health");
13565 }
13566 SetHealthMax("","Health");
13567 }
13568
13571 {
13572 float global_health = GetHealth01("","Health");
13573 array<string> zones = new array<string>;
13574 GetDamageZones(zones);
13575
13576 for (int i = 0; i < zones.Count(); i++)
13577 {
13578 SetHealth01(zones.Get(i),"Health",global_health);
13579 }
13580 }
13581
13584 {
13585 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13586 }
13587
13589 {
13590 if (!hasRootAsPlayer)
13591 {
13592 if (refParentIB)
13593 {
13594
13595 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13596 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13597
13598 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13599 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13600
13603 }
13604 else
13605 {
13606
13609 }
13610 }
13611 }
13612
13614 {
13616 {
13617 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13618 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13619 {
13620 float heatPermCoef = 1.0;
13622 while (ent)
13623 {
13624 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13625 ent = ent.GetHierarchyParent();
13626 }
13627
13628 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13629 }
13630 }
13631 }
13632
13634 {
13635
13636 EntityAI parent = GetHierarchyParent();
13637 if (!parent)
13638 {
13639 hasParent = false;
13640 hasRootAsPlayer = false;
13641 }
13642 else
13643 {
13644 hasParent = true;
13645 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13646 refParentIB =
ItemBase.Cast(parent);
13647 }
13648 }
13649
13650 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13651 {
13652
13653 }
13654
13656 {
13657
13658 return false;
13659 }
13660
13662 {
13663
13664
13665 return false;
13666 }
13667
13669 {
13670
13671 return false;
13672 }
13673
13676 {
13677 return !GetIsFrozen() &&
IsOpen();
13678 }
13679
13681 {
13682 bool hasParent = false, hasRootAsPlayer = false;
13684
13685 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13686 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13687
13688 if (wwtu || foodDecay)
13689 {
13693
13694 if (processWetness || processTemperature || processDecay)
13695 {
13697
13698 if (processWetness)
13699 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13700
13701 if (processTemperature)
13703
13704 if (processDecay)
13705 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13706 }
13707 }
13708 }
13709
13712 {
13714 }
13715
13717 {
13720
13721 return super.GetTemperatureFreezeThreshold();
13722 }
13723
13725 {
13728
13729 return super.GetTemperatureThawThreshold();
13730 }
13731
13733 {
13736
13737 return super.GetItemOverheatThreshold();
13738 }
13739
13741 {
13743 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13744
13745 return super.GetTemperatureFreezeTime();
13746 }
13747
13749 {
13751 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13752
13753 return super.GetTemperatureThawTime();
13754 }
13755
13760
13762 {
13763 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13764 }
13765
13767 {
13768 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13769 }
13770
13773 {
13775 }
13776
13778 {
13780 }
13781
13783 {
13785 }
13786
13789 {
13790 return null;
13791 }
13792
13795 {
13796 return false;
13797 }
13798
13800 {
13802 {
13805 if (!trg)
13806 {
13808 explosive = this;
13809 }
13810
13811 explosive.PairRemote(trg);
13813
13814 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13815 trg.SetPersistentPairID(persistentID);
13816 explosive.SetPersistentPairID(persistentID);
13817
13818 return true;
13819 }
13820 return false;
13821 }
13822
13825 {
13826 float ret = 1.0;
13829 ret *= GetHealth01();
13830
13831 return ret;
13832 }
13833
13834 #ifdef DEVELOPER
13835 override void SetDebugItem()
13836 {
13837 super.SetDebugItem();
13838 _itemBase = this;
13839 }
13840
13842 {
13843 string text = super.GetDebugText();
13844
13846 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13847
13848 return text;
13849 }
13850 #endif
13851
13853 {
13854 return true;
13855 }
13856
13858
13860
13862 {
13865 }
13866
13867
13875
13891
13892 [
Obsolete(
"Use ItemSoundHandler instead")]
13895 {
13896 if (!
g_Game.IsDedicatedServer())
13897 {
13898 if (ConfigIsExisting("attachSoundSet"))
13899 {
13900 string cfg_path = "";
13901 string soundset = "";
13902 string type_name =
GetType();
13903
13906 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13907 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13908
13909 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13910 {
13911 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13912 {
13913 if (cfg_slot_array[i] == slot_type)
13914 {
13915 soundset = cfg_soundset_array[i];
13916 break;
13917 }
13918 }
13919 }
13920
13921 if (soundset != "")
13922 {
13923 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13925 }
13926 }
13927 }
13928 }
13929
13931}
13932
13934{
13936 if (entity)
13937 {
13938 bool is_item = entity.IsInherited(
ItemBase);
13939 if (is_item && full_quantity)
13940 {
13943 }
13944 }
13945 else
13946 {
13948 return NULL;
13949 }
13950 return entity;
13951}
13952
13954{
13955 if (item)
13956 {
13957 if (health > 0)
13958 item.SetHealth("", "", health);
13959
13960 if (item.CanHaveTemperature())
13961 {
13963 if (item.CanFreeze())
13964 item.SetFrozen(false);
13965 }
13966
13967 if (item.HasEnergyManager())
13968 {
13969 if (quantity >= 0)
13970 {
13971 item.GetCompEM().SetEnergy0To1(quantity);
13972 }
13973 else
13974 {
13976 }
13977 }
13978 else if (item.IsMagazine())
13979 {
13980 Magazine mag = Magazine.Cast(item);
13981 if (quantity >= 0)
13982 {
13983 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13984 }
13985 else
13986 {
13988 }
13989
13990 }
13991 else
13992 {
13993 if (quantity >= 0)
13994 {
13995 item.SetQuantityNormalized(quantity, false);
13996 }
13997 else
13998 {
14000 }
14001
14002 }
14003 }
14004}
14005
14006#ifdef DEVELOPER
14008#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.