9245{
9247 {
9248 return true;
9249 }
9250};
9251
9253{
9254
9255};
9256
9257
9258
9260{
9264
9266
9269
9270
9271
9272
9273
9282
9288
9293
9298
9319 protected bool m_IsResultOfSplit
9320
9322
9327
9328
9329
9331
9335
9336
9337
9339
9342
9343
9344
9350
9351
9359
9362
9363
9365
9366
9368
9369
9374
9375
9380
9382
9383
9385
9386
9388 {
9393
9394 if (!
g_Game.IsDedicatedServer())
9395 {
9397 {
9399
9401 {
9403 }
9404 }
9405
9408 }
9409
9410 m_OldLocation = null;
9411
9413 {
9415 }
9416
9417 if (ConfigIsExisting("headSelectionsToHide"))
9418 {
9421 }
9422
9424 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9425 {
9427 }
9428
9430
9431 m_IsResultOfSplit = false;
9432
9434 }
9435
9437 {
9438 super.InitItemVariables();
9439
9445 m_Count = ConfigGetInt(
"count");
9446
9449
9454
9457
9462
9474
9478
9479
9482 if (ConfigIsExisting("canBeSplit"))
9483 {
9486 }
9487
9489 if (ConfigIsExisting("itemBehaviour"))
9491
9492
9495 RegisterNetSyncVariableInt("m_VarLiquidType");
9496 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9497
9498 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9499 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9500 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9501
9502 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9503 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9504 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9505 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9506
9507 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9508 RegisterNetSyncVariableBool("m_IsTakeable");
9509 RegisterNetSyncVariableBool("m_IsHologram");
9510
9513 {
9516 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9517 }
9518
9520
9522 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9524
9526 }
9527
9529 {
9531 }
9532
9534 {
9537 {
9542 }
9543 }
9544
9545 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9546 {
9548 {
9551 }
9552
9554 }
9555
9557 {
9563 }
9564
9566
9568 {
9570
9571 if (!action)
9572 {
9573 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9574 return;
9575 }
9576
9578 if (!ai)
9579 {
9581 return;
9582 }
9583
9585 if (!action_array)
9586 {
9587 action_array = new array<ActionBase_Basic>;
9589 }
9590 if (LogManager.IsActionLogEnable())
9591 {
9592 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9593 }
9594
9595 if (action_array.Find(action) != -1)
9596 {
9597 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9598 }
9599 else
9600 {
9601 action_array.Insert(action);
9602 }
9603 }
9604
9606 {
9607 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9608 ActionBase action = player.GetActionManager().GetAction(actionName);
9611
9612 if (action_array)
9613 {
9614 action_array.RemoveItem(action);
9615 }
9616 }
9617
9618
9619
9621 {
9622 ActionOverrideData overrideData = new ActionOverrideData();
9626
9628 if (!actionMap)
9629 {
9632 }
9633
9634 actionMap.Insert(this.
Type(), overrideData);
9635
9636 }
9637
9639
9641
9642
9644 {
9647
9650
9651 string config_to_search = "CfgVehicles";
9652 string muzzle_owner_config;
9653
9655 {
9656 if (IsInherited(Weapon))
9657 config_to_search = "CfgWeapons";
9658
9659 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9660
9661 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9662
9663 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9664
9665 if (config_OnFire_subclass_count > 0)
9666 {
9667 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9668
9669 for (int i = 0; i < config_OnFire_subclass_count; i++)
9670 {
9671 string particle_class = "";
9672 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9673 string config_OnFire_entry = config_OnFire_class + particle_class;
9674 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9675 WPOF_array.Insert(WPOF);
9676 }
9677
9678
9680 }
9681 }
9682
9684 {
9685 config_to_search = "CfgWeapons";
9686 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9687
9688 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9689
9690 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9691
9692 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9693 {
9694 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9695
9696 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9697 {
9698 string particle_class2 = "";
9699 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9700 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9701 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9702 WPOBE_array.Insert(WPOBE);
9703 }
9704
9705
9707 }
9708 }
9709 }
9710
9711
9713 {
9716
9718 {
9719 string config_to_search = "CfgVehicles";
9720
9721 if (IsInherited(Weapon))
9722 config_to_search = "CfgWeapons";
9723
9724 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9725 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9726
9727 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9728 {
9729
9731
9733 {
9735 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9737 return;
9738 }
9739
9742
9743
9744
9745 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9746 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9747
9748 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9749 {
9750 string particle_class = "";
9751 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9752 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9753 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9754
9755 if (entry_type == CT_CLASS)
9756 {
9757 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9758 WPOOH_array.Insert(WPOF);
9759 }
9760 }
9761
9762
9764 }
9765 }
9766 }
9767
9769 {
9771 }
9772
9774 {
9776 {
9778
9781
9784
9785 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9786 }
9787 }
9788
9790 {
9792 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9793
9795 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9796
9798 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9799
9801 {
9803 }
9804 }
9805
9807 {
9809 }
9810
9812 {
9815 else
9817
9819 {
9822 }
9823 else
9824 {
9827
9830 }
9831
9833 }
9834
9836 {
9838 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9839 }
9840
9842 {
9844 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9846 }
9847
9849 {
9851 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9852 }
9853
9855 {
9858
9859 OverheatingParticle OP = new OverheatingParticle();
9864
9866 }
9867
9869 {
9872
9873 return -1;
9874 }
9875
9877 {
9879 {
9882
9883 for (int i = count; i > 0; --i)
9884 {
9885 int id = i - 1;
9888
9891
9892 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9893 {
9894 if (p)
9895 {
9898 }
9899 }
9900 }
9901 }
9902 }
9903
9905 {
9907 {
9909 {
9910 int id = i - 1;
9912
9913 if (OP)
9914 {
9916
9917 if (p)
9918 {
9920 }
9921
9922 delete OP;
9923 }
9924 }
9925
9928 }
9929 }
9930
9933 {
9934 return 0.0;
9935 }
9936
9937
9939 {
9940 return 250;
9941 }
9942
9944 {
9945 return 0;
9946 }
9947
9950 {
9952 return true;
9953
9954 return false;
9955 }
9956
9959 {
9962
9964 {
9966 }
9967 else
9968 {
9969
9971 }
9972
9974 }
9975
9982 {
9983 return -1;
9984 }
9985
9986
9987
9988
9990 {
9992 {
9993 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9994 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9995
9996 if (r_index >= 0)
9997 {
9998 InventoryLocation r_il = new InventoryLocation;
9999 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10000
10001 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10004 {
10005 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10006 }
10008 {
10009 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10010 }
10011
10012 }
10013
10014 player.GetHumanInventory().ClearUserReservedLocation(this);
10015 }
10016
10019 }
10020
10021
10022
10023
10025 {
10026 return ItemBase.m_DebugActionsMask;
10027 }
10028
10030 {
10031 return ItemBase.m_DebugActionsMask & mask;
10032 }
10033
10035 {
10036 ItemBase.m_DebugActionsMask = mask;
10037 }
10038
10040 {
10041 ItemBase.m_DebugActionsMask |= mask;
10042 }
10043
10045 {
10046 ItemBase.m_DebugActionsMask &= ~mask;
10047 }
10048
10050 {
10052 {
10054 }
10055 else
10056 {
10058 }
10059 }
10060
10061
10063 {
10064 if (GetEconomyProfile())
10065 {
10066 float q_max = GetEconomyProfile().GetQuantityMax();
10067 if (q_max > 0)
10068 {
10069 float q_min = GetEconomyProfile().GetQuantityMin();
10070 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10071
10073 {
10074 ComponentEnergyManager comp = GetCompEM();
10076 {
10078 }
10079 }
10081 {
10083
10084 }
10085
10086 }
10087 }
10088 }
10089
10092 {
10093 EntityAI parent = GetHierarchyParent();
10094
10095 if (parent)
10096 {
10097 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10098 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10099 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10100 }
10101 }
10102
10105 {
10106 EntityAI parent = GetHierarchyParent();
10107
10108 if (parent)
10109 {
10110 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10111 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10112 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10113 }
10114 }
10115
10117 {
10118
10119
10120
10121
10123
10125 {
10126 if (ScriptInputUserData.CanStoreInputUserData())
10127 {
10128 ScriptInputUserData ctx = new ScriptInputUserData;
10134 ctx.
Write(use_stack_max);
10137
10139 {
10140 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10141 }
10142 }
10143 }
10144 else if (!
g_Game.IsMultiplayer())
10145 {
10147 }
10148 }
10149
10151 {
10153 }
10154
10156 {
10158 }
10159
10161 {
10163 }
10164
10166 {
10167
10168 return false;
10169 }
10170
10172 {
10173 return false;
10174 }
10175
10179 {
10180 return false;
10181 }
10182
10184 {
10185 return "";
10186 }
10187
10189
10191 {
10192 return false;
10193 }
10194
10196 {
10197 return true;
10198 }
10199
10200
10201
10203 {
10204 return true;
10205 }
10206
10208 {
10209 return true;
10210 }
10211
10213 {
10214 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10216 }
10217
10219 {
10221 }
10222
10224 {
10226 if (!is_being_placed)
10228 SetSynchDirty();
10229 }
10230
10231
10233
10235 {
10237 }
10238
10240 {
10242 }
10243
10245 {
10246 return 1;
10247 }
10248
10250 {
10251 return false;
10252 }
10253
10255 {
10257 SetSynchDirty();
10258 }
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10295 {
10296 super.OnMovedInsideCargo(container);
10297
10298 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10299 }
10300
10301 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10302 {
10303 super.EEItemLocationChanged(oldLoc, newLoc);
10304
10305 PlayerBase newPlayer = null;
10306 PlayerBase oldPlayer = null;
10307
10308 if (newLoc.GetParent())
10309 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10310
10311 if (oldLoc.GetParent())
10312 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10313
10315 {
10316 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10317
10318 if (rIndex >= 0)
10319 {
10320 InventoryLocation rIl = new InventoryLocation;
10321 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10322
10323 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10326 {
10327 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10328 }
10330 {
10332 }
10333
10334 }
10335 }
10336
10338 {
10339 if (newPlayer)
10340 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10341
10342 if (newPlayer == oldPlayer)
10343 {
10344 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10345 {
10347 {
10348 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10349 {
10350 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10351 }
10352 }
10353 else
10354 {
10355 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10356 }
10357 }
10358
10359 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10360 {
10361 int type = oldLoc.GetType();
10363 {
10364 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10365 }
10367 {
10368 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10369 }
10370 }
10371 if (!m_OldLocation)
10372 {
10373 m_OldLocation = new InventoryLocation;
10374 }
10375 m_OldLocation.Copy(oldLoc);
10376 }
10377 else
10378 {
10379 if (m_OldLocation)
10380 {
10381 m_OldLocation.Reset();
10382 }
10383 }
10384
10385 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10386 }
10387 else
10388 {
10389 if (newPlayer)
10390 {
10391 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10392 if (resIndex >= 0)
10393 {
10394 InventoryLocation il = new InventoryLocation;
10395 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10397 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10400 {
10401 il.
GetParent().GetOnReleaseLock().Invoke(it);
10402 }
10404 {
10406 }
10407
10408 }
10409 }
10411 {
10412
10414 }
10415
10416 if (m_OldLocation)
10417 {
10418 m_OldLocation.Reset();
10419 }
10420 }
10421
10423 {
10424 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10425 }
10426
10428 {
10429 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10430 }
10431 }
10432
10433 override void EOnContact(IEntity other, Contact extra)
10434 {
10436 {
10437 int liquidType = -1;
10439 if (impactSpeed > 0.0)
10440 {
10442 #ifndef SERVER
10444 #else
10446 SetSynchDirty();
10447 #endif
10449 }
10450 }
10451
10452 #ifdef SERVER
10453 if (GetCompEM() && GetCompEM().IsPlugged())
10454 {
10455 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10456 GetCompEM().UnplugThis();
10457 }
10458 #endif
10459 }
10460
10462
10464 {
10466 }
10467
10469 {
10470
10471 }
10472
10474 {
10475 super.OnItemLocationChanged(old_owner, new_owner);
10476
10477 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10478 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10479
10480 if (!relatedPlayer && playerNew)
10481 relatedPlayer = playerNew;
10482
10483 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10484 {
10486 if (actionMgr)
10487 {
10488 ActionBase currentAction = actionMgr.GetRunningAction();
10489 if (currentAction)
10491 }
10492 }
10493
10494 Man ownerPlayerOld = null;
10495 Man ownerPlayerNew = null;
10496
10497 if (old_owner)
10498 {
10499 if (old_owner.
IsMan())
10500 {
10501 ownerPlayerOld = Man.Cast(old_owner);
10502 }
10503 else
10504 {
10505 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10506 }
10507 }
10508 else
10509 {
10511 {
10513
10514 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10515 {
10516 GetCompEM().UnplugThis();
10517 }
10518 }
10519 }
10520
10521 if (new_owner)
10522 {
10523 if (new_owner.
IsMan())
10524 {
10525 ownerPlayerNew = Man.Cast(new_owner);
10526 }
10527 else
10528 {
10529 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10530 }
10531 }
10532
10533 if (ownerPlayerOld != ownerPlayerNew)
10534 {
10535 if (ownerPlayerOld)
10536 {
10537 array<EntityAI> subItemsExit = new array<EntityAI>;
10539 for (int i = 0; i < subItemsExit.Count(); i++)
10540 {
10543 }
10544 }
10545
10546 if (ownerPlayerNew)
10547 {
10548 array<EntityAI> subItemsEnter = new array<EntityAI>;
10550 for (int j = 0; j < subItemsEnter.Count(); j++)
10551 {
10554 }
10555 }
10556 }
10557 else if (ownerPlayerNew != null)
10558 {
10559 PlayerBase nplayer;
10560 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10561 {
10562 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10564 for (int k = 0; k < subItemsUpdate.Count(); k++)
10565 {
10567 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10568 }
10569 }
10570 }
10571
10572 if (old_owner)
10573 old_owner.OnChildItemRemoved(this);
10574 if (new_owner)
10575 new_owner.OnChildItemReceived(this);
10576 }
10577
10578
10580 {
10581 super.EEDelete(parent);
10582 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10583 if (player)
10584 {
10586
10587 if (player.IsAlive())
10588 {
10589 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10590 if (r_index >= 0)
10591 {
10592 InventoryLocation r_il = new InventoryLocation;
10593 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10594
10595 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10598 {
10599 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10600 }
10602 {
10603 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10604 }
10605
10606 }
10607
10608 player.RemoveQuickBarEntityShortcut(this);
10609 }
10610 }
10611 }
10612
10614 {
10615 super.EEKilled(killer);
10616
10619 {
10620 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10621 {
10622 if (IsMagazine())
10623 {
10624 if (Magazine.Cast(this).GetAmmoCount() > 0)
10625 {
10627 }
10628 }
10629 else
10630 {
10632 }
10633 }
10634 }
10635 }
10636
10638 {
10639 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10640
10641 super.OnWasAttached(parent, slot_id);
10642
10645
10648 }
10649
10651 {
10652 super.OnWasDetached(parent, slot_id);
10653
10656
10659 }
10660
10662 {
10663 int idx;
10666
10667 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10668 if (inventory_slots.Count() < 1)
10669 {
10670 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10671 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10672 }
10673 else
10674 {
10675 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10676 }
10677
10678 idx = inventory_slots.Find(slot);
10679 if (idx < 0)
10680 return "";
10681
10682 return attach_types.Get(idx);
10683 }
10684
10686 {
10687 int idx = -1;
10688 string slot;
10689
10692
10693 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10694 if (inventory_slots.Count() < 1)
10695 {
10696 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10697 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10698 }
10699 else
10700 {
10701 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10702 if (detach_types.Count() < 1)
10703 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10704 }
10705
10706 for (int i = 0; i < inventory_slots.Count(); i++)
10707 {
10708 slot = inventory_slots.Get(i);
10709 }
10710
10711 if (slot != "")
10712 {
10713 if (detach_types.Count() == 1)
10714 idx = 0;
10715 else
10716 idx = inventory_slots.Find(slot);
10717 }
10718 if (idx < 0)
10719 return "";
10720
10721 return detach_types.Get(idx);
10722 }
10723
10725 {
10726
10728
10729
10730 float min_time = 1;
10731 float max_time = 3;
10732 float delay = Math.RandomFloat(min_time, max_time);
10733
10734 explode_timer.Run(delay, this, "DoAmmoExplosion");
10735 }
10736
10738 {
10739 Magazine magazine = Magazine.Cast(this);
10740 int pop_sounds_count = 6;
10741 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10742
10743
10744 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10745 string sound_name = pop_sounds[ sound_idx ];
10746 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10747
10748
10749 magazine.ServerAddAmmoCount(-1);
10750
10751
10752 float min_temp_to_explode = 100;
10753
10754 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10755 {
10757 }
10758 }
10759
10760
10761 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10762 {
10763 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10764
10765 const int CHANCE_DAMAGE_CARGO = 4;
10766 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10767 const int CHANCE_DAMAGE_NOTHING = 2;
10768
10770 {
10771 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10772 int chances;
10773 int rnd;
10774
10775 if (GetInventory().GetCargo())
10776 {
10777 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10778 rnd = Math.RandomInt(0,chances);
10779
10780 if (rnd < CHANCE_DAMAGE_CARGO)
10781 {
10783 }
10784 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10785 {
10787 }
10788 }
10789 else
10790 {
10791 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10792 rnd = Math.RandomInt(0,chances);
10793
10794 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10795 {
10797 }
10798 }
10799 }
10800 }
10801
10803 {
10804 CargoBase cargo = GetInventory().GetCargo();
10805 if (cargo)
10806 {
10808 if (item_count > 0)
10809 {
10810 int random_pick = Math.RandomInt(0, item_count);
10812 if (!item.IsExplosive())
10813 {
10814 item.AddHealth("","",damage);
10815 return true;
10816 }
10817 }
10818 }
10819 return false;
10820 }
10821
10823 {
10824 GameInventory inventory = GetInventory();
10826 if (attachment_count > 0)
10827 {
10828 int random_pick = Math.RandomInt(0, attachment_count);
10830 if (!attachment.IsExplosive())
10831 {
10832 attachment.AddHealth("","",damage);
10833 return true;
10834 }
10835 }
10836 return false;
10837 }
10838
10840 {
10842 }
10843
10845 {
10847 return GetInventory().CanRemoveEntity();
10848
10849 return false;
10850 }
10851
10853 {
10854
10856 return false;
10857
10858
10860 return false;
10861
10862
10863
10865 if (delta == 0)
10866 return false;
10867
10868
10869 return true;
10870 }
10871
10873 {
10875 {
10876 if (ScriptInputUserData.CanStoreInputUserData())
10877 {
10878 ScriptInputUserData ctx = new ScriptInputUserData;
10883 ctx.
Write(destination_entity);
10885 ctx.
Write(slot_id);
10887 }
10888 }
10889 else if (!
g_Game.IsMultiplayer())
10890 {
10892 }
10893 }
10894
10896 {
10897 float split_quantity_new;
10901 InventoryLocation loc = new InventoryLocation;
10902
10903 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10904 {
10906 split_quantity_new = stack_max;
10907 else
10909
10911 {
10912 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10913 if (new_item)
10914 {
10915 new_item.SetResultOfSplit(true);
10916 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10918 new_item.
SetQuantity(split_quantity_new,
false,
true);
10919 }
10920 }
10921 }
10922 else if (destination_entity && slot_id == -1)
10923 {
10924 if (quantity > stack_max)
10925 split_quantity_new = stack_max;
10926 else
10927 split_quantity_new = quantity;
10928
10930 {
10931 GameInventory destinationInventory = destination_entity.GetInventory();
10933 {
10936 }
10937
10938 if (new_item)
10939 {
10940 new_item.SetResultOfSplit(true);
10941 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10943 new_item.
SetQuantity(split_quantity_new,
false,
true);
10944 }
10945 }
10946 }
10947 else
10948 {
10949 if (stack_max != 0)
10950 {
10952 {
10954 }
10955
10956 if (split_quantity_new == 0)
10957 {
10958 if (!
g_Game.IsMultiplayer())
10959 player.PhysicalPredictiveDropItem(this);
10960 else
10961 player.ServerDropEntity(this);
10962 return;
10963 }
10964
10966 {
10968
10969 if (new_item)
10970 {
10971 new_item.SetResultOfSplit(true);
10972 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10975 new_item.PlaceOnSurface();
10976 }
10977 }
10978 }
10979 }
10980 }
10981
10983 {
10984 float split_quantity_new;
10988 InventoryLocation loc = new InventoryLocation;
10989
10990 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10991 {
10993 split_quantity_new = stack_max;
10994 else
10996
10998 {
10999 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11000 if (new_item)
11001 {
11002 new_item.SetResultOfSplit(true);
11003 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11005 new_item.
SetQuantity(split_quantity_new,
false,
true);
11006 }
11007 }
11008 }
11009 else if (destination_entity && slot_id == -1)
11010 {
11011 if (quantity > stack_max)
11012 split_quantity_new = stack_max;
11013 else
11014 split_quantity_new = quantity;
11015
11017 {
11018 GameInventory destinationInventory = destination_entity.GetInventory();
11020 {
11023 }
11024
11025 if (new_item)
11026 {
11027 new_item.SetResultOfSplit(true);
11028 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11030 new_item.
SetQuantity(split_quantity_new,
false,
true);
11031 }
11032 }
11033 }
11034 else
11035 {
11036 if (stack_max != 0)
11037 {
11039 {
11041 }
11042
11044 {
11046
11047 if (new_item)
11048 {
11049 new_item.SetResultOfSplit(true);
11050 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11053 new_item.PlaceOnSurface();
11054 }
11055 }
11056 }
11057 }
11058 }
11059
11061 {
11063 {
11064 if (ScriptInputUserData.CanStoreInputUserData())
11065 {
11066 ScriptInputUserData ctx = new ScriptInputUserData;
11071 dst.WriteToContext(ctx);
11073 }
11074 }
11075 else if (!
g_Game.IsMultiplayer())
11076 {
11078 }
11079 }
11080
11082 {
11084 {
11085 if (ScriptInputUserData.CanStoreInputUserData())
11086 {
11087 ScriptInputUserData ctx = new ScriptInputUserData;
11092 ctx.
Write(destination_entity);
11098 }
11099 }
11100 else if (!
g_Game.IsMultiplayer())
11101 {
11103 }
11104 }
11105
11107 {
11109 }
11110
11112 {
11114 float split_quantity_new;
11116 if (dst.IsValid())
11117 {
11118 int slot_id = dst.GetSlot();
11120
11121 if (quantity > stack_max)
11122 split_quantity_new = stack_max;
11123 else
11124 split_quantity_new = quantity;
11125
11127 {
11129
11130 if (new_item)
11131 {
11132 new_item.SetResultOfSplit(true);
11133 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11135 new_item.
SetQuantity(split_quantity_new,
false,
true);
11136 }
11137
11138 return new_item;
11139 }
11140 }
11141
11142 return null;
11143 }
11144
11146 {
11148 float split_quantity_new;
11150 if (destination_entity)
11151 {
11153 if (quantity > stackable)
11154 split_quantity_new = stackable;
11155 else
11156 split_quantity_new = quantity;
11157
11159 {
11160 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11161 if (new_item)
11162 {
11163 new_item.SetResultOfSplit(true);
11164 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11166 new_item.
SetQuantity(split_quantity_new,
false,
true);
11167 }
11168 }
11169 }
11170 }
11171
11173 {
11175 {
11176 if (ScriptInputUserData.CanStoreInputUserData())
11177 {
11178 ScriptInputUserData ctx = new ScriptInputUserData;
11183 ItemBase destination_entity =
this;
11184 ctx.
Write(destination_entity);
11188 }
11189 }
11190 else if (!
g_Game.IsMultiplayer())
11191 {
11193 }
11194 }
11195
11197 {
11199 float split_quantity_new;
11201 if (player)
11202 {
11204 if (quantity > stackable)
11205 split_quantity_new = stackable;
11206 else
11207 split_quantity_new = quantity;
11208
11210 {
11211 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11212 new_item =
ItemBase.Cast(in_hands);
11213 if (new_item)
11214 {
11215 new_item.SetResultOfSplit(true);
11216 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11218 new_item.SetQuantity(split_quantity_new, false, true);
11219 }
11220 }
11221 }
11222 }
11223
11225 {
11227 float split_quantity_new = Math.Floor(quantity * 0.5);
11228
11230 return;
11231
11233
11234 if (new_item)
11235 {
11236 if (new_item.GetQuantityMax() < split_quantity_new)
11237 {
11238 split_quantity_new = new_item.GetQuantityMax();
11239 }
11240
11241 new_item.SetResultOfSplit(true);
11242 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11243
11245 {
11248 }
11249 else
11250 {
11252 new_item.
SetQuantity(split_quantity_new,
false,
true);
11253 }
11254 }
11255 }
11256
11258 {
11260 float split_quantity_new = Math.Floor(quantity / 2);
11261
11263 return;
11264
11265 InventoryLocation invloc = new InventoryLocation;
11267
11269 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11270
11271 if (new_item)
11272 {
11273 if (new_item.GetQuantityMax() < split_quantity_new)
11274 {
11275 split_quantity_new = new_item.GetQuantityMax();
11276 }
11278 {
11281 }
11282 else if (split_quantity_new > 1)
11283 {
11285 new_item.
SetQuantity(split_quantity_new,
false,
true);
11286 }
11287 }
11288 }
11289
11292 {
11293 SetWeightDirty();
11295
11296 if (parent)
11297 parent.OnAttachmentQuantityChangedEx(this, delta);
11298
11300 {
11302 {
11304 }
11306 {
11307 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11309 }
11310 }
11311 }
11312
11315 {
11316
11317 }
11318
11321 {
11323 }
11324
11326 {
11327 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11328
11330 {
11331 if (newLevel == GameConstants.STATE_RUINED)
11332 {
11334 EntityAI parent = GetHierarchyParent();
11335 if (parent && parent.IsFireplace())
11336 {
11337 CargoBase cargo = GetInventory().GetCargo();
11338 if (cargo)
11339 {
11341 {
11343 }
11344 }
11345 }
11346 }
11347
11349 {
11350
11352 return;
11353 }
11354
11355 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11356 {
11358 }
11359 }
11360 }
11361
11362
11364 {
11365 super.OnRightClick();
11366
11368 {
11370 {
11371 if (ScriptInputUserData.CanStoreInputUserData())
11372 {
11373 EntityAI root = GetHierarchyRoot();
11374 Man playerOwner = GetHierarchyRootPlayer();
11375 InventoryLocation dst = new InventoryLocation;
11376
11377
11378 if (!playerOwner && root && root == this)
11379 {
11381 }
11382 else
11383 {
11384
11385 GetInventory().GetCurrentInventoryLocation(dst);
11387 {
11388 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11390 {
11392 }
11393 else
11394 {
11396
11397
11398 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11399 {
11401 }
11402 else
11403 {
11404 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11405 }
11406 }
11407 }
11408 }
11409
11410 ScriptInputUserData ctx = new ScriptInputUserData;
11418 }
11419 }
11420 else if (!
g_Game.IsMultiplayer())
11421 {
11423 }
11424 }
11425 }
11426
11428 {
11429 if (root)
11430 {
11431 vector m4[4];
11432 root.GetTransform(m4);
11433 dst.SetGround(this, m4);
11434 }
11435 else
11436 {
11437 GetInventory().GetCurrentInventoryLocation(dst);
11438 }
11439 }
11440
11441 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11442 {
11443
11444 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11445 return false;
11446
11447 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11448 return false;
11449
11450
11452 return false;
11453
11454
11455 Magazine mag = Magazine.Cast(this);
11456 if (mag)
11457 {
11458 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11459 return false;
11460
11461 if (stack_max_limit)
11462 {
11463 Magazine other_mag = Magazine.Cast(other_item);
11464 if (other_item)
11465 {
11466 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11467 return false;
11468 }
11469
11470 }
11471 }
11472 else
11473 {
11474
11476 return false;
11477
11479 return false;
11480 }
11481
11482 PlayerBase player = null;
11483 if (CastTo(player, GetHierarchyRootPlayer()))
11484 {
11485 if (player.GetInventory().HasAttachment(this))
11486 return false;
11487
11488 if (player.IsItemsToDelete())
11489 return false;
11490 }
11491
11492 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11493 return false;
11494
11495 int slotID;
11497 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11498 return false;
11499
11500 return true;
11501 }
11502
11504 {
11506 }
11507
11509 {
11510 return m_IsResultOfSplit;
11511 }
11512
11514 {
11515 m_IsResultOfSplit = value;
11516 }
11517
11519 {
11521 }
11522
11524 {
11525 float other_item_quantity = other_item.GetQuantity();
11526 float this_free_space;
11527
11529
11531
11532 if (other_item_quantity > this_free_space)
11533 {
11534 return this_free_space;
11535 }
11536 else
11537 {
11538 return other_item_quantity;
11539 }
11540 }
11541
11543 {
11545 }
11546
11548 {
11550 return;
11551
11552 if (!IsMagazine() && other_item)
11553 {
11555 if (quantity_used != 0)
11556 {
11557 float hp1 = GetHealth01("","");
11558 float hp2 = other_item.GetHealth01("","");
11559 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11560 hpResult = hpResult / (
GetQuantity() + quantity_used);
11561
11562 hpResult *= GetMaxHealth();
11563 Math.Round(hpResult);
11564 SetHealth("", "Health", hpResult);
11565
11567 other_item.AddQuantity(-quantity_used);
11568 }
11569 }
11571 }
11572
11574 {
11575 #ifdef SERVER
11576 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11577 GetHierarchyParent().IncreaseLifetimeUp();
11578 #endif
11579 };
11580
11582 {
11583 PlayerBase p = PlayerBase.Cast(player);
11584
11585 array<int> recipesIds = p.m_Recipes;
11586 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11587 if (moduleRecipesManager)
11588 {
11589 EntityAI itemInHands = player.GetEntityInHands();
11590 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11591 }
11592
11593 for (int i = 0;i < recipesIds.Count(); i++)
11594 {
11595 int key = recipesIds.Get(i);
11596 string recipeName = moduleRecipesManager.GetRecipeName(key);
11598 }
11599 }
11600
11601
11602 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11603 {
11604 super.GetDebugActions(outputList);
11605
11606
11612
11613
11618
11623
11624
11628
11629
11631 {
11635 }
11636
11639
11640
11644
11646
11647 InventoryLocation loc = new InventoryLocation();
11648 GetInventory().GetCurrentInventoryLocation(loc);
11650 {
11651 if (Gizmo_IsSupported())
11654 }
11655
11657 }
11658
11659
11660
11661
11663 {
11664 super.OnAction(action_id, player, ctx);
11665
11667 {
11668 switch (action_id)
11669 {
11673 return true;
11677 return true;
11678 }
11679 }
11680
11682 {
11683 switch (action_id)
11684 {
11686 Delete();
11687 return true;
11688 }
11689 }
11690
11691 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11692 {
11693 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11694 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11695 PlayerBase p = PlayerBase.Cast(player);
11696 if (
EActions.RECIPES_RANGE_START < 1000)
11697 {
11698 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11699 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11700 }
11701 }
11702 #ifndef SERVER
11703 else if (action_id ==
EActions.WATCH_PLAYER)
11704 {
11705 PluginDeveloper.SetDeveloperItemClientEx(player);
11706 }
11707 #endif
11709 {
11710 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11711 {
11712 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11713 OnDebugButtonPressServer(id + 1);
11714 }
11715
11716 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11717 {
11718 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11720 }
11721
11722 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11723 {
11724 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11726 }
11727
11728 else if (action_id ==
EActions.ADD_QUANTITY)
11729 {
11730 if (IsMagazine())
11731 {
11732 Magazine mag = Magazine.Cast(this);
11733 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11734 }
11735 else
11736 {
11738 }
11739
11740 if (m_EM)
11741 {
11742 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11743 }
11744
11745 }
11746
11747 else if (action_id ==
EActions.REMOVE_QUANTITY)
11748 {
11749 if (IsMagazine())
11750 {
11751 Magazine mag2 = Magazine.Cast(this);
11752 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11753 }
11754 else
11755 {
11757 }
11758 if (m_EM)
11759 {
11760 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11761 }
11762
11763 }
11764
11765 else if (action_id ==
EActions.SET_QUANTITY_0)
11766 {
11768
11769 if (m_EM)
11770 {
11771 m_EM.SetEnergy(0);
11772 }
11773 }
11774
11775 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11776 {
11778
11779 if (m_EM)
11780 {
11781 m_EM.SetEnergy(m_EM.GetEnergyMax());
11782 }
11783 }
11784
11785 else if (action_id ==
EActions.ADD_HEALTH)
11786 {
11787 AddHealth("","",GetMaxHealth("","Health")/5);
11788 }
11789 else if (action_id ==
EActions.REMOVE_HEALTH)
11790 {
11791 AddHealth("","",-GetMaxHealth("","Health")/5);
11792 }
11793 else if (action_id ==
EActions.DESTROY_HEALTH)
11794 {
11795 SetHealth01("","",0);
11796 }
11797 else if (action_id ==
EActions.WATCH_ITEM)
11798 {
11800 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11801 #ifdef DEVELOPER
11802 SetDebugDeveloper_item(this);
11803 #endif
11804 }
11805
11806 else if (action_id ==
EActions.ADD_TEMPERATURE)
11807 {
11808 AddTemperature(20);
11809
11810 }
11811
11812 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11813 {
11814 AddTemperature(-20);
11815
11816 }
11817
11818 else if (action_id ==
EActions.FLIP_FROZEN)
11819 {
11820 SetFrozen(!GetIsFrozen());
11821
11822 }
11823
11824 else if (action_id ==
EActions.ADD_WETNESS)
11825 {
11827
11828 }
11829
11830 else if (action_id ==
EActions.REMOVE_WETNESS)
11831 {
11833
11834 }
11835
11836 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11837 {
11840
11841
11842 }
11843
11844 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11845 {
11848 }
11849
11850 else if (action_id ==
EActions.MAKE_SPECIAL)
11851 {
11852 auto debugParams = DebugSpawnParams.WithPlayer(player);
11853 OnDebugSpawnEx(debugParams);
11854 }
11855
11856 }
11857
11858
11859 return false;
11860 }
11861
11862
11863
11864
11868
11871
11872
11873
11875 {
11876 return false;
11877 }
11878
11879
11881 {
11882 return true;
11883 }
11884
11885
11887 {
11888 return true;
11889 }
11890
11891
11892
11894 {
11895 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11896 return g_Game.ConfigIsExisting(config_path);
11897 }
11898
11901 {
11902 return null;
11903 }
11904
11906 {
11907 return false;
11908 }
11909
11911 {
11912 return false;
11913 }
11914
11918
11919
11921 {
11922 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11923 return module_repairing.CanRepair(this, item_repair_kit);
11924 }
11925
11926
11927 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11928 {
11929 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11930 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11931 }
11932
11933
11935 {
11936
11937
11938
11939
11940
11941
11942
11943
11944 return 1;
11945 }
11946
11947
11948
11950 {
11952 }
11953
11954
11955
11957 {
11959 }
11960
11961
11970 {
11971 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11972
11973 if (player)
11974 {
11975 player.MessageStatus(text);
11976 }
11977 }
11978
11979
11988 {
11989 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11990
11991 if (player)
11992 {
11993 player.MessageAction(text);
11994 }
11995 }
11996
11997
12006 {
12007 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12008
12009 if (player)
12010 {
12011 player.MessageFriendly(text);
12012 }
12013 }
12014
12015
12024 {
12025 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12026
12027 if (player)
12028 {
12029 player.MessageImportant(text);
12030 }
12031 }
12032
12034 {
12035 return true;
12036 }
12037
12038
12039 override bool KindOf(
string tag)
12040 {
12041 bool found = false;
12042 string item_name = this.
GetType();
12044 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12045
12046 int array_size = item_tag_array.Count();
12047 for (int i = 0; i < array_size; i++)
12048 {
12049 if (item_tag_array.Get(i) == tag)
12050 {
12051 found = true;
12052 break;
12053 }
12054 }
12055 return found;
12056 }
12057
12058
12060 {
12061
12062 super.OnRPC(sender, rpc_type,ctx);
12063
12064
12065 switch (rpc_type)
12066 {
12067 #ifndef SERVER
12068 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12069 Param2<bool, string> p = new Param2<bool, string>(false, "");
12070
12072 return;
12073
12074 bool play = p.param1;
12075 string soundSet = p.param2;
12076
12077 if (play)
12078 {
12080 {
12082 {
12084 }
12085 }
12086 else
12087 {
12089 }
12090 }
12091 else
12092 {
12094 }
12095
12096 break;
12097 #endif
12098
12099 }
12100
12102 {
12104 }
12105 }
12106
12107
12108
12109
12111 {
12112 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12113 return plugin.GetID(
name);
12114 }
12115
12117 {
12118 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12119 return plugin.GetName(id);
12120 }
12121
12124 {
12125
12126
12127 int varFlags;
12128 if (!ctx.
Read(varFlags))
12129 return;
12130
12131 if (varFlags & ItemVariableFlags.FLOAT)
12132 {
12134 }
12135 }
12136
12138 {
12139
12140 super.SerializeNumericalVars(floats_out);
12141
12142
12143
12145 {
12147 }
12148
12150 {
12152 }
12153
12155 {
12157 }
12158
12160 {
12165 }
12166
12168 {
12170 }
12171 }
12172
12174 {
12175
12176 super.DeSerializeNumericalVars(floats);
12177
12178
12179 int index = 0;
12180 int mask = Math.Round(floats.Get(index));
12181
12182 index++;
12183
12185 {
12187 {
12189 }
12190 else
12191 {
12192 float quantity = floats.Get(index);
12193 SetQuantity(quantity,
true,
false,
false,
false);
12194 }
12195 index++;
12196 }
12197
12199 {
12200 float wet = floats.Get(index);
12202 index++;
12203 }
12204
12206 {
12207 int liquidtype = Math.Round(floats.Get(index));
12209 index++;
12210 }
12211
12213 {
12215 index++;
12217 index++;
12219 index++;
12221 index++;
12222 }
12223
12225 {
12226 int cleanness = Math.Round(floats.Get(index));
12228 index++;
12229 }
12230 }
12231
12233 {
12234 super.WriteVarsToCTX(ctx);
12235
12236
12238 {
12240 }
12241
12243 {
12245 }
12246
12248 {
12250 }
12251
12253 {
12254 int r,g,b,a;
12260 }
12261
12263 {
12265 }
12266 }
12267
12269 {
12270 if (!super.ReadVarsFromCTX(ctx,version))
12271 return false;
12272
12273 int intValue;
12274 float value;
12275
12276 if (version < 140)
12277 {
12278 if (!ctx.
Read(intValue))
12279 return false;
12280
12281 m_VariablesMask = intValue;
12282 }
12283
12285 {
12286 if (!ctx.
Read(value))
12287 return false;
12288
12290 {
12292 }
12293 else
12294 {
12296 }
12297 }
12298
12299 if (version < 140)
12300 {
12302 {
12303 if (!ctx.
Read(value))
12304 return false;
12305 SetTemperatureDirect(value);
12306 }
12307 }
12308
12310 {
12311 if (!ctx.
Read(value))
12312 return false;
12314 }
12315
12317 {
12318 if (!ctx.
Read(intValue))
12319 return false;
12321 }
12322
12324 {
12325 int r,g,b,a;
12327 return false;
12329 return false;
12331 return false;
12333 return false;
12334
12336 }
12337
12339 {
12340 if (!ctx.
Read(intValue))
12341 return false;
12343 }
12344
12345 if (version >= 138 && version < 140)
12346 {
12348 {
12349 if (!ctx.
Read(intValue))
12350 return false;
12351 SetFrozen(intValue);
12352 }
12353 }
12354
12355 return true;
12356 }
12357
12358
12360 {
12363 {
12365 }
12366
12367 if (!super.OnStoreLoad(ctx, version))
12368 {
12370 return false;
12371 }
12372
12373 if (version >= 114)
12374 {
12375 bool hasQuickBarIndexSaved;
12376
12377 if (!ctx.
Read(hasQuickBarIndexSaved))
12378 {
12380 return false;
12381 }
12382
12383 if (hasQuickBarIndexSaved)
12384 {
12385 int itmQBIndex;
12386
12387
12388 if (!ctx.
Read(itmQBIndex))
12389 {
12391 return false;
12392 }
12393
12394 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12395 if (itmQBIndex != -1 && parentPlayer)
12396 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12397 }
12398 }
12399 else
12400 {
12401
12402 PlayerBase player;
12403 int itemQBIndex;
12404 if (version ==
int.
MAX)
12405 {
12406 if (!ctx.
Read(itemQBIndex))
12407 {
12409 return false;
12410 }
12411 }
12412 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12413 {
12414
12415 if (!ctx.
Read(itemQBIndex))
12416 {
12418 return false;
12419 }
12420 if (itemQBIndex != -1 && player)
12421 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12422 }
12423 }
12424
12425 if (version < 140)
12426 {
12427
12428 if (!LoadVariables(ctx, version))
12429 {
12431 return false;
12432 }
12433 }
12434
12435
12437 {
12439 return false;
12440 }
12441 if (version >= 132)
12442 {
12444 if (raib)
12445 {
12447 {
12449 return false;
12450 }
12451 }
12452 }
12453
12455 return true;
12456 }
12457
12458
12459
12461 {
12462 super.OnStoreSave(ctx);
12463
12464 PlayerBase player;
12465 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12466 {
12468
12469 int itemQBIndex = -1;
12470 itemQBIndex = player.FindQuickBarEntityIndex(this);
12471 ctx.
Write(itemQBIndex);
12472 }
12473 else
12474 {
12476 }
12477
12479
12481 if (raib)
12482 {
12484 }
12485 }
12486
12487
12489 {
12490 super.AfterStoreLoad();
12491
12493 {
12495 }
12496
12498 {
12501 }
12502 }
12503
12505 {
12506 super.EEOnAfterLoad();
12507
12509 {
12511 }
12512
12515 }
12516
12518 {
12519 return false;
12520 }
12521
12522
12523
12525 {
12527 {
12528 #ifdef PLATFORM_CONSOLE
12529
12531 {
12533 if (menu)
12534 {
12536 }
12537 }
12538 #endif
12539 }
12540
12542 {
12545 }
12546
12548 {
12549 SetWeightDirty();
12551 }
12553 {
12556 }
12557
12559 {
12562
12565 }
12567 {
12571 }
12572
12573 super.OnVariablesSynchronized();
12574 }
12575
12576
12577
12579 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12580 {
12581 if (!IsServerCheck(allow_client))
12582 return false;
12583
12585 return false;
12586
12589
12590 if (value <= (min + 0.001))
12591 value = min;
12592
12593 if (value == min)
12594 {
12595 if (destroy_config)
12596 {
12597 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12598 if (dstr)
12599 {
12601 this.Delete();
12602 return true;
12603 }
12604 }
12605 else if (destroy_forced)
12606 {
12608 this.Delete();
12609 return true;
12610 }
12611
12613 }
12614
12617
12619 {
12620 EntityAI parent = GetHierarchyRoot();
12621 InventoryLocation iLoc = new InventoryLocation();
12622 GetInventory().GetCurrentInventoryLocation(iLoc);
12624 {
12625 int iLocSlot = iLoc.
GetSlot();
12627 {
12629 }
12631 {
12633 }
12634 }
12635 }
12636
12638 {
12640
12641 if (delta)
12643 }
12644
12646
12647 return false;
12648 }
12649
12650
12652 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12653 {
12655 }
12656
12658 {
12661 }
12662
12664 {
12667 }
12668
12670 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12671 {
12672 float value_clamped = Math.Clamp(value, 0, 1);
12674 SetQuantity(result, destroy_config, destroy_forced);
12675 }
12676
12677
12680 {
12682 }
12683
12685 {
12687 }
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12699 {
12700 int slot = -1;
12701 GameInventory inventory = GetInventory();
12702 if (inventory)
12703 {
12704 InventoryLocation il = new InventoryLocation;
12707 }
12708
12710 }
12711
12713 {
12714 float quantity_max = 0;
12715
12717 {
12718 if (attSlotID != -1)
12719 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12720
12721 if (quantity_max <= 0)
12723 }
12724
12725 if (quantity_max <= 0)
12727
12728 return quantity_max;
12729 }
12730
12732 {
12734 }
12735
12737 {
12739 }
12740
12741
12743 {
12745 }
12746
12748 {
12750 }
12751
12753 {
12755 }
12756
12757
12759 {
12760
12761 float weightEx = GetWeightEx();
12762 float special = GetInventoryAndCargoWeight();
12763 return weightEx - special;
12764 }
12765
12766
12768 {
12770 }
12771
12773 {
12775 {
12776 #ifdef DEVELOPER
12777 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12778 {
12779 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12781 }
12782 #endif
12783
12784 return GetQuantity() * GetConfigWeightModified();
12785 }
12786 else if (HasEnergyManager())
12787 {
12788 #ifdef DEVELOPER
12789 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12790 {
12791 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12792 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12793 }
12794 #endif
12795 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12796 }
12797 else
12798 {
12799 #ifdef DEVELOPER
12800 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12801 {
12802 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12803 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12804 }
12805 #endif
12806 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12807 }
12808 }
12809
12812 {
12813 int item_count = 0;
12815
12816 GameInventory inventory = GetInventory();
12817 CargoBase cargo = inventory.
GetCargo();
12818 if (cargo != NULL)
12819 {
12821 }
12822
12824 for (int i = 0; i < nAttachments; ++i)
12825 {
12827 if (item)
12828 item_count += item.GetNumberOfItems();
12829 }
12830 return item_count;
12831 }
12832
12835 {
12836 float weight = 0;
12837 float wetness = 1;
12838 if (include_wetness)
12841 {
12842 weight = wetness * m_ConfigWeight;
12843 }
12845 {
12846 weight = 1;
12847 }
12848 return weight;
12849 }
12850
12851
12852
12854 {
12855 GameInventory inventory = GetInventory();
12856 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12857 {
12858 array<EntityAI> items = new array<EntityAI>;
12860 for (int i = 0; i < items.Count(); ++i)
12861 {
12863 if (item)
12864 {
12865 g_Game.ObjectDelete(item);
12866 }
12867 }
12868 }
12869 }
12870
12871
12872
12873
12875 {
12876 float energy = 0;
12877 if (HasEnergyManager())
12878 {
12879 energy = GetCompEM().GetEnergy();
12880 }
12881 return energy;
12882 }
12883
12884
12886 {
12887 super.OnEnergyConsumed();
12888
12890 }
12891
12893 {
12894 super.OnEnergyAdded();
12895
12897 }
12898
12899
12901 {
12902 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12903 {
12905 {
12906 float energy_0to1 = GetCompEM().GetEnergy0To1();
12908 }
12909 }
12910 }
12911
12912
12914 {
12915 return ConfigGetFloat("heatIsolation");
12916 }
12917
12919 {
12921 }
12922
12924 {
12925 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12926 if (
g_Game.ConfigIsExisting(paramPath))
12927 return g_Game.ConfigGetFloat(paramPath);
12928
12929 return 0.0;
12930 }
12931
12933 {
12934 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12935 if (
g_Game.ConfigIsExisting(paramPath))
12936 return g_Game.ConfigGetFloat(paramPath);
12937
12938 return 0.0;
12939 }
12940
12941 override void SetWet(
float value,
bool allow_client =
false)
12942 {
12943 if (!IsServerCheck(allow_client))
12944 return;
12945
12948
12950
12951 m_VarWet = Math.Clamp(value, min, max);
12952
12954 {
12957 }
12958 }
12959
12960 override void AddWet(
float value)
12961 {
12963 }
12964
12966 {
12968 }
12969
12971 {
12973 }
12974
12976 {
12978 }
12979
12981 {
12983 }
12984
12986 {
12988 }
12989
12990 override void OnWetChanged(
float newVal,
float oldVal)
12991 {
12994 if (newLevel != oldLevel)
12995 {
12997 }
12998 }
12999
13001 {
13002 SetWeightDirty();
13003 }
13004
13006 {
13007 return GetWetLevelInternal(
m_VarWet);
13008 }
13009
13010
13011
13013 {
13015 }
13016
13018 {
13020 }
13021
13023 {
13025 }
13026
13028 {
13030 }
13031
13032
13033
13035 {
13036 if (ConfigIsExisting("itemModelLength"))
13037 {
13038 return ConfigGetFloat("itemModelLength");
13039 }
13040 return 0;
13041 }
13042
13044 {
13045 if (ConfigIsExisting("itemAttachOffset"))
13046 {
13047 return ConfigGetFloat("itemAttachOffset");
13048 }
13049 return 0;
13050 }
13051
13052 override void SetCleanness(
int value,
bool allow_client =
false)
13053 {
13054 if (!IsServerCheck(allow_client))
13055 return;
13056
13058
13060
13063 }
13064
13066 {
13068 }
13069
13071 {
13072 return true;
13073 }
13074
13075
13076
13077
13079 {
13081 }
13082
13084 {
13086 }
13087
13088
13089
13090
13091 override void SetColor(
int r,
int g,
int b,
int a)
13092 {
13098 }
13100 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13101 {
13106 }
13107
13109 {
13111 }
13112
13115 {
13116 int r,g,b,a;
13118 r = r/255;
13119 g = g/255;
13120 b = b/255;
13121 a = a/255;
13122 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13123 }
13124
13125
13126
13127 override void SetLiquidType(
int value,
bool allow_client =
false)
13128 {
13129 if (!IsServerCheck(allow_client))
13130 return;
13131
13136 }
13137
13139 {
13140 return ConfigGetInt("varLiquidTypeInit");
13141 }
13142
13144 {
13146 }
13147
13149 {
13151 SetFrozen(false);
13152 }
13153
13156 {
13157 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13158 }
13159
13160
13163 {
13164 PlayerBase nplayer;
13165 if (PlayerBase.CastTo(nplayer, player))
13166 {
13168 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13169 }
13170 }
13171
13172
13175 {
13176 PlayerBase nplayer;
13177 if (PlayerBase.CastTo(nplayer,player))
13178 {
13179 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13180 }
13181
13182 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13183
13184 if (HasEnergyManager())
13185 {
13186 GetCompEM().UpdatePlugState();
13187 }
13188 }
13189
13190
13192 {
13193 super.OnPlacementStarted(player);
13194
13196 }
13197
13198 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13199 {
13201 {
13202 m_AdminLog.OnPlacementComplete(player,
this);
13203 }
13204
13205 super.OnPlacementComplete(player, position, orientation);
13206 }
13207
13208
13209
13210
13211
13213 {
13215 {
13216 return true;
13217 }
13218 else
13219 {
13220 return false;
13221 }
13222 }
13223
13224
13226 {
13228 {
13230 }
13231 }
13232
13233
13235 {
13237 }
13238
13240 {
13242 }
13243
13244 override void InsertAgent(
int agent,
float count = 1)
13245 {
13246 if (count < 1)
13247 return;
13248
13250 }
13251
13254 {
13256 }
13257
13258
13260 {
13262 }
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13306 {
13308 return false;
13309 return true;
13310 }
13311
13313 {
13314
13316 }
13317
13318
13321 {
13322 super.CheckForRoofLimited(timeTresholdMS);
13323
13324 float time =
g_Game.GetTime();
13325 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13326 {
13327 m_PreviousRoofTestTime = time;
13328 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13329 }
13330 }
13331
13332
13334 {
13336 {
13337 return 0;
13338 }
13339
13340 if (GetInventory().GetAttachmentSlotsCount() != 0)
13341 {
13342 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13343 if (filter)
13344 return filter.GetProtectionLevel(type, false, system);
13345 else
13346 return 0;
13347 }
13348
13349 string subclassPath, entryName;
13350
13351 switch (type)
13352 {
13354 entryName = "biological";
13355 break;
13357 entryName = "chemical";
13358 break;
13359 default:
13360 entryName = "biological";
13361 break;
13362 }
13363
13364 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13365
13366 return g_Game.ConfigGetFloat(subclassPath + entryName);
13367 }
13368
13369
13370
13373 {
13374 if (!IsMagazine())
13376
13378 }
13379
13380
13381
13382
13383
13388 {
13389 return true;
13390 }
13391
13393 {
13395 }
13396
13397
13398
13399
13400
13402 {
13403 if (parent)
13404 {
13405 if (parent.IsInherited(DayZInfected))
13406 return true;
13407
13408 if (!parent.IsRuined())
13409 return true;
13410 }
13411
13412 return true;
13413 }
13414
13416 {
13417 if (!super.CanPutAsAttachment(parent))
13418 {
13419 return false;
13420 }
13421
13422 if (!IsRuined() && !parent.IsRuined())
13423 {
13424 return true;
13425 }
13426
13427 return false;
13428 }
13429
13431 {
13432
13433
13434
13435
13436 return super.CanReceiveItemIntoCargo(item);
13437 }
13438
13440 {
13441
13442
13443
13444
13445 GameInventory attachmentInv = attachment.GetInventory();
13447 {
13448 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13449 return false;
13450 }
13451
13452 InventoryLocation loc = new InventoryLocation();
13453 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13454 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13455 return false;
13456
13457 return super.CanReceiveAttachment(attachment, slotId);
13458 }
13459
13461 {
13462 if (!super.CanReleaseAttachment(attachment))
13463 return false;
13464
13465 return GetInventory().AreChildrenAccessible();
13466 }
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13489 {
13490 int id = muzzle_owner.GetMuzzleID();
13491 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13492
13493 if (WPOF_array)
13494 {
13495 for (int i = 0; i < WPOF_array.Count(); i++)
13496 {
13497 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13498
13499 if (WPOF)
13500 {
13501 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13502 }
13503 }
13504 }
13505 }
13506
13507
13509 {
13510 int id = muzzle_owner.GetMuzzleID();
13512
13513 if (WPOBE_array)
13514 {
13515 for (int i = 0; i < WPOBE_array.Count(); i++)
13516 {
13517 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13518
13519 if (WPOBE)
13520 {
13521 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13522 }
13523 }
13524 }
13525 }
13526
13527
13529 {
13530 int id = muzzle_owner.GetMuzzleID();
13531 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13532
13533 if (WPOOH_array)
13534 {
13535 for (int i = 0; i < WPOOH_array.Count(); i++)
13536 {
13537 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13538
13539 if (WPOOH)
13540 {
13541 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13542 }
13543 }
13544 }
13545 }
13546
13547
13549 {
13550 int id = muzzle_owner.GetMuzzleID();
13551 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13552
13553 if (WPOOH_array)
13554 {
13555 for (int i = 0; i < WPOOH_array.Count(); i++)
13556 {
13557 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13558
13559 if (WPOOH)
13560 {
13561 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13562 }
13563 }
13564 }
13565 }
13566
13567
13569 {
13570 int id = muzzle_owner.GetMuzzleID();
13571 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13572
13573 if (WPOOH_array)
13574 {
13575 for (int i = 0; i < WPOOH_array.Count(); i++)
13576 {
13577 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13578
13579 if (WPOOH)
13580 {
13581 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13582 }
13583 }
13584 }
13585 }
13586
13587
13588
13590 {
13592 {
13593 return true;
13594 }
13595
13596 return false;
13597 }
13598
13600 {
13602 {
13603 return true;
13604 }
13605
13606 return false;
13607 }
13608
13610 {
13612 {
13613 return true;
13614 }
13615
13616 return false;
13617 }
13618
13620 {
13621 return false;
13622 }
13623
13626 {
13627 return UATimeSpent.DEFAULT_DEPLOY;
13628 }
13629
13630
13631
13632
13634 {
13636 SetSynchDirty();
13637 }
13638
13640 {
13642 }
13643
13644
13646 {
13647 return false;
13648 }
13649
13652 {
13653 string att_type = "None";
13654
13655 if (ConfigIsExisting("soundAttType"))
13656 {
13657 att_type = ConfigGetString("soundAttType");
13658 }
13659
13661 }
13662
13664 {
13666 }
13667
13668
13669
13670
13671
13677
13679 {
13682
13684 }
13685
13686
13688 {
13690 return;
13691
13693
13696
13699
13700 SoundParameters params = new SoundParameters();
13704 }
13705
13706
13708 {
13710 {
13713
13714 SetSynchDirty();
13715
13718 }
13719 }
13720
13722 {
13724 }
13725
13726
13728 {
13730 return;
13731
13733 SetSynchDirty();
13734
13737 }
13738
13740 {
13743 }
13744
13746 {
13748 }
13749
13750 void OnApply(PlayerBase player);
13751
13753 {
13754 return 1.0;
13755 };
13756
13758 {
13760 }
13761
13763 {
13765 }
13766
13768
13770 {
13771 SetDynamicPhysicsLifeTime(0.01);
13773 }
13774
13776 {
13777 array<string> zone_names = new array<string>;
13778 GetDamageZones(zone_names);
13779 for (int i = 0; i < zone_names.Count(); i++)
13780 {
13781 SetHealthMax(zone_names.Get(i),"Health");
13782 }
13783 SetHealthMax("","Health");
13784 }
13785
13788 {
13789 float global_health = GetHealth01("","Health");
13790 array<string> zones = new array<string>;
13791 GetDamageZones(zones);
13792
13793 for (int i = 0; i < zones.Count(); i++)
13794 {
13795 SetHealth01(zones.Get(i),"Health",global_health);
13796 }
13797 }
13798
13801 {
13802 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13803 }
13804
13806 {
13807 if (!hasRootAsPlayer)
13808 {
13809 if (refParentIB)
13810 {
13811
13812 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13813 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13814
13815 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13816 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13817
13820 }
13821 else
13822 {
13823
13826 }
13827 }
13828 }
13829
13831 {
13833 {
13834 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13835 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13836 {
13837 float heatPermCoef = 1.0;
13839 while (ent)
13840 {
13841 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13842 ent = ent.GetHierarchyParent();
13843 }
13844
13845 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13846 }
13847 }
13848 }
13849
13851 {
13852
13853 EntityAI parent = GetHierarchyParent();
13854 if (!parent)
13855 {
13856 hasParent = false;
13857 hasRootAsPlayer = false;
13858 }
13859 else
13860 {
13861 hasParent = true;
13862 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13863 refParentIB =
ItemBase.Cast(parent);
13864 }
13865 }
13866
13867 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13868 {
13869
13870 }
13871
13873 {
13874
13875 return false;
13876 }
13877
13879 {
13880
13881
13882 return false;
13883 }
13884
13886 {
13887
13888 return false;
13889 }
13890
13893 {
13894 return !GetIsFrozen() &&
IsOpen();
13895 }
13896
13898 {
13899 bool hasParent = false, hasRootAsPlayer = false;
13901
13902 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13903 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13904
13905 if (wwtu || foodDecay)
13906 {
13910
13911 if (processWetness || processTemperature || processDecay)
13912 {
13914
13915 if (processWetness)
13916 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13917
13918 if (processTemperature)
13920
13921 if (processDecay)
13922 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13923 }
13924 }
13925 }
13926
13929 {
13931 }
13932
13934 {
13937
13938 return super.GetTemperatureFreezeThreshold();
13939 }
13940
13942 {
13945
13946 return super.GetTemperatureThawThreshold();
13947 }
13948
13950 {
13953
13954 return super.GetItemOverheatThreshold();
13955 }
13956
13958 {
13960 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13961
13962 return super.GetTemperatureFreezeTime();
13963 }
13964
13966 {
13968 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13969
13970 return super.GetTemperatureThawTime();
13971 }
13972
13977
13979 {
13980 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13981 }
13982
13984 {
13985 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13986 }
13987
13990 {
13992 }
13993
13995 {
13997 }
13998
14000 {
14002 }
14003
14006 {
14007 return null;
14008 }
14009
14012 {
14013 return false;
14014 }
14015
14017 {
14019 {
14022 if (!trg)
14023 {
14025 explosive = this;
14026 }
14027
14028 explosive.PairRemote(trg);
14030
14031 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14032 trg.SetPersistentPairID(persistentID);
14033 explosive.SetPersistentPairID(persistentID);
14034
14035 return true;
14036 }
14037 return false;
14038 }
14039
14042 {
14043 float ret = 1.0;
14046 ret *= GetHealth01();
14047
14048 return ret;
14049 }
14050
14051 #ifdef DEVELOPER
14052 override void SetDebugItem()
14053 {
14054 super.SetDebugItem();
14055 _itemBase = this;
14056 }
14057
14059 {
14060 string text = super.GetDebugText();
14061
14063 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14064
14065 return text;
14066 }
14067 #endif
14068
14070 {
14071 return true;
14072 }
14073
14075
14077
14079 {
14082 }
14083
14084
14092
14108
14109 [
Obsolete(
"Use ItemSoundHandler instead")]
14112 {
14113 if (!
g_Game.IsDedicatedServer())
14114 {
14115 if (ConfigIsExisting("attachSoundSet"))
14116 {
14117 string cfg_path = "";
14118 string soundset = "";
14119 string type_name =
GetType();
14120
14123 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14124 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14125
14126 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14127 {
14128 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14129 {
14130 if (cfg_slot_array[i] == slot_type)
14131 {
14132 soundset = cfg_soundset_array[i];
14133 break;
14134 }
14135 }
14136 }
14137
14138 if (soundset != "")
14139 {
14140 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14142 }
14143 }
14144 }
14145 }
14146
14148}
14149
14151{
14153 if (entity)
14154 {
14155 bool is_item = entity.IsInherited(
ItemBase);
14156 if (is_item && full_quantity)
14157 {
14160 }
14161 }
14162 else
14163 {
14165 return NULL;
14166 }
14167 return entity;
14168}
14169
14171{
14172 if (item)
14173 {
14174 if (health > 0)
14175 item.SetHealth("", "", health);
14176
14177 if (item.CanHaveTemperature())
14178 {
14180 if (item.CanFreeze())
14181 item.SetFrozen(false);
14182 }
14183
14184 if (item.HasEnergyManager())
14185 {
14186 if (quantity >= 0)
14187 {
14188 item.GetCompEM().SetEnergy0To1(quantity);
14189 }
14190 else
14191 {
14193 }
14194 }
14195 else if (item.IsMagazine())
14196 {
14197 Magazine mag = Magazine.Cast(item);
14198 if (quantity >= 0)
14199 {
14200 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14201 }
14202 else
14203 {
14205 }
14206
14207 }
14208 else
14209 {
14210 if (quantity >= 0)
14211 {
14212 item.SetQuantityNormalized(quantity, false);
14213 }
14214 else
14215 {
14217 }
14218
14219 }
14220 }
14221}
14222
14223#ifdef DEVELOPER
14225#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.