9116{
9118 {
9119 return true;
9120 }
9121};
9122
9124{
9125
9126};
9127
9128
9129
9131{
9135
9137
9140
9141
9142
9143
9144
9153
9159
9164
9169
9190 protected bool m_IsResultOfSplit
9191
9193
9198
9199
9200
9202
9206
9207
9208
9210
9213
9214
9215
9221
9222
9230
9233
9234
9236
9237
9239
9240
9245
9246
9251
9253
9254
9256
9257
9259 {
9264
9265 if (!
g_Game.IsDedicatedServer())
9266 {
9268 {
9270
9272 {
9274 }
9275 }
9276
9279 }
9280
9281 m_OldLocation = null;
9282
9284 {
9286 }
9287
9288 if (ConfigIsExisting("headSelectionsToHide"))
9289 {
9292 }
9293
9295 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9296 {
9298 }
9299
9301
9302 m_IsResultOfSplit = false;
9303
9305 }
9306
9308 {
9309 super.InitItemVariables();
9310
9316 m_Count = ConfigGetInt(
"count");
9317
9320
9325
9328
9333
9345
9349
9350
9353 if (ConfigIsExisting("canBeSplit"))
9354 {
9357 }
9358
9360 if (ConfigIsExisting("itemBehaviour"))
9362
9363
9366 RegisterNetSyncVariableInt("m_VarLiquidType");
9367 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9368
9369 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9370 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9371 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9372
9373 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9374 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9375 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9376 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9377
9378 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9379 RegisterNetSyncVariableBool("m_IsTakeable");
9380 RegisterNetSyncVariableBool("m_IsHologram");
9381
9384 {
9387 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9388 }
9389
9391
9393 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9395
9397 }
9398
9400 {
9402 }
9403
9405 {
9408 {
9413 }
9414 }
9415
9416 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9417 {
9419 {
9422 }
9423
9425 }
9426
9428 {
9434 }
9435
9437
9439 {
9441
9442 if (!action)
9443 {
9444 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9445 return;
9446 }
9447
9449 if (!ai)
9450 {
9452 return;
9453 }
9454
9456 if (!action_array)
9457 {
9458 action_array = new array<ActionBase_Basic>;
9460 }
9461 if (LogManager.IsActionLogEnable())
9462 {
9463 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9464 }
9465
9466 if (action_array.Find(action) != -1)
9467 {
9468 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9469 }
9470 else
9471 {
9472 action_array.Insert(action);
9473 }
9474 }
9475
9477 {
9478 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9479 ActionBase action = player.GetActionManager().GetAction(actionName);
9482
9483 if (action_array)
9484 {
9485 action_array.RemoveItem(action);
9486 }
9487 }
9488
9489
9490
9492 {
9493 ActionOverrideData overrideData = new ActionOverrideData();
9497
9499 if (!actionMap)
9500 {
9503 }
9504
9505 actionMap.Insert(this.
Type(), overrideData);
9506
9507 }
9508
9510
9512
9513
9515 {
9518
9521
9522 string config_to_search = "CfgVehicles";
9523 string muzzle_owner_config;
9524
9526 {
9527 if (IsInherited(Weapon))
9528 config_to_search = "CfgWeapons";
9529
9530 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9531
9532 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9533
9534 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9535
9536 if (config_OnFire_subclass_count > 0)
9537 {
9538 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9539
9540 for (int i = 0; i < config_OnFire_subclass_count; i++)
9541 {
9542 string particle_class = "";
9543 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9544 string config_OnFire_entry = config_OnFire_class + particle_class;
9545 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9546 WPOF_array.Insert(WPOF);
9547 }
9548
9549
9551 }
9552 }
9553
9555 {
9556 config_to_search = "CfgWeapons";
9557 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9558
9559 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9560
9561 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9562
9563 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9564 {
9565 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9566
9567 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9568 {
9569 string particle_class2 = "";
9570 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9571 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9572 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9573 WPOBE_array.Insert(WPOBE);
9574 }
9575
9576
9578 }
9579 }
9580 }
9581
9582
9584 {
9587
9589 {
9590 string config_to_search = "CfgVehicles";
9591
9592 if (IsInherited(Weapon))
9593 config_to_search = "CfgWeapons";
9594
9595 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9596 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9597
9598 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9599 {
9600
9602
9604 {
9606 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9608 return;
9609 }
9610
9613
9614
9615
9616 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9617 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9618
9619 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9620 {
9621 string particle_class = "";
9622 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9623 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9624 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9625
9626 if (entry_type == CT_CLASS)
9627 {
9628 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9629 WPOOH_array.Insert(WPOF);
9630 }
9631 }
9632
9633
9635 }
9636 }
9637 }
9638
9640 {
9642 }
9643
9645 {
9647 {
9649
9652
9655
9656 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9657 }
9658 }
9659
9661 {
9663 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9664
9666 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9667
9669 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9670
9672 {
9674 }
9675 }
9676
9678 {
9680 }
9681
9683 {
9686 else
9688
9690 {
9693 }
9694 else
9695 {
9698
9701 }
9702
9704 }
9705
9707 {
9709 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9710 }
9711
9713 {
9715 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9717 }
9718
9720 {
9722 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9723 }
9724
9726 {
9729
9730 OverheatingParticle OP = new OverheatingParticle();
9735
9737 }
9738
9740 {
9743
9744 return -1;
9745 }
9746
9748 {
9750 {
9753
9754 for (int i = count; i > 0; --i)
9755 {
9756 int id = i - 1;
9759
9762
9763 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9764 {
9765 if (p)
9766 {
9769 }
9770 }
9771 }
9772 }
9773 }
9774
9776 {
9778 {
9780 {
9781 int id = i - 1;
9783
9784 if (OP)
9785 {
9787
9788 if (p)
9789 {
9791 }
9792
9793 delete OP;
9794 }
9795 }
9796
9799 }
9800 }
9801
9804 {
9805 return 0.0;
9806 }
9807
9808
9810 {
9811 return 250;
9812 }
9813
9815 {
9816 return 0;
9817 }
9818
9821 {
9823 return true;
9824
9825 return false;
9826 }
9827
9830 {
9833
9835 {
9837 }
9838 else
9839 {
9840
9842 }
9843
9845 }
9846
9853 {
9854 return -1;
9855 }
9856
9857
9858
9859
9861 {
9863 {
9864 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9865 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9866
9867 if (r_index >= 0)
9868 {
9869 InventoryLocation r_il = new InventoryLocation;
9870 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9871
9872 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9875 {
9876 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9877 }
9879 {
9880 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9881 }
9882
9883 }
9884
9885 player.GetHumanInventory().ClearUserReservedLocation(this);
9886 }
9887
9890 }
9891
9892
9893
9894
9896 {
9897 return ItemBase.m_DebugActionsMask;
9898 }
9899
9901 {
9902 return ItemBase.m_DebugActionsMask & mask;
9903 }
9904
9906 {
9907 ItemBase.m_DebugActionsMask = mask;
9908 }
9909
9911 {
9912 ItemBase.m_DebugActionsMask |= mask;
9913 }
9914
9916 {
9917 ItemBase.m_DebugActionsMask &= ~mask;
9918 }
9919
9921 {
9923 {
9925 }
9926 else
9927 {
9929 }
9930 }
9931
9932
9934 {
9935 if (GetEconomyProfile())
9936 {
9937 float q_max = GetEconomyProfile().GetQuantityMax();
9938 if (q_max > 0)
9939 {
9940 float q_min = GetEconomyProfile().GetQuantityMin();
9941 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9942
9944 {
9945 ComponentEnergyManager comp = GetCompEM();
9947 {
9949 }
9950 }
9952 {
9954
9955 }
9956
9957 }
9958 }
9959 }
9960
9963 {
9964 EntityAI parent = GetHierarchyParent();
9965
9966 if (parent)
9967 {
9968 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9969 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9970 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9971 }
9972 }
9973
9976 {
9977 EntityAI parent = GetHierarchyParent();
9978
9979 if (parent)
9980 {
9981 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9982 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9983 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9984 }
9985 }
9986
9988 {
9989
9990
9991
9992
9994
9996 {
9997 if (ScriptInputUserData.CanStoreInputUserData())
9998 {
9999 ScriptInputUserData ctx = new ScriptInputUserData;
10005 ctx.
Write(use_stack_max);
10008
10010 {
10011 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10012 }
10013 }
10014 }
10015 else if (!
g_Game.IsMultiplayer())
10016 {
10018 }
10019 }
10020
10022 {
10024 }
10025
10027 {
10029 }
10030
10032 {
10034 }
10035
10037 {
10038
10039 return false;
10040 }
10041
10043 {
10044 return false;
10045 }
10046
10050 {
10051 return false;
10052 }
10053
10055 {
10056 return "";
10057 }
10058
10060
10062 {
10063 return false;
10064 }
10065
10067 {
10068 return true;
10069 }
10070
10071
10072
10074 {
10075 return true;
10076 }
10077
10079 {
10080 return true;
10081 }
10082
10084 {
10085 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10087 }
10088
10090 {
10092 }
10093
10095 {
10097 if (!is_being_placed)
10099 SetSynchDirty();
10100 }
10101
10102
10104
10106 {
10108 }
10109
10111 {
10113 }
10114
10116 {
10117 return 1;
10118 }
10119
10121 {
10122 return false;
10123 }
10124
10126 {
10128 SetSynchDirty();
10129 }
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10166 {
10167 super.OnMovedInsideCargo(container);
10168
10169 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10170 }
10171
10172 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10173 {
10174 super.EEItemLocationChanged(oldLoc, newLoc);
10175
10176 PlayerBase newPlayer = null;
10177 PlayerBase oldPlayer = null;
10178
10179 if (newLoc.GetParent())
10180 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10181
10182 if (oldLoc.GetParent())
10183 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10184
10186 {
10187 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10188
10189 if (rIndex >= 0)
10190 {
10191 InventoryLocation rIl = new InventoryLocation;
10192 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10193
10194 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10197 {
10198 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10199 }
10201 {
10203 }
10204
10205 }
10206 }
10207
10209 {
10210 if (newPlayer)
10211 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10212
10213 if (newPlayer == oldPlayer)
10214 {
10215 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10216 {
10218 {
10219 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10220 {
10221 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10222 }
10223 }
10224 else
10225 {
10226 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10227 }
10228 }
10229
10230 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10231 {
10232 int type = oldLoc.GetType();
10234 {
10235 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10236 }
10238 {
10239 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10240 }
10241 }
10242 if (!m_OldLocation)
10243 {
10244 m_OldLocation = new InventoryLocation;
10245 }
10246 m_OldLocation.Copy(oldLoc);
10247 }
10248 else
10249 {
10250 if (m_OldLocation)
10251 {
10252 m_OldLocation.Reset();
10253 }
10254 }
10255
10256 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10257 }
10258 else
10259 {
10260 if (newPlayer)
10261 {
10262 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10263 if (resIndex >= 0)
10264 {
10265 InventoryLocation il = new InventoryLocation;
10266 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10268 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10271 {
10272 il.
GetParent().GetOnReleaseLock().Invoke(it);
10273 }
10275 {
10277 }
10278
10279 }
10280 }
10282 {
10283
10285 }
10286
10287 if (m_OldLocation)
10288 {
10289 m_OldLocation.Reset();
10290 }
10291 }
10292
10294 {
10295 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10296 }
10297
10299 {
10300 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10301 }
10302 }
10303
10304 override void EOnContact(IEntity other, Contact extra)
10305 {
10307 {
10308 int liquidType = -1;
10310 if (impactSpeed > 0.0)
10311 {
10313 #ifndef SERVER
10315 #else
10317 SetSynchDirty();
10318 #endif
10320 }
10321 }
10322
10323 #ifdef SERVER
10324 if (GetCompEM() && GetCompEM().IsPlugged())
10325 {
10326 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10327 GetCompEM().UnplugThis();
10328 }
10329 #endif
10330 }
10331
10333
10335 {
10337 }
10338
10340 {
10341
10342 }
10343
10345 {
10346 super.OnItemLocationChanged(old_owner, new_owner);
10347
10348 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10349 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10350
10351 if (!relatedPlayer && playerNew)
10352 relatedPlayer = playerNew;
10353
10354 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10355 {
10357 if (actionMgr)
10358 {
10359 ActionBase currentAction = actionMgr.GetRunningAction();
10360 if (currentAction)
10362 }
10363 }
10364
10365 Man ownerPlayerOld = null;
10366 Man ownerPlayerNew = null;
10367
10368 if (old_owner)
10369 {
10370 if (old_owner.
IsMan())
10371 {
10372 ownerPlayerOld = Man.Cast(old_owner);
10373 }
10374 else
10375 {
10376 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10377 }
10378 }
10379 else
10380 {
10382 {
10384
10385 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10386 {
10387 GetCompEM().UnplugThis();
10388 }
10389 }
10390 }
10391
10392 if (new_owner)
10393 {
10394 if (new_owner.
IsMan())
10395 {
10396 ownerPlayerNew = Man.Cast(new_owner);
10397 }
10398 else
10399 {
10400 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10401 }
10402 }
10403
10404 if (ownerPlayerOld != ownerPlayerNew)
10405 {
10406 if (ownerPlayerOld)
10407 {
10408 array<EntityAI> subItemsExit = new array<EntityAI>;
10410 for (int i = 0; i < subItemsExit.Count(); i++)
10411 {
10414 }
10415 }
10416
10417 if (ownerPlayerNew)
10418 {
10419 array<EntityAI> subItemsEnter = new array<EntityAI>;
10421 for (int j = 0; j < subItemsEnter.Count(); j++)
10422 {
10425 }
10426 }
10427 }
10428 else if (ownerPlayerNew != null)
10429 {
10430 PlayerBase nplayer;
10431 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10432 {
10433 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10435 for (int k = 0; k < subItemsUpdate.Count(); k++)
10436 {
10438 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10439 }
10440 }
10441 }
10442
10443 if (old_owner)
10444 old_owner.OnChildItemRemoved(this);
10445 if (new_owner)
10446 new_owner.OnChildItemReceived(this);
10447 }
10448
10449
10451 {
10452 super.EEDelete(parent);
10453 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10454 if (player)
10455 {
10457
10458 if (player.IsAlive())
10459 {
10460 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10461 if (r_index >= 0)
10462 {
10463 InventoryLocation r_il = new InventoryLocation;
10464 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10465
10466 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10469 {
10470 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10471 }
10473 {
10474 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10475 }
10476
10477 }
10478
10479 player.RemoveQuickBarEntityShortcut(this);
10480 }
10481 }
10482 }
10483
10485 {
10486 super.EEKilled(killer);
10487
10490 {
10491 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10492 {
10493 if (IsMagazine())
10494 {
10495 if (Magazine.Cast(this).GetAmmoCount() > 0)
10496 {
10498 }
10499 }
10500 else
10501 {
10503 }
10504 }
10505 }
10506 }
10507
10509 {
10510 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10511
10512 super.OnWasAttached(parent, slot_id);
10513
10516
10519 }
10520
10522 {
10523 super.OnWasDetached(parent, slot_id);
10524
10527
10530 }
10531
10533 {
10534 int idx;
10537
10538 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10539 if (inventory_slots.Count() < 1)
10540 {
10541 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10542 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10543 }
10544 else
10545 {
10546 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10547 }
10548
10549 idx = inventory_slots.Find(slot);
10550 if (idx < 0)
10551 return "";
10552
10553 return attach_types.Get(idx);
10554 }
10555
10557 {
10558 int idx = -1;
10559 string slot;
10560
10563
10564 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10565 if (inventory_slots.Count() < 1)
10566 {
10567 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10568 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10569 }
10570 else
10571 {
10572 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10573 if (detach_types.Count() < 1)
10574 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10575 }
10576
10577 for (int i = 0; i < inventory_slots.Count(); i++)
10578 {
10579 slot = inventory_slots.Get(i);
10580 }
10581
10582 if (slot != "")
10583 {
10584 if (detach_types.Count() == 1)
10585 idx = 0;
10586 else
10587 idx = inventory_slots.Find(slot);
10588 }
10589 if (idx < 0)
10590 return "";
10591
10592 return detach_types.Get(idx);
10593 }
10594
10596 {
10597
10599
10600
10601 float min_time = 1;
10602 float max_time = 3;
10603 float delay = Math.RandomFloat(min_time, max_time);
10604
10605 explode_timer.Run(delay, this, "DoAmmoExplosion");
10606 }
10607
10609 {
10610 Magazine magazine = Magazine.Cast(this);
10611 int pop_sounds_count = 6;
10612 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10613
10614
10615 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10616 string sound_name = pop_sounds[ sound_idx ];
10617 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10618
10619
10620 magazine.ServerAddAmmoCount(-1);
10621
10622
10623 float min_temp_to_explode = 100;
10624
10625 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10626 {
10628 }
10629 }
10630
10631
10632 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10633 {
10634 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10635
10636 const int CHANCE_DAMAGE_CARGO = 4;
10637 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10638 const int CHANCE_DAMAGE_NOTHING = 2;
10639
10641 {
10642 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10643 int chances;
10644 int rnd;
10645
10646 if (GetInventory().GetCargo())
10647 {
10648 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10649 rnd = Math.RandomInt(0,chances);
10650
10651 if (rnd < CHANCE_DAMAGE_CARGO)
10652 {
10654 }
10655 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10656 {
10658 }
10659 }
10660 else
10661 {
10662 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10663 rnd = Math.RandomInt(0,chances);
10664
10665 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10666 {
10668 }
10669 }
10670 }
10671 }
10672
10674 {
10675 CargoBase cargo = GetInventory().GetCargo();
10676 if (cargo)
10677 {
10679 if (item_count > 0)
10680 {
10681 int random_pick = Math.RandomInt(0, item_count);
10683 if (!item.IsExplosive())
10684 {
10685 item.AddHealth("","",damage);
10686 return true;
10687 }
10688 }
10689 }
10690 return false;
10691 }
10692
10694 {
10695 GameInventory inventory = GetInventory();
10697 if (attachment_count > 0)
10698 {
10699 int random_pick = Math.RandomInt(0, attachment_count);
10701 if (!attachment.IsExplosive())
10702 {
10703 attachment.AddHealth("","",damage);
10704 return true;
10705 }
10706 }
10707 return false;
10708 }
10709
10711 {
10713 }
10714
10716 {
10718 return GetInventory().CanRemoveEntity();
10719
10720 return false;
10721 }
10722
10724 {
10725
10727 return false;
10728
10729
10731 return false;
10732
10733
10734
10736 if (delta == 0)
10737 return false;
10738
10739
10740 return true;
10741 }
10742
10744 {
10746 {
10747 if (ScriptInputUserData.CanStoreInputUserData())
10748 {
10749 ScriptInputUserData ctx = new ScriptInputUserData;
10754 ctx.
Write(destination_entity);
10756 ctx.
Write(slot_id);
10758 }
10759 }
10760 else if (!
g_Game.IsMultiplayer())
10761 {
10763 }
10764 }
10765
10767 {
10768 float split_quantity_new;
10772 InventoryLocation loc = new InventoryLocation;
10773
10774 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10775 {
10777 split_quantity_new = stack_max;
10778 else
10780
10782 {
10783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10784 if (new_item)
10785 {
10786 new_item.SetResultOfSplit(true);
10787 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10789 new_item.
SetQuantity(split_quantity_new,
false,
true);
10790 }
10791 }
10792 }
10793 else if (destination_entity && slot_id == -1)
10794 {
10795 if (quantity > stack_max)
10796 split_quantity_new = stack_max;
10797 else
10798 split_quantity_new = quantity;
10799
10801 {
10802 GameInventory destinationInventory = destination_entity.GetInventory();
10804 {
10807 }
10808
10809 if (new_item)
10810 {
10811 new_item.SetResultOfSplit(true);
10812 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10814 new_item.
SetQuantity(split_quantity_new,
false,
true);
10815 }
10816 }
10817 }
10818 else
10819 {
10820 if (stack_max != 0)
10821 {
10823 {
10825 }
10826
10827 if (split_quantity_new == 0)
10828 {
10829 if (!
g_Game.IsMultiplayer())
10830 player.PhysicalPredictiveDropItem(this);
10831 else
10832 player.ServerDropEntity(this);
10833 return;
10834 }
10835
10837 {
10839
10840 if (new_item)
10841 {
10842 new_item.SetResultOfSplit(true);
10843 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10846 new_item.PlaceOnSurface();
10847 }
10848 }
10849 }
10850 }
10851 }
10852
10854 {
10855 float split_quantity_new;
10859 InventoryLocation loc = new InventoryLocation;
10860
10861 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10862 {
10864 split_quantity_new = stack_max;
10865 else
10867
10869 {
10870 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10871 if (new_item)
10872 {
10873 new_item.SetResultOfSplit(true);
10874 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10876 new_item.
SetQuantity(split_quantity_new,
false,
true);
10877 }
10878 }
10879 }
10880 else if (destination_entity && slot_id == -1)
10881 {
10882 if (quantity > stack_max)
10883 split_quantity_new = stack_max;
10884 else
10885 split_quantity_new = quantity;
10886
10888 {
10889 GameInventory destinationInventory = destination_entity.GetInventory();
10891 {
10894 }
10895
10896 if (new_item)
10897 {
10898 new_item.SetResultOfSplit(true);
10899 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10901 new_item.
SetQuantity(split_quantity_new,
false,
true);
10902 }
10903 }
10904 }
10905 else
10906 {
10907 if (stack_max != 0)
10908 {
10910 {
10912 }
10913
10915 {
10917
10918 if (new_item)
10919 {
10920 new_item.SetResultOfSplit(true);
10921 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10924 new_item.PlaceOnSurface();
10925 }
10926 }
10927 }
10928 }
10929 }
10930
10932 {
10934 {
10935 if (ScriptInputUserData.CanStoreInputUserData())
10936 {
10937 ScriptInputUserData ctx = new ScriptInputUserData;
10942 dst.WriteToContext(ctx);
10944 }
10945 }
10946 else if (!
g_Game.IsMultiplayer())
10947 {
10949 }
10950 }
10951
10953 {
10955 {
10956 if (ScriptInputUserData.CanStoreInputUserData())
10957 {
10958 ScriptInputUserData ctx = new ScriptInputUserData;
10963 ctx.
Write(destination_entity);
10969 }
10970 }
10971 else if (!
g_Game.IsMultiplayer())
10972 {
10974 }
10975 }
10976
10978 {
10980 }
10981
10983 {
10985 float split_quantity_new;
10987 if (dst.IsValid())
10988 {
10989 int slot_id = dst.GetSlot();
10991
10992 if (quantity > stack_max)
10993 split_quantity_new = stack_max;
10994 else
10995 split_quantity_new = quantity;
10996
10998 {
11000
11001 if (new_item)
11002 {
11003 new_item.SetResultOfSplit(true);
11004 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11006 new_item.
SetQuantity(split_quantity_new,
false,
true);
11007 }
11008
11009 return new_item;
11010 }
11011 }
11012
11013 return null;
11014 }
11015
11017 {
11019 float split_quantity_new;
11021 if (destination_entity)
11022 {
11024 if (quantity > stackable)
11025 split_quantity_new = stackable;
11026 else
11027 split_quantity_new = quantity;
11028
11030 {
11031 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11032 if (new_item)
11033 {
11034 new_item.SetResultOfSplit(true);
11035 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11037 new_item.
SetQuantity(split_quantity_new,
false,
true);
11038 }
11039 }
11040 }
11041 }
11042
11044 {
11046 {
11047 if (ScriptInputUserData.CanStoreInputUserData())
11048 {
11049 ScriptInputUserData ctx = new ScriptInputUserData;
11054 ItemBase destination_entity =
this;
11055 ctx.
Write(destination_entity);
11059 }
11060 }
11061 else if (!
g_Game.IsMultiplayer())
11062 {
11064 }
11065 }
11066
11068 {
11070 float split_quantity_new;
11072 if (player)
11073 {
11075 if (quantity > stackable)
11076 split_quantity_new = stackable;
11077 else
11078 split_quantity_new = quantity;
11079
11081 {
11082 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11083 new_item =
ItemBase.Cast(in_hands);
11084 if (new_item)
11085 {
11086 new_item.SetResultOfSplit(true);
11087 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11089 new_item.SetQuantity(split_quantity_new, false, true);
11090 }
11091 }
11092 }
11093 }
11094
11096 {
11098 float split_quantity_new = Math.Floor(quantity * 0.5);
11099
11101 return;
11102
11104
11105 if (new_item)
11106 {
11107 if (new_item.GetQuantityMax() < split_quantity_new)
11108 {
11109 split_quantity_new = new_item.GetQuantityMax();
11110 }
11111
11112 new_item.SetResultOfSplit(true);
11113 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11114
11116 {
11119 }
11120 else
11121 {
11123 new_item.
SetQuantity(split_quantity_new,
false,
true);
11124 }
11125 }
11126 }
11127
11129 {
11131 float split_quantity_new = Math.Floor(quantity / 2);
11132
11134 return;
11135
11136 InventoryLocation invloc = new InventoryLocation;
11138
11140 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11141
11142 if (new_item)
11143 {
11144 if (new_item.GetQuantityMax() < split_quantity_new)
11145 {
11146 split_quantity_new = new_item.GetQuantityMax();
11147 }
11149 {
11152 }
11153 else if (split_quantity_new > 1)
11154 {
11156 new_item.
SetQuantity(split_quantity_new,
false,
true);
11157 }
11158 }
11159 }
11160
11163 {
11164 SetWeightDirty();
11166
11167 if (parent)
11168 parent.OnAttachmentQuantityChangedEx(this, delta);
11169
11171 {
11173 {
11175 }
11177 {
11178 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11180 }
11181 }
11182 }
11183
11186 {
11187
11188 }
11189
11192 {
11194 }
11195
11197 {
11198 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11199
11201 {
11202 if (newLevel == GameConstants.STATE_RUINED)
11203 {
11205 EntityAI parent = GetHierarchyParent();
11206 if (parent && parent.IsFireplace())
11207 {
11208 CargoBase cargo = GetInventory().GetCargo();
11209 if (cargo)
11210 {
11212 {
11214 }
11215 }
11216 }
11217 }
11218
11220 {
11221
11223 return;
11224 }
11225
11226 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11227 {
11229 }
11230 }
11231 }
11232
11233
11235 {
11236 super.OnRightClick();
11237
11239 {
11241 {
11242 if (ScriptInputUserData.CanStoreInputUserData())
11243 {
11244 EntityAI root = GetHierarchyRoot();
11245 Man playerOwner = GetHierarchyRootPlayer();
11246 InventoryLocation dst = new InventoryLocation;
11247
11248
11249 if (!playerOwner && root && root == this)
11250 {
11252 }
11253 else
11254 {
11255
11256 GetInventory().GetCurrentInventoryLocation(dst);
11258 {
11259 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11261 {
11263 }
11264 else
11265 {
11267
11268
11269 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11270 {
11272 }
11273 else
11274 {
11275 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11276 }
11277 }
11278 }
11279 }
11280
11281 ScriptInputUserData ctx = new ScriptInputUserData;
11289 }
11290 }
11291 else if (!
g_Game.IsMultiplayer())
11292 {
11294 }
11295 }
11296 }
11297
11299 {
11300 if (root)
11301 {
11302 vector m4[4];
11303 root.GetTransform(m4);
11304 dst.SetGround(this, m4);
11305 }
11306 else
11307 {
11308 GetInventory().GetCurrentInventoryLocation(dst);
11309 }
11310 }
11311
11312 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11313 {
11314
11315 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11316 return false;
11317
11318 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11319 return false;
11320
11321
11323 return false;
11324
11325
11326 Magazine mag = Magazine.Cast(this);
11327 if (mag)
11328 {
11329 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11330 return false;
11331
11332 if (stack_max_limit)
11333 {
11334 Magazine other_mag = Magazine.Cast(other_item);
11335 if (other_item)
11336 {
11337 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11338 return false;
11339 }
11340
11341 }
11342 }
11343 else
11344 {
11345
11347 return false;
11348
11350 return false;
11351 }
11352
11353 PlayerBase player = null;
11354 if (CastTo(player, GetHierarchyRootPlayer()))
11355 {
11356 if (player.GetInventory().HasAttachment(this))
11357 return false;
11358
11359 if (player.IsItemsToDelete())
11360 return false;
11361 }
11362
11363 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11364 return false;
11365
11366 int slotID;
11368 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11369 return false;
11370
11371 return true;
11372 }
11373
11375 {
11377 }
11378
11380 {
11381 return m_IsResultOfSplit;
11382 }
11383
11385 {
11386 m_IsResultOfSplit = value;
11387 }
11388
11390 {
11392 }
11393
11395 {
11396 float other_item_quantity = other_item.GetQuantity();
11397 float this_free_space;
11398
11400
11402
11403 if (other_item_quantity > this_free_space)
11404 {
11405 return this_free_space;
11406 }
11407 else
11408 {
11409 return other_item_quantity;
11410 }
11411 }
11412
11414 {
11416 }
11417
11419 {
11421 return;
11422
11423 if (!IsMagazine() && other_item)
11424 {
11426 if (quantity_used != 0)
11427 {
11428 float hp1 = GetHealth01("","");
11429 float hp2 = other_item.GetHealth01("","");
11430 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11431 hpResult = hpResult / (
GetQuantity() + quantity_used);
11432
11433 hpResult *= GetMaxHealth();
11434 Math.Round(hpResult);
11435 SetHealth("", "Health", hpResult);
11436
11438 other_item.AddQuantity(-quantity_used);
11439 }
11440 }
11442 }
11443
11445 {
11446 #ifdef SERVER
11447 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11448 GetHierarchyParent().IncreaseLifetimeUp();
11449 #endif
11450 };
11451
11453 {
11454 PlayerBase p = PlayerBase.Cast(player);
11455
11456 array<int> recipesIds = p.m_Recipes;
11457 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11458 if (moduleRecipesManager)
11459 {
11460 EntityAI itemInHands = player.GetEntityInHands();
11461 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11462 }
11463
11464 for (int i = 0;i < recipesIds.Count(); i++)
11465 {
11466 int key = recipesIds.Get(i);
11467 string recipeName = moduleRecipesManager.GetRecipeName(key);
11469 }
11470 }
11471
11472
11473 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11474 {
11475 super.GetDebugActions(outputList);
11476
11477
11483
11484
11489
11494
11495
11499
11500
11502 {
11506 }
11507
11510
11511
11515
11517
11518 InventoryLocation loc = new InventoryLocation();
11519 GetInventory().GetCurrentInventoryLocation(loc);
11521 {
11522 if (Gizmo_IsSupported())
11525 }
11526
11528 }
11529
11530
11531
11532
11534 {
11535 super.OnAction(action_id, player, ctx);
11536
11538 {
11539 switch (action_id)
11540 {
11544 return true;
11548 return true;
11549 }
11550 }
11551
11553 {
11554 switch (action_id)
11555 {
11557 Delete();
11558 return true;
11559 }
11560 }
11561
11562 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11563 {
11564 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11565 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11566 PlayerBase p = PlayerBase.Cast(player);
11567 if (
EActions.RECIPES_RANGE_START < 1000)
11568 {
11569 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11570 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11571 }
11572 }
11573 #ifndef SERVER
11574 else if (action_id ==
EActions.WATCH_PLAYER)
11575 {
11576 PluginDeveloper.SetDeveloperItemClientEx(player);
11577 }
11578 #endif
11580 {
11581 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11582 {
11583 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11584 OnDebugButtonPressServer(id + 1);
11585 }
11586
11587 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11588 {
11589 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11591 }
11592
11593 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11594 {
11595 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11597 }
11598
11599 else if (action_id ==
EActions.ADD_QUANTITY)
11600 {
11601 if (IsMagazine())
11602 {
11603 Magazine mag = Magazine.Cast(this);
11604 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11605 }
11606 else
11607 {
11609 }
11610
11611 if (m_EM)
11612 {
11613 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11614 }
11615
11616 }
11617
11618 else if (action_id ==
EActions.REMOVE_QUANTITY)
11619 {
11620 if (IsMagazine())
11621 {
11622 Magazine mag2 = Magazine.Cast(this);
11623 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11624 }
11625 else
11626 {
11628 }
11629 if (m_EM)
11630 {
11631 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11632 }
11633
11634 }
11635
11636 else if (action_id ==
EActions.SET_QUANTITY_0)
11637 {
11639
11640 if (m_EM)
11641 {
11642 m_EM.SetEnergy(0);
11643 }
11644 }
11645
11646 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11647 {
11649
11650 if (m_EM)
11651 {
11652 m_EM.SetEnergy(m_EM.GetEnergyMax());
11653 }
11654 }
11655
11656 else if (action_id ==
EActions.ADD_HEALTH)
11657 {
11658 AddHealth("","",GetMaxHealth("","Health")/5);
11659 }
11660 else if (action_id ==
EActions.REMOVE_HEALTH)
11661 {
11662 AddHealth("","",-GetMaxHealth("","Health")/5);
11663 }
11664 else if (action_id ==
EActions.DESTROY_HEALTH)
11665 {
11666 SetHealth01("","",0);
11667 }
11668 else if (action_id ==
EActions.WATCH_ITEM)
11669 {
11671 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11672 #ifdef DEVELOPER
11673 SetDebugDeveloper_item(this);
11674 #endif
11675 }
11676
11677 else if (action_id ==
EActions.ADD_TEMPERATURE)
11678 {
11679 AddTemperature(20);
11680
11681 }
11682
11683 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11684 {
11685 AddTemperature(-20);
11686
11687 }
11688
11689 else if (action_id ==
EActions.FLIP_FROZEN)
11690 {
11691 SetFrozen(!GetIsFrozen());
11692
11693 }
11694
11695 else if (action_id ==
EActions.ADD_WETNESS)
11696 {
11698
11699 }
11700
11701 else if (action_id ==
EActions.REMOVE_WETNESS)
11702 {
11704
11705 }
11706
11707 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11708 {
11711
11712
11713 }
11714
11715 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11716 {
11719 }
11720
11721 else if (action_id ==
EActions.MAKE_SPECIAL)
11722 {
11723 auto debugParams = DebugSpawnParams.WithPlayer(player);
11724 OnDebugSpawnEx(debugParams);
11725 }
11726
11727 }
11728
11729
11730 return false;
11731 }
11732
11733
11734
11735
11739
11742
11743
11744
11746 {
11747 return false;
11748 }
11749
11750
11752 {
11753 return true;
11754 }
11755
11756
11758 {
11759 return true;
11760 }
11761
11762
11763
11765 {
11766 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11767 return g_Game.ConfigIsExisting(config_path);
11768 }
11769
11772 {
11773 return null;
11774 }
11775
11777 {
11778 return false;
11779 }
11780
11782 {
11783 return false;
11784 }
11785
11789
11790
11792 {
11793 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11794 return module_repairing.CanRepair(this, item_repair_kit);
11795 }
11796
11797
11798 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11799 {
11800 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11801 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11802 }
11803
11804
11806 {
11807
11808
11809
11810
11811
11812
11813
11814
11815 return 1;
11816 }
11817
11818
11819
11821 {
11823 }
11824
11825
11826
11828 {
11830 }
11831
11832
11841 {
11842 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11843
11844 if (player)
11845 {
11846 player.MessageStatus(text);
11847 }
11848 }
11849
11850
11859 {
11860 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11861
11862 if (player)
11863 {
11864 player.MessageAction(text);
11865 }
11866 }
11867
11868
11877 {
11878 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11879
11880 if (player)
11881 {
11882 player.MessageFriendly(text);
11883 }
11884 }
11885
11886
11895 {
11896 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11897
11898 if (player)
11899 {
11900 player.MessageImportant(text);
11901 }
11902 }
11903
11905 {
11906 return true;
11907 }
11908
11909
11910 override bool KindOf(
string tag)
11911 {
11912 bool found = false;
11913 string item_name = this.
GetType();
11915 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11916
11917 int array_size = item_tag_array.Count();
11918 for (int i = 0; i < array_size; i++)
11919 {
11920 if (item_tag_array.Get(i) == tag)
11921 {
11922 found = true;
11923 break;
11924 }
11925 }
11926 return found;
11927 }
11928
11929
11931 {
11932
11933 super.OnRPC(sender, rpc_type,ctx);
11934
11935
11936 switch (rpc_type)
11937 {
11938 #ifndef SERVER
11939 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11940 Param2<bool, string> p = new Param2<bool, string>(false, "");
11941
11943 return;
11944
11945 bool play = p.param1;
11946 string soundSet = p.param2;
11947
11948 if (play)
11949 {
11951 {
11953 {
11955 }
11956 }
11957 else
11958 {
11960 }
11961 }
11962 else
11963 {
11965 }
11966
11967 break;
11968 #endif
11969
11970 }
11971
11973 {
11975 }
11976 }
11977
11978
11979
11980
11982 {
11983 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11984 return plugin.GetID(
name);
11985 }
11986
11988 {
11989 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11990 return plugin.GetName(id);
11991 }
11992
11995 {
11996
11997
11998 int varFlags;
11999 if (!ctx.
Read(varFlags))
12000 return;
12001
12002 if (varFlags & ItemVariableFlags.FLOAT)
12003 {
12005 }
12006 }
12007
12009 {
12010
12011 super.SerializeNumericalVars(floats_out);
12012
12013
12014
12016 {
12018 }
12019
12021 {
12023 }
12024
12026 {
12028 }
12029
12031 {
12036 }
12037
12039 {
12041 }
12042 }
12043
12045 {
12046
12047 super.DeSerializeNumericalVars(floats);
12048
12049
12050 int index = 0;
12051 int mask = Math.Round(floats.Get(index));
12052
12053 index++;
12054
12056 {
12058 {
12060 }
12061 else
12062 {
12063 float quantity = floats.Get(index);
12064 SetQuantity(quantity,
true,
false,
false,
false);
12065 }
12066 index++;
12067 }
12068
12070 {
12071 float wet = floats.Get(index);
12073 index++;
12074 }
12075
12077 {
12078 int liquidtype = Math.Round(floats.Get(index));
12080 index++;
12081 }
12082
12084 {
12086 index++;
12088 index++;
12090 index++;
12092 index++;
12093 }
12094
12096 {
12097 int cleanness = Math.Round(floats.Get(index));
12099 index++;
12100 }
12101 }
12102
12104 {
12105 super.WriteVarsToCTX(ctx);
12106
12107
12109 {
12111 }
12112
12114 {
12116 }
12117
12119 {
12121 }
12122
12124 {
12125 int r,g,b,a;
12131 }
12132
12134 {
12136 }
12137 }
12138
12140 {
12141 if (!super.ReadVarsFromCTX(ctx,version))
12142 return false;
12143
12144 int intValue;
12145 float value;
12146
12147 if (version < 140)
12148 {
12149 if (!ctx.
Read(intValue))
12150 return false;
12151
12152 m_VariablesMask = intValue;
12153 }
12154
12156 {
12157 if (!ctx.
Read(value))
12158 return false;
12159
12161 {
12163 }
12164 else
12165 {
12167 }
12168 }
12169
12170 if (version < 140)
12171 {
12173 {
12174 if (!ctx.
Read(value))
12175 return false;
12176 SetTemperatureDirect(value);
12177 }
12178 }
12179
12181 {
12182 if (!ctx.
Read(value))
12183 return false;
12185 }
12186
12188 {
12189 if (!ctx.
Read(intValue))
12190 return false;
12192 }
12193
12195 {
12196 int r,g,b,a;
12198 return false;
12200 return false;
12202 return false;
12204 return false;
12205
12207 }
12208
12210 {
12211 if (!ctx.
Read(intValue))
12212 return false;
12214 }
12215
12216 if (version >= 138 && version < 140)
12217 {
12219 {
12220 if (!ctx.
Read(intValue))
12221 return false;
12222 SetFrozen(intValue);
12223 }
12224 }
12225
12226 return true;
12227 }
12228
12229
12231 {
12234 {
12236 }
12237
12238 if (!super.OnStoreLoad(ctx, version))
12239 {
12241 return false;
12242 }
12243
12244 if (version >= 114)
12245 {
12246 bool hasQuickBarIndexSaved;
12247
12248 if (!ctx.
Read(hasQuickBarIndexSaved))
12249 {
12251 return false;
12252 }
12253
12254 if (hasQuickBarIndexSaved)
12255 {
12256 int itmQBIndex;
12257
12258
12259 if (!ctx.
Read(itmQBIndex))
12260 {
12262 return false;
12263 }
12264
12265 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12266 if (itmQBIndex != -1 && parentPlayer)
12267 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12268 }
12269 }
12270 else
12271 {
12272
12273 PlayerBase player;
12274 int itemQBIndex;
12275 if (version ==
int.
MAX)
12276 {
12277 if (!ctx.
Read(itemQBIndex))
12278 {
12280 return false;
12281 }
12282 }
12283 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12284 {
12285
12286 if (!ctx.
Read(itemQBIndex))
12287 {
12289 return false;
12290 }
12291 if (itemQBIndex != -1 && player)
12292 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12293 }
12294 }
12295
12296 if (version < 140)
12297 {
12298
12299 if (!LoadVariables(ctx, version))
12300 {
12302 return false;
12303 }
12304 }
12305
12306
12308 {
12310 return false;
12311 }
12312 if (version >= 132)
12313 {
12315 if (raib)
12316 {
12318 {
12320 return false;
12321 }
12322 }
12323 }
12324
12326 return true;
12327 }
12328
12329
12330
12332 {
12333 super.OnStoreSave(ctx);
12334
12335 PlayerBase player;
12336 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12337 {
12339
12340 int itemQBIndex = -1;
12341 itemQBIndex = player.FindQuickBarEntityIndex(this);
12342 ctx.
Write(itemQBIndex);
12343 }
12344 else
12345 {
12347 }
12348
12350
12352 if (raib)
12353 {
12355 }
12356 }
12357
12358
12360 {
12361 super.AfterStoreLoad();
12362
12364 {
12366 }
12367
12369 {
12372 }
12373 }
12374
12376 {
12377 super.EEOnAfterLoad();
12378
12380 {
12382 }
12383
12386 }
12387
12389 {
12390 return false;
12391 }
12392
12393
12394
12396 {
12398 {
12399 #ifdef PLATFORM_CONSOLE
12400
12402 {
12404 if (menu)
12405 {
12407 }
12408 }
12409 #endif
12410 }
12411
12413 {
12416 }
12417
12419 {
12420 SetWeightDirty();
12422 }
12424 {
12427 }
12428
12430 {
12433
12436 }
12438 {
12442 }
12443
12444 super.OnVariablesSynchronized();
12445 }
12446
12447
12448
12450 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12451 {
12452 if (!IsServerCheck(allow_client))
12453 return false;
12454
12456 return false;
12457
12460
12461 if (value <= (min + 0.001))
12462 value = min;
12463
12464 if (value == min)
12465 {
12466 if (destroy_config)
12467 {
12468 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12469 if (dstr)
12470 {
12472 this.Delete();
12473 return true;
12474 }
12475 }
12476 else if (destroy_forced)
12477 {
12479 this.Delete();
12480 return true;
12481 }
12482
12484 }
12485
12488
12490 {
12491 EntityAI parent = GetHierarchyRoot();
12492 InventoryLocation iLoc = new InventoryLocation();
12493 GetInventory().GetCurrentInventoryLocation(iLoc);
12495 {
12496 int iLocSlot = iLoc.
GetSlot();
12498 {
12500 }
12502 {
12504 }
12505 }
12506 }
12507
12509 {
12511
12512 if (delta)
12514 }
12515
12517
12518 return false;
12519 }
12520
12521
12523 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12524 {
12526 }
12527
12529 {
12532 }
12533
12535 {
12538 }
12539
12541 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12542 {
12543 float value_clamped = Math.Clamp(value, 0, 1);
12545 SetQuantity(result, destroy_config, destroy_forced);
12546 }
12547
12548
12551 {
12553 }
12554
12556 {
12558 }
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12570 {
12571 int slot = -1;
12572 GameInventory inventory = GetInventory();
12573 if (inventory)
12574 {
12575 InventoryLocation il = new InventoryLocation;
12578 }
12579
12581 }
12582
12584 {
12585 float quantity_max = 0;
12586
12588 {
12589 if (attSlotID != -1)
12590 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12591
12592 if (quantity_max <= 0)
12594 }
12595
12596 if (quantity_max <= 0)
12598
12599 return quantity_max;
12600 }
12601
12603 {
12605 }
12606
12608 {
12610 }
12611
12612
12614 {
12616 }
12617
12619 {
12621 }
12622
12624 {
12626 }
12627
12628
12630 {
12631
12632 float weightEx = GetWeightEx();
12633 float special = GetInventoryAndCargoWeight();
12634 return weightEx - special;
12635 }
12636
12637
12639 {
12641 }
12642
12644 {
12646 {
12647 #ifdef DEVELOPER
12648 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12649 {
12650 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12652 }
12653 #endif
12654
12655 return GetQuantity() * GetConfigWeightModified();
12656 }
12657 else if (HasEnergyManager())
12658 {
12659 #ifdef DEVELOPER
12660 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12661 {
12662 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12663 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12664 }
12665 #endif
12666 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12667 }
12668 else
12669 {
12670 #ifdef DEVELOPER
12671 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12672 {
12673 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12674 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12675 }
12676 #endif
12677 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12678 }
12679 }
12680
12683 {
12684 int item_count = 0;
12686
12687 GameInventory inventory = GetInventory();
12688 CargoBase cargo = inventory.
GetCargo();
12689 if (cargo != NULL)
12690 {
12692 }
12693
12695 for (int i = 0; i < nAttachments; ++i)
12696 {
12698 if (item)
12699 item_count += item.GetNumberOfItems();
12700 }
12701 return item_count;
12702 }
12703
12706 {
12707 float weight = 0;
12708 float wetness = 1;
12709 if (include_wetness)
12712 {
12713 weight = wetness * m_ConfigWeight;
12714 }
12716 {
12717 weight = 1;
12718 }
12719 return weight;
12720 }
12721
12722
12723
12725 {
12726 GameInventory inventory = GetInventory();
12727 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12728 {
12729 array<EntityAI> items = new array<EntityAI>;
12731 for (int i = 0; i < items.Count(); ++i)
12732 {
12734 if (item)
12735 {
12736 g_Game.ObjectDelete(item);
12737 }
12738 }
12739 }
12740 }
12741
12742
12743
12744
12746 {
12747 float energy = 0;
12748 if (HasEnergyManager())
12749 {
12750 energy = GetCompEM().GetEnergy();
12751 }
12752 return energy;
12753 }
12754
12755
12757 {
12758 super.OnEnergyConsumed();
12759
12761 }
12762
12764 {
12765 super.OnEnergyAdded();
12766
12768 }
12769
12770
12772 {
12773 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12774 {
12776 {
12777 float energy_0to1 = GetCompEM().GetEnergy0To1();
12779 }
12780 }
12781 }
12782
12783
12785 {
12786 return ConfigGetFloat("heatIsolation");
12787 }
12788
12790 {
12792 }
12793
12795 {
12796 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12797 if (
g_Game.ConfigIsExisting(paramPath))
12798 return g_Game.ConfigGetFloat(paramPath);
12799
12800 return 0.0;
12801 }
12802
12804 {
12805 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12806 if (
g_Game.ConfigIsExisting(paramPath))
12807 return g_Game.ConfigGetFloat(paramPath);
12808
12809 return 0.0;
12810 }
12811
12812 override void SetWet(
float value,
bool allow_client =
false)
12813 {
12814 if (!IsServerCheck(allow_client))
12815 return;
12816
12819
12821
12822 m_VarWet = Math.Clamp(value, min, max);
12823
12825 {
12828 }
12829 }
12830
12831 override void AddWet(
float value)
12832 {
12834 }
12835
12837 {
12839 }
12840
12842 {
12844 }
12845
12847 {
12849 }
12850
12852 {
12854 }
12855
12857 {
12859 }
12860
12861 override void OnWetChanged(
float newVal,
float oldVal)
12862 {
12865 if (newLevel != oldLevel)
12866 {
12868 }
12869 }
12870
12872 {
12873 SetWeightDirty();
12874 }
12875
12877 {
12878 return GetWetLevelInternal(
m_VarWet);
12879 }
12880
12881
12882
12884 {
12886 }
12887
12889 {
12891 }
12892
12894 {
12896 }
12897
12899 {
12901 }
12902
12903
12904
12906 {
12907 if (ConfigIsExisting("itemModelLength"))
12908 {
12909 return ConfigGetFloat("itemModelLength");
12910 }
12911 return 0;
12912 }
12913
12915 {
12916 if (ConfigIsExisting("itemAttachOffset"))
12917 {
12918 return ConfigGetFloat("itemAttachOffset");
12919 }
12920 return 0;
12921 }
12922
12923 override void SetCleanness(
int value,
bool allow_client =
false)
12924 {
12925 if (!IsServerCheck(allow_client))
12926 return;
12927
12929
12931
12934 }
12935
12937 {
12939 }
12940
12942 {
12943 return true;
12944 }
12945
12946
12947
12948
12950 {
12952 }
12953
12955 {
12957 }
12958
12959
12960
12961
12962 override void SetColor(
int r,
int g,
int b,
int a)
12963 {
12969 }
12971 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12972 {
12977 }
12978
12980 {
12982 }
12983
12986 {
12987 int r,g,b,a;
12989 r = r/255;
12990 g = g/255;
12991 b = b/255;
12992 a = a/255;
12993 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12994 }
12995
12996
12997
12998 override void SetLiquidType(
int value,
bool allow_client =
false)
12999 {
13000 if (!IsServerCheck(allow_client))
13001 return;
13002
13007 }
13008
13010 {
13011 return ConfigGetInt("varLiquidTypeInit");
13012 }
13013
13015 {
13017 }
13018
13020 {
13022 SetFrozen(false);
13023 }
13024
13027 {
13028 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13029 }
13030
13031
13034 {
13035 PlayerBase nplayer;
13036 if (PlayerBase.CastTo(nplayer, player))
13037 {
13039 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13040 }
13041 }
13042
13043
13046 {
13047 PlayerBase nplayer;
13048 if (PlayerBase.CastTo(nplayer,player))
13049 {
13050 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13051 }
13052
13053 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13054
13055 if (HasEnergyManager())
13056 {
13057 GetCompEM().UpdatePlugState();
13058 }
13059 }
13060
13061
13063 {
13064 super.OnPlacementStarted(player);
13065
13067 }
13068
13069 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13070 {
13072 {
13073 m_AdminLog.OnPlacementComplete(player,
this);
13074 }
13075
13076 super.OnPlacementComplete(player, position, orientation);
13077 }
13078
13079
13080
13081
13082
13084 {
13086 {
13087 return true;
13088 }
13089 else
13090 {
13091 return false;
13092 }
13093 }
13094
13095
13097 {
13099 {
13101 }
13102 }
13103
13104
13106 {
13108 }
13109
13111 {
13113 }
13114
13115 override void InsertAgent(
int agent,
float count = 1)
13116 {
13117 if (count < 1)
13118 return;
13119
13121 }
13122
13125 {
13127 }
13128
13129
13131 {
13133 }
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13177 {
13179 return false;
13180 return true;
13181 }
13182
13184 {
13185
13187 }
13188
13189
13192 {
13193 super.CheckForRoofLimited(timeTresholdMS);
13194
13195 float time =
g_Game.GetTime();
13196 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13197 {
13198 m_PreviousRoofTestTime = time;
13199 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13200 }
13201 }
13202
13203
13205 {
13207 {
13208 return 0;
13209 }
13210
13211 if (GetInventory().GetAttachmentSlotsCount() != 0)
13212 {
13213 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13214 if (filter)
13215 return filter.GetProtectionLevel(type, false, system);
13216 else
13217 return 0;
13218 }
13219
13220 string subclassPath, entryName;
13221
13222 switch (type)
13223 {
13225 entryName = "biological";
13226 break;
13228 entryName = "chemical";
13229 break;
13230 default:
13231 entryName = "biological";
13232 break;
13233 }
13234
13235 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13236
13237 return g_Game.ConfigGetFloat(subclassPath + entryName);
13238 }
13239
13240
13241
13244 {
13245 if (!IsMagazine())
13247
13249 }
13250
13251
13252
13253
13254
13259 {
13260 return true;
13261 }
13262
13264 {
13266 }
13267
13268
13269
13270
13271
13273 {
13274 if (parent)
13275 {
13276 if (parent.IsInherited(DayZInfected))
13277 return true;
13278
13279 if (!parent.IsRuined())
13280 return true;
13281 }
13282
13283 return true;
13284 }
13285
13287 {
13288 if (!super.CanPutAsAttachment(parent))
13289 {
13290 return false;
13291 }
13292
13293 if (!IsRuined() && !parent.IsRuined())
13294 {
13295 return true;
13296 }
13297
13298 return false;
13299 }
13300
13302 {
13303
13304
13305
13306
13307 return super.CanReceiveItemIntoCargo(item);
13308 }
13309
13311 {
13312
13313
13314
13315
13316 GameInventory attachmentInv = attachment.GetInventory();
13318 {
13319 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13320 return false;
13321 }
13322
13323 InventoryLocation loc = new InventoryLocation();
13324 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13325 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13326 return false;
13327
13328 return super.CanReceiveAttachment(attachment, slotId);
13329 }
13330
13332 {
13333 if (!super.CanReleaseAttachment(attachment))
13334 return false;
13335
13336 return GetInventory().AreChildrenAccessible();
13337 }
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13360 {
13361 int id = muzzle_owner.GetMuzzleID();
13362 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13363
13364 if (WPOF_array)
13365 {
13366 for (int i = 0; i < WPOF_array.Count(); i++)
13367 {
13368 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13369
13370 if (WPOF)
13371 {
13372 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13373 }
13374 }
13375 }
13376 }
13377
13378
13380 {
13381 int id = muzzle_owner.GetMuzzleID();
13383
13384 if (WPOBE_array)
13385 {
13386 for (int i = 0; i < WPOBE_array.Count(); i++)
13387 {
13388 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13389
13390 if (WPOBE)
13391 {
13392 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13393 }
13394 }
13395 }
13396 }
13397
13398
13400 {
13401 int id = muzzle_owner.GetMuzzleID();
13402 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13403
13404 if (WPOOH_array)
13405 {
13406 for (int i = 0; i < WPOOH_array.Count(); i++)
13407 {
13408 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13409
13410 if (WPOOH)
13411 {
13412 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13413 }
13414 }
13415 }
13416 }
13417
13418
13420 {
13421 int id = muzzle_owner.GetMuzzleID();
13422 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13423
13424 if (WPOOH_array)
13425 {
13426 for (int i = 0; i < WPOOH_array.Count(); i++)
13427 {
13428 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13429
13430 if (WPOOH)
13431 {
13432 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13433 }
13434 }
13435 }
13436 }
13437
13438
13440 {
13441 int id = muzzle_owner.GetMuzzleID();
13442 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13443
13444 if (WPOOH_array)
13445 {
13446 for (int i = 0; i < WPOOH_array.Count(); i++)
13447 {
13448 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13449
13450 if (WPOOH)
13451 {
13452 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13453 }
13454 }
13455 }
13456 }
13457
13458
13459
13461 {
13463 {
13464 return true;
13465 }
13466
13467 return false;
13468 }
13469
13471 {
13473 {
13474 return true;
13475 }
13476
13477 return false;
13478 }
13479
13481 {
13483 {
13484 return true;
13485 }
13486
13487 return false;
13488 }
13489
13491 {
13492 return false;
13493 }
13494
13497 {
13498 return UATimeSpent.DEFAULT_DEPLOY;
13499 }
13500
13501
13502
13503
13505 {
13507 SetSynchDirty();
13508 }
13509
13511 {
13513 }
13514
13515
13517 {
13518 return false;
13519 }
13520
13523 {
13524 string att_type = "None";
13525
13526 if (ConfigIsExisting("soundAttType"))
13527 {
13528 att_type = ConfigGetString("soundAttType");
13529 }
13530
13532 }
13533
13535 {
13537 }
13538
13539
13540
13541
13542
13548
13550 {
13553
13555 }
13556
13557
13559 {
13561 return;
13562
13564
13567
13570
13571 SoundParameters params = new SoundParameters();
13575 }
13576
13577
13579 {
13581 {
13584
13585 SetSynchDirty();
13586
13589 }
13590 }
13591
13593 {
13595 }
13596
13597
13599 {
13601 return;
13602
13604 SetSynchDirty();
13605
13608 }
13609
13611 {
13614 }
13615
13617 {
13619 }
13620
13621 void OnApply(PlayerBase player);
13622
13624 {
13625 return 1.0;
13626 };
13627
13629 {
13631 }
13632
13634 {
13636 }
13637
13639
13641 {
13642 SetDynamicPhysicsLifeTime(0.01);
13644 }
13645
13647 {
13648 array<string> zone_names = new array<string>;
13649 GetDamageZones(zone_names);
13650 for (int i = 0; i < zone_names.Count(); i++)
13651 {
13652 SetHealthMax(zone_names.Get(i),"Health");
13653 }
13654 SetHealthMax("","Health");
13655 }
13656
13659 {
13660 float global_health = GetHealth01("","Health");
13661 array<string> zones = new array<string>;
13662 GetDamageZones(zones);
13663
13664 for (int i = 0; i < zones.Count(); i++)
13665 {
13666 SetHealth01(zones.Get(i),"Health",global_health);
13667 }
13668 }
13669
13672 {
13673 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13674 }
13675
13677 {
13678 if (!hasRootAsPlayer)
13679 {
13680 if (refParentIB)
13681 {
13682
13683 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13684 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13685
13686 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13687 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13688
13691 }
13692 else
13693 {
13694
13697 }
13698 }
13699 }
13700
13702 {
13704 {
13705 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13706 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13707 {
13708 float heatPermCoef = 1.0;
13710 while (ent)
13711 {
13712 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13713 ent = ent.GetHierarchyParent();
13714 }
13715
13716 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13717 }
13718 }
13719 }
13720
13722 {
13723
13724 EntityAI parent = GetHierarchyParent();
13725 if (!parent)
13726 {
13727 hasParent = false;
13728 hasRootAsPlayer = false;
13729 }
13730 else
13731 {
13732 hasParent = true;
13733 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13734 refParentIB =
ItemBase.Cast(parent);
13735 }
13736 }
13737
13738 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13739 {
13740
13741 }
13742
13744 {
13745
13746 return false;
13747 }
13748
13750 {
13751
13752
13753 return false;
13754 }
13755
13757 {
13758
13759 return false;
13760 }
13761
13764 {
13765 return !GetIsFrozen() &&
IsOpen();
13766 }
13767
13769 {
13770 bool hasParent = false, hasRootAsPlayer = false;
13772
13773 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13774 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13775
13776 if (wwtu || foodDecay)
13777 {
13781
13782 if (processWetness || processTemperature || processDecay)
13783 {
13785
13786 if (processWetness)
13787 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13788
13789 if (processTemperature)
13791
13792 if (processDecay)
13793 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13794 }
13795 }
13796 }
13797
13800 {
13802 }
13803
13805 {
13808
13809 return super.GetTemperatureFreezeThreshold();
13810 }
13811
13813 {
13816
13817 return super.GetTemperatureThawThreshold();
13818 }
13819
13821 {
13824
13825 return super.GetItemOverheatThreshold();
13826 }
13827
13829 {
13831 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13832
13833 return super.GetTemperatureFreezeTime();
13834 }
13835
13837 {
13839 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13840
13841 return super.GetTemperatureThawTime();
13842 }
13843
13848
13850 {
13851 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13852 }
13853
13855 {
13856 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13857 }
13858
13861 {
13863 }
13864
13866 {
13868 }
13869
13871 {
13873 }
13874
13877 {
13878 return null;
13879 }
13880
13883 {
13884 return false;
13885 }
13886
13888 {
13890 {
13893 if (!trg)
13894 {
13896 explosive = this;
13897 }
13898
13899 explosive.PairRemote(trg);
13901
13902 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13903 trg.SetPersistentPairID(persistentID);
13904 explosive.SetPersistentPairID(persistentID);
13905
13906 return true;
13907 }
13908 return false;
13909 }
13910
13913 {
13914 float ret = 1.0;
13917 ret *= GetHealth01();
13918
13919 return ret;
13920 }
13921
13922 #ifdef DEVELOPER
13923 override void SetDebugItem()
13924 {
13925 super.SetDebugItem();
13926 _itemBase = this;
13927 }
13928
13930 {
13931 string text = super.GetDebugText();
13932
13934 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13935
13936 return text;
13937 }
13938 #endif
13939
13941 {
13942 return true;
13943 }
13944
13946
13948
13950 {
13953 }
13954
13955
13963
13979
13980 [
Obsolete(
"Use ItemSoundHandler instead")]
13983 {
13984 if (!
g_Game.IsDedicatedServer())
13985 {
13986 if (ConfigIsExisting("attachSoundSet"))
13987 {
13988 string cfg_path = "";
13989 string soundset = "";
13990 string type_name =
GetType();
13991
13994 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13995 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13996
13997 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13998 {
13999 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14000 {
14001 if (cfg_slot_array[i] == slot_type)
14002 {
14003 soundset = cfg_soundset_array[i];
14004 break;
14005 }
14006 }
14007 }
14008
14009 if (soundset != "")
14010 {
14011 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14013 }
14014 }
14015 }
14016 }
14017
14019}
14020
14022{
14024 if (entity)
14025 {
14026 bool is_item = entity.IsInherited(
ItemBase);
14027 if (is_item && full_quantity)
14028 {
14031 }
14032 }
14033 else
14034 {
14036 return NULL;
14037 }
14038 return entity;
14039}
14040
14042{
14043 if (item)
14044 {
14045 if (health > 0)
14046 item.SetHealth("", "", health);
14047
14048 if (item.CanHaveTemperature())
14049 {
14051 if (item.CanFreeze())
14052 item.SetFrozen(false);
14053 }
14054
14055 if (item.HasEnergyManager())
14056 {
14057 if (quantity >= 0)
14058 {
14059 item.GetCompEM().SetEnergy0To1(quantity);
14060 }
14061 else
14062 {
14064 }
14065 }
14066 else if (item.IsMagazine())
14067 {
14068 Magazine mag = Magazine.Cast(item);
14069 if (quantity >= 0)
14070 {
14071 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14072 }
14073 else
14074 {
14076 }
14077
14078 }
14079 else
14080 {
14081 if (quantity >= 0)
14082 {
14083 item.SetQuantityNormalized(quantity, false);
14084 }
14085 else
14086 {
14088 }
14089
14090 }
14091 }
14092}
14093
14094#ifdef DEVELOPER
14096#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.